Skip to content

fix(review): deliver code-review findings to the Review panel - #170

Merged
radutopala merged 1 commit into
mainfrom
fix/review-findings-reach-panel
Jul 27, 2026
Merged

fix(review): deliver code-review findings to the Review panel#170
radutopala merged 1 commit into
mainfrom
fix/review-findings-reach-panel

Conversation

@radutopala

Copy link
Copy Markdown
Owner

A PR review run reported its findings and the Review panel stayed empty. Three defects stacked up between the agent's tool call and the ingest path — fixing any one alone would not have surfaced a comment.

1. The stream reader dropped the callbacks

collectOutput chose between following the container's logs live and reading them once at exit based on a hand-listed subset of the callbacks:

if cb.onTurn != nil || cb.onThinking != nil || cb.onToolResult != nil {

A review request sets only a tool-use callback, so it fell through to the batch read — which re-scans the logs with an empty streamCallbacks and discards everything. The findings were sitting in the stream with nothing listening.

Replaced with an exhaustive streamCallbacks.any(), so a callback can't be silently ignored by omission again. This also fixes a latent case: a request setting only OnActivity was losing stream-derived model and api_retry events for the same reason.

2. Tool inputs reached callers only as a lossy summary

extractToolUses passed summarizeToolInput's chat-facing summary, which returns "" for any tool whose schema it doesn't know — including ReportFindings. Added ToolUse.Raw, onToolUseRaw and AgentRequest.OnToolUseRaw so a caller that has to decode arguments gets the verbatim JSON, and pointed the review runner at that instead.

3. The review command forked into a silent subagent

The built-in /code-review command runs inline only when CLAUDE_CODE_REPORT_FINDINGS is set and ReportFindings is callable; otherwise it forks. A fork emits nothing on the parent stream — the run looks hung for minutes — and its findings never reach a tool call the parent can observe.

Review mode now takes ReportFindings out of the batch disallow list and passes the env through --settings rather than container env vars. Settings scopes are applied over process.env in a fixed order, so a container env var ranks below the user's settings file — which is bind-mounted into every agent container. A host CLAUDE_CODE_SUBAGENT_MODEL would otherwise overwrite ours and quietly downgrade the model; --settings lands in a scope that wins.

Verification

Reproduced against a real review run, whose ReportFindings payload is now a test fixture. Before: session ready, 0 comments. After: both findings render in the panel.

  • go test ./... clean
  • make coverage-check → 100.0%
  • make lint → 0 issues

Tests added cover the raw channel, the streaming gate per callback, and a review-shaped request end to end. Docs now describe ReportFindings as the default reporting channel with the MCP tool as the override path for non-slash review prompts.

A PR review run reported its findings and the panel stayed empty. Three
defects stacked up between the agent's tool call and the ingest path.

1. collectOutput picked the streaming reader off a hand-listed subset of
   the callbacks (onTurn / onThinking / onToolResult). A review request
   sets none of those, so it fell through to the batch read, which
   re-scans the logs with an empty streamCallbacks and drops every
   callback. The findings were on the stream with nothing listening.
   Replaced with an exhaustive streamCallbacks.any(), which also restores
   stream-derived activity events for requests that set only OnActivity.

2. Tool inputs reached callers only as summarizeToolInput's chat-facing
   summary, which is empty for any tool it has no case for — including
   ReportFindings. Added ToolUse.Raw / onToolUseRaw / OnToolUseRaw so a
   caller that needs to decode arguments gets the verbatim JSON, and
   pointed the review runner at it.

3. Review runs forked the built-in /code-review command into a silent
   subagent instead of running it inline. Inline requires
   CLAUDE_CODE_REPORT_FINDINGS plus an available ReportFindings tool, so
   review mode now drops that tool from the batch disallow list and
   passes the env via --settings. Container env is applied *under* the
   user's settings file, so a host CLAUDE_CODE_SUBAGENT_MODEL would
   otherwise overwrite ours; --settings lands in a scope that wins.

Tests cover the raw channel, the streaming gate per callback, and a
review-shaped request end to end, plus the real findings payload.
Docs updated to describe ReportFindings as the default reporting channel
with the MCP tool as the override path.
@radutopala
radutopala enabled auto-merge (rebase) July 27, 2026 17:06
@radutopala
radutopala merged commit c45f3e8 into main Jul 27, 2026
17 checks passed
@radutopala
radutopala deleted the fix/review-findings-reach-panel branch July 27, 2026 17:08
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