fix(coding-agent): persisted vibe sessions across restarts

Vibe worker roster lived only in a process-local Map, so a resumed parent
session started with an empty registry and vibe_send failed with
"Unknown vibe session". Persist a versioned, parent-scoped lifecycle
journal (spawn/turn/tombstone events), rehydrate validated idle workers
through the persisted-subagent reviver on resume, and gate the flow with
generation/CAS protection so stale finalizers cannot clobber a
replacement worker. Killed transcripts stay readable but non-revivable;
mode-exit commits tombstones atomically with the mode change and rolls
back cleanly on storage failure.

Ported from @mastertyko's fork branch fix/vibe-session-persistence.

Fixes #5303
This commit is contained in:
roboomp
2026-07-14 17:58:14 +00:00
parent 01d3fc9b6b
commit 4bc68b45e2
29 changed files with 3919 additions and 229 deletions
+3 -2
View File
@@ -614,10 +614,11 @@ export class CollabHost {
case "kill": {
const kill = async () => {
const ref = AgentRegistry.global().get(agentId);
if (ref && ref.status === "running" && ref.session) {
if (!ref) return;
if (ref.status === "running" && ref.session) {
await ref.session.abort({ reason: USER_INTERRUPT_LABEL });
}
await AgentLifecycleManager.global().release(agentId);
await AgentLifecycleManager.global().release(agentId, ref);
};
kill().catch(fail);
break;