Dashboard › opencode-lore › Distillation
eb5ff91f-2a29-458d-9253-b4190d8ca8be["lore_tm_v1_I8z2uMFYZZZD9g1w4UMEKE6_ycEJObuk2B9AddVA7uM","lore_tm_v1_FWXc5Ba3JJJzIPfHMi9Wy8e3UIMztXGBkza893ix3F0","lore_tm_v1_fyEWZ_oArdZ1qgZtP-hBPdJlKPYKgq_bLE_d1ppG1BI","lore_tm_v1_eP4bMqJjAKLStLlr2nVh87yx1NzdbgxTK0CegxphZqk"]
Date: Sep 16, 2026
packages/core/src/cgroup-memory.ts to parse Linux cgroup membership and mount information, resolve cgroup v1/v2 memory files while retaining host-side mount roots, decode octal path escapes, and read container memory headroom.packages/core/src/cgroup-memory.ts treats a cgroup v2 limit value of max as Number.POSITIVE_INFINITY.MODELED_WORKER_MEM_BUDGET_BYTESβthe model plus a 2048-token attention estimateβfrom the resident high-water reserve used to prevent unsafe pool growth.PER_WORKER_MEM_BUDGET_BYTES now reflects EMBED_WORKER_RESIDENT_RESERVE_BYTES; tests expect it to equal exactly 1536 * MB.packages/core/src/embedding/pool.ts:577-657, runOperation() owns the worker slot until native inference settles; caller AbortSignals are intentionally omitted from slot.provider.embed(...), because callers own only their waiters.packages/core/src/embedding/pool.ts:581-615, each operation has a watchdog that starts in "init" using embedInitWatchdogMs, switches to "execution" using embedExecutionWatchdogMs, logs embedding worker watchdog expired: stage=${stage} timeout_ms=${timeoutMs}, rejects with EmbeddingWorkerWatchdogError(stage), uses Math.max(1, timeoutMs), and calls watchdogTimer.unref?.().packages/core/src/embedding/pool.ts:616-632, successful operations call recordSlotSuccess(slot), clone vectors only when retainResult === true and no waiters remain, clear operation.texts, settle all waiters, and either prune retained completed operations or remove the operation from this.operations.packages/core/src/embedding/pool.ts:633-655, failed operations are removed, release text/vector payloads, settle every waiter with the owned error, and retire the slot for either LocalProviderUnavailableError or EmbeddingWorkerWatchdogError; the watchdog is cleared, slot.inflight is decremented, and dispatch resumes in finally.packages/core/src/embedding/pool.ts:659-708, dispatch drops queued operations with no waiters and does not replace the last active slot or grow the pool while retiredWorkers still owns live native model/heap memory.dispatch() handles EmbeddingWorkerRetryCooldownError by scheduling retry at error.retryAt; other slot-selection failures remove the operation and settle all waiters with the owned error or LocalProviderUnavailableError.packages/core/src/embedding/pool.ts:710-754, embed() rejects pre-aborted signals with EmbeddingRequestAbortedError, rejects a closing pool with LocalProviderUnavailableError("embedding pool is unavailable"), deduplicates requests by embeddingOperationKey(ownedTexts, inputType), prioritizes recall embeddings as "high", measures queued bytes with Buffer.byteLength(text), and rejects over-capacity work with EmbeddingQueueCapacityError.packages/core/src/embedding/pool.ts:760-802, shutdown() is idempotent via shutdownPromise, marks the pool closing, clears retry dispatch, rejects all waiters with LocalProviderUnavailableError("embedding pool shut down"), releases queued texts/vectors and token-batch checkpoint vectors, shuts down all providers with Promise.allSettled, waits for retired workers, and throws AggregateError("embedding worker termination was not confirmed") if any shutdown cannot be confirmed.packages/core/test/cgroup-memory.test.ts for resolveLinuxCgroupMemoryFiles() and readLinuxCgroupMemoryHeadroomBytes(), including v1/v2 path resolution, malformed metadata, headroom results of exactly 100, 50, and 400, and fail-closed undefined outcomes.packages/core/test/embedding-cap.test.ts covers clampFreeToContainerLimit() and resolveMemoryHeadroom(): invalid or unknown limits (0, Number.NaN, negative) do not constrain host free memory unless current container availability is known; a constrained cgroup with unknown or invalid current usage fails closed to 0.resolveMemoryHeadroom() tests require the minimum valid headroom source: (12 * GB, 23 * MB, 7 * GB) β 23 * MB, (12 * GB, 7 * GB, 23 * MB) β 23 * MB, (12 * GB, undefined, 2 * GB) β 2 * GB, and (1 * GB, undefined, 2 * GB) β 1 * GB; wholly unknown inputs return undefined.desiredEmbedPoolSize() tests establish exact boundaries: 3 * GB - 1 β 1 worker, 3 * GB β 2 workers, 64 * GB β DEFAULT_MAX_EMBED_POOL, (64 * GB, 4) β 4, (64 * GB, 3.9) β 3, (1024 * GB, 100) β EMBED_POOL_ABS_MAX, (3 * PER_WORKER_MEM_BUDGET_BYTES, 4) β 3, and invalid/negative/zero free memory β 1.packages/core/test/embedding-pool-memory.test.ts contains the OOM-regression suite verifying that each pool workerβs token cap is sized from free / ceiling rather than full free memory, and that the token floor is used when constrained primary-worker headroom is unknown.