Dashboard › opencode-lore › Distillation
4988d345-6da3-4a9c-8c39-8dfc8bff0a45["lore_tm_v1_ew58iAL8fv1MuhdhB0gWLCcXk_W5cuFXaSQ4YrRYIvM","lore_tm_v1_-x2cYyEYj1sltDGVr8-qrhZk_ieUvMjQBh-zZw_MH5g","lore_tm_v1_6sbbkNXdmQtJ3kXahWt9TbX38i4g8Q-9N-Ho_F-Sa9U","lore_tm_v1_LYhBhMf8_PTFIQGrtVpVofP_EN7e4x0d2GiwyZ4fry0","lore_tm_v1_ebJO7o9_7SLCbrMZs-YIORCeBZyc-Crwov2DY9ELnXM","lore_tm_v1_osyEtn5tqTm1duV_2QFu6uvXvuzGtchHFSlAZrA28Bo","lore_tm_v1_nBw8tnOtA41QKan2VNiadfTjO7PM8dtiV1McgVqJeY0","lore_tm_v1_YXJqeC1_4OeQtdZJMkn0Jmmvi4xii8jdaC2wf5wNIiM","lore_tm_v1_Hi9YRXl8T6f_doyRZj9wg7Mj1F3naZLh9LqMNrmJTSY"]
Date: Sep 17, 2026
"unhandled"; settle<T>() in packages/core/test/embedding-oom-recovery.test.ts attaches success and rejection handlers as soon as the promise is created.packages/core/test/embedding-oom-recovery.test.ts defines FakeWorker extends EventEmitter, snapshots posted EmbedMsg payloads to prevent later in-place maxTokens mutations from retroactively changing captured messages, and exposes deterministic "message", "error", and "exit" events through _setTestWorkerFactory.VOYAGE_API_KEY and OPENAI_API_KEY, set _setConstrainedMemoryForTest(0) and _setContainerFreeForTest(16 * 1024 * 1024 * 1024), and restore provider state, environment variables, worker factory, memory seams, and local-provider probe state after each test.packages/core/test/embedding-oom-recovery.test.ts persists stale cap 8192 with freeMemBytes=0, verifies the initial request uses EMBED_TOKEN_CEILING, emits EMBED_OOM_EXIT_CODE, and verifies a fresh worker receives the same request ID at backoffEmbedCap(EMBED_TOKEN_CEILING); the lowered cap is persisted through _readPersistedEmbedCap(), and the original promise resolves after the replacement worker returns one vector.MIN_EMBED_TOKENS, verifies an OOM does not spawn another worker, rejects the pending request with LocalProviderUnavailableError, and makes isAvailable() return false, degrading recall to FTS-only._setTestWorkerFactory() invocation throw Error("synthetic spawn failure"); it verifies exactly 2 spawn calls and rejection of the pending request with LocalProviderUnavailableError.EMBED_OOM_EXIT_CODE for at most 30 iterations, requires caps to be monotonically non-increasing, bottoms out at MIN_EMBED_TOKENS, then latches without respawning, rejects with LocalProviderUnavailableError, and leaves isAvailable() false.isStderrSilenced() state into workerData.stderrSilenced; after silenceStderr(true), the worker factory must observe true so worker [lore] OOM output cannot corrupt the host TUI.packages/core/test/embedding-cap-persistence.test.ts verifies lore:embedding_cap persistence: absent rows return null; cap 1234 round-trips with positive freeMemBytes; cap 500 overwrites 1000 through ON CONFLICT; corrupt JSON and JSON missing required fields return null; { cap: 1000, freeMemBytes: 4 GiB, knownBadCap: 3000 } round-trips; knownBadCap is omitted for 0/undefined and ignored when non-positive or non-numeric.withSavepoint() names in packages/core/src/db.ts to be bare SQL identifiers because the name is interpolated into SQL and is never a bind parameter; /^[A-Za-z_][A-Za-z0-9_]*$/ rejects non-identifiers to prevent injection.withSavepoint<T>(name, fn) in packages/core/src/db.ts executes SAVEPOINT ${name}, releases on success, and on failure executes ROLLBACK TO ${name} followed by RELEASE ${name} before rethrowing. It is safe both standalone and nested, unlike withTransaction() using BEGIN IMMEDIATE, because SQLite permits nested savepoints but not nested BEGINs.checkConfigChange() in packages/core/src/embedding/backfill.ts re-reads the stored embedding fingerprint after write serialization to prevent a late process from clearing vectors another process rebuilt; it uses withSavepoint("embedding_config_reconcile", reconcile) when databaseInTransaction(db()) is true and withTransaction(reconcile) otherwise."vec0" but the vec extension is unavailable, clears stale embeddings after a provider/model/dimension change, recreates vec0 storage when needed, calls resetTemporalRechunkProgress(), and stores the new ${provider}:${model}:${dimensions} fingerprint under lore:embedding_config.reprobeEmbedCap() to never re-probe up to or past a known-bad cap; knownBadCap - 1 acts as a hard upper boundary while gentler upward steps below that boundary remain unaffected.packages/core/src/embedding/local.ts seeds lastOomCap from persisted knownBadCap and persists the known-bad cap alongside the backed-off cap so the next process retains the OOM safety boundary.resolveMemoryHeadroom() to always accept finite Node runtime headroom when no hard memory limit exists, including resolveMemoryHeadroom(Number.NaN, Number.NaN, 7 * GB) === 7 * GB.packages/core/src/embedding/local.ts adds _setAvailableMemoryForTest(bytes) and availableMemoryHeadroom(). The latter uses Linux readLinuxCgroupMemoryHeadroomBytes(), avoids Bunβs host-wide process.availableMemory() alias by calling resolveMemoryHeadroom(constrained, linuxHeadroom), uses Nodeβs process.availableMemory() when available, and falls back to resolveMemoryHeadroom(constrained, linuxHeadroom) if the API is absent or throws.containerFreeBytes() now calls clampFreeToContainerLimit(raw, constrainedMemoryLimit(), availableMemoryHeadroom()), incorporating current cgroup/runtime headroom rather than only the hard constrained-memory limit.resolveMemoryHeadroom(12 * GB, 23 * MB, 7 * GB) === 23 * MB, requiring Linux cgroup headroom to take precedence over the broader Node runtime value when a constrained environment is detected.