Repository navigation
fix: dispose session on archive - #177
Merged
Merged
Conversation
maxy-shpfy
force-pushed
the
maxy/fix--dispose-session-on-archive
branch
from
November 12, 2026 05:52
1e671f3 to
7dd8abc
Compare
maxy-shpfy
changed the base branch from
maxy/feat--bundle-global-memory
to
main
November 12, 2026 05:52
maxy-shpfy
marked this pull request as ready for review
November 12, 2026 07:46
maxy-shpfy
force-pushed
the
maxy/fix--dispose-session-on-archive
branch
from
November 18, 2026 21:07
7dd8abc to
761aaaf
Compare
Mbeaulne
approved these changes
Nov 18, 2026
maxy-shpfy
force-pushed
the
maxy/fix--dispose-session-on-archive
branch
from
November 18, 2026 21:16
761aaaf to
5143ff0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Archiving a session now tears down its live compute instead of leaving Pi processes running in the background.
PATCH /api/sessions/:idwitharchived: trueputs the session to sleep: open Runs are cancelled, every Pi agent (Prime + sub-agents) is killed without supervisor respawn, and schedules are disarmed. Live sub-agents are persisted asdetachedso a later wake can revive them. Unarchiving only re-arms schedules — agents wake lazily on the next message.PiAgentManager.sleep(sessionId)cancels open Runs, quiets each agent so the kill-triggered exit is not reported as an in-flight error, disposes the session, and returns the live sub-agent ids.TriggerEngine.load()registers a session's triggers for listing without arming a schedule;sync()now loads + arms. Joining an archived session loads triggers without waking it.handleUpdateSessionnow takesSessionUpdateDeps { store, pi, triggerEngine };applyArchiveStatesleeps + disarms on archive and re-arms on unarchive.Screenshots
N/A — backend only.
How to test
PATCH /api/sessions/:idwith{ "archived": true }.cancelled, live sub-agents persist asdetached, and no error event is emitted.pnpm --filter @tangent/server test— new coverage inpiAgentManager.test.ts("sleep kills every agent…") andsockets/chat.test.ts(cold wake, live no-op, archived join).