Dashboard › opencode › Distillation
443db008-39c1-4615-9b60-50d08670078d["lore_tm_v1_NL_7iO051c6uw-5ldT4ewMhmaDs3OGZlKi-cLj3qEFQ","lore_tm_v1_HAz7MZ6WwOQXhwIrxkwQXgU-GAYPqcct77PZ7bGES5k","lore_tm_v1_79iNlmnByhdL9soa9qU8q24vdRFLowLTDKsKP994QUY","lore_tm_v1_GDgM8wXMZTNTu6QFU887Eiit1cEW-2aZQCkDnEaa0dc","lore_tm_v1_VkQnuxJps3539YPGMr3sgInJAlRmI5-2mWz6rgZJLSk","lore_tm_v1_JbYPmAebIzS4CO2UuWySyQOYsdT4YSgXLJ33zqCf0JQ"]
Date: Sep 16, 2026
SessionExecutionLocal must never start a second owner while the lease is live.SessionExecutionLocal must never overwrite an expired lease.SessionExecutionLocal must never re-enter its own uncertain live lease.SessionExecutionLocal must never revive an expired claim on heartbeat.packages/core/src/session/run-coordinator.ts, defining Coordinator<Key, E> with active, run(key), wake(key), and interrupt(key, cleanup?); executions are serialized per key while different keys may run concurrently.run(key) starts with force=true when idle, joins an existing execution, or waits for a stopping execution before retrying; wake(key) coalesces follow-up work through pendingWake; and interrupt(key) sets stopping, interrupts the owner fiber, runs cleanup, settles the interrupted entry, and starts work registered during cleanup.packages/core/test/session-execution-local.test.ts tests covering: claim removal after successful drain; claim preservation when scope closes; claim removal after explicit interruption; exclusion of a second owner under a live lease; refusal to overwrite an expired lease; refusal to re-enter the same ownerβs uncertain live lease; heartbeat expiry renewal; refusal to revive an expired claim; and cancellation settlement before a pending successor starts.packages/core/test/session-execution-local.test.ts: initial expires_at is 30_000; after TestClock.adjust("10 seconds") it becomes 40_000; after another 10 seconds it becomes 50_000.packages/core/test/session-execution-local.test.ts: while the first runβs finalizer is blocked, a wake is registered and the clock advances by "40 seconds"; the claim expiry must remain greater than 40_000, the finalizer must settle before the successor starts, exactly 2 runs must occur, and all claims must ultimately be cleared.packages/core/test/session-runner.test.ts: never publish streamed output after ownership changes; never start a local tool after ownership changes; never fail interrupted tools after ownership changes; and preserve successor ownership during compaction.packages/core/test/session-projector.test.ts: roll back promotion and Context Epoch mutation after ownership loss, and never advance the Context Epoch after ownership changes.packages/core/src/session/context-epoch.ts, where SessionContextEpoch.initialize() and prepare() require a SessionExecutionClaim.Claim; Context Epoch insert, replace, and advance mutations execute through SessionExecutionClaim.transaction(...) to fence database changes against ownership loss.prepareOnce() concurrently loads current SystemContext, stored epoch, and latest compaction; initializes when no epoch exists; decodes stored snapshots with SystemContext.Snapshot; uses SystemContext.replace() when compaction sequence exceeds baseline_seq, otherwise SystemContext.reconcile(); retains the stored baseline for Unchanged or ReplacementBlocked; replaces the baseline for ReplacementReady; and publishes SessionEvent.ContextUpdated with advance(...) as its commit for an incremental update.packages/core/src/session/compaction.ts configuration constants: DEFAULT_BUFFER = 20_000, DEFAULT_KEEP_TOKENS = 8_000, TOOL_OUTPUT_MAX_CHARS = 2_000, and SUMMARY_OUTPUT_TOKENS = 4_096.compaction.auto, compaction.buffer, and compaction.keep.tokens; defaults are { auto: true, buffer: 20_000, tokens: 8_000 }.head, tool and shell output exceeding 2_000 characters is truncated with \n[truncated], and attachments are represented by MIME type and optional name.SessionCompaction.compactIfNeeded() and compactAfterOverflow(): compaction is skipped when disabled or model context is absent/nonpositive; overflow is determined by estimated { system, messages, tools } tokens exceeding context - Math.max(output, config.buffer); summary output is capped at 4_096 tokens; tools are disabled for the summary request; SessionEvent.Compaction.Started is published before streaming and SessionEvent.Compaction.Ended after a nonempty successful summary; provider errors, LLM.Error, empty output, or an oversized summary prompt cause compaction to return false.packages/core/src/session/compaction.ts: ## Objective, ## Important Details, ## Work State with ### Completed, ### Active, and ### Blocked, then ## Next Move, then ## Relevant Files; every section must remain present, bullets must be terse, exact technical artifacts must be preserved, and the output must not mention compaction or the summary process.