Repository navigation
fix(permission): honour SDK ask hints, route effort through applyFlagSettings, offer Auto and dontAsk (lr-2ebc65) - #431
Merged
Conversation
…plyFlagSettings, gate Auto and dontAsk by capability (lr-2ebc65)
Carry suppressAlwaysAllowRule, defaultToNo and matchedAskRule from the
canUseTool options into the permission prompt record, in process and over
the worker IPC (one shared message shape for both sides). The permission
kind refuses an Allow-for-session answer to a suppressed ask on every
response path, so the prompt stays pending, nothing is granted and the
responder is shown it again. No host-side auto-approval answers a
rule-forced ask, and no standing approval answers an ask the SDK marked as
needing its own answer. The rule is recorded on the resolved event.
A prompt_response naming a browser-extension command no longer settles it;
only the socket the command was sent to can.
Effort changes on a running Claude session go through
applyFlagSettings({effortLevel}) on both the in-process and worker paths;
the worker handle settles on the worker's real outcome, and the bridge
announces an effort only once the query has taken it. The Claude
capabilities list permissionModes, and set_permission_mode refuses dontAsk
and auto for a session whose vendor does not declare them.
A tool-use id shared by two sessions no longer takes over the other
session's request index entry, and a recorded AskUserQuestion skip replays
as skipped.
Folds in lr-5f4691 and lr-543036 item 3.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…No ask on No, offer Auto and Don't ask by capability (lr-2ebc65) The card and the notification banner read one choice list (permission-choices.js), so they cannot offer different answers to one ask. The card shows the user rule that forced an ask. The mode picker offers Don't ask and Auto only for a session whose vendor declares them. A send that throws is reported as such instead of as a dropped connection, and a recorded AskUserQuestion skip replays as skipped. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ing on every caller shape (lr-2ebc65) Hint fields join the prompt harness world, the round-trip property test (every kind, with the connect snapshot) and the invariant model (I9). A real claude-worker.js process runs against a stand-in SDK to prove the IPC payloads and the applyFlagSettings path. Adds the schema generator's missing one-sided bounds, tracks rejected callbacks in the hostile-id test, makes a lib that cannot express an answer explicit in the invariant harness, and documents the hints, the effort control and the capability-gated modes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
BOBBIE — clean (0 finding(s)) |
|
PEACHES — blocking (8 finding(s), 4 dropped)
Dropped candidates (4):
|
…unexpressible-step guard reachable (lr-2ebc65) A settle detector now counts a rejection as settled (shared isSettled, also used by the worker effort test), client() and withServer() live in the prompt harness world, the lost-step guard has a case that trips it, and the grant check documents why a session grant never answers a restricted ask. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
PEACHES — clean (2 finding(s), 5 dropped)
Dropped candidates (5):
|
|
BOBBIE — clean (0 finding(s)) |
Contributor
|
Merged via clagentic-loadout v0.2.0
|
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.
TASK: lr-2ebc65 (lead). Folds lr-5f4691 (effort and modes) and lr-543036 item 3 (remaining prompt-path findings). Closes lr-2ebc65, lr-5f4691 and lr-543036 on merge.
What changed
Permission hints (the safety defect). SDK 0.3.295 may attach suppressAlwaysAllowRule, defaultToNo and matchedAskRule to a canUseTool ask. No file under lib/ read them: the card and the banner offered Allow for session unconditionally, the server honoured it, and the worker relay dropped all three. Now:
Host-side auto-approval paths (all in handleCanUseTool, lib/sdk-bridge.js): full-auto mode, autonomous loop execution, the read-only and safe-command whitelist, and an earlier Allow for session. A matchedAskRule ask skips all four and reaches the operator.
Session-grant scope extension (reviewed, kept). A prior Allow-for-session grant does not auto-answer an ask carrying suppressAlwaysAllowRule or defaultToNo. Rationale, also stated in a code comment at the check in handleCanUseTool: a session grant is a standing rule for every later call with the same key, which is broader than the single action the SDK allows such an ask to cover, and the SDK forbids offering that; for defaultToNo, a silent approval would bypass the required opening on No, and the stricter reading is the safe one. This goes past the spec text and is called out for review.
Effort (lr-5f4691). The SDK Query has no setEffort. Both the in-process handle and the worker path now call applyFlagSettings({effortLevel}) through one module (effort-control.js). The worker handle settles on the worker real answer (requestId echo, 15s timeout, rejected when the query ends). The bridge records and announces an effort only after the query took it; a refusal is shown to the operator and the picker is put back. INTERFACE_VERSION is not bumped because test/yoke-robustness.test.js pins 0.2.0.
Modes (lr-5f4691). Auto and Dont-ask are offered only for a session whose vendor declares them in capabilities.permissionModes (Claude does, Codex does not). set_permission_mode refuses them otherwise.
lr-543036 item 1(b). The extension kind is not operator-answerable on any path (operatorMayAnswer), with a test.
lr-543036 item 3. prompt-card.js trySend reports a thrown send; newRequestId no longer reuses a tool-use id held by another session; a recorded AskUserQuestion skip replays as skipped; pruneTasks is not a defect (comment added); the round-trip schema generator gained one-sided bounds.
Round 2 (review rulings)
Demonstrated failure first
With lib/ at 3cd503e and the new tests present, npm test failed 36 tests: the two known environment failures and 34 new ones (a suppressed ask settling on allow_always, a real claude-worker.js process never answering set_effort with effort_changed, an extension-kind prompt_response settling a command, and the card, banner and hint tests). With this head only the two environment failures remain.
CREW_SOP section 6 compliance record
This diff changes what the console permission gate does at runtime. Every caller shape has a test (file: test name):
No crew hook, guard or test-runner behaviour changes. No new LLM call path, no new dependency.
Tests
npm test at this head, full suite run once. Failing-test-ID set: lr-29f9 (5): ceiling - query at MAX_CONCURRENT is rejected with error+done immediately; lr-2d91 (4): getMemoryStats returns activeLiveCount and maxConcurrentSessions. Both fail only inside a console-spawned session because of an inherited env var (lr-3c00dd). CI test check-run at the new head is reported in the PR conversation.
class sweep: git grep for then-only settle detectors and duplicated client()/withServer() helpers across test/, 3 duplicated-helper sites and 2 settle-detector sites fixed.
Followups
Task: lr-2ebc65
🤖 Generated with Claude Code