Repository navigation
fix(approvals): only the person approves what the assistant asks - #598
Merged
Merged
Conversation
The assistant's approvals (send_mail, add_event, write_file, entity and
topic changes and the rest) could be approved through
POST /api/v1/approvals/{id} with an API token or an OAuth app token:
approvals.can only refused the "agent" route for approvals that weren't
an automation's. Now every assistant approval follows the automation
rule: only the person signed in to Lens, or in the chat it was asked in,
approves (or samples) it; an API key, an app, MCP and the assistant can
only decline (403 otherwise), and each approval's `can` says so. A
research plan keeps its admin opt-in, research.agents_skip_review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFUNzy1QZy5HhKAyJxTAYJ
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.
Requested by Adeel · project thread
Description
Before: the README says agents never approve, but an API key or an OAuth app could approve (or sample) the assistant's pending approvals, such as sending mail, adding an event or writing a file, through
POST /api/v1/approvals/{id}.approvals.canandai_tools.approverefused only the MCP/assistant route for approvals that weren't an automation's.After: those approvals are approved only by the person signed in to Lens, or in the chat they were asked in, the same rule automation approvals already follow. Tokens, apps, MCP and the assistant can decline but get 403 on approve or sample, and
can.approvesays so. Research plans keep their existing admin switch (research.agents_skip_review).How:
approvals.canallows approve for the assistant's approvals onlyvia"web" or "chat";ai_tools.approverefuses a non-decline pick whencansays no.Motivation and Context
Found while building calendar proposals from dates said (personal feature plan sheet). The docs and threat model (
P-APPROVAL) promised this; the code didn't enforce it.Screenshots (if appropriate):
n/a
Steps to reproduce (if appropriate):
Ask the assistant to send a mail, then
POST /api/v1/approvals/{id}with{"pick":"approve"}and an API key: before, it sent; now it's 403.Types of changes
!in the title)Checklist:
make hookschecks it on commit).test_approvals.pytest_only_the_person_approves_what_the_assistant_asks, which fails on main).docs/accordingly (automations, api, assistant, README, threat model).## UnreleasedinCHANGELOG.md. Written aschangelog.d/agent-approve.md, per build(release): changelog fragments in changelog.d/ instead of one Unreleased section #581.Done questions (AGENTS.md)
.envedit or manual step.P-APPROVAL.Local CI (
ci/local-ci.sh): FastAPI (embedded and server), Next.js, pre-commit and PR title passed.Generated by Claude Code