Repository navigation
Description
Summary
Guardian action review is live in core, but material write tools still execute without review because approvalMode is opt-in and most plugins never set it. Live evidence: github_createIssue created an issue with no guardian_action_reviewed event.
Parent design: #874. Related adoption slices: #1051 (scheduler), #923 (Vercel). Enforcement PR: #1082.
Observed
- User asked Junior to create a GitHub issue (write side effect).
- Runtime executed
github_createIssuesuccessfully. queryConversationEventsfor that turn showed tool starts/results for the create path.- No
guardian_action_reviewed(and no auth events) for those calls. - Source inspection confirmed this matches current policy resolution, not a missing log.
Read-only investigation tools in the same conversation (searchTools, queryConversationEvents, Slack reads, sandbox bash) also had no Guardian events; that part is expected under the current opt-in gate.
Root cause
Confidence: high — direct source + unit test + live event log.
Core keeps tools outside review unless they explicitly opt in:
// packages/junior/src/chat/tool-support/action-review.ts
/** Keep tools outside action review unless they explicitly opt in. */
function effectiveApprovalMode(...) {
const declared = tool.approvalMode;
if (declared === undefined || declared === "approve") {
return "approve"; // no Guardian
}
if (declared === "review") return "review";
// "auto" only reviews when annotations/identity/source trip the policy
}reviewToolAction / prepareToolActionReview early-return when approvalMode is undefined or "approve", so Guardian never sees a proposal and no guardian_action_reviewed event is recorded.
Modes today:
approvalMode |
Behavior |
|---|---|
omit / approve |
no Guardian |
review |
always review |
auto |
review only if destructive/open-world/readOnlyHint === false, or identity/source present |
Plugin registration does stamp identity + source on every plugin tool (packages/junior/src/chat/plugins/agent-hooks.ts), but those fields only matter after a tool declares approvalMode: "auto" or "review". Without the opt-in, identity/source are ignored for the gate.
Unit coverage matches this: "preserves execution behavior for unclassified tools" asserts Guardian is not called when approvalMode is omitted (packages/junior/tests/unit/tool-support/action-review.test.ts).
Scope of missing opt-in
Verified against current getsentry/junior main:
packages/junior-github— zeroapprovalModedeclarations, includingcreateIssue/createPullRequestpackages/junior-scheduler— zeropackages/junior-memory— zeropackages/junior-vercel— zero- Production core opt-in found:
callMcpToolonly (approvalMode: "auto"inpackages/junior/src/chat/tools/skill/call-mcp-tool.ts)
So even after #1082, most side-effecting first-party tools still bypass Guardian by default.
Design tension
#874 states:
- "External, plugin, MCP, or otherwise material tools should default conservatively to
review." - "Unknown material tool behavior defaults to
review." - Initial rollout: "Preserve existing behavior until tools are explicitly classified..."
Current code implements the rollout carve-out (omit = outside review), not the conservative default. The live github_createIssue path is the concrete gap between those two statements.
Reproduction
- In a Slack conversation with Junior (Guardian-enabled deploy post-feat(agent): enforce Guardian action review #1082), ask it to create a GitHub issue via the native tool path (not
gh issue createin bash). - Confirm the issue is created (
github_createIssuetool result / issue URL). - Call
queryConversationEventsfor that conversation id (slack:{channelId}:{threadTs}). - Observe tool execution events for
github_createIssue(orexecuteTool→ catalog tool). - Observe no
guardian_action_reviewedevent for that tool call.
Optional source check:
- Open
packages/junior-github/src/tools/create-issue.ts—definePluginTool({...})has noapprovalMode. - Open
packages/junior/src/chat/tool-support/action-review.ts— undefined/approveshort-circuits beforereviewer.review. - Confirm unit test "preserves execution behavior for unclassified tools" still expects no Guardian call.
Why this matters
- Users/operators inspecting conversation events will conclude "Guardian did not review this write" — correctly, under current code.
- Side effects that feat: add core action review and approvals for permissioned tools #874 called out as review-worthy (persistent external writes, surprising destinations, credentialed provider actions) can still run without a Guardian proposal.
- Adoption tickets (feat: adopt core action review in scheduler tools #1051, Adopt Guardian-reviewed read-only Vercel tools #923) cover individual surfaces; they do not record this end-to-end RCA that omit still means bypass for GitHub writes and other unclassified plugins.
Non-goals / unknowns
- Not claiming every read-only tool should hit Guardian.
- Not claiming feat(agent): enforce Guardian action review #1082 failed to enforce the gate when
approvalModeis set — enforcement works for opted-in tools. - Unknown without product decision: whether the fix is (a) classify high-risk tools (
review/autoper tool), (b) change the default so plugin/identity tools review unlessapprove, or (c) both. feat: add core action review and approvals for permissioned tools #874 text leans (b) for material/plugin tools; current code is (a)-only via explicit opt-in.
Suggested direction (not prescriptive)
Thread discussion pointed at declaring approvalMode on write tools (e.g. GitHub create issue/PR) at minimum. A stronger alignment with #874 would also reconsider the default for plugin-identity tools so new material tools cannot silently ship outside review.
Requested by David Cramer via Junior.
--
Activity
fix(agent): require tool behavior annotations (getsentry#1156)