CLI: four places disagree about what a slash command is, so Tab hides real commands and bare ones go to the model
- 主要言語
- Rust
- スター
- 54.2k
- フォーク
- 6.2k
- 平均マージ
- 3日 2時間
- マージ済み PR(30日)
- 262
説明
**Describe the bug**
Four separate places in the code answer the question "is this a slash command?", and they answer it differently:
1. the CLI parser's own constants in `session/input.rs`
2. a hardcoded list in `session/completion.rs`, merged with `list_commands()`
3. the agent's `COMMANDS` table in `agents/execute_commands.rs`
4. `is_known_slash_command`, which checks that table *plus* recipe commands *plus* installed skills
Depending on which one is asked, the same typed line is run, hidden, or sent to the model as prose. Three symptoms I hit in normal use, all from this one split:
- **Real commands are invisible to Tab.** `/endplan` and `/edit` are matched by the parser and work when typed in full, but neither appears in completion — the completer's list simply does not contain them.
- **Recipe- and skill-backed commands are invisible too**, although dispatch accepts them (`is_known_slash_command` checks both) and the desktop app lists them. Prior reports: #7722 was closed as completed when the agent built-ins were added to the completer — the recipe/skill half is still open; #8723 reported the same symptom and was closed as not planned.
- **A command typed without its argument is sent to the model.** `/mode`, `/extension` and `/builtin` are only matched with a trailing space, so a bare `/mode` falls through to the catch-all that means "this is prose". The model then spends a turn guessing what I meant — a request and its tokens for a line I clearly typed as a command.
---
**To Reproduce**
1. Start `goose session`
2. Type `/` and press Tab: `/endplan` and `/edit` are missing, as are any recipe- or skill-backed commands
3. Type `/edit` in full and press Enter: it runs
4. Type `/mode` with no argument and press Enter: the line goes to the model, which answers with a guess
---
**Expected behavior**
What the CLI runs, what it completes, and what it treats as prose come from one shared answer. Concretely: everything dispatch accepts is completable, and a known command word typed on its own tells me what it expects instead of costing a model turn.
---
**Screenshots**
n/a
---
**Please provide the following information**
- **OS & Arch:** macOS 26.5 arm64 — the parsing is platform-independent
- **Interface:** CLI
- **Version:** reproduced on 1.44.0; code paths checked against `main` at 3810898a7 (post-v1.46.0)
- **Extensions enabled:** any
- **Provider & Model:** any
---
**Additional context**
Two things worth holding on to in the discussion:
- **`/model` already does the bare-word case right** — it is matched both alone and with an argument, so typing it alone opens model selection instead of asking the model about it. The difference to `/mode` looks accidental rather than intended.
- **Unknown slash commands must keep falling through to the model.** That is how the agent's own commands (`/goal`, `/grind`, `/status`) reach it, and a line like "/etc/hosts looks wrong" is a sentence. So the distinction that matters is "an exact, known command word", not "starts with a slash".
- Completion runs on every keystroke, so whatever list it reads must not hit the filesystem while typing — recipes and skills are discovered from disk, and the CLI already fills a cache at startup for prompt completion.
コントリビューションガイド
評価
この issue はまだ評価されていません。