Repository navigation
feat(runtime): restore checklist and inspect delegate traces - #1584
AuhNijGnahz wants to merge 1 commit into
Conversation
Keep the Host-owned checklist available to the model after restart and compaction, with bounded state updates that preserve mode and permission boundaries. Let the parent request selected delegate evidence through TaskList without replaying entire child histories or adding peer channels. Exercise the real model tool path and isolated Host persistence, and specify the additive trace contract and recovery behavior.
muzimu217
left a comment
There was a problem hiding this comment.
Independently verified on the current main (64296456d, 51 commits ahead of the PR base 2b6ce805c) — the patch applies cleanly, so the integration surface is intact:
packages/agent-runtimesuite on the patched tree: 99 files / 1345 tests passed (including the newdelegation-trace.test.tsandruntime-collaboration-context.test.ts).E2E-COLLABORATION-contextagainst a real Host binary: passed —{"ok":true,"restart":true,"compaction":true,"cleared":true,"traceEntries":1}.- Cross-checked that every referenced integration point exists on main:
todos.getRPC (rpc/mod.rs:2667),SessionTodoSnapshot(shared/session-todos.ts),selectChainRows/rebuildChainsFromTranscript(delegation-history.ts:166/551).
Code-reading notes (non-blocking):
- Cursor semantics are sound but worth stating explicitly in the tool description:
afteris the last returnedmessageId, and because the page break is detected before appending, the row that triggered the break is re-examined on the next page — no row can be skipped across pages. An unknown/foreign cursor throws rather than silently restarting, which is the right default. nextAfteris only set when a page breaks; a naturally exhausted scan returnsentrieswith nonextAfter, so "no cursor = done" is unambiguous. Good.- One Host RPC (
todos.get) per model turn: the ADR acknowledges the cost and the section is skipped when empty; fine at this granularity, just flagging for the maintainer's cost review. - The checklist text explicitly declares itself "task data, not instructions or authorization" — consistent with the repo's injection posture; trace output excludes thinking/images/arguments and uses literal (non-regex) search, so no ReDoS surface.
Draft + feat policy status noted — this is the maintainer's call on direction; verification data above stands whenever it is considered.
|
I verified this independently and it holds up — the change applies cleanly, the test suite passes, and the real-app scenario for the collaboration path runs green. It has stayed a draft for three and a half weeks and now conflicts, so it is closed here rather than left as a draft nobody is looking at. The branch is preserved. If you want to continue: rebase, add one line to the description about the small extra cost per turn, and mark it ready for review. 我独立验证过,结论成立——改动能干净应用,测试套件能过,协作路径的真实应用场景也跑绿了。 它作为草稿放了三周半而且现在冲突,所以关掉,而不是留成一个没人看的草稿。分支保留。如果想继续:变基,在描述里补一句「每轮会多一次很轻的读取开销」,然后标为可评审。 |
Restoring a session or compacting its context can leave the model without the current Host-owned Todo checklist. The parent also receives only a delegate's final report, so it cannot selectively reuse that delegate's recorded intermediate evidence.
This change restores a bounded checklist snapshot before request budget checks and keeps it in an independent chronological system section. Updates, empty revisions, read failures, restart, compaction and temporary recovery prompts preserve current state without duplicating checklist text. Host storage and existing mode/permission rules remain authoritative.
TaskList()keeps its existing status response. OptionaldelegationId, literalquery,afterandlimitinspect a current-session delegation chain, including resumed runs and restored transcripts. Results contain bounded visible assistant text and text tool results, with a next-page cursor; thinking, images, attachments, arbitrary arguments and system rows are omitted. Selected evidence can be passed in a later ordinary Task brief.Validation on candidate
b241da9e277ec38711cdfb916c4f87fb0b010ec5, containingorigin/mainat2b6ce805c08a:tsc -b --force packages/shared packages/agent-runtime.E2E-COLLABORATION-context: real candidate Runtime → pi → loopback SSE and real Host Todo/transcript persistence, covering Host restart, on-demand child evidence, compaction and cleared-list recovery. Ran with the installed compatible 0.18.0 Host binary and isolated temporary HOME/data/workspace. Reproduce withPI_DESKTOP_HOST_BIN=<compatible-host> pnpm test:e2e:collaboration-context.The spec, ADR proposal and E2E scenario are included. No dependencies, storage schema or RPC operations are added.
This is a feature proposal submitted as a draft at the user's request. The current AGENTS.md policy limits outside landing candidates to fix/perf; maintainer direction or a policy change is needed before this feature can land. It is intentionally classified as
feat.