Dashboard › opencode › Distillation
064d877b-e6e5-41e4-8e57-060d3700e42c["lore_tm_v1_rRjjrqneNoI1rrB1ul_iBbq-MXDSkQr1Mvc_haQKH8U","lore_tm_v1_5zzHQvTGsPpYdtcccZG8PBLXyLmqmtBDA9ng5uvQoyE","lore_tm_v1_VzLaGuUpAlyDt43DBtVEeYCvilcVe7QLRX4ELSz6wAM","lore_tm_v1_e4sw0CT9LdCyOJl3dzqq5Qwx0qIf9sp1-uIoRuz6ImE","lore_tm_v1_-2qVBIMF0dCsnt_onCIycIyx66FS4DiQmbWhyQqJ-EE"]
Date: Sep 16, 2026
packages/core/src/session/sql.ts:23 defines MAX_WAKE_ATTEMPTS = Number.MAX_SAFE_INTEGER; checks on SessionTable.wake_attempts and SessionRecoveryTable.wake_attempts enforce the range 0..MAX_WAKE_ATTEMPTS.packages/core/src/session/sql.ts:148-179 defines SessionInputTable with boolean wake_pending defaulting to false; indexes include unique (session_id, admitted_seq), unique (session_id, promoted_seq), and session_input_wake_pending_promoted_session_idx on (wake_pending, promoted_seq, session_id).packages/core/src/session/sql.ts:182-218 defines SessionRecoveryTable: primary key execution_id; required session_id, continuation_message_id, phase, and time_created; nullable assistant_message_id and recovery_error; wake_pending defaults to true; wake_attempts defaults to 0; phases are typed as "ready" | "unknown" | "continue"; continuation_message_id is unique.SessionRecoveryTable foreign keys cascade on deletion from SessionTable, SessionMessageTable, and SessionInputTable, including deletion of a recovery row when its assistant message or continuation input is deleted.packages/core/src/session/sql.ts:220-243 defines SessionExecutionTable: primary key id, unique session_id, indexed owner_id, required lease expiry expires_at, and phases constrained to ready, safe, unknown, continue, or cancelling; SESSION_EXECUTION_LEASE_MS is 30_000.packages/core/src/session/sql.ts:3: import * as DatabasePath from "../database/path", conflicting with the repository rule that import * as Foo must never be used.packages/core/src/database/migration/20260914170650_session-recovery.ts has ID 20260914170650_session-recovery; it adds session_input.wake_pending default false, adds session.wake_attempts default 0 with maximum 9007199254740991, creates session_execution and session_recovery, and creates the corresponding unique and lookup indexes.session_execution phase check includes exactly ('ready', 'safe', 'unknown', 'continue', 'cancelling'), matching packages/core/src/session/sql.ts; its recovery wake-attempt check uses the exact numeric Number.MAX_SAFE_INTEGER value 9007199254740991.quarantines an execution claim blocked by a conflicting recovery identity is located at packages/core/test/session-projector.test.ts:1251-1303."conflicting-recovery-identity" in phase "continue", clears its wake_pending, and inserts an expired SessionExecutionTable claim for the same Session/execution with owner "dead-owner", phase "ready", time_created: 0, and expires_at: 0.SessionRecovery.recover(), the regression expects the exact execution claim to remain with recovery_error: "Recovery projection failed" and expects the recovery row to remain with execution ID "conflicting-recovery-identity" and phase "continue", demonstrating the phase-conflict quarantine path.rejects a recovery execution identity owned by another Session at packages/core/test/session-projector.test.ts:1199-1249 publishes execution ID "shared-recovery-identity" for one Session, verifies reuse from another Session fails, and verifies the original recovery and continuation rows remain owned by the first Session.quarantines a recovery wake behind a newer assistant begins at packages/core/test/session-projector.test.ts:1305; it creates recovered assistant msg_recovery_stale, then newer assistant msg_recovery_newest, runs recovery with a wake spy, and expects no Session wakes ([]).