fix(review-utils): metrics write permission + fail run on missing metrics - #322
Merged
Merged
Conversation
…ssing metrics
The review agent is told to write review-metrics.yaml to $RUNNER_TEMP, but
that path was never in the claude-code-action settings' additionalDirectories
allowlist, so the write was sandbox-denied — the exact failure seen on
greasemonkey-scripts#54, where the agent reported it could not write the
metrics file at all.
Also: the receiver script exited 0 when metrics were missing, so the PR
check correctly showed failure but the Actions run itself stayed green.
Per the review-dispatch spec ("if absent, the workflow fails"), exit 1
instead so a genuine agent failure is red on the run, not just the PR check.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012gUPPPteashVoJMa4cNDD6
Contributor
Plugin Version PreviewPreview only — plugin versions and
|
Owner
Author
|
The Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause for the "AI Code Review" check showing
failureon greasemonkey-scripts#54 while the underlying Actions run in.ai-agent-henryshowed green:run-agent/action.yamltells the review skill to write metrics to$RUNNER_TEMP/review-metrics.yaml, but$RUNNER_TEMPwas never in theclaude-code-actionsettings'permissions.additionalDirectoriesallowlist. The write was sandbox-denied, so the agent could never emit the metrics file — confirmed in the run's own transcript ("Write to /home/runner/work/_temp/review-metrics.yaml — sandbox restricts writes outside the working directory").read-metrics-and-compute-conclusion.shtreated "metrics missing" as a soft case andexit 0'd after postingconclusion=failureto the PR check. That's why the PR check went red but the Actions job/run stayed green — the script never actually failed the job. The spec (review-dispatch.md§Stage-by-stage bullet 6) already says this should fail the workflow; the implementation just didn't.Changes
plugins/claude-code/review-utils/actions/run-agent/action.yaml: add${{ runner.temp }}toadditionalDirectoriesso the mandated metrics write is actually permitted..github/scripts/review-receiver/read-metrics-and-compute-conclusion.sh:exit 1(wasexit 0) when no metrics file is found, and log::error::instead of::warning::. This routes through the receiver's existingif: failure()guard, so the Actions run itself shows red whenever the agent fails to complete a review — not just the PR check.Test plan
bash -nsyntax check passes on the modified script (done locally)yaml.safe_load)Generated by Claude Code