Skip to content

fix(tui): keep local commands out of model prompts - #100188

Merged
steipete merged 1 commit into
mainfrom
codex/tui-local-command-routing
Jul 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/tui-local-command-routing

Conversation

@steipete

@steipete steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Closes #71592

What Problem This Solves

Fixes an issue where users of openclaw tui --local could select or type shared slash commands such as /status, /compact, /commands, and /context, then have those control commands sent to the model as ordinary user prompts because the embedded backend does not run the Gateway command handlers.

Why This Change Was Made

The TUI now resolves shared aliases through the canonical command registry, advertises only commands with an explicit local route, and rejects known Gateway-owned commands before model submission. Gateway-connected behavior, argument-bearing /btw and /side, and intentionally unknown slash text remain unchanged; bare /btw and /side now return the shared usage hint.

AI-assisted: yes. I reviewed the implementation and understand the affected local and Gateway command paths.

User Impact

Local TUI users no longer spend model turns or pollute transcripts when they invoke an advertised control command that requires the Gateway. Autocomplete and /help now match what local embedded mode can actually execute, and unsupported commands produce a direct local explanation.

Evidence

  • Focused unit proof: node scripts/run-vitest.mjs src/tui/commands.test.ts src/tui/tui-command-handlers.test.ts — 96 tests passed.
  • Real local PTY proof: OPENCLAW_TUI_PTY_INCLUDE_LOCAL=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-pty-local.e2e.test.ts --testNamePattern 'drives the real local backend' — the TUI visibly rejected /status, /compact, /commands, and /context, returned usage for bare /side, made zero model requests for those inputs, then sent a normal prompt through the real embedded backend and rendered LOCAL_PTY_RESPONSE.
  • Linux CI-parity proof: Blacksmith Testbox through Crabbox tbx_01kwrdzcx1a87xgeb9v92yfghr (run 28731441776) — pnpm check:changed passed core production/test typechecks, lint, import cycles, and changed guards; the same real local PTY scenario passed on Linux.
  • Autoreview: final autoreview --mode local completed with no accepted/actionable findings after two in-scope routing findings were fixed.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 5, 2026
@clawsweeper

clawsweeper Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(tui): keep local commands out of model prompts This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete

steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready verification for 0769617e6c24bea999264ea481d4896d02678731:

  • Focused unit proof: node scripts/run-vitest.mjs src/tui/commands.test.ts src/tui/tui-command-handlers.test.ts — 96 tests passed.
  • Real PTY local-mode proof: OPENCLAW_TUI_PTY_INCLUDE_LOCAL=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-pty-local.e2e.test.ts --testNamePattern 'drives the real local backend' — /status, /compact, /commands, /context, and bare /side produced local errors with zero model requests; a normal prompt then reached the embedded backend and rendered LOCAL_PTY_RESPONSE.
  • Remote changed-surface + PTY proof: Blacksmith Testbox tbx_01kwrdzcx1a87xgeb9v92yfghr, run 28731441776 — passed.
  • Fresh autoreview: clean; no accepted/actionable findings.

Known gap: external model transport remains mocked by the repository's PTY harness; command routing and the real local TUI/backend path are exercised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI local mode advertises /status and /compact but falls through to model text

1 participant