Skip to content

Claude review: fix Jira context and skip changes merged from main - #1588

Open
yuryyas wants to merge 2 commits into
mainfrom
claude_review_jira_mcp
Open

yuryyas wants to merge 2 commits into
mainfrom
claude_review_jira_mcp

Conversation

@yuryyas

@yuryyas yuryyas commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Two fixes to .github/workflows/claude-review.yml, in separate commits.

1. Jira context never reached Claude

The summaries on #1585 and #1586 both say "The Jira tool wasn't available in this run". claude-code-action merges --mcp-config values with its own built-in server and drops any value that is a file path (mergeMcpConfigs in base-action/src/parse-sdk-options.ts). Our Jira server was in $RUNNER_TEMP/mcp.json, so it was silently ignored.

 Extract Jira ticket
+  curl Jira /issue/$KEY → print HTTP status only; not 200 → ::warning::, review without ticket
-Write Jira MCP config → $RUNNER_TEMP/mcp.json            (dropped by the action)
+Prepare Jira MCP server → --mcp-config '{"mcpServers":{"jira":{… "${JIRA_USERNAME}" …}}}'
+  (pre-installs mcp-atlassian so it starts within the MCP timeout)
+Show MCP status (always) → "server jira: connected", "tool mcp__jira__jira_get_issue"

Credentials still never appear in args or logs. Claude Code fills in the ${JIRA_*} placeholders from the step's environment.

2. Merging main into a PR re-reviewed all of main's changes

The next review diffed <last reviewed>..HEAD, which includes everything merged in from main. The range is now computed in a step before Claude runs:

LAST = "Reviewed up to <sha>" from claude[bot]'s summary comment
MB   = merge-base(base, HEAD)
no LAST, or LAST not an ancestor (rebase)  → full:        git diff MB HEAD
base unchanged since LAST                  → incremental: git diff LAST HEAD
base merged in since LAST                  → incremental: git diff merge-tree(LAST + MB) HEAD   # author's changes only
  …merge had conflicts                     → full
diff empty (push only merged main)         → skip: ::notice::, Claude doesn't run

Claude gets the exact git diff command and the range label in the prompt, instead of working out the range itself. With no previous summary, the first review is now the whole PR. Before, it was only the last push, so a PR whose first review failed never got a full review.

Evidence

  • Jira (local): with Claude Code 2.1.329 (the action uses 2.1.328), an inline --mcp-config probe server saw cfg=expanded-ok inherit=inherited-ok. The action's shell-quote parsing keeps the inline JSON intact, and --allowedTools is unchanged.
  • Range step: ran the actual step script against a scratch repo, with a stub gh for the comment lookup:
S1 first review           -> mode=full        | changes: -2 +two
S2 new commit             -> mode=incremental | changes: -3 +three
S3 only merged main       -> mode=skip        | changes: none
S4 merge main + commit    -> mode=incremental | changes: -4 +four     ← main's change excluded
S5 conflicting merge      -> mode=full        | whole PR vs base
S6 rebased, not ancestor  -> mode=full        | changes: -2 +two
  • The workflow YAML parses.

Not tested on GitHub: the action skips itself on PRs that change its own workflow file, so this takes effect after merge.

Merge Danger

Door: two-way. Revert to restore the previous behaviour.

Blast Radius: review job only.

  • If Jira access fails, the job logs a warning and reviews without ticket context, instead of failing.
  • If the summary comment is missing or can't be parsed, the step falls back to a whole-PR review. That costs more but never misses changes.
  • Runs with a ticket key take about 10 s longer, to pre-install mcp-atlassian.

🤖 Generated with Claude Code

yuryyas and others added 2 commits November 20, 2026 14:16
claude-code-action merges --mcp-config values with its own inline
servers and drops file paths, so the Jira server from mcp.json was
silently ignored. Pass it as inline JSON instead (credentials still
expanded from env by Claude Code), check Jira access before the review,
and log MCP server/tool status after each run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The incremental review diffed from the last reviewed commit, so merging
main into a PR made Claude re-review everything that came from main.
Compute the range in a step instead: whole PR first time, then the
author's changes since the last review, diffed against the last reviewed
commit merged with the same base (git merge-tree). A push that only
merges the base skips the review; conflicts fall back to the whole PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yuryyas
yuryyas requested a review from ari as a code owner November 20, 2026 13:17
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Unit Test Results

358 tests  ±0   358 ✔️ ±0   12m 29s ⏱️ + 1m 42s
241 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 307039c. ± Comparison against base commit d00f9be.

♻️ This comment has been updated with latest results.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant