Skip to content

fix(agent): surface review limits as tool rejections - #1529

Merged
dcramer merged 4 commits into
mainfrom
fix/no-sentry-tool-action-review-limit
Aug 13, 2026
Merged

dcramer merged 4 commits into
mainfrom
fix/no-sentry-tool-action-review-limit

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

After three consecutive action-review denials, Junior used to abort the whole run with ToolActionReviewLimitError. That showed up to the agent as an internal error instead of a normal tool failure.

This keeps Sentry capture for the limit, but the third denial stays on the normal tool-rejection path with explicit stop-retrying instructions.

Changes

  • on the third consecutive denial, throw ToolActionRejectedError with stop-retrying instructions
  • capture ToolActionReviewLimitError at the tool boundary as guardian.action_review.exhausted
  • do not call onFatal / abort the agent run for the limit case
  • project the rejection into the durable tool result like any other action-review deny

Verification

  • pnpm --filter @sentry/junior exec vitest run tests/unit/tool-support/action-review.test.ts tests/component/tool-support/pi-tool-adapter.test.ts

Coverage lives in the existing pi-tool-adapter component scenario only.

Requested by David Cramer.

--

View Junior Session [Sentry]

sentry-junior Bot and others added 2 commits August 13, 2026 18:08
ToolActionReviewLimitError is expected control flow after Guardian rejects
three consecutive tool attempts. Return an execution_failure outcome without
logException, and finalize that stop with a warn plus user-visible text
instead of opening a Sentry issue.

Evidence: https://sentry.sentry.io/issues/7649537952/
Co-Authored-By: David Cramer <[email protected]>
Keep one agent failure return path, detect the limit by stable message,
and emit guardian.action_review.exhausted without extra helpers.

Co-Authored-By: David Cramer <[email protected]>
@vercel

vercel Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Aug 13, 2026 7:36pm

Request Review

Keep Sentry capture for consecutive action-review denials, but stop
aborting the agent run. The third rejection stays a normal tool failure
with explicit stop-retrying instructions instead of an internal error.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior sentry-junior Bot changed the title fix(agent): stop capturing action review limits in Sentry fix(agent): surface review limits as tool rejections Aug 13, 2026
@dcramer
dcramer marked this pull request as ready for review August 13, 2026 19:27
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Aug 13, 2026
Keep the existing pi-tool-adapter component scenario as the single owner
for consecutive rejection behavior. Do not assert telemetry as product
behavior.

Co-Authored-By: David Cramer <[email protected]>
@github-actions github-actions Bot added risk: low PR risk score: low and removed risk: medium PR risk score: medium labels Aug 13, 2026
@dcramer
dcramer merged commit bc89059 into main Aug 13, 2026
38 checks passed
@dcramer
dcramer deleted the fix/no-sentry-tool-action-review-limit branch August 13, 2026 20:19
dcramer added a commit that referenced this pull request Oct 2, 2026
The chat README invariant said three consecutive Guardian rejections
interrupt the execution slice. That has not been true since
#1529: the third rejection is a normal
`ToolActionRejectedError` that tells the agent to stop retrying and
explain the risk to the user, and the run continues. This updates the
invariant to match `tool-support/action-review.ts`, so a later change
does not restore the old abort behavior because the README says so.

Fixes #2003

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 3dde76af Deployed Aug 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant