Dashboard › opencode-lore › Distillation
7c7c0fa0-f418-4e63-96e9-6ef4e7f831cb["lore_tm_v1_zPto2ml_m3v6du8FpCeODiIrVB0OEOmbbRc36HVMFh8","lore_tm_v1_o8S8iZSukuv-rt_lhpvBbRBbfDXn4x9l54D40U-Umd8","lore_tm_v1_2aw8vIi3y1-xjdvg3rWPldph-6B75wpeHiHCptkLkn0","lore_tm_v1_VTGzlIi8RGAJFYR-PfLpEYT-Xni6OkfzSalOWY8_OXE"]
Date: Sep 16, 2026
packages/gateway/src/pipeline.ts:12066).assertValidNonStreamCompletion() in packages/gateway/src/pipeline.ts:12103 found strict terminal-envelope validation for anthropic, openai, openai-responses, vertex, and gemini.id, nonempty model, object usage, exactly 1 choice, an assistant-role message, and finish_reason equal to stop, tool_calls, or length; otherwise it throws "upstream OpenAI request did not complete" (packages/gateway/src/pipeline.ts:12111-12144).status only as completed or incomplete, validates unique output item identities and supported output item types, and rejects standalone item_reference because a non-stream response has no streamed lifecycle against which to resolve it (packages/gateway/src/pipeline.ts:12148-12297).incomplete_details.reason may only be max_output_tokens or content_filter; malformed or other reasons throw "upstream Responses request did not complete" (packages/gateway/src/pipeline.ts:12274-12295).responseId and modelVersion, valid usage with numeric promptTokenCount and candidatesTokenCount, exactly 1 model-role candidate, array parts, no string blockReason, and finishReason of STOP or MAX_TOKENS (packages/gateway/src/pipeline.ts:12300-12344).type="message", role="assistant", nonempty id and model, array content, valid required input/output usage, and stop_reason in end_turn, tool_use, max_tokens, stop_sequence, pause_turn, refusal, or model_context_window_exceeded (packages/gateway/src/pipeline.ts:12347-12380).accumulateAnthropicNonStreamJSON aliases shared parseAnthropicResponseJSON at packages/gateway/src/pipeline.ts:12383-12384.accumulateOpenAINonStreamJSON() in packages/gateway/src/pipeline.ts:12386 validates choice structure, safe nonnegative unique logical choice indices, message content/role types, tool-call function names and arguments, and nonempty unique tool-call IDs; malformed input throws "malformed OpenAI response choice" or "malformed OpenAI response tool identity".packages/gateway/test/recall-buffered-transaction.test.ts covers buffered Codex quota retention, ordered preservation of accepted/failed/recovered quota updates, malformed OpenAI recovery-envelope rejection, and incomplete recovery-metadata rejection.packages/gateway/test/codex-usage-metadata.test.ts covers true-streaming quota forwarding without duplication, projection rebuilding from a private allowlist, adjacent-update deduplication, canonical request-wide byte bounds, and preservation of ordered quota updates without changing consumption.