Skip to content

fix: route non-builtin slash commands after TUI dispatch#3432

Merged
jeremymcs merged 1 commit intogsd-build:mainfrom
deseltrus:fix/slash-command-session-routing
Apr 3, 2026
Merged

fix: route non-builtin slash commands after TUI dispatch#3432
jeremymcs merged 1 commit intogsd-build:mainfrom
deseltrus:fix/slash-command-session-routing

Conversation

@deseltrus
Copy link
Copy Markdown
Contributor

TL;DR

What: Restore non-builtin slash-command routing in the interactive TUI so extension commands, prompt templates, and enabled /skill:* inputs are not rejected as unknown.
Why: The unknown-command fallback added in the TUI slash dispatcher consumed any unmatched /... before session-level slash resolution could run, and /export also matched unrelated /export* prefixes.
How: Move unknown-command rejection to the interactive entry points that can distinguish builtins from session-resolved slash commands, gate /skill:* recognition on the skill-command setting, and tighten /export matching to exact command tokens.

What

This change updates the interactive slash-command routing path in pi-coding-agent.

File Change
packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts Keep the dispatcher focused on true builtins and require exact /export tokens instead of matching every /export* prefix.
packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts Reject only truly unknown slash commands after builtin dispatch, while allowing known session-resolved slash commands to continue to session.prompt().
packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts Reuse the same known-slash classification for follow-up and compaction queue entry points, and only recognize /skill:* when skill commands are enabled.
packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts Add regression coverage for extension commands, prompt templates, enabled and disabled skill commands, /export prefix collisions, and unknown slash commands.

Why

dispatchSlashCommand() started treating every unrecognized /... input as handled inside the TUI before session.prompt() could run its normal slash resolution. That meant valid non-builtin slash inputs never reached extension command execution, prompt-template expansion, or /skill:* expansion.

It also left a narrower routing bug in place because /export matched any /export* prefix, which could still steal unrelated slash names from later resolution.

Fixes #3421
See also #3422

How

The fix keeps builtin handling in the TUI, but moves unknown-command rejection to the interactive entry points that know when a slash input should fall through to session-level routing:

  • builtin commands still execute directly in dispatchSlashCommand();
  • extension commands, prompt templates, and enabled /skill:* commands continue to session.prompt();
  • truly unknown slash inputs show the error before they are queued or sent;
  • /export now matches only /export and /export ..., not arbitrary /export* prefixes.

This stays within the existing command model rather than adding a new routing layer.

Test Evidence

  • node --import ./src/resources/extensions/gsd/tests/resolve-ts.mjs --experimental-strip-types --test packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts
  • npm run build

AI-assisted contribution — reviewed and tested by contributor.

  • fix

The TUI slash dispatcher started treating any unrecognized /command as handled before session.prompt() could resolve extension commands, prompt templates, or /skill:* inputs. That blocked valid non-builtin slash commands and also let /export swallow unrelated /export* prefixes.

Move unknown-command detection to the interactive entry points, allow only known builtins or session-resolved slash commands through, gate /skill:* on the skill-command setting, and tighten /export matching to exact command tokens.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🟠 PR Risk Report — HIGH

Files changed 4
Systems affected 3
Overall risk 🟠 HIGH

Affected Systems

Risk System
🟠 high Modes
🟡 medium TUI Components
🟡 medium Commands
File Breakdown
Risk File Systems
🟠 packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts Modes, TUI Components
🟠 packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts Modes, TUI Components
🟠 packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts Modes, Commands
packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts (unclassified)

⚠️ High risk — please run full integration tests and verify tool/extension contracts.

@jeremymcs jeremymcs merged commit 3de3832 into gsd-build:main Apr 3, 2026
10 checks passed
@justinwyer
Copy link
Copy Markdown
Contributor

@jeremymcs I see the publish pipeline is stuck waiting on a pipeline from yesterday

@jeremymcs
Copy link
Copy Markdown
Collaborator

Sorry guys. I stepped away this morning for a golf tourney. Didn't see stuck pipeline.

@justinwyer
Copy link
Copy Markdown
Contributor

@jeremymcs thanks so much hope you beat your handicap!

@TerminalSausage
Copy link
Copy Markdown

i don't think this release was pushed out for npm installation. Latest is still pushing the broken version. Thanks for your work on this project.

@jeremymcs
Copy link
Copy Markdown
Collaborator

Sorry for the long delay in getting NPM up guys. We've got a gap in permissions and @glittercowboy is waiting on some hardware replacments to get back online. Hopefully he'll be able to jump on tonight and get 2.60 pushed out to NPM.

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

Labels

bug Something isn't working High Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tui): slash command fallback blocks all extension commands (/gsd, /kill, etc.)

4 participants