Dashboard › opencode-lore › Distillation
fc4b7329-5f4f-4aa7-8a21-9cb9cd4ca848["lore_tm_v1_z4M3N93WzpZxqqw8tcw1YltOd3F8dDzr4PbD1aSq1is","lore_tm_v1_3hLPqTipxFnQ4GkKjM_BdJBhRzTVgKcx-gXU1DRECUI","lore_tm_v1_k_FPCJAXiyTBrlpMWb1jMJG0zZYtId39DQgAtCplLa8","lore_tm_v1_jU-FDlADC2JbXcIJu9fkOKzZwbe6XeFRP1q_tb14a1o","lore_tm_v1_rH8XGg7AWAzjwHpnWJeRgRUvd8kCXLDwL8aBNWMHHnE","lore_tm_v1_rNw9gnv1q-y0Hy-b1vke3soQ6MebQuoao345gi7fHs8","lore_tm_v1_qa8lUbkAbjTEg9vWPK26t-9nbgUGIFKxAykv4xnk_VE"]
Date: Sep 16, 2026
/home/byk/Code/opencode-lore-provider-error/packages/gateway/src/pipeline.ts lines 9080β9329. Reasoning output completion rejects changed content type/value, incomplete delta or part lifecycles, and disagreement among authoritativeValue, finalValue, partFinalValue, and the final output item; successful validation sets lifecycle.outputDone = true.seedImplicitCodexItem only operates with a normalizationState, skips response.output_item.added and response.output_item.done, requires a nonnegative safe-integer output_index, and seeds a missing acc.rawItems entry from normalizationState.rawItems by applying a synthetic response.output_item.added.validateResponseLifecycle rejects any Responses event after terminal, duplicate response.created, missing response identity, invalid creation status, nonempty creation output, and any response.* event before response.created. Under Codex validation, response.created.status === "queued" is allowed.response.in_progress validation requires stable response identity, optional status "in_progress", and empty output.response.completed, response.done, response.incomplete, and response.failed; allowed terminal statuses are "completed", "incomplete", "failed", and "cancelled". Codex validation uniquely permits response.completed with status "incomplete", while response.failed may carry "failed" or "cancelled"."incomplete", incomplete_details must be null/undefined or a non-array object, and its optional reason must be "max_output_tokens" or "content_filter"; malformed forms throw "malformed Responses terminal event".assertOutputLifecyclesComplete accepts optional allowedIncompleteIndices. Outside Codex validation it throws when a raw output lacks output_item.done; in sparse Codex streams, omission is retained for non-reasoning items and reasoning without a string ciphertext envelope, but reasoning with string encrypted_content throws as provisional.preserveStreamedReasoning reconstructs missing reasoning summary entries from lifecycle authoritativeValue as { type: "summary_text", text: summaryState.authoritativeValue }.assertTerminalReasoningMatchesLifecycle validates both actual.summary against lifecycle.reasoning and actual.content against lifecycle.content; terminal collections must be arrays, indexed parts must be non-array objects, and part types/values must match lifecycle state.packages/gateway/test/codex-usage-provisional.test.ts, packages/gateway/test/codex-usage-metadata.test.ts, packages/gateway/test/recall-buffered-transaction.test.ts, packages/gateway/src/pipeline.ts, packages/gateway/src/translate/types.ts, packages/gateway/src/translate/openai-responses.ts, and packages/gateway/src/stream/openai-responses.ts."codex.rate_limits" and optional field metered_limit_name; GatewayResponse/stream state expose codexRateLimits?: Array<Record<string, unknown>>, stream accumulation pushes each quota into state.codexRateLimits, translation emits every stored quota, and recall continuation merging appends currentResp.codexRateLimits before continuationResp.codexRateLimits.streamResponsesRecallAware at /home/byk/Code/opencode-lore-provider-error/packages/gateway/src/pipeline.ts:7799, call sites around lines 15453 and 18871, and streamResponsesPassthrough at /home/byk/Code/opencode-lore-provider-error/packages/gateway/src/stream/openai-responses.ts:2649 with a pipeline call around line 19079."Never throws / never" for the relevant post-response/context-warning pathway.accountUnsuccessfulResponse declared at /home/byk/Code/opencode-lore-provider-error/packages/gateway/src/pipeline.ts:13458 and called around lines 15879, 16142, 18746, and 18812./home/byk/Code/opencode-lore-provider-error/packages/gateway/src/pipeline.ts lines 13380β13579. Successful post-response processing updates shadow context using actual input, output tokens, worker model, requested model, resolved conversation TTL, and long-context status; marks sessionState._dirty = true; persists session tracking; learns candidate headers when headerSessionId is absent; and schedules background work unless noStore.loreConfig().knowledge.enabled, loreConfig().curator.onIdle, and containsGitCommit(req). Its multiplier is 3 when model input cost is at least 5, 2 when at least 1, otherwise 1; effectiveAfterTurns = loreConfig().curator.afterTurns * curationMultiplier, and turnsSinceCuration is raised to that threshold when lower."post-response processing failed:", returns false, and always invokes endSpan?.() in finally; success returns true.accountUnsuccessfulResponse(resp, sessionID, resolvedConversationTTL, genAiSpan, endSpan, markDirty?) records only validated provider usage without publishing successful-turn state. It treats usage as present only when at least one token count is numeric and greater than 0, optionally calls markDirty, accounts usage through accountConversationUsage, adds Sentry usage attributes when a span exists, then always sets span status { code: 2, message: "upstream response did not complete" } and calls endSpan().conversationTTLForAccounting first checks the live sessionβs resolvedConversationTTL, then persisted tracking, and returns only "5m", "1h", or undefined.postResponse delegates through withTenant(sessionState.storageTenantId ?? "", ...) to postResponseForTenant.inFlightBackground: Set<Promise<unknown>>; trackBackground increments state.backgroundWorkCount, adds the promise, and on either fulfillment or rejection removes it and decrements the count. Reset awaits these chains alongside limiter drain before swapping the database, and ownership includes global-queue waiting time.scheduleBackgroundWorkForTenant combines pipelineGenerationAbort.signal and sessionLifecycleSignal(sessionID) with AbortSignal.any. It skips background work when session auth is stale and no fresh fallback resolves, preventing worker calls that would return 401.getWorkerModel(sessionState.lastUpstream)?.providerID; the provider-aware auth guard exists because a session may hold credentials for provider A while lastUpstream targets provider B, and it skips work rather than repeatedly issuing unauthenticated calls and degrading worker health.