Repository navigation
tool: rename public shell tool id from bash to shell (Refs #780) - #787
agenteinstinct1-max wants to merge 14 commits into
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]>
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
…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]>
Code Review SummaryStatus: No Issues Found | Recommendation: Merge OverviewIncremental diff Files Reviewed (18 files)
Previous Review Summaries (7 snapshots, latest commit fe6fd39)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit fe6fd39)This review did not finish. The model reached its output limit before it Previous review (commit fe6fd39)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 99f3eb2)Status: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Previous review (commit eb0aeee)Status: No Issues Found | Recommendation: Merge Files Reviewed (incremental diff)
Previous review (commit b60cfc3)Status: No Issues Found | Recommendation: Merge Files Reviewed (incremental diff)
Previous review (commit 2fc5fd7)Status: No Issues Found | Recommendation: Merge Files Reviewed (incremental diff)
Previous review (commit be54fb3)Review Summary: Rename shell tool from "bash" to "shell"OverallThe PR correctly renames the tool ID/permission from Issue Found
These should say Positive Findings
RecommendationFix the three Reviewed by free · Input: 128.1K · Output: 28.8K · Cached: 568K |
…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]>
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
…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]>
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Refs #780 — publishes the host-shell tool to models as
shell(wasbash) across V1/V2 registry, core tool, schema/SDK, TUI, CLI, ACP, history, plugins, config and native permissions, with truthful fresh-process wording for zsh/sh/fish/PowerShell/cmd. Legacypermission.bashrules, per-pattern rules, wildcards, saved grants and persistedtool: "bash"history keep working; genuine bash-interpreter concepts (ZEN_FINGERPRINT_TOOLS,ShellID.kinds, tree-sitter bash,BashLS) are untouched. Base integrates accepted50d6a23(#785) by ordinary merge (18ceca2).Follow-up 1 (REQUEST CHANGES on
18ceca2) —2fc5fd7..fe6fd39Config-merge precedence across spellings,
doom_looptool-id aliasing,tool_search/context-protection name lists, Zen invalid-tool classification (+ end-to-end zero-exec control), LOW text leftovers, LSP settled-publish synchronous resolution, UI evidence committed under.github/assets/.Follow-up 2 (REQUEST CHANGES on
fe6fd39) —c3cdbfb,1b0a5f0All four HIGH findings reproduced RED first, then fixed:
bash/shellinto the first key's position ({bash:ask, *:allow, shell:deny}evaluated allow; nested pattern order likewise), and plainmergeDeepretains first-seen positions across layers/MDM/env. Decode no longer folds (written order and spelling preserved). Every permission merge —mergeConfig(top-level,agent.*,mode.*), agent-dir loads, mode conversion,OPENCODE_PERMISSION, tools→perms, agent tools+explicit — now usesConfigPermissionV1.merge: rule-sequence semantics (a key/pattern written by a later layer takes that layer's position; a flat action promotes to the*pattern instead of replacing inner patterns). Layering evaluates as the concatenation of the layers' rule sequences. Regression tests cover single-file wildcard interleaving, nested objects, same- and cross-spelling layers, MDM, env (from follow-up 1), and allow-last controls.toolslayers — thebashkey is folded toshellper layer before merging (top-level + agent/mode records), sotools {shell:false}→{bash:true}→ managed{shell:false}resolves deny, in both spelling orders.Object.assign), keeping its own order:tools{bash:true}+permission{*:allow, shell:deny}evaluates deny; mirrored allow-last control passes.s*(written when it coveredskill) recruit the renamed tool and bypass an earlierbash:deny.matchActionnow preserves each pattern's written meaning: literal patterns match either exact spelling in written order (explicit re-permits still win by position), while wildcard patterns match against the legacy spelling only (ba*still gatesshell;s*/sh*do not capture it and fail closed to ask — new config names the tool exactly). Uniform across V1evaluate, V2Permission,Policy,doom_loopresources (with negative + mixed-order controls), and tool-name lists. Investigated and reported tradeoff: an undated pattern cannot both keep its pre-rename extension and match the new name by wildcard; preserving existing rule meaning (no silent allow) wins over new-name wildcards.tool:"bash"part replays from stored output and is never re-executed under the new name.Windows CI at
fe6fd39— causal determination (run 41328532463, job 124913746900, raw logs read)Exactly one failing test, and it is not the LSP test (which passed on Windows this run):
workspace sync state > remote connection HTTP failures set error and clear syncing(test/control-plane/workspace.test.ts:1321) expected status"error", got"connecting". Trace: the sync loop setserroronly after the first HTTP 503 round-trip (fiber scheduling + real in-process HTTP on a runner executing seven suites in parallel), and flips back toconnectingafter the 1s retry backoff — the test polled a transient state inside a fixed 1500ms wall-clock window and the first transition landed after it. Product behavior is correct (setStatusupdates then emits; 5000 is the product's ownwaitEventbound).1b0a5f0makes the test await the Statuserrorevent itself via the product'swaitEvent, then performs the samestatus()/isSyncingassertions — condition-driven, no assertion or product deadline changed (healthy case completes as soon as the transition fires). The history-failure sibling had the identical latent race and got the same wait.Tests (Bun 1.3.14,
bun test --timeout30000 --only-failures, sequential)tsgo, opencodetsc— clean1b0a5f0: 4961 pass / 25 skip / 1 todo / 7 fail (4994, 342 files). All 7 are bun 5s per-test budget timeouts in child-process tests (TUI worker, session HttpApi, skill discovery, headless/JSON finish ×4) on this 2-vCPU sandbox; zero deterministic failures. Matched-condition controls: the identical suite at pre-follow-up18ceca2in this sandbox failed the same class (incl. the same worker test), and the two worst files re-run atfe6fd39under current host load fail 8/26 with the same 5000ms timeouts vs 9/26 at head. Recorded as evidence, not claimed as a waiver — the exact-head CI is the arbiter.Freeze / handoff
packages/tui/src/routes/session/index.tsx,permission.tsx,util/activity.ts,util/cap-lines.ts, and the activity/inline-tool TUI tests are frozen at theirfe6fd39blobs and handed to the coordinator/rawReview owner — untouched by these follow-ups (verified: empty diff for the set). Shell rename/security ownership for all other paths remains with this PR's owner.UI evidence: https://github.com/mdev34-lab/silvercode/blob/arena/7b56ded6-silvercode/.github/assets/tui-permission-shell-780.png · https://github.com/mdev34-lab/silvercode/blob/arena/7b56ded6-silvercode/.github/assets/tui-fmt-shell-780.png
Head:
1b0a5f0dd5df949c6da4494e260f2518a7dc4b52. Issue #780 remains open; ready for fresh exact-head independent review.Follow-up 3 (parent review of
1b0a5f0) —9c71945,ddf78d1s*/sh*stopped namingshell. Replaced with the source-grounded contract: plain unionWildcard.match+findLast(production rulesets always carry*:allowdefaults first, so tier/extension schemes would disable canonical wildcards in practice), plus one narrow clamp inWildcard.winningRule(V1/V2/Policy evaluate,disabled, preapproved/wholly-disabled lookups): a winner that matched the tool only via rename recruitment (a wildcard matching the new name but no legacy spelling; exact spellings never recruited) cannot lift a deny that applied under the legacy name. So{bash:deny, s*:allow}stays deny, while{*:ask, s*:allow},{s*:deny}, and exact-name re-permits all behave canonically. Residual, documented: only deny is clamped (a legacyaskcan be overridden by a later canonical wildcardallow); carving out of a legacy deny requires the exactshellname.waitEventtimeout is back to the original 1500ms observation bound; the wait is event-driven (subscribed before sync starts) so the transient error state (1s retry backoff flips it back toconnecting) cannot be missed by a level poll, with the identical assertions. Raw-log evidence for the original Windows failure: nofailed to connect to global syncwarning before teardown — the first transition itself exceeded the window on that runner; curing that sub-case within the family would require an authorized bound change, not taken here.ddf78d1: core 1528/3/0, tui 786/4/0, sdk 5/0, llm 303/30/0 (pass/skip/fail); opencode 4963/25/1 todo/5 fail (4994) — all 5 are the recurring bun-5s child-process timeouts on this 2-vCPU sandbox (worker, session HttpApi, skill discovery, headless finish ×2), rotating across runs and reproduced at base under matched load; recorded as unresolved environmental evidence, not a waiver. Typechecks coretsgo+ opencodetscclean (tui/sdk untouched since their last clean run).Head:
ddf78d14d197e0b9ad90129cac1ba3427c0db09f(supersedes the head line above).