Skip to content

Commit 3975f2b

Browse files
committed
fix(#748): mcp unknown subcommand now emits error_kind:unknown_mcp_action matching agents/plugins parity
1 parent 04eb661 commit 3975f2b

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

ROADMAP.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7661,3 +7661,5 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
76617661
746. **`claw --output-format json` (bare, no TTY, no prompt) returned `hint: null` — the non-TTY interactive-only guard error string had no `\n` separator, so `split_error_hint` couldn't extract the remediation text into `.hint`** — dogfooded 2026-05-26 on `3c5459a3`. The single-string message `"interactive_only: claw requires an interactive terminal (stdin is not a TTY and no prompt was provided \u2014 pipe a prompt or run in a TTY)"` contained the hint inline but no newline, so callers reading `.hint` got null and had to parse the prose `error` string. Fix: split at `\n` — short error `"interactive_only: claw requires an interactive terminal."` + hint `"Stdin is not a TTY…pipe a prompt with \`echo 'task' | claw\` or run \`claw\` in an interactive terminal."`. Source: Jobdori dogfood on `3c5459a3`, 2026-05-26.
76627662

76637663
747. **ROADMAP #745 has no regression test: `claw issue/pr/commit --output-format json hint` could silently regress to null** — confirmed by gaebal-gajae on `3c5459a33`. Same pattern as #737, #742, #744. Fix: add `bare_slash_command_hint_745` test iterating `issue`, `pr`, `commit` and asserting `error_kind:"interactive_only"` + non-empty `hint` field. Source: gaebal-gajae dogfood on `3c5459a33`, fixed on `18e7744e`, 2026-05-26.
7664+
7665+
748. **`claw mcp bogussubcmd --output-format json` returned `error_kind: null` when an unknown subcommand was passed — `render_mcp_usage_json(Some("bogus"))` set `status:"error"` but left `error_kind` absent — while `agents bogussubcmd` emits `error_kind:"unknown_agents_subcommand"`** — dogfooded 2026-05-26 on `04eb661e`. Fix: add `error_kind: "unknown_mcp_action"` to `render_mcp_usage_json` when `unexpected.is_some()`; remains `null` for the `help` path (`unexpected: null`). Source: Jobdori dogfood on `04eb661e`, 2026-05-26.

rust/crates/commands/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4161,11 +4161,18 @@ fn render_mcp_usage(unexpected: Option<&str>) -> String {
41614161
}
41624162

41634163
fn render_mcp_usage_json(unexpected: Option<&str>) -> Value {
4164+
// #748: add error_kind when unexpected is set, matching agents/plugins unknown-subcommand shape.
4165+
let error_kind: Value = if unexpected.is_some() {
4166+
json!("unknown_mcp_action")
4167+
} else {
4168+
Value::Null
4169+
};
41644170
json!({
41654171
"kind": "mcp",
41664172
"action": "help",
41674173
"ok": unexpected.is_none(),
41684174
"status": if unexpected.is_some() { "error" } else { "ok" },
4175+
"error_kind": error_kind,
41694176
"usage": {
41704177
"slash_command": "/mcp [list|show <server>|help]",
41714178
"direct_cli": "claw mcp [list|show <server>|help]",

0 commit comments

Comments
 (0)