fix(#782): acp unsupported invocation now returns non-null hint with newline-delimited remediation text

This commit is contained in:
YeonGyu-Kim
2026-05-27 07:37:26 +09:00
parent 16c1117af6
commit 32c9276fdb
3 changed files with 38 additions and 1 deletions

View File

@@ -1593,7 +1593,7 @@ fn parse_acp_args(args: &[String], output_format: CliOutputFormat) -> Result<Cli
[] => Ok(CliAction::Acp { output_format }),
[subcommand] if subcommand == "serve" => Ok(CliAction::Acp { output_format }),
_ => Err(String::from(
"unsupported ACP invocation. Use `claw acp`, `claw acp serve`, `claw --acp`, or `claw -acp`.",
"unsupported ACP invocation. Use `claw acp`, `claw acp serve`, `claw --acp`, or `claw -acp`.\nACP/Zed editor integration is currently a discoverability alias only; a real daemon and JSON-RPC endpoint are in ROADMAP tracking.",
)),
}
}

View File

@@ -2329,3 +2329,38 @@ fn resume_skills_invocation_is_typed_interactive_only_779() {
"hint must reference live session or CLI, got: {hint:?}"
);
}
#[test]
fn acp_unsupported_invocation_has_hint_782() {
// #782: `claw acp start` returned error_kind:unsupported_acp_invocation but hint:null
// because the remediation text was on the same line as the error message.
// Fix: add \n-delimited hint so split_error_hint extracts it.
let root = unique_temp_dir("acp-unsupported-782");
fs::create_dir_all(&root).expect("temp dir");
std::process::Command::new("git")
.args(["init", "-q"])
.current_dir(&root)
.output()
.ok();
let output = run_claw(&root, &["--output-format", "json", "acp", "start"], &[]);
assert!(!output.status.success(), "acp start should fail");
let stderr = String::from_utf8_lossy(&output.stderr);
let json_line = stderr
.lines()
.find(|l| l.trim_start().starts_with('{'))
.expect("should emit JSON error");
let parsed: serde_json::Value = serde_json::from_str(json_line).unwrap();
assert_eq!(
parsed["error_kind"], "unsupported_acp_invocation",
"unsupported ACP invocation should be classified correctly"
);
let hint = parsed["hint"]
.as_str()
.expect("hint must be non-null (#782)");
assert!(!hint.is_empty(), "hint must not be empty");
assert!(
hint.contains("discoverability") || hint.contains("ROADMAP"),
"hint should explain the discoverability-only status, got: {hint:?}"
);
}