6 months ago
a8e471b* fix: make child-agent results parseable Child-agent outputs were too loose for the parent to consume reliably, so inspectAgent had to guess at trailing JSON from arbitrary prose. This makes the completion contract explicit in the role prompts, moves parsing into a server-owned module, and keeps a compatibility fallback for older plain or fenced JSON reports so existing child outputs still inspect cleanly. Constraint: Keep the existing inspectAgent wire schema and lastMessagePreview behavior unchanged Rejected: Add a new verdict field to ChildAgentReport | existing status values already cover reviewer PASS/PARTIAL/FAIL mapping Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep child-report parsing server-owned and require tagged footers for new prompt contracts; do not move parser heuristics back into shared types Tested: bun test test/agentReportParser.test.ts test/agentControl.test.ts test/prompt.test.ts test/persistentAgents.tool.test.ts test/tools.test.ts test/server.jsonrpc.control.test.ts test/jsonrpc.control-schemas.test.ts; bun run typecheck; bun test test/run_raw_agent_loops.test.ts; bun test Not-tested: Remote MCP integration tests skipped by default in bun test * fix: prefer the trailing child-agent report footer The initial parser stopped at the first `<agent_report>` tag, which let echoed examples shadow the actual final footer and break inspectAgent parsing for otherwise valid child outputs. This switches tagged parsing to the last footer in the message, keeps legacy fallback behavior for untagged outputs, and adds a regression test covering earlier example tags. Constraint: Keep malformed final tagged footers failing closed instead of falling back to earlier tagged content Rejected: Parse the first valid tagged block | it can still accept an echoed example instead of the real completion footer Confidence: high Scope-risk: narrow Reversibility: clean Directive: For footer-style model output parsers, prefer the trailing completion block and keep an explicit regression test for echoed format examples Tested: bun test test/agentReportParser.test.ts test/agentControl.test.ts test/persistentAgents.tool.test.ts test/run_raw_agent_loops.test.ts; bun run typecheck Not-tested: Full bun test rerun after this narrow parser-only follow-up; remote MCP tests remain skipped by default
Parentbbeab4c