Repository navigation
fix(gateway): preserve OpenCode v2 title requests and avoid WARP pool churn - #169
Merged
jasonxu114514 merged 1 commit intoNov 5, 2026
Merged
Conversation
jasonxu114514
added a commit
that referenced
this pull request
Nov 5, 2026
#169 called anonymousNodes.CursorForOffset, warp.Pool.ReportWithRetryAfter and warp.Pool.HasUntriedActive without defining them, so main did not compile. Add the three methods: an attempt offset shifts the anonymous start node, a longer Retry-After extends the egress cooldown, and HasUntriedActive matches the pool's egress keys. Also: - rewrite title.go in house style: named limits, a prompt table, no issue numbers in comments, and a titleFallback helper shared by both lanes - document the held-back tool-call helpers in protocol/stream.go - gofmt internal/admin/server.go - drop the _test.go files from #169, #170 and #171
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
Fixes #164. Completes and extends #102 by handling OpenCode v2 session-title prompts, preventing false-positive tool injection, capping title requests to a single attempt, and providing a clean local fallback on 429.
Problem
tools: []). The free-tier upstream accepts this tool-free body, butprepareAnonymousBodyattached the complete official CLI toolset to all requests. This caused upstream Zen gates to reject title calls with403 FreeTierErroror429 FreeUsageLimitError(in: 0)."Generate a title for this conversation"). OpenCode v2 rewritten this into a system prompt beginning"You name conversations so the user can find them later in a list of past sessions...", which escaped PR fix: do not inject agent tools into title-generation requests #102's guard.max_attempts), burning every healthy exit in 1–2 seconds and triggering cascading 429 errors for subsequent user agent requests.Changes
internal/gateway/title.go):"you name conversations so the user can find them later","reply with a title and nothing else", auto-rename).<= 3messages, and no assistant/tool turns.internal/gateway/upstream.go):renameAndCompleteToolswhen title generation is detected so the payload reaches upstream tool-free.internal/gateway/warp.go,internal/gateway/upstream.go):limit = 1) to eliminate egress pool rotation churn.Verification
internal/gateway/title_test.go:TestIsTitleGenerationRequest_Comprehensive: verifies v1, v2, and false-positive prevention cases.TestPrepareAnonymousBody_TitleVsAgentToolsInjection: verifies title requests stay tool-free while agent requests retain tools.TestSynthesizeTitle_UnicodeAndFallbacks: verifies truncation, UTF-8 safety, and empty fallbacks.TestWarpAnonymous_TitleRequestSingleAttemptFallbackOn429: verifies 1-attempt cap and 429 fallback on mock WARP pool.go vet ./...clean.go test -count=1 -v ./...all passed.go build ./cmd/opencode2apiclean.