Skip to content

feat(permissions)!: add automatic tool review - #61

Open
minixalpha wants to merge 9 commits into
mainfrom
basic-permissions
Open

minixalpha wants to merge 9 commits into
mainfrom
basic-permissions

Conversation

@minixalpha

@minixalpha minixalpha commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Tool calls previously executed without an authorization gate. This change defaults interactive and headless runs to auto: each valid call receives an independent review before execution, and a denied call returns its reason to the main model without running the tool body.

The top-level permission_mode setting accepts auto or full and is fixed at startup. Auto uses the current endpoint/model with the pending tool's schema, arguments, and conversation context. Only technical review failures fall back to one-call manual approval in interactive mode; headless failures remain unexecuted. Both modes apply a limited deterministic guard for literal root deletion and raw disk destruction; this is not a sandbox or a general shell safety analyzer.

Review requests retain usage, cost, and tool linkage in the journal and ATIF. They count against wall-clock budgets but not the main model's turn limit. The English runtime prompt matches the generated English development notes verbatim, with a regression test. The branch also includes the permission-mode and review-prompt research, the workflow diagram, and synchronized English/Chinese user documentation and README changes.

Valid review explanations are trimmed and capped at 200 Unicode characters for display without changing the decision or triggering manual fallback solely for verbosity. The raw reviewer response remains intact in the journal. Invalid JSON, decision values, fields, and blank or non-string explanations still fail review.

Validation:

  • uv run --frozen pytest -q: 422 passed, 4 skipped (unavailable alternate transport).
  • uv run --with anthropic==1.5.0 python -m pytest -q: 426 passed.
  • Tests exercise all four tools, refusals without side effects, manual failure fallback, headless failures, fixed startup settings, frozen arguments, strict review JSON, reason-length boundaries and Unicode, real SDK mock transport, task deadlines, cost accounting, and prompt/document equality. A regression reproduces the 216-character explanation from a live write review and checks both pass and not_pass without manual approval.
  • Both suites report the existing SDK serializer warning for deliberately malformed tool input; tests use mocked API access, with no live-model safety evaluation.
  • Bilingual research notes retain matching source URLs and pinned revisions. The 0.11.0 development notes and configuration/CLI documentation are synchronized.
  • git diff --check and local documentation-link checks pass.

BREAKING CHANGE: Tool calls now default to model review and incur additional requests. Set "permission_mode": "full" in the user settings file before startup to skip model review.

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