Skip to content

fix(permission): make session/persist approval grants tool-wide#3542

Merged
esengine merged 2 commits into
main-v2from
fix/approval-tool-wide
Jun 8, 2026
Merged

fix(permission): make session/persist approval grants tool-wide#3542
esengine merged 2 commits into
main-v2from
fix/approval-tool-wide

Conversation

@esengine

@esengine esengine commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Fixes the most-reported approval complaint: clicking "本会话内允许" / "持久允许" (allow for session / allow persistently) kept re-prompting on every new file or command.

Root cause

Both grants pinned the exact subject (file path / command):

  • the session grant keyed on tool + subject (requestApproval),
  • the persisted rule was tool=subject (literal).

So "allow write_file for this session" only suppressed re-prompts for that one file; the next file re-asked. Users read the labels as "trust this tool" and expected no further prompts.

Fix (tool-wide, per maintainer decision)

  • Session grant now keys on the tool name → any later subject of that tool short-circuits.
  • Persisted rule is the bare tool name → tool-wide allow in config.
  • Deny rules still take precedence on every call, so e.g. rm -rf on the deny list is still blocked even after "allow bash for this session".

Tests

  • Updated TestApprovalSessionGrant to use different subjects (the actual regression).
  • New full agent-turn e2e (TestApprovalToolWideEndToEnd): model writes two different files, user picks "allow for session" once, second write runs with no second prompt — exactly one approval, both files written.
  • All of permission / control / agent / boot / config green; vet clean.

Closes #3498
Closes #3520

"Allow for this session" and "Allow persistently" pinned the exact
subject (file path / command), so writing a different file or running a
different command re-prompted every time — users read the labels as
"trust this tool" and reasonably expected no further prompts. Both now
grant the whole tool: the session grant keys on the tool name, and the
persisted rule is the bare tool name. Deny rules still take precedence on
every call. Adds a full agent-turn e2e proving a second file write under
the same tool runs without a second prompt.

Closes #3498
Closes #3520
@esengine esengine requested a review from SivanCola as a code owner June 8, 2026 07:35
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development agent Core agent loop (internal/agent, internal/control) and removed v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 8, 2026
@esengine esengine merged commit c0bb179 into main-v2 Jun 8, 2026
9 checks passed
@esengine esengine deleted the fix/approval-tool-wide branch June 8, 2026 07:43
dorokuma pushed a commit to dorokuma/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
…gine#3542)

* fix(permission): make session/persist approval grants tool-wide

"Allow for this session" and "Allow persistently" pinned the exact
subject (file path / command), so writing a different file or running a
different command re-prompted every time — users read the labels as
"trust this tool" and reasonably expected no further prompts. Both now
grant the whole tool: the session grant keys on the tool name, and the
persisted rule is the bare tool name. Deny rules still take precedence on
every call. Adds a full agent-turn e2e proving a second file write under
the same tool runs without a second prompt.

Closes esengine#3498
Closes esengine#3520

* test: gofmt the e2e approval test

---------

Co-authored-by: reasonix <reasonix@deepseek.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control)

Projects

None yet

1 participant