Skip to content

[bugfix] post AI review inline comments instead of buffering them - #665

Merged
tiankongdeguiji merged 1 commit into
alibaba:masterfrom
tiankongdeguiji:bugfix/inline-comment-buffer
Sep 9, 2026
Merged

tiankongdeguiji merged 1 commit into
alibaba:masterfrom
tiankongdeguiji:bugfix/inline-comment-buffer

Conversation

@tiankongdeguiji

Copy link
Copy Markdown
Collaborator

Problem

The AI code review stopped posting inline comments. In run 34201597956 (PR #662) the reviewer made 11 create_inline_comment calls, every one succeeded, and none reached the PR (GET /pulls/662/comments returns 0). Only the top-level summary landed, because that goes through gh pr comment.

Each call came back:

{"success": true, "buffered": true,
 "message": "Comment buffered. It will be classified and posted after this session
             completes ... Set confirmed=true to post immediately."}

Root cause

claude-code-action's github-inline-comment-server.ts appends every unconfirmed call to /tmp/inline-comments-buffer.jsonl instead of posting it:

const CLASSIFY_ENABLED = process.env.CLASSIFY_INLINE_COMMENTS !== "false";
if (CLASSIFY_ENABLED && confirmed !== true) { appendFileSync(BUFFER_PATH, ...); return buffered; }

The buffer is drained by a separate entrypoint, src/entrypoints/post-buffered-inline-comments.ts, which the composite action runs as a post-step. Both jobs here drive the CLI directly with only --mcp-config / [mcp_servers], so that entrypoint never runs, the MCP server dies with the session, and the buffer stays on the runner.

The behavior has been upstream since March; the runner's git clone --branch v1 of the action was older than that until its last update. Run 34120554588 (2026-09-07 12:41) still posted 11 inline comments live; run 34201597956 (2026-09-08 07:53) buffered all of them. Nothing in this repo changed — .claude/commands/review-pr.md has never mentioned confirmed.

Fix

Set CLASSIFY_INLINE_COMMENTS=false in the MCP server's environment in both jobs, which restores immediate posting. The codex job needs its own copy of the variable: its [mcp_servers.github_inline_comment.env] block is the server's whole environment, not an inherited one, which is also why GITHUB_TOKEN and friends are listed there explicitly.

Two alternatives were rejected. Instructing the reviewers to pass confirmed: true depends on the model remembering the argument on every call and needs the same edit duplicated into the codex agent prompts. Adding the flush entrypoint as a post-step is worse still: post-buffered-inline-comments.ts reads the buffer but never truncates it, and on this persistent self-hosted runner the file has been accumulating since the regression — a flush without an rm -f first would spray one PR's comments onto the next.

Test Plan

  • yaml.safe_load on the workflow: parses, and the RunCodeReview step env carries CLASSIFY_INLINE_COMMENTS: 'false' (string, so the server's !== "false" check sees it).
  • Replayed the codex heredoc through tomllib: the generated config.toml parses with its preserved indentation and mcp_servers.github_inline_comment.env carries the new key alongside the existing four.
  • pre-commit run --files .github/workflows/code_review.yml: all applicable hooks pass.
  • End-to-end verification is the next claude-review / codex-review label on a PR — inline comments should appear during the run rather than being reported as buffered.

Unrelated follow-up worth doing on the runner: the setup instructions clone the action from a moving v1 branch, which is how a tool contract changed under CI unnoticed; pinning to a tag or SHA would prevent a repeat. The stale /tmp/inline-comments-buffer.jsonl there can also be deleted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BJg1zk3pFsjZdaUCWvjwBT

The inline-comment MCP server from claude-code-action buffers every
create_inline_comment call into /tmp/inline-comments-buffer.jsonl unless
the caller passes confirmed=true, and only a post-step entrypoint that
ships with the composite action drains that buffer. These jobs drive the
claude and codex CLIs directly, so nothing ever drained it and no inline
comment reached the PR -- only the top-level summary, which goes through
gh pr comment. The runner's clone of the server picked the behavior up on
its last update; before that every call posted live.

Setting CLASSIFY_INLINE_COMMENTS=false in the server's environment turns
the buffer off, so calls post as they are made again. The codex job needs
its own copy of the variable because its config.toml env block is the
server's whole environment rather than an inherited one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BJg1zk3pFsjZdaUCWvjwBT
@tiankongdeguiji
tiankongdeguiji merged commit 7392f51 into alibaba:master Sep 9, 2026
7 checks passed
@tiankongdeguiji
tiankongdeguiji deleted the bugfix/inline-comment-buffer branch September 9, 2026 01:43
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.

2 participants