fix(ext/ai): cold agent.run EFI — self.preflight and resolve llm_free

Miss resolve omitted llm_free and run called bare preflight, which crashed
qdagent on empty OKF. Align miss fields, use self.preflight + json.get, add
regression gold and research note.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-10-16 12:54:00 +08:00
1 parent a993cfd76a
commit d489f7c088
5 files changed
+247 -24

No files matched your search

+26
View File
@@ -1038,10 +1038,17 @@ pub fn resolve_task(args: &Value) -> Result<Value, String> {
"tools": args.get("tools").cloned().unwrap_or(Value::Null),
}))?;
if hit.is_null() {
// Keep field set aligned with hit path so facades can safely read llm_free
// (qdagent / agent.run crashed on missing key when OKF is cold).
return Ok(json!({
"mode": "unknown",
"match": null,
"skill": null,
"resource": null,
"slug": null,
"status": null,
"llm_free": false,
"score": null,
"confidence": 0.0,
}));
}
@@ -1078,6 +1085,25 @@ pub fn resolve_task(args: &Value) -> Result<Value, String> {
mod tests {
use super::*;
#[test]
fn resolve_miss_includes_llm_free() {
let dir = std::env::temp_dir().join(format!(
"marqdo-resolve-miss-{}",
std::process::id()
));
let _ = fs::remove_dir_all(&dir);
fs::create_dir_all(&dir).unwrap();
let out = resolve_task(&json!({
"task": "no-such-skill-cold-miss",
"kb_dir": dir.to_string_lossy(),
"near_match": false,
}))
.unwrap();
assert_eq!(out.get("mode").and_then(|v| v.as_str()), Some("unknown"));
assert_eq!(out.get("llm_free").and_then(|v| v.as_bool()), Some(false));
let _ = fs::remove_dir_all(&dir);
}
#[test]
fn record_and_cluster_and_compile() {
let dir = std::env::temp_dir().join(format!(