Skip to content

fix(#2160): report no-op code runs to the Jira issue - #2162

Closed
fullsend-ai-coder[bot] wants to merge 2 commits into
mainfrom
agent/2160-jira-noop-comment
Closed

fullsend-ai-coder[bot] wants to merge 2 commits into
mainfrom
agent/2160-jira-noop-comment

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

When a Jira-sourced code run ends without a PR, scripts/post-code.src.sh now leaves a "No PR created" comment on the Jira issue. Before this, it only wrote a ::notice line to the workflow log.

Changes

  • post_noop_comment: when the tracker is jira, it calls the new post_jira_noop_comment after the existing notice line. Other external trackers still get only the notice.

  • post_jira_noop_comment (new) writes a plain-text comment:

    • No PR created for <KEY>: the code agent determined no changes are needed.
    • Reason: <reason>
    • The agent's context from pr_body, if any.
    • Workflow run: <run URL>

    It is best-effort: if the Jira write fails, it logs a warning and the run still exits 0. The PR-ready transition never runs on this path. xtrace is turned off around the write, the same way post_jira_stage_update does it.

  • post_jira_code_comment (new, taken out of _post_jira_stage_update_inner) holds the Jira write that both paths share:

    • the Jira URL, key and host checks
    • jira_auth_select
    • the checks for FULLSEND_DIR and the CLI
    • jira_auth_fullsend ... issues post-comment --tracker jira --marker "<!-- fullsend:code-agent -->"

    Because both paths use the same marker, a later run that opens a PR replaces the no-op comment. The stage update builds its own body, calls this helper, and then runs maybe_transition_jira_pr_ready as before. It gets the project and number from WORK_ITEM_KEY, which the helper has already checked against the URL.

  • load_noop_agent_context (new): the sanitize_failure_detail and scan_public_text steps now live in one place, used by both the GitHub and Jira comments. The context is left out if the scan fails. The GitHub comment body is unchanged.

  • Trusted fullsend lookup moved earlier: _jira_fullsend_bin is now set before section 1. Before, the first no-op exit ("no feature branch") ran before it was set. The lookup still happens before any repo-controlled code runs.

  • scripts/post-code.sh was regenerated from the source with scripts/bundle-sh.sh.

Testing

New tests in scripts/post-code-test.sh use the Jira test setup's stub fullsend, which records its arguments and stdin:

  • Jira no-op, for both the "no changed files" and "no feature branch" exits: exactly one post-comment call, with the marker, the trusted credentials, the reason, the agent context and the run URL. No transition runs even with CODE_JIRA_PR_READY_TRANSITION=Review, the notice line is still printed, and no GitHub issue comment is made.
  • Agent context whose gitleaks scan fails is left out of the comment, with a warning.
  • A failing stub CLI still exits 0 and logs ::warning::Failed to post no-op comment to Jira issue TESTPROJ-42.
  • A non-Jira external tracker gets only the notice: no Jira write and no forge comment.
  • GitHub-issue no-op: the full comment body is checked line by line, and nothing goes to Jira.

Results:

  • All new tests pass, both against the source script and with SCRIPT_TEST_TARGET=bundled.
  • Running the bundler again leaves no diff.
  • shellcheck 0.10.0.1, run with the configured args, is clean.

Caveats

  • pre-commit could not fetch its hook repos in the sandbox (TLS failure). I ran the relevant hooks directly instead (shellcheck, whitespace and EOF checks, lint-release-cases, and a secret scan).
  • make lint (skillsaw) was not run because uvx is not available. It does not lint shell scripts.
  • post-code-test.sh has 4 failures in this sandbox that also happen on unmodified main, so this change did not cause them: yq is missing, and the git author environment is wrong for the signed-commits tests.

🤖 Generated with Claude Code


Closes #2160

Post-script verification

  • Branch is not main/master (agent/2160-jira-noop-comment)
  • Secret scan passed (gitleaks — a4d3b9f47a39e4d6a02babb390adb6ec12c327c3..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Final PR description secret scan passed (gitleaks — no-git)

A Jira-sourced code run that ended without a PR wrote nothing to Jira:
post_noop_comment returned after a ::notice line for every external
tracker, and the only Jira writer ran on the PR path.

post_noop_comment now posts a plain-text "No PR created" comment to the
Jira issue (reason, sanitized and gitleaks-scanned agent context, run
URL) when the tracker is jira, keeping the notice line. Other external
trackers keep the notice only.

The identity checks, credential selection and marked post-comment call
move out of _post_jira_stage_update_inner into post_jira_code_comment,
shared by both paths, so the shared <!-- fullsend:code-agent --> marker
lets a later PR run replace the no-op comment. The no-op write is
best-effort: a failure logs a warning and the run still exits 0, and
the PR-ready transition never runs on this path. The agent-context
sanitize/scan step is shared with the GitHub comment through
load_noop_agent_context; the GitHub body is unchanged.

The trusted fullsend binary is now resolved before the first no-op exit
(the no-feature-branch check), which previously ran before it was set.

Tests: Jira no-op on both no-op exits posts one marked comment with the
reason, context and run URL and no transition; scan failure omits the
context; a failing CLI still exits 0 with a warning; non-Jira external
trackers stay notice-only; the GitHub no-op comment body is unchanged.

Note: pre-commit could not fetch hook repos (TLS failure in sandbox);
shellcheck 0.10.0.1 with the configured args, whitespace/EOF checks,
lint-release-cases and scan-secrets were run directly and passed.
make lint (skillsaw) not run: uvx unavailable; it does not lint shell.
post-code-test.sh: 4 failures also present on main in this sandbox
(yq missing, git author env), unrelated to this change.

Closes #2160

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner November 23, 2026 16:27
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Nov 23, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 4:29 PM UTC · Completed 4:36 PM UTC

Commit: 142a6c1 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.51

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Nov 23, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Small 3-file change aligned closely with issue scope keeps risk moderate, balanced against protected script modifications and high recent churn in post-code scripts.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [stale-doc] docs/code.md:81 — docs/code.md line 81 says "External-tracker runs (such as Jira) emit only a generic notice; the upstream explanation remains in the agent's final message in the run transcript", and line 105 says "Jira-source no-PR runs still emit only their existing generic notice." The PR adds post_jira_noop_comment, so Jira-sourced runs that exit without a PR now also post a comment to the Jira issue under the code-agent marker with the reason, the sanitized and secret-scanned agent context, and the workflow run URL. Only non-Jira external trackers remain notice-only.
    Remediation: Update docs/code.md lines 81-82 and line 105 to say Jira-sourced no-PR runs now post a no-op comment (reason, secret-scanned agent context, run URL) to the Jira issue, and only other external trackers emit just a notice. Optionally mention it in the 'Jira results' bullet (~line 352).
  • [protected-path] scripts/post-code.src.sh — This PR modifies files under the protected path scripts/: scripts/post-code.src.sh, scripts/post-code.sh and scripts/post-code-test.sh. The PR links issue post-code: report no-op runs to the Jira issue #2160 and explains the rationale, but human approval is always required for protected-path changes regardless of context.

Low

  • [secret-exposure] scripts/post-code.src.sh:562 — The new Jira no-op path calls load_noop_agent_context before xtrace is turned off. If the script runs under bash -x, the raw pr_body is printed to runner logs before redaction and before the gitleaks scan. Exposure only happens when tracing is explicitly enabled, and the same unguarded load already runs in the existing GitHub no-op path.
    Remediation: Turn off xtrace while extracting, sanitizing and scanning agent context in load_noop_agent_context, restoring the original tracing state on every return path (this also covers the GitHub no-op caller).

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

Comment thread scripts/post-code.src.sh
local run_url
run_url="$(forge_get_workflow_run_url)"

load_noop_agent_context

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] secret-exposure

The new Jira no-op path calls load_noop_agent_context before xtrace is turned off. If the script runs under bash -x, the loader's agent_context assignment and the sanitize_failure_detail argument print the raw pr_body into runner logs before redaction and before the gitleaks scan. The later set +x protects the Jira credential expansions but not the unscanned agent context. Exposure only happens when tracing is explicitly enabled, and the same unguarded load already runs in the existing GitHub no-op path.

Suggested fix: Turn off xtrace while extracting, sanitizing and scanning agent context in load_noop_agent_context, and restore the original tracing state on every return path. This also covers the GitHub no-op caller. Optionally add a traced test with a secret in pr_body.

@fullsend-ai-coder

fullsend-ai-coder Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 4:38 PM UTC · Completed 4:43 PM UTC

Commit: 142a6c1 · View workflow run →

Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.36

- Suspend xtrace while load_noop_agent_context reads, sanitizes and scans
  the agent's pr_body, restoring the tracing state on every return path
  (covers both the Jira and GitHub no-op callers). Regenerate post-code.sh
  and add an xtrace regression test.
- Update docs/code.md: Jira-sourced no-PR runs now post a no-op comment
  to the Jira issue; only other external trackers emit a notice alone.

Notes: pre-commit could not fetch hook repos (certificate failure), so
applicable hooks were checked directly (whitespace, CR, lint-agent-docs);
shellcheck and uvx were unavailable. scripts/post-code-test.sh has four
failures that also occur without this change.

Addresses #2162

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 1 (bot-triggered)

Addressed all three findings. Updated docs/code.md for Jira no-op comments, and made load_noop_agent_context suspend xtrace while it handles the raw agent context (with a regression test and regenerated post-code.sh). Recorded the protected-path finding as a human-approval gate with no code change. Four tests in scripts/post-code-test.sh fail both with and without this change. Pre-commit could not fetch hook repos, so applicable checks were run directly. shellcheck and uvx were not available.

Fixed (2):

  1. stale-doc: docs/code.md still says Jira no-PR runs emit only a generic notice (docs/code.md): Updated the no-PR escalation paragraph, the secret-scan paragraph and the Jira results bullet. Jira-sourced no-PR runs now post a no-op comment (reason, scanned agent context, run URL) to the Jira issue, and only other external trackers emit a notice alone.
  2. secret-exposure: load_noop_agent_context reads the raw pr_body with xtrace possibly on (scripts/post-code.src.sh): load_noop_agent_context now suspends xtrace for the whole extract, sanitize and scan, and restores it afterwards. The body moved to a new inner helper, so every return path is covered, for both the Jira and GitHub callers. Regenerated scripts/post-code.sh with bundle-sh.sh and added an xtrace regression test to scripts/post-code-test.sh.

Disagreed (1):

  1. protected-path: PR modifies files under scripts/: This is the mandatory merge-gate finding. It asks for human approval, not a content change, so there is nothing for the fix agent to edit.

Tests: passed

CI inspections (4):

  1. test (passing, SUCCESS): CI test job passed.
  2. skillsaw (passing, SUCCESS): Lint passed.
  3. functional-tests (code) (passing, SUCCESS): Functional tests for the code agent passed.
  4. script-test (pending, IN_PROGRESS): Script tests were still running when inspected.

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push

Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 4:45 PM UTC · Completed 4:52 PM UTC

Commit: d6eb109 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.65

@waynesun09

Copy link
Copy Markdown
Member

Closing as a duplicate: #2010 implements #1953, which covers this.

@waynesun09 waynesun09 closed this Nov 23, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Review skipped — this PR is already closed.

The /fs-review command only reviews open PRs/MRs.

Posted by fullsend post-review check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Triggers review agent dispatch risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

post-code: report no-op runs to the Jira issue

1 participant