Make SessionManager projections authoritative for provider requests, add append-only context edits and actionable turn boundaries, and preserve existing queue scheduling during continuation and recovery.
This change makes system prompt text and tool changes part of the transcript rather than silently rewriting its starting conditions. This lets Pi record when instructions changed or tools became available, restore that state after resuming or navigating branches, and preserve cached prompt prefixes where the upstream supports it.
- Cover application list copying and branch-state exclusion
- Verify sequence preservation and next-write allocation
- Group WP08 cases separately until SQLite is ready
Require a non-empty commit to persist normalized format-4 IDs before forking an open v3 session.
Verify rejection leaves the source unchanged and that the same destination ID succeeds after upgrade.
waitForChildProcess resolved null for the exit code when a child was killed by a signal (e.g. OOM killer), and exec mapped it with code ?? 0, so the bash tool treated killed commands as successful.
Track the termination signal and fall back to the shell convention of 128 + signal number (137 for SIGKILL) when no exit code is available.
fixes#8992closes#8882
streamProxy dropped a final SSE event that was not newline-terminated
(the residual line buffer was never flushed after the read loop) and
called stream.end() without a result when no done/error event had been
seen, leaving EventStream.result() pending forever. Consumers like
agentLoop awaiting response.result() hung indefinitely when the server
closed the connection mid-response.
Flush the decoder and process the residual buffer after EOF, and push a
synthesized error event when the stream ended without a terminal event.
fixes#8996
Move service, replicated-state, facet host, and loader ownership into the standalone Chord package. Migrate consumers and leave runtime JSON enforcement to serializers.
Run next-turn preparation only when the agent loop continues, allowing threshold compaction before the next provider request. Restore interactive progress when the same run resumes.
Closes#6879
Important to notice:
this changes when prepareNextTurn & prepareNextTurnWithContext are invoked:
the now run only when a next turn actually happens, and after shouldStopAfterTurn.