Dashboard › opencode › Distillation
0056f415-dd7e-457a-a50d-3eb441ed3c6a["lore_tm_v1_ZVEg7GbJPwKypnfQ6dlJdJ5GBxWxy4F9MexP43Apjas","lore_tm_v1_MhtrJOqyZDKYnmNjhA2thDWf0IG4J7_GAiMgqFKiHLs","lore_tm_v1_KF-pJ0-0GDfd3zY9NfsYAveD0Wk8HLut2fCziN14rPo","lore_tm_v1_gacbm-29UYSQwhn_asRqBIzjxKc-jjI1kuOe7LghQis","lore_tm_v1_HWrIHK61Lf1AibfCG9jrPx0yFGhdd7LEU_bDxlGgBzk","lore_tm_v1_Rwv8_whfivEm3Q-MAspxpqrkeI-yAfg69pLh8AbT6PI","lore_tm_v1_koqzzjtJZ3Chs1T80w6aaVVyGWaWt5K50YUgQ5Mt90c","lore_tm_v1_LY0k5TXxi_2iAqsDu5suQ5lukm-XmkRGkHfHWkeQFJQ","lore_tm_v1_jRdJy8aLT7ohF0YqzniSrGrbIcCMbp71fhFqBTsHwc4","lore_tm_v1_eQWAgtpwTWkUMcJu1_486skOiMR0teCiINyr73zPU3U","lore_tm_v1_npXbItJ4y5dBsqAxGWaz-VOQ5fJt2imEkN8uQomeLwE","lore_tm_v1_OzIv2eWkbrco_xk8zbI7oL3SA9kpplD8FpUfa6HFop4","lore_tm_v1__SU_u35Oh5-6y1YGeRA2g4Eu4VKUTni1qLqPwXoPHd8"]
Date: Sep 9, 2026
/home/byk/Code/opencode-lore/packages/gateway/test/shutdown-sqlite-readers.test.ts is a 342-line regression suite for issue #1599: graceful gateway shutdown must close vector/read worker-pool SQLite readers before writer close, and core close() must run exactly once on the normal path.#1599 root cause: SQLite WAL TRUNCATE requires zero concurrent readers, but each vector worker holds a read-mark through reader.db; the pre-#1599 synchronous shutdownVectorPool() posted shutdown and terminate() in the same tick without awaiting, allowing readers to outlive writer close and causing a busy checkpoint, busy-timeout hang, stranded -wal, and recovery on the next boot.stopTemporalEmbeddingScheduler, 2. settleTemporalEmbeddingScheduler with a finite positive deadline, 3. settleDocumentEmbeds, 4. resetProvider, 5. shutdownVectorPoolAsync, 6. core close.close() must run exactly once on the graceful path: zero calls leave WAL uncheckpointed, while two calls indicate a logic bug or leaked cleanup hook.close() is idempotent and must be a true no-op when the DB was never opened (does not open it); repeated calls after gateway shutdown must not throw or close an already-closed handle again.close() failure, such as Error("checkpoint busy"), must never propagate and block the forced-exit path; the gateway shutdown closure catches the error and still resolves successfully.#1599 lifecycle regression test sets LORE_DB_PATH to a temporary lore.db, writes shutdown_canary(id="canary-1", payload="before-shutdown"), shuts down, reopens through a fresh DatabaseSync, requires PRAGMA integrity_check to return "ok", and verifies the accepted write remains readable./home/byk/Code/opencode-lore/packages/gateway/test/shutdown-sqlite-readers.test.ts snapshots and restores the process-start LORE_DB_PATH, closes any opened DB before deleting temporary directories for Windows file-lock compatibility, and uses best-effort cleanup./home/byk/Code/opencode-lore/packages/gateway/test/cch.test.ts relies on the real header being always system[0] and nothing serializing before it; tests also warn when a sentinel-shaped block serializes before the real header in both signBody and resignBody./home/byk/Code/opencode-lore/packages/gateway/test/lifecycle-lock.test.ts tests acquireLifecycleLock, withLifecycleLock, LifecycleLockBusyError, LifecycleLockLostError, uninstall tombstones, verified package invocation, and stableUnixProcessIdentity.owner.json with version, 43-character token, pid, operation, createdAt, processStartedAt, and processIdentity; Unix permissions are 0o700 for parent/lock directories and 0o600 for owner.json, and release removes only the releasing generation.stableUnixProcessIdentity distinguishes same-second Unix PID generations using procfs boot ID plus start ticks, producing values such as unix-procfs:boot-generation:10001 and unix-procfs:boot-generation:10002; lstart-only second-resolution metadata is rejected with null./home/byk/Code/opencode-lore/packages/gateway/test/lifecycle-lock-sigkill-child.ts using process.execPath --import tsx, with phases crash-initialize, crash-recovery, crash-release, and acquire-release, and a 90_000 ms child timeout.effect-smol source rather than memory or Effect v2/v3 examples. If .opencode/references/effect-smol is absent, clone https://github.com/Effect-TS/effect-smol into the project, then search it and nearby repository code for exact APIs and local style before answering or implementing.Effect.gen(function* () { ... }); reusable service methods or important workflows should use Effect.fn("Name") or Effect.fnUntraced(...).Schema, branded schemas for IDs, and Schema.TaggedErrorClass for typed domain errors. HTTP handlers should remain thin—decode input, read request context, call services, and map transport errors—while business rules belong in services.any, non-null assertions, unchecked casts, old Effect APIs, and broad hidden provisioning.testEffect(...) from packages/opencode/test/lib/effect.ts for services, layers, runtime context, scoped resources, or platform integrations; use it.live(...) for filesystem, git, child processes, locks, timing, HTTP servers, sockets, and other live platform behavior.packages/opencode; never run package tests from the repo root./home/byk/Code/opencode/packages/plugin/src/v2/effect/plugin.ts defines Plugin<R = Scope.Scope> with readonly id: string and effect: (context: PluginContext) => Effect.Effect<void, never, R>; define<R = Scope.Scope>(plugin: Plugin<R>) returns the plugin unchanged./home/byk/Code/opencode/packages/plugin/src/v2/effect/plugin.ts defines PluginDomain with readonly add: (plugin: Plugin) => Effect.Effect<void> and remove: (id: string) => Effect.Effect<void>./home/byk/Code/opencode-lore/packages/gateway/test/start-gateway-reuse.test.ts verifies authenticated gateway reuse: a second startGateway handle has owned: false, reuses the existing port and exact managementToken, and avoids EADDRINUSE.6669: unauthenticated health remains "healthy", a wrong token yields { kind: "rejected" }, the correct token yields { kind: "authenticated", identity: { pid: process.pid } }, and reuse returns owned: false on port 6669.https://gateway.example.test/health; loopback probes use bounded behavior and classify a hanging HTTP server with a 10 ms deadline as "timeout".49152, its management token, and the authenticated host; it can also reuse an existing gateway when the requested interface does not overlap, normalizing to the authenticated host./health response claiming { status: "ok", service: "lore" } is insufficient proof of identity; a spoofing HTTP service and a non-HTTP foreign process both produce a friendly error matching not an authenticated lore gateway.startGateway removes both port and PID records. If listener cleanup itself fails, it retains discovery evidence instead, reports that evidence was retained, and does not call record-removal hooks.startGateway calls are serialized through process-record publication: after a stale owner probe is released, the first caller owns the new gateway and the second reuses its port and management token with owned: false.owned: true./home/byk/Code/opencode/packages/core/test/plugin/provider-openai-compatible.test.ts verifies the OpenAI-compatible plugin sets options.includeUsage to true, uses provider ID custom-provider to produce language-model provider "custom-provider.chat", and does not overwrite an SDK sentinel installed by an earlier provider-specific plugin.