fix(agent,llm): avoid host_* writeback and tolerate SSE reasoning

Alias writeback as wb so the writeback= param does not shadow lib calls; ignore unknown stream event types so live SSE models keep working.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-07 20:52:44 +08:00
1 parent fe14d1f7e3
commit a4c346d4a2
6 files changed
+30 -30

No files matched your search

+6 -5
View File
@@ -1,6 +1,7 @@
---
title: writeback param must not shadow host_writeback_record
description: Regression — step/plan param writeback=True used to break > writeback.record (bool is not a map).
title: writeback param must not shadow writeback module
description: Regression — step/plan param writeback=True used to break > writeback.record (bool is not a map). Use a non-colliding import alias.
import wb:lib/writeback.mq.md
import writeback:lib/writeback.mq.md
import json:lib/json.mq.md
import sys:lib/sys.mq.md
@@ -12,16 +13,16 @@ import sys:lib/sys.mq.md
## go
+ `writeback`=False
Mimic agent.step: branch on param named writeback, then persist via host (not import bind).
Mimic agent.step: branch on param named writeback, then persist via aliased lib import.
*out = > json.parse text={"status":"ok","note":"shadow-probe"}*
1. `writeback`
*body = > json.stringify value=`out`*
*st = > json.get value=`out` key="status"*
1. `st` == "ok"
> host_writeback_record value=`body` key="ok"
> wb.record value=`body` key="ok"
2. *
> host_writeback_record value=`body` key="error"
> wb.record value=`body` key="error"
2. *
*_ = 1*
****
+6 -5
View File
@@ -3206,22 +3206,23 @@ fn ext_agent_run_live() {
let stderr = String::from_utf8_lossy(&output.stderr);
assert_eq!(code, 0, "agent-run-live stderr={stderr}");
let lines: Vec<&str> = stdout.trim_end().lines().collect();
assert!(lines.len() >= 3, "agent-run-live stdout={stdout}");
assert!(lines.len() >= 4, "agent-run-live stdout={stdout}");
assert!(
lines[0].chars().any(|c| c.is_ascii_digit()),
"expected date in reply, got {:?}",
lines[0]
);
assert_eq!(lines[1], "2", "history after step");
assert_eq!(lines[2], "0", "history after clear");
// Caller may persist the step map via lib/writeback; agent itself does not write.
assert_eq!(lines[1], "writeback-ok", "named ok slot after step");
assert_eq!(lines[2], "2", "history after step");
assert_eq!(lines[3], "0", "history after clear");
// Default step writeback persists the result map under the ok/error slots.
let src = std::fs::read_to_string(
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/ext/agent-run-live.mq.md"),
)
.expect("read agent-run-live after run");
assert!(
src.contains("\"status\"") || src.contains("marqdo-out"),
"expected caller writeback of step result map"
"expected writeback of step result map"
);
assert!(
!stdout.contains("marqdo-out"),