Conversation
tt-a1i
left a comment
There was a problem hiding this comment.
Reviewed at 64c5ec8.
The implementation direction looks sound: execution identity is owned by the Pi runtime lifecycle rather than the originating Web prompt trace, retained runtimes preserve the current handle across session switches, and the existing session/command/epoch guards remain intact.
I am holding approval pending the acceptance evidence requested by #468. The browser coverage currently uses a cron wake, while the issue explicitly calls for a real Subagent or Workflow completion native wake and verification that the unique execution identity is reflected consistently in events, snapshots, the Composer Stop state, and the terminal outcome. The generic agent_start seam makes the implementation plausible, but that exact path is not yet demonstrated.
Local validation: bun run check passed; 83 focused pi-runtime/web-host tests passed. Hosted CI is green.
Problem
Closes #468.
Web Stop derives its target from a Web prompt trace. Switching from a running Session A to B and back clears that trace, so A stays running without a usable Stop handle. A native follow-up wake has no Web prompt trace at all and loses the same control.
Value
Users can stop the selected Session's actual running turn after switching Sessions, reloading the browser, or receiving a native wake.
Approach
Track the execution identity on its Pi runtime from
agent_startthroughagent_settled, independently of Web prompt tracing. Retained runtimes keep their identity; native runs receive a unique handle. Retry and continuation starts within an unsettled run reuse that handle. Keep the existing Session/command/epoch guards and terminal-outcome requirement for accepting cancellation, and avoid retaining an abort operation when abort settles synchronously.Validation
node --test --experimental-strip-types tests/web/pi-runtime.test.ts tests/web/web-host.test.ts: 83 passed./cron in 30snative wake receives a handle and can be stopped through the browser.pi listin that directory reports only this source checkout. Screenshots were visually checked. Subagent/Workflow completion itself was not separately run; the Cron test exercises the shared native follow-up/trigger-turn entry path.bun run checkandgit diff --check: passed.bun run teston Windows / Node 24.14.0: 1,516 passed, 2 failed, 10 skipped. The failures were the existinggit-info/process.test.ts1-second process timeout andworkflows/execute.e2e.test.tsdetached-workflow settlement timeout, also seen on the audit baseline. The runner stopped before its later Windows serial and Vitest partitions. Full local suite success is not claimed.Impact