feat(examples/pi): adapt OpenViking extension to pi 0.81 (agent_settled commits + entry rendering) - #2996
feat(examples/pi): adapt OpenViking extension to pi 0.81 (agent_settled commits + entry rendering)#2996ZaynJarvis wants to merge 1 commit into
Conversation
|
closed for future PI feat migration. |
0a4c891 to
6536354
Compare
…ntry rendering main already carries the full OV context-takeover extension; this adapts it to pi 0.81's new extension primitives without regressing any existing behavior. - Threshold takeover commits (flush + commit + overview poll, worst case pollMax x pollMs) previously ran inline in turn_end, stalling the in-flight agent run. turn_end now only accumulates token pressure (noteSynced); the commit runs from agent_settled (pi >= 0.81, run fully settled), with a fire-and-forget before_agent_start fallback for older pi. onTurnSynced is split into noteSynced() + commitIfDue(). - Render the persisted ov-takeover state entries in the TUI via registerEntryRenderer (pi >= 0.81): a dim one-line archive-boundary status, expandable to preview the overview, never entering LLM context. - Align the README comparison table with the code: the startup memory index was dropped for latency in favor of on-demand recall. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MRy5Epi4rQ7vCzSk3BLQcA
6536354 to
2ffa5d5
Compare
huangruiteng
left a comment
There was a problem hiding this comment.
Requesting changes for one correctness race in the legacy fallback path. The focused suite passes (44/44), but a deterministic in-memory reproduction shows the boundary can advance past the data that was committed when a new prompt arrives during the overview await.
|
|
||
| // Fallback commit point for pi < 0.81 where agent_settled never fires. | ||
| // Fire-and-forget: never delay the prompt; commitAndAdvance self-serializes. | ||
| if (config.takeoverEnabled) void takeover.commitIfDue(); |
There was a problem hiding this comment.
[P1] Avoid advancing the boundary from mutable in-flight context state
This fire-and-forget call can overlap the following context hook. commitAndAdvance() awaits flush/commit/overview and only then reads mutable lastSeenUserTurns; meanwhile context can include the just-submitted user message, which has not yet been synced to OpenViking. The boundary can therefore advance past committed data and a later context transform may drop that unsynced turn. I reproduced this by starting a commit with 3 user turns and keepRecent=1, adding a fourth turn during the overview await, and observing coveredUserTurns=3 instead of the safe value 2. Please gate this fallback to runtimes without agent_settled and snapshot/derive the covered-turn count from committed state at commit start, with a regression test for the overlap.
What
main already carries the full OV context-takeover extension (#3081, #3079, #3099, #3233). This PR does not re-do takeover — it adapts it to pi 0.81's new extension primitives, without regressing any existing behavior. Rebuilt on current main; single commit.
turn_end, blocking the in-flight run.turn_endnow only accumulates token pressure (noteSynced); the commit runs fromagent_settled(pi ≥ 0.81, run fully settled), with a fire-and-forgetbefore_agent_startfallback for older pi.onTurnSyncedsplit intonoteSynced()+commitIfDue().ov-takeoverstate rendered in the TUI viaregisterEntryRenderer(pi ≥ 0.81): a dim one-line archive-boundary status, expandable to preview the overview; never enters LLM context. Optional, zero logic risk.Dropped after necessity review
mirrorMemoryWrites— mirroring.memory/MEMORY.mdduplicates OV's own turn-based memory extraction (and re-mirrors unchanged content every shutdown). Removed.commitOnShutdown— near-dead switch (only affects non-takeover mode; takeover is on by default). Removed.Test
cd examples/pi-coding-agent-extension && node --test tests/*.test.mjs— 44 pass.agent_settledadvances the boundary 121ms after the run;pi -crestores boundary/watermark; cross-boundary facts recalled from the overview.Note (out of scope)
DESIGN.md(pre-existing on main) still documentsmirrorMemoryWrites/commitOnShutdownas implemented — a doc/code mismatch predating this PR, left for a separate cleanup.🤖 Generated with Claude Code
https://claude.ai/code/session_01MRy5Epi4rQ7vCzSk3BLQcA