-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
When use_sticky_comment: true is set but the action enters agent mode (because track_progress: false and a prompt is provided), the sticky comment feature silently breaks. No comment is ever created on the PR, even though the MCP comment server is included in the tool list.
The root cause is a code path gap in src/modes/agent/index.ts:
detectMode()insrc/modes/detector.tsreturns"agent"whentrack_progressis false andpromptis set- In
src/modes/agent/index.tsline 105,claudeCommentIdis hardcoded toundefined - Even though
shouldIncludeCommentServerevaluates totrueininstall-mcp-server.ts(becausemcp__github_comment__update_claude_commentis inallowedTools), the MCP server starts withoutCLAUDE_COMMENT_IDin its environment - Every call to
update_claude_commentfails at line 42-44 ofgithub-comment-server.tswith:"CLAUDE_COMMENT_ID environment variable is required"
Unlike tag mode, agent mode never calls createInitialComment() to create the comment and obtain its ID.
To Reproduce
- Configure a workflow with
track_progress: false,use_sticky_comment: true, and aprompton apull_requestevent (e.g., withtypes: [labeled]) - Trigger the action by adding the label to a PR
- The action runs successfully (Claude executes the prompt and produces output)
- No sticky comment appears on the PR
Expected behavior
When use_sticky_comment: true, agent mode should create an initial comment (like tag mode does via createInitialComment()) and pass the resulting comment ID to the MCP server via CLAUDE_COMMENT_ID. The sticky comment should be updated throughout the run.
Workflow yml file
on:
pull_request:
types: [labeled]
jobs:
review:
if: github.event.label.name == 'claude-review'
runs-on: ubuntu-latest
steps:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
use_sticky_comment: true
prompt: |
Review this pull request and post your findings as a comment.Because track_progress defaults to false and prompt is set, this enters agent mode where the sticky comment is silently ignored.
API Provider
[x] Anthropic First-Party API (default)
[ ] AWS Bedrock
[ ] GCP Vertex
Additional context
- Workaround: Setting
track_progress: trueforces tag mode where sticky comments work, but this isn't viable for all event types (e.g.,labeledfailsvalidateTrackProgressEvent). - Suggested fix: In
agent/index.ts, whencontext.inputs.useStickyCommentis true and the context is a PR or issue, callcreateInitialComment()and pass the resulting ID asclaudeCommentIdtoprepareMcpConfig. - Possibly related: use_sticky_comment: review text captured in result but never posted as PR comment #1052 may be a downstream symptom of this same root cause — the review result is captured but never posted because the comment server silently fails.