Skip to content

components C4: bash-mode (!) input - #296

Merged
ericleepi314 merged 1 commit into
mainfrom
components/c4-bash-mode
Jun 11, 2026
Merged

components C4: bash-mode (!) input#296
ericleepi314 merged 1 commit into
mainfrom
components/c4-bash-mode

Conversation

@ericleepi314

Copy link
Copy Markdown
Collaborator

Summary

  • !command runs directly through the Bash tool (no permission prompt — pinned by test; the tool's own dangerous-pattern guard still applies), no agent turn, and <bash-input>/<bash-stdout|stderr> user messages reach the conversation (TS processBashCommand parity)
  • Conversation integrity: new AgentBridge.append_user_texts defers mid-run texts and drains them at run end + before the next prompt — a bash completion can never interleave a tool_use/tool_result pair (review blocking find)
  • Synchronous echo row + in-place output fill; both streams rendered; shared truncate_body; sequential-only with honest refusals; ! input accent
  • Documented divergences: no caveat message, both streams XML-escaped, no PowerShell, no live progress/ESC cancel yet (follow-up)

Test plan

  • 15 tests: no-permission-prompt pin, dangerous-command refusal, deferral via a real bridge, timeout (exit 143), !cd cwd parity pin, stderr-on-success render, repl dispatch, busy refusal + history
  • Full suite BASELINE-IDENTICAL (diff-verified)
  • Impl-critic: REQUEST CHANGES (conversation interleave, stderr drop, no in-flight feedback) → all fixed → APPROVE

🤖 Generated with Claude Code

Port of TS processBashCommand: a user-typed !command runs DIRECTLY
through the Bash tool call (no registry permission flow — user-typed
commands aren't model-initiated; the tool's defense-in-depth
dangerous-pattern guard still applies and is pinned by a test that
also asserts the permission handler is NEVER consulted), produces no
agent turn, and feeds <bash-input>/<bash-stdout|stderr> user messages
into the conversation so the model sees them next turn.

- conversation integrity (review B1): texts route through the new
  AgentBridge.append_user_texts — deferred while a run is in flight
  (mid-run appends could interleave a tool_use/result pair, durably
  via the persister) and drained in _finish() before the durable
  flush, plus at the top of submit() so teardown-window stragglers
  land BEFORE the next prompt; this also replaces the app's
  _persister reach-in
- UI: echo row mounts synchronously ("running…"), the worker fills
  the output in place; BOTH streams render (git/npm write to stderr
  with exit 0); shared truncate_body() so panel/stash limits can
  never drift; ctrl+o-expandable; sequential-only with honest
  refusals (busy agent / bash already running); magenta input accent
  on the ! prefix
- divergences documented: no caveat message, both streams escaped,
  no PowerShell branch, no live progress/ESC cancel yet (follow-up)

15 tests incl. deferral through a real bridge, exit-143 timeout via
env shrink, !cd cwd-persistence pinned as deliberate TS parity, and
repl dispatch (bash called, agent NOT). Suite baseline-identical.
Critic-approved after one REQUEST CHANGES round.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ericleepi314
ericleepi314 merged commit 79ef648 into main Jun 11, 2026
singlaamitesh pushed a commit to singlaamitesh/clawcodex that referenced this pull request Jul 7, 2026
…-bash-mode

components C4: bash-mode (!) input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant