fix(#760): agent_not_found and plugin_not_found envelopes now include hint field

This commit is contained in:
YeonGyu-Kim
2026-05-26 23:36:30 +09:00
parent ef31328aab
commit 7fa81b5dae
3 changed files with 6 additions and 0 deletions

View File

@@ -7685,3 +7685,5 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
758. **Three remaining `missing value for --X` strings in `parse_init_args` were still untyped** — dogfooded 2026-05-26 on `02d77ae1`. `--cwd`, `--date`, `--session` missing-value errors in the init-args parser used the old plain-string form with no `missing_flag_value:` prefix and no `\n` hint, unlike the main `parse_args` flags fixed in #756/#757. Fix: applied `missing_flag_value:` prefix + `\n` usage hint to all three. `grep '"missing value for --'` now returns zero results outside of test assertions. Source: Jobdori dogfood sweep on `02d77ae1`, 2026-05-26. 758. **Three remaining `missing value for --X` strings in `parse_init_args` were still untyped** — dogfooded 2026-05-26 on `02d77ae1`. `--cwd`, `--date`, `--session` missing-value errors in the init-args parser used the old plain-string form with no `missing_flag_value:` prefix and no `\n` hint, unlike the main `parse_args` flags fixed in #756/#757. Fix: applied `missing_flag_value:` prefix + `\n` usage hint to all three. `grep '"missing value for --'` now returns zero results outside of test assertions. Source: Jobdori dogfood sweep on `02d77ae1`, 2026-05-26.
759. **`--model badmodel --output-format json` returned `error_kind:"invalid_model_syntax"` but `hint: null`** — dogfooded 2026-05-26 on `b8b3af6f`. `validate_model_syntax()` had hint text embedded after a period in the error string (no `\n`), so `split_error_hint()` could not extract it. Affected paths: (a) generic invalid format `"invalid model syntax: '{}'. Expected ..."` — joined with `.` not `\n`; (b) spaces-in-model `"contains spaces. Use ..."` — same issue; (c) empty model string — no hint at all. Fix: added `\n` before hint text in all three format strings in `validate_model_syntax`. Source: Jobdori dogfood sweep on `b8b3af6f`, 2026-05-26. 759. **`--model badmodel --output-format json` returned `error_kind:"invalid_model_syntax"` but `hint: null`** — dogfooded 2026-05-26 on `b8b3af6f`. `validate_model_syntax()` had hint text embedded after a period in the error string (no `\n`), so `split_error_hint()` could not extract it. Affected paths: (a) generic invalid format `"invalid model syntax: '{}'. Expected ..."` — joined with `.` not `\n`; (b) spaces-in-model `"contains spaces. Use ..."` — same issue; (c) empty model string — no hint at all. Fix: added `\n` before hint text in all three format strings in `validate_model_syntax`. Source: Jobdori dogfood sweep on `b8b3af6f`, 2026-05-26.
760. **`agent_not_found` and `plugin_not_found` error envelopes lacked `hint` field** — dogfooded 2026-05-26 on `ef31328a`. `claw agents show nonexistent-agent --output-format json` returned `error_kind:"agent_not_found"` with `hint: null`; same for `claw plugins show`. Both structured JSON envelopes in `commands/src/lib.rs` and `main.rs` omitted `hint`. Fix: added `"hint": "Run \`claw agents list\` to see available agents."` to the `agent_not_found` envelope; `"hint": "Run \`claw plugins list\` to see available plugins."` to the `plugin_not_found` envelope. Source: Jobdori dogfood sweep on `ef31328a`, 2026-05-26.

View File

@@ -2468,6 +2468,8 @@ pub fn handle_agents_slash_command_json(args: Option<&str>, cwd: &Path) -> std::
"requested": name, "requested": name,
// #734: parity with skills show which always emits a message field // #734: parity with skills show which always emits a message field
"message": format!("agent '{}' not found", name), "message": format!("agent '{}' not found", name),
// #760: hint so callers know how to enumerate available agents
"hint": "Run `claw agents list` to see available agents.",
})); }));
} }
Ok(render_agents_report_json_with_action(cwd, &matched, "show")) Ok(render_agents_report_json_with_action(cwd, &matched, "show"))

View File

@@ -6227,6 +6227,8 @@ impl LiveCli {
"requested": name, "requested": name,
// #734: parity with skills show which always emits a message field // #734: parity with skills show which always emits a message field
"message": format!("plugin '{}' not found", name), "message": format!("plugin '{}' not found", name),
// #760: hint so callers know how to enumerate available plugins
"hint": "Run `claw plugins list` to see available plugins.",
}); });
println!("{}", serde_json::to_string_pretty(&obj)?); println!("{}", serde_json::to_string_pretty(&obj)?);
return Ok(()); return Ok(());