fix(agent): writeback param shadow + Wave B1 dump/harness
step/plan writeback=True shadowed lib/writeback; persist via host_writeback_record. Align ZH context builder, add dump_step_context, lock offline harness. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d1b4e62d4d
commit
e3e2cfa9d1
11 files changed
+162
-53
No files matched your search
@@ -0,0 +1,54 @@
|
||||
---
|
||||
title: dump_step_context (Wave B1 offline)
|
||||
description: Assert dump_step_context exposes call_site + prompt without LLM.
|
||||
import llm:ext/ai/llm.mq.md
|
||||
import agent:ext/ai/agent.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import plugin:lib/plugin.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
---
|
||||
|
||||
## probe_tool
|
||||
|
||||
**"probe-ok"**
|
||||
|
||||
# main
|
||||
|
||||
*p = > plugin.native_path name="agent"*
|
||||
1. `p`
|
||||
> plugin.load path=`p`
|
||||
2. *
|
||||
> print text=no-agent-plugin
|
||||
> sys.exit code=1
|
||||
|
||||
> sys.env_set name="OPENAI_API_KEY" value="offline-dump-dummy"
|
||||
*model = > llm.llm*
|
||||
|
||||
`工具表` =
|
||||
| 工具 |
|
||||
|------|
|
||||
| probe_tool |
|
||||
|
||||
*助手 = > agent.agent model=`model` tools=`工具表` standing="dump probe"*
|
||||
*dump = > agent.dump_step_context agent=`助手` task="dump-probe-task"*
|
||||
|
||||
*site = > json.get value=`dump` key="call_site"*
|
||||
*path = > json.get value=`site` key="path"*
|
||||
*chars = > json.get value=`dump` key="prompt_chars"*
|
||||
*prompt = > json.get value=`dump` key="prompt"*
|
||||
|
||||
1. `path`
|
||||
1. `chars` > 100
|
||||
*parts = > split value=`prompt` sep="--- call site ---"*
|
||||
*n = > len value=`parts`*
|
||||
1. `n` > 1
|
||||
> print text=dump-context-ok
|
||||
2. *
|
||||
> print text=dump-prompt-missing-site
|
||||
> sys.exit code=1
|
||||
2. *
|
||||
> print text=dump-chars-too-small
|
||||
> sys.exit code=1
|
||||
2. *
|
||||
> print text=dump-site-path-missing
|
||||
> sys.exit code=1
|
||||
@@ -16,7 +16,7 @@ import agent:ext/ai/agent.mq.md
|
||||
|
||||
# main
|
||||
|
||||
> llm.load_env path=.env
|
||||
> llm.load_env path="../../.env"
|
||||
|
||||
*模型 = > llm.llm*
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
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).
|
||||
import writeback:lib/writeback.mq.md
|
||||
import json:lib/json.mq.md
|
||||
import sys:lib/sys.mq.md
|
||||
---
|
||||
|
||||
# box
|
||||
+ `writeback`=False
|
||||
|
||||
## go
|
||||
+ `writeback`=False
|
||||
|
||||
Mimic agent.step: branch on param named writeback, then persist via host (not import bind).
|
||||
|
||||
*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"
|
||||
2. *
|
||||
> host_writeback_record value=`body` key="error"
|
||||
2. *
|
||||
*_ = 1*
|
||||
****
|
||||
|
||||
# main
|
||||
|
||||
*b = > box*
|
||||
> `b`.go writeback=True
|
||||
<!-- marqdo-out ok
|
||||
{"note":"shadow-probe","status":"ok"}
|
||||
-->
|
||||
|
||||
*cached = > writeback.get key="ok"*
|
||||
1. `cached`
|
||||
> print text=writeback-shadow-ok
|
||||
2. *
|
||||
> print text=writeback-shadow-missing
|
||||
> sys.exit code=1
|
||||
@@ -11,8 +11,8 @@ import json:lib/json.mq.md
|
||||
+ `value`
|
||||
+ `line`
|
||||
|
||||
> writeback.ensure key=ok placeholder=pending line=`line`
|
||||
> writeback.ensure key=error placeholder=pending line=`line`
|
||||
> writeback.ensure key="ok" placeholder="pending" line=`line`
|
||||
> writeback.ensure key="error" placeholder="pending" line=`line`
|
||||
> writeback.record value=`value` key=`key` line=`line`
|
||||
****
|
||||
|
||||
|
||||
Reference in new issue
Block a user