Conversation
Owner
|
感谢你的PR,我们正在进行版本升级,请等我们近期升级完成之后集中处理PR请求 |
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.
Problem
The edit approval menu distinguishes one-time, turn-scoped, and persistent
choices, but
allow_onceanddeny_oncewere recorded in session-scopedcaches.
A one-time decision therefore applied to every later edit of the same file for
the rest of the session, even when the proposed diff had changed:
apply oncekept approving them with no prompt, and
reject oncekept rejecting them withno prompt and no way to re-approve. This also made
apply oncebroader thanallow this file in this turn.The session-scoped edit caches predate the turn-scoped choices. Once
allow this file in this turnandallow all edits in this turnexisted, theone-time branches were still writing to those caches, so the one-time entries
never behaved as one-time.
Reproduction
npm run dev.1(apply once) for the first edit.Before: the second edit is applied without another prompt or diff review.
After: the second edit prompts again and displays its own diff.
Repeat with
5(reject once), which is also what Escape maps to:Before: later edits to the same file fail with
Edit deniedwithoutanother prompt.
After: the next edit prompts again and can be approved.
Changes
allow_oncelocal to the currentensureEdit()requestdeny_oncelocal to the currentensureEdit()requestsessionAllowedEditscacheTurn-scoped and persistent edit choices are unchanged.
sessionDeniedEditsisretained because reject-with-guidance still uses it.
Path and command approvals keep their session-scoped
allow once: those menushave no turn-scoped option, so the session cache is still the only way to stop
being asked there. The edit menu already offers
2-4for that, which is whyonly edits change here.
Choosing
apply oncerepeatedly now prompts once per edit. Options2-4remain available for approving the file for the turn, all edits for the turn,
or the file permanently. Adding an explicit session-scoped choice to the edit
menu would be a product decision rather than a fix, so it is left out of this
PR.
The production change is a five-line deletion in
src/permissions.ts. Itintroduces no new abstraction, dependency, persistence-format change, or TUI
change. This preserves MiniCode's explicit Claude Code-style approval
hierarchy: broader permissions remain separate choices instead of being
inferred from a one-time response.
No user-facing documentation described the previous session-scoped behavior,
so no documentation change is included.
Regression tests
Added
test/permissions.test.tscovering:allow_oncedeny_onceand can then be approvedallow_turnstill covers repeated edits to the same file only within thecurrent turn
The first two tests fail on the previous implementation. The
allow_turntest is a regression guard and passes before and after the fix.
Verification