Repository navigation
fix(config): preserve inherited shell deny across rename - #811
Merged
Merged
Conversation
Early durable checkpoint — slice 1 of the #780 rename: - ShellID.ToolID and the V2 core tool now publish "shell"; core tool file bash.ts -> shell.ts (ShellTool), no doubled registration. - CORE_TOOLS drops the stale "bash" duplicate. - Model-facing prompt text says shell (and truthfully describes a fresh process per call) for pwsh/cmd/POSIX profiles. - Permission compatibility: Wildcard.matchAction treats legacy "bash" as an alias subject for canonical "shell" in V1 evaluate/disabled/ask, V2 evaluate, Policy.evaluate, whollyDisabled, and llm preapproved matching — wildcard semantics and findLast precedence unchanged, so a legacy deny cannot degrade to ask. Config schema gains typed "shell", keeps "bash". - Core tool test renamed to tool-shell.test.ts incl. a legacy bash-deny case. Remaining: ACP/CLI/TUI labels + legacy history recognition, generated SDK/schema contracts, opencode test/tree update, fake-provider catalog coverage, full package suites. Co-authored-by: arena-agent <[email protected]>
…s (Refs #780) Slice 2 checkpoint: - ACP/CLI run/TUI/github handler recognize canonical "shell" and keep rendering legacy persisted "bash" parts (no re-execution, no doubled rendering); synthetic shell-mode commits now carry tool "shell". - TUI activity grouping kind bash -> shell with legacy tool id mapped to the same kind; permission prompt, tips text say shell. - Model-facing system/agent prompts and grep tool text reference the shell tool by its new name. - CLI agent create lists canonical "shell" permission (help snapshot regenerated; single owned line). - Generated contracts via canonical generator, owned delta only (PermissionConfig gains "shell" in openapi.json + SDK v2 types); pre-existing baseline drift in generated files left untouched. - Tests updated to canonical shell (fake providers call "shell"); legacy fixtures kept where they simulate persisted history; run-process legacy {bash: ask/deny} config kept deliberately as runtime back-compat proof. Verified so far: core suite 1515+ pass after location-layer expectation update (1 remaining file fix included), opencode previously-failing 26 tests across 10 files now pass file-by-file. Full re-runs + TUI pending. Co-authored-by: arena-agent <[email protected]>
…prompts
- permission/next.test.ts: order-preservation tests now evaluate the
canonical "shell" action against legacy "bash" config; new tests pin
legacy deny (no ask broadening), per-pattern rules, wildcard permission
patterns ("ba*"), last-wins order across spellings, and disabled().
- core permission.test.ts: V2 saved legacy "bash" approvals apply to
"shell" assertions; configured legacy deny keeps precedence.
- registry/catalog tests: model-facing catalog publishes exactly one
"shell" and no "bash"; CORE_TOOLS likewise.
- shell-prompt.test.ts: every profile says "shell tool call", never
"bash tool call"/"given bash command"/"persistent shell session";
POSIX intro says fresh shell process.
- tui activity tests: kind expectations bash -> shell; legacy tool id
"bash" asserted to group as shell.
- customize-opencode skill doc: permission examples/known keys say
"shell" (legacy "bash" noted as honored alias).
Co-authored-by: arena-agent <[email protected]>
The repo-wide formatter run inside the contract generator had rewrapped unrelated regions of these two owned files. Restored from baseline and re-applied only the semantic rename edits; behavior unchanged (activity tests + tui typecheck re-verified). Co-authored-by: arena-agent <[email protected]>
…ame (Refs #780) Co-authored-by: arena-agent <[email protected]>
…name (Refs #780) Review follow-up for the #780 rename, addressing the REQUEST CHANGES findings on 18ceca2 with RED/GREEN regression tests: - HIGH config merge: config layers merge by object key, so keeping both the legacy 'bash' and canonical 'shell' permission keys let an older layer outrank a newer one purely by key position (a later deny lost to an earlier allow). Fold 'bash' into 'shell' as each layer is decoded (ConfigPermissionV1.canonicalize, order-preserving; two rule objects deep-merge per pattern, otherwise the later entry wins), and canonicalize again at the merge choke points (mergeConfig operands, OPENCODE_PERMISSION, tools->permissions, agent tools/permission) so layered global/project/local, managed (MDM), env, and agent cases all resolve by layer order exactly as pre-rename configs did. No blanket deny: findLast semantics are preserved. - HIGH doom_loop: doom_loop rules key on the tool id, so match their resources with matchAction in the V1 evaluator, V2 Permission, and Policy: a legacy {bash: deny} pattern (or 'ba*') gates the renamed 'shell' tool again, with wildcard + findLast semantics unchanged and no deny->ask conversion. Non-doom resources are unaffected. - MED tool-name lists: tool_search defer/always_load now match with matchAction (legacy 'bash' hits 'shell'); V2 context protection compares canonical spellings so tools:['bash'] protects new shell calls and tools:['shell'] protects archived bash calls. - MED Zen: fingerprint names stay wire constants, but a fingerprint tool counts as caller-provided when the catalog carries its canonical spelling; a hallucinated 'bash' call now reaches the runtime invalid-tool repair (and satisfies no required tool_choice check) instead of being silently stripped as gateway-injected. Zero shell execution proven by a new end-to-end fake-provider control. - LOW: CLI run summary says 'shell completed'; tips name shell permissions; builtin TUI renderer test covers 'shell'. - LSP: an already-settled publish (quiet for the full debounce window) resolves synchronously instead of depending on timer scheduling latency; the debounce quiet-period guarantee for fresh publishes, the 1000ms test bound, and all budgets are unchanged. Co-authored-by: arena-agent <[email protected]>
…(Refs #780) Co-authored-by: arena-agent <[email protected]>
… (Refs #780) Co-authored-by: arena-agent <[email protected]>
Config decode now stores canonical 'shell' rules, so a permission query under the legacy 'bash' name must resolve them too: matchAction treats the two spellings as one action identity in both directions (previously only a canonical query matched legacy-spelled patterns). This restores agent/task evaluations that ask for 'bash' against canonicalized rulesets. Updates the remaining test expectations that encoded the pre-canonicalization 'bash' key in decoded config (tools migration, key order, managed-plist). Co-authored-by: arena-agent <[email protected]>
Captured from the real binary at the current head (--mini --demo): /permission shell renders the canonical 'Shell command' permission prompt and /fmt shell renders the shell tool part; neither surface mentions the pre-rename bash identity. Co-authored-by: arena-agent <[email protected]>
…eaning (Refs #780) Second exact-review follow-up (REQUEST CHANGES on fe6fd39), RED/GREEN: 1. Ordered permission merge: folding bash->shell at decode (previous follow-up) collapsed two keys into the first key's position, so {bash:ask, *:allow, shell:deny} evaluated allow and nested pattern order was lost; plain mergeDeep has the same retention across layers. Decode no longer folds (written key order/spelling preserved), and every permission merge (mergeConfig top-level + agent.* + mode.*, agent-dir loads, mode conversion, OPENCODE_PERMISSION, tools->perms, agent tools+explicit) now uses ConfigPermissionV1.merge: rule-sequence semantics where a key/pattern written by a later layer takes that layer's position, and a flat action promotes to the * pattern instead of replacing inner patterns. Layering now evaluates as the concatenation of the layers' rule sequences. 2. Legacy tools records: fold the bash key to shell per layer before merging (mergeConfig operands, agent/mode records), so tools {shell:false} / {bash:true} / managed {shell:false} resolves by layer order (deny), in both spelling orders. 3. Agent normalize: explicit permission merges over the tools-derived layer with the ordered merge instead of Object.assign, so tools{bash:true} + permission{*:allow, shell:deny} keeps the explicit order and evaluates deny (allow-last control covered). 4. Wildcard meaning: union alias matching let a legacy s* (written when it covered skill) recruit the renamed shell tool and bypass an explicit bash:deny ordered before it. matchAction now preserves each pattern's written meaning: literal patterns match either exact spelling in written order (explicit re-permits still win), wildcard patterns match against the legacy spelling only (ba* still gates shell; s*/sh* do not capture it — fail-closed to ask). Applies uniformly to V1 evaluate, V2 Permission, Policy, doom_loop resources, and tool-name lists. Also adds the archived-history control: a persisted completed tool:'bash' part is replayed from stored output and never re-executed under the new name. Co-authored-by: arena-agent <[email protected]>
…ansient state (Refs #780) Windows CI at fe6fd39 failed exactly one test: 'remote connection HTTP failures set error and clear syncing' expected status 'error' but still saw 'connecting' when its 1500ms poll expired. Causal trace: the sync loop sets 'error' only after the first 503 round-trip (fiber scheduling plus real in-process HTTP on a runner executing seven suites in parallel) and flips back to 'connecting' after the 1s retry backoff, so the test raced both the first-transition latency and a transient state with a fixed wall-clock polling window. Product behavior is correct (error is set and emitted on HTTP failure; setStatus updates state before emitting). The test now registers for the Status 'error' event via the product's own waitEvent (same 5000ms bound Workspace uses internally) before starting sync, joins it, and then makes the same status()/isSyncing assertions. No assertion or product deadline changed; the wait is now condition-driven and completes as soon as the transition happens. The history-failure sibling had the identical latent race and gets the same wait. Co-authored-by: arena-agent <[email protected]>
… clamp (Refs #780) Parent review of c3cdbfb rejected redefining wildcard behavior: matching s*/sh* against the legacy spelling only silently broke canonical wildcard use. Source-grounded contract (issue #780 + repo semantics): rules match with Wildcard.match and resolve with findLast, and a configured deny must never silently broaden. Production rulesets also always carry defaults ('*': allow) before user rules, so any extension/tier scheme that sidelines canonical wildcards whenever a legacy-visible rule exists would disable them in practice. Minimal compatible semantics, implemented as Wildcard.winningRule and used by V1 evaluate, V2 Permission.evaluate, Policy.evaluate, Permission.disabled, and the preapproved/wholly-disabled lookups: - matchAction is plain union matching again: a pattern matches if it matches any spelling of the tool name; findLast order is untouched. Canonical s*/sh* name shell (including as carve-outs over '*' defaults), legacy ba* still gates it, exact-name re-permits win by written order. - One clamp: when the winning rule matched the tool only because of the rename (a wildcard matching the canonical name but no legacy spelling — recruitedByRename; exact spellings of either name never count as recruited) and the same rules evaluated under the legacy name yield a deny, the legacy deny stands. Only deny is clamped; narrowing and ask->allow order are unchanged. Applies to the doom_loop resource dimension the same way. So {bash:deny, s*:allow} stays deny, {*:ask, s*:allow} allows, and {s*:deny} disables shell — canonical behavior with legacy negative scope intact. Co-authored-by: arena-agent <[email protected]>
…by event (Refs #780) Parent review: the previous waitEvent timeout of 5000 changed the observation bound (original poll: 1500ms); a deadline increase needs explicit authority. Restore the identical 1500ms bound and assertions: the test subscribes for the Status 'error' event before starting sync and joins it, so the transient error state (the loop flips back to 'connecting' after the 1s retry backoff) cannot be missed by a level poll, and the status()/isSyncing assertions run in the same instant the transition is recorded (setStatus updates state before emitting). Raw-log note for the fe6fd39 Windows failure: no 'failed to connect to global sync' warning appears before teardown, indicating the first transition had not fired inside the window on that loaded runner. This change removes the structural level-poll miss at the same bound; a first transition slower than 1500ms under CI load remains possible and would need a separately authorized bound change. Co-authored-by: arena-agent <[email protected]>
… to the bash/shell pair (Refs #780) Independent review of the successor head reproduced a HIGH: the earlier ordered permission merge repositioned every key a later layer wrote, so global edit {'*': allow, 'src/**': deny} + project edit {'*': allow} flipped src paths from base deny to allow — the rename was silently changing the pre-existing deep-merge precedence contract for permissions it does not involve (same for external_directory secrets, and flat actions were being promoted/merged instead of replacing records wholesale). Restore remeda mergeDeep / Object.assign everywhere (mergeConfig, agent-record merge, OPENCODE_PERMISSION, tools-derived merge, agent normalize) and delete ConfigPermissionV1.merge. The only remaining rename-specific ordering is between the two spellings of the renamed permission itself: - ConfigPermissionV1.orderShellRename(merged, source): after a base merge, permutes / within the key slots they already occupy so their relative order follows last write (global shell -> project bash -> local shell must keep local precedence). A spelling never crosses or any unrelated key; single-layer written order is preserved exactly. - ConfigPermissionV1.clearDerivedShellRename: in tools-derived records (agent normalize, top-level tools), an explicit / entry replaces the synthetic derived slot at its own written position. update/updateGlobal apply the same pair ordering after their mergeDeep so a written config evaluates the same way it loads (JSON path; the jsonc text patch still relies on load-time ordering). Inner pattern positions keep base semantics uniformly, including for shell itself; new regression tests pin the reviewer cases (edit, external_directory, wholesale replace, shell pattern position) and the round-3 cross-spelling layer precedence stays green. Co-authored-by: arena-agent <[email protected]>
…atalog (Refs #780) Independent review HIGH: #780 coverage only exercised the JSON/stream response guards with a toy one-tool catalog, never the outbound createFetch path with the catalog the app actually publishes. - requests: send a CORE_TOOLS-shaped catalog (shell, glob, grep, read, tool_search, edit, write; web tools deferred) through createFetch against a fake gateway enforcing exactly the acceptance rules documented in opencode-zen.ts, including the 2026-10-14 revision (session required, streaming only, synthetic empty-schema quartet rejected, tool catalogs without a web tool rejected, tool-less accepted). Assert the wire carries the caller catalog verbatim plus appended web tools: canonical shell, no hidden bash. A control test proves the fake rejects session-less, non-streamed, synthetic-stub, and webless requests so the pass is not vacuous. No in-repo source documents a tool-name allowlist on the live gateway; this proves the adapter satisfies every documented rule, not live acceptance of the shell name (unverifiable without a live request, which this does not make). - injected guard: hallucinated bash preservation through the SSE aggregation path (previously only JSON and streamed paths covered). - end to end (fake gateway HTTP server + AI SDK): the renamed shell tool dispatches and executes for generateText and streamText with the expected wire catalog; negative control — a catalog with glob, grep, read but no shell still strips a bash call, proving canonical membership is what preserves it. - Align the ZEN_FINGERPRINT_TOOLS comment with the 2026-10-14 gate revision it contradicted; the constant and wire names are unchanged. Co-authored-by: arena-agent <[email protected]>
…op paths (Refs #780) Independent-review MEDs: the write paths and doom_loop were only covered at unit level. - update/updateGlobal roundtrips: an existing file carrying both spellings plus an unrelated edit record is rewritten so the patch-written spelling is ordered after its sibling (the file evaluates the way load orders it), while the edit record keeps base deep-merge pattern positions. - V1 doom_loop: config permission {doom_loop: deny} gates the renamed shell tool through real agent resolution, using exactly the query the doom detector issues (patterns: [toolName]); default stays ask. - V2: opencode.json permissions with a legacy bash doom_loop resource load through the location and land on resolved AgentV2 rulesets, gating shell. (Authored experimental.policies remain limited to provider.use actions by ConfigExperimental.PolicyAction, so Policy- level doom stays programmatic and unit-covered.) Co-authored-by: arena-agent <[email protected]>
…wildcard (Refs #780) Co-authored-by: arena-agent <[email protected]>
…632e3a-silvercode # Conflicts: # packages/tui/src/routes/session/index.tsx Co-authored-by: arena-agent <[email protected]>
…76e84e-silvercode
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
agenteinstinct1-max
marked this pull request as ready for review
November 2, 2026 21:47
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.
Issue for this PR
Refs #780 and #800; successor to closed #805. This is partial scope and does not close #800 or claim the entire issue is resolved.
Type of change
What does this PR do?
The full change against
dev-vibecodedspans 82 files (+2,677/−339). It includes the inherited host-shellbash→shellrename across tool publication, permissions and config compatibility, prompts/docs, session and CLI rendering, TUI activity/permission views, SDK v2/OpenAPI, and tests and screenshot assets. Legacy permission spellings remain supported; frozen SDK v1 types are unchanged.The successor repair preserves the provenance of an inherited
tools.bash: falsedeny through config layering without overriding explicit last-wins rules. The POSIX launcher test synchronizes signal handling with its child; the Windows baseline remains unchanged. Zen coverage is fake-gateway/static contract coverage, not live Zen acceptance.How did you verify your code works?
823874c60d96211d973c96e3598293a3a81551a4againstcecc80be84c7aa8a5adba27d8baef5b860756458: STATIC-CLEAN (review01a19abe, consolidatedd11e6a5a).Screenshots / recordings
Inherited shell-rename screenshots from #800; no new screenshots were captured for this successor:
Checklist