fix: fall back to upstream when compaction summary generation fails#392
Merged
Conversation
8f6ff7e to
7044cd5
Compare
When the worker model is unavailable (429 rate limits, auth errors, etc.), generateCompactionSummary() now returns null instead of a bogus error string. handleCompaction() detects null and falls back to forwarding the original compaction request to the upstream API via handlePassthrough(), so the client still gets a proper compaction response. Also handles the explicit /v1/compact endpoint (Pi plugin) with a proper 502 error response instead of returning null as the summary text. Fixes LOREAI-GATEWAY-4 (1758 events of worker 429 failures producing "(Compaction failed — no summary generated.)" in Claude Code).
7044cd5 to
fd8f0b8
Compare
This was referenced May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the worker model is unavailable (429 rate limits, auth errors, etc.), the gateway now gracefully falls back to forwarding the compaction request to the upstream API instead of returning a bogus error string to the client.
Problem
generateCompactionSummary()returned"(Compaction failed — no summary generated.)"whenllm.prompt()returnednull(worker model 429, 401, or network failure). This string was wrapped in a synthetic 200 OK response and displayed to the user as their compacted conversation content.Sentry:
LOREAI-GATEWAY-4— 1,758 events ofWorker upstream exhausted 3 retries: 429 Too Many Requests, last seen today.Changes
generateCompactionSummary()now returnsstring | null— returnsnullon failure with a warning log instead of a bogus error stringhandleCompaction()checks fornulland falls back tohandlePassthrough(req, config), forwarding the original compaction request to the upstream API so the client still gets a proper responsehandleCompactEndpoint()(Pi plugin's explicit/v1/compact) returns a proper 502 JSON error instead of a null summary