Dashboard › opencode › Distillation
52eade0f-2860-46be-ba4a-2207eb077c3b["lore_tm_v1_AtgdC_X85_7o1F9yCYRU7Sn3yOzk9_tsyGO-HcEoaSU","lore_tm_v1_wMYD5Auty9lY2GISpkswTXzp6GnjEZrbTy8Azp_XNyU","lore_tm_v1_BtnZFDTBAVq1prF_Z7N_q7eIiwAwc5Az4G2POvXvTRI","lore_tm_v1_rPTzpHe_DtWW3T-SjtVKheK8LR-yUeThVCPJ-BsXPic","lore_tm_v1_suc1qTZvClkzrzAuhwG8oIMa34VzWf0-gs-WuwMPsmc","lore_tm_v1_ZfwCG71mx6v6VASXl7QmY5Uxj1TtS8clr8qMtB8DbrE"]
Date: Sep 17, 2026
packages/core/src/session/sql.ts sets MAX_WAKE_ATTEMPTS = Number.MAX_SAFE_INTEGER and enforces session_wake_attempts_check and session_recovery_wake_attempts_check bounds of 0..9007199254740991.SessionTable in packages/core/src/session/sql.ts includes wake_attempts as a non-null integer defaulting to 0, alongside execution-related session state such as revert, agent, model, time_compacting, and time_archived.SessionInputTable adds wake_pending as a non-null boolean defaulting to false; its indexes are session_input_session_pending_delivery_seq_idx on (session_id, promoted_seq, delivery, admitted_seq), unique session_input_session_admitted_seq_idx, unique session_input_session_promoted_seq_idx, and session_input_wake_pending_promoted_session_idx on (wake_pending, promoted_seq, session_id).SessionRecoveryTable schema: session_id, primary-key execution_id, optional assistant_message_id, required unique continuation_message_id, phase restricted by TypeScript to "ready" | "unknown" | "continue", wake_pending default true, wake_attempts default 0, optional recovery_error, and required time_created. Foreign keys cascade from session_id to SessionTable, assistant_message_id to SessionMessageTable, and continuation_message_id to SessionInputTable.SessionRecoveryTable defines session_recovery_wake_pending_error_attempts_created_execution_idx on (wake_pending, recovery_error, wake_attempts, time_created, execution_id) and unique session_recovery_continuation_message_idx on continuation_message_id.SessionExecutionTable schema: primary-key id, unique session_id, required owner_id, optional assistant_message_id, phase "ready" | "safe" | "unknown" | "continue" | "cancelling" | "cancelled", assistant_seq default -1, required time_created and expires_at, and optional recovery_error. It defines session_execution_owner_idx and session_execution_recovery_scan_idx on (recovery_error, expires_at, time_created, id).packages/core/src/session/sql.ts sets SESSION_EXECUTION_LEASE_MS = 30_000.SessionContextEpochTable in packages/core/src/session/sql.ts maps session_context_epoch with primary-key/cascading session_id, required baseline, JSON snapshot typed as SystemContext.Snapshot, and required baseline_seq.packages/core/src/database/migration/20260914170650_session-recovery.ts, ID 20260914170650_session-recovery, adds session_input.wake_pending, adds session.wake_attempts, creates session_execution and session_recovery, and creates their execution, recovery-scan, continuation-message, and wake-pending indexes.20260914170650_session-recovery enforces session_execution_phase_check for ('ready', 'safe', 'unknown', 'continue', 'cancelling', 'cancelled'); it creates no analogous SQL phase check for session_recovery.phase.packages/core/src/database/migration.gen.ts registers import("./migration/20260914170650_session-recovery") as the final and newest entry after 20260622202450_simplify_session_input.packages/core/src/database/schema.gen.ts includes session_execution, session_recovery, session_input.wake_pending, session.wake_attempts, all corresponding checks and foreign keys, and indexes matching packages/core/src/session/sql.ts and migration 20260914170650_session-recovery.