Dashboard › opencode-lore › Distillation
f97a3586-7880-4875-9017-71bb6b872732["lore_tm_v1_lHcZtca1yWBotMwL2Ny0gz0ZgUNFgfBEApDNTWy5ZY0","lore_tm_v1_VCpyHvdC9os4A8K39rD160QU-1TH_pNB1XMbSd437CU","lore_tm_v1_-wl720hWdu6e7L-6f3l2fu-uy68lABSeHrdiAvrxEPw","lore_tm_v1_80JzI6P_Jjp3uTbR0MEgbkfbOY14E3N9yUBhsd0znJw","lore_tm_v1_Yj68ipbx4zzt3qAHJd4VNfGqv0KSYgUhKO3jNiM5rHE","lore_tm_v1_668-UPj6DTS2sUj6h4pLtbkNGkdk0RBNVxgOHe5ydsA","lore_tm_v1_5C8CTd4tn3souttdRFZ2aYSLG-hJczmmCcRFFnrfiss","lore_tm_v1_wa11GNOzF9d7lzELVTCQeTM9VXKLjWgsFRNvvP4B1ZA","lore_tm_v1_RFBIr6Ou0tfjz1YorpmFBksEdxLntMZVwHIqHmDZwKM","lore_tm_v1_Jq8nb15PIJeE0Yko-6xOxxZVRMucjjaOXQIByudQ0l8"]
Date: Sep 16, 2026
messages.length - 1 so at least one real message—user turn or tool_result—always follows the injected pair and closes the request.tool_use, never after its tool_use, including both completed pairs and pending tool calls.*🧠Refreshed memory* must always remain a separate assistant message and never be coalesced into a real assistant response.safeDeltaInsertIndex cap; if that message is an assistant with tool_use, a user-turn separator is required.captureToolPairing400() identifies a specific Anthropic tool-pairing HTTP 400 only when status === 400 and errorBody contains tool_use, without, and tool_result; this avoids false positives from other tool-related 400s such as malformed schemas.captureToolPairing400() records only counts, layer, model, and the first 16 characters of sessionID, never message content, honoring the NO gen_ai.input.messages proxy posture.captureToolPairing400() captures Error("tool-pairing 400 (tool_use/tool_result concurrency)") with tags error_class: "tool_pairing_400", gradient_layer, and model; context includes layer, tool_use_count, tool_result_count, message_count, session_id_prefix, and concurrency_class: true.coalesceAdjacentAssistants() merges adjacent assistant messages by concatenating content blocks in order, but intentionally leaves user-to-user adjacency unchanged because providers accept it and delta-placement tests depend on distinct user blocks.packages/gateway/src/stream/anthropic.ts defines the shared finite SSE frame ceiling DEFAULT_MAX_SSE_FRAMES = 100_000, independently bounding parser work for tiny, blank, and comment-only frames.SSEStreamTransportError represents post-header SSE body transport failures with kind: "inactivity" | "read"; SSEStreamLimitError is a separate deterministic local-limit error.readStreamChunk() preserves SSEStreamLimitError, wraps other reader failures as SSEStreamTransportError("read", "SSE stream read failed", { cause }), independently races caller abort and inactivity, and emits SSEStreamTransportError("inactivity", "SSE stream inactivity deadline exceeded") on timeout.parseResponsesNonStreamEnvelope() obtains a GatewayResponse via accumulateResponsesNonStreamJSON(), reads string json.status or defaults to "unknown", validates completion for statuses "completed" and "incomplete", and returns { response, status }.ResponsesTerminalError(response, parsed.status) whenever status is not "completed".accountUnsuccessfulResponse() records validated positive usage via accountConversationUsage(), optionally invokes markDirty(), sets GenAI usage attributes, then always sets span status code 2 with message "upstream response did not complete" and ends the span.captureUnsuccessfulResponses() returns { response, successful: true } on success; for ResponsesTerminalError, it calls finishUnsuccessfulStreaming(error.response), returns { response, successful: false } only for status "incomplete", and returns undefined for other terminal statuses.errorResponse(502, "Gateway request failed"); an incomplete response also becomes that 502 if it contains recall tool use, otherwise it is projected through nonStreamHttpResponse().streamResponsesRecallAware() accepts onComplete(response, successful), transaction commit()/rollback(), sessionID, maxRecallExecutions, deprecated maxRecallDepth, storage and byte/frame ceilings, validation: "public" | "codex", caller signal, recallDeadlineAt, retryPrincipal({ attempt, signal }), test-only sseInactivityMs, and an onRecall() callback.retryPrincipal() is specified to reissue the byte-stable principal request only after a pre-output body-read failure; the caller must preserve the original transformed request, route, credentials, and abort deadline.wswlsmrn, commit 24880457763b6f10831856d01c41bd72d62ddc28, descending through the provider-failure stack from main@origin commit 2cbf40060c67df229731cf1b9e34d5bf22ec2145.c79cc2ec010e22f01961d8eec7bce3a60b8dfcb02c12b9ce4c0de9c5e173cb4d from review start to end and that the immutable candidate revision and patch hash did not change.jj file show -r wswlsmrn; all cited line numbers refer to that immutable revision.response.created, a malformed non-JSON frame such as event: error / data: private-provider-diagnostic can be forwarded verbatim because the principal parser forwards non-JSON events unless the name starts with response. or is message (packages/gateway/src/pipeline.ts:10135-10156), while sanitization runs only after successful JSON parsing (:10284-10320).error leak in continuation handling: packages/gateway/src/pipeline.ts:10921-10944 retains the raw frame and :11259-11268 can later queue it for client delivery, bypassing the fixed "Gateway request failed" envelope.error events across recall pending, backpressure, EOF, and later successful or failing terminal outcomes.response.in_progress events can leak untrusted metadata before a sanitized failure because recall-aware validation checks identity, status, and empty output but does not validate or project model, timestamp, extensions, or nested diagnostics (packages/gateway/src/pipeline.ts:9183-9198) before forwarding the original event (:11664-11675).packages/gateway/src/stream/openai-responses.ts:1094-1118, :2583); the existing test at packages/gateway/test/openai-responses-recall-aware-stream.test.ts:820-894 covers only an in-progress event hidden by active recall, not the visible no-recall path.response.created state.packages/gateway/src/stream/openai-responses.ts:2134-2174), recall-aware principal path (packages/gateway/src/pipeline.ts:10284-10333), and continuation path (pipeline.ts:10959-10983).packages/gateway/src/stream/openai-responses.ts:2764-2774, packages/gateway/src/pipeline.ts:9618-9628, and rollback handling at pipeline.ts:8033-8040; log.error() exports message and sanitized stack to durable sinks and Sentry (packages/core/src/log.ts:206-222, :497-504), and pattern redaction does not remove arbitrary callback text.applyResponsesEvent() without the terminal snapshot used by the normal branch (packages/gateway/src/stream/openai-responses.ts:2134-2174; snapshot begins at :2179).applyResponsesEvent() sets terminal state and stop reason before validating usage (packages/gateway/src/stream/openai-responses.ts:845-928), so malformed or overflowing failure usage throws after partial state mutation even though output remains hidden.615/615, a repeated 200/200 sequence battery, static checks, and bundle results—did not prove failing-first or mutation behavior because no base-failure or guard-removal artifact was provided.error in principal and continuation, 2. visible response.in_progress metadata poisoning, 3. malformed failure usage with state restoration, 4. throwing onComplete and rollback callbacks with sink/Sentry assertions, 5. Codex rate-limit events followed by failure, 6. numbered principal frames followed by a locally synthesized failure.packages/gateway/src/stream/openai-responses.ts:605-650), while recall-aware output rewrites every JSON frame to contiguous gateway-owned numbers (packages/gateway/src/pipeline.ts:9586-9615).packages/gateway/src/stream/openai-responses.ts:653-666, :2109-2119; packages/gateway/src/pipeline.ts:10161-10167, :10950-10964).packages/gateway/src/stream/openai-responses.ts:605-650), and failed completion projections clear content and raw output while retaining validated usage (:1030-1044).response.in_progress before creation, failure diagnostics before creation, alias/type mismatches, contradictory terminal statuses, malformed identities, malformed references, and malformed output lifecycles.packages/gateway/src/stream/openai-responses.ts:2801-2805; packages/gateway/src/pipeline.ts:10312-10325), while unsuccessful finalization performs accounting and rollback without successful-turn persistence (pipeline.ts:18795-18826).@loreai/core artifact, so it provided no validation evidence.DO-NOT-MERGE.