fix(context): retain observed file fragments and current engineering facts

This commit is contained in:
Agent Workbench Dev
2026-11-04 07:52:59 +08:00
parent 0644407b2c
commit 7e77fd65c3
23 changed files with 583 additions and 57 deletions
+5 -1
View File
@@ -51,8 +51,12 @@ test('a real two-reply failure replay reaches request three at 16K with complete
try { return JSON.parse(m.content.split('\n').at(-1)); } catch { return {}; }
}).find(value => value.latest_tools);
assert.ok(latest); assert.equal(latest.data.entries.length, 6);
const working=third.messages.filter(m=>m.role==='system').map(m=>{try{return JSON.parse(m.content.split('\n').at(-1));}catch{return{};}}).find(value=>value.working_set);
for (const file of sources) {
assert.equal(latest.data.entries.find(entry => entry.result.path === file).result.content_excerpt, before[file]);
const direct=third.messages.filter(m=>m.role==='tool').map(m=>JSON.parse(m.content)).find(result=>result.path===file&&typeof result.content==='string');
const sent=working?.data.entries.find(entry=>entry.observation.path===file)?.content
??direct?.content??latest.data.entries.find(entry => entry.result.path === file)?.result.content_excerpt;
assert.equal(sent,before[file],'The actual bounded request must retain every original source byte, regardless of versioned view.');
assert.equal(fs.readFileSync(path.join(f.projectRoot, file), 'utf8'), before[file]);
}
for (const step of JSON.parse(input.replies[1].tool_calls.at(-1).function.arguments).steps) {