aaif-goose / aaif-goose/goose

CLI: four places disagree about what a slash command is, so Tab hides real commands and bare ones go to the model

已关闭
#11,270 6 条评论 1 个 reaction 已指派 1 人 已被 @DOsinga 认领 在 GitHub 查看
主要语言
Rust
星标
54.2k
派生
6.2k
平均合并
3 天 4 小时
30 天内合并 PR
240

描述

**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.

贡献指南

打开贡献指南

调研方向

Start by examining the four code locations: `session/input.rs`, `session/completion.rs`, `agents/execute_commands.rs`, and the `is_known_slash_command` function. Run the CLI to reproduce the bug with `/endplan`, `/edit`, and `/mode`. The goal is to unify the command detection logic so that dispatch, completion, and prose detection use the same source. Ensure unknown slash commands still fall through to the model.

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
描述清楚
新手友好度
70/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。