Repository navigation
Conversation
…ached context verifyProxyAfterError detached its health check with context.WithoutCancel, so verifications outlived client disconnects and server shutdown: each ran the full 10s against a dead network while holding the checking flag, serializing later checks behind pointless work. WithTimeout on the caller context keeps the timeout cap for hung checks; cancellation only ends checks nobody waits for.
|
Thanks for looking into this. I don't think we can take it as-is, because it reintroduces the failure
If the goal is to stop checks from outliving server shutdown, that's reasonable, but it should hang off the gateway's lifetime context (the |
|
Closing per maintainer feedback: binding the check to the request context reintroduces the failure WithoutCancel prevents (cancelled requests make the check a no-op, and a fired request deadline can evict a healthy proxy). The right fix hangs off the gateway lifetime context, not the request's — will send that as a fresh PR if we get to it. Keeping our variant locally in the meantime. |
…ver-key usage) Takes upstream f8e996d/be91f86/0204ca1 (client fingerprint + inference endpoint + genuine tools), jasonxu114514#59 anon cooldown lockup, jasonxu114514#63 token floor, jasonxu114514#64 whole-attempt deadline, jasonxu114514#62 tool images, jasonxu114514#58 server-key usage split, jasonxu114514#65/jasonxu114514#66 models surface, plus our merged jasonxu114514#76/jasonxu114514#77/jasonxu114514#78. Kept local (fork-owned, still no upstream equivalent): zero-delivery replay + length rescue + SSE heartbeat + stop/tail census (stream lanes), offline no_upstream_contact probe guard, single-marshal Zen shaping with paid-model gate, tcp4 dial + TLS resumption, RandomID math/rand fallback, cancel-detached refresh fix (PR jasonxu114514#80 superseded by maintainer feedback; kept locally pending lifetime-context rework). Telemetry takes upstream's session-burn + server-key split with their LRU session cap (better than our smallest-first); CloneMap takes upstream's merged comment. Metrics ring test retargeted at upstream's concrete ring types. doUpstream keeps upstream's 3-value signature; replay uses a new doUpstreamCounted wrapper for continuous legs.
Upstream rewrote the anonymous lane: doAnonymousUpstream now walks an ordered upstream list per proxy and shapes the body per gate (prepareAnonymousBody(body, protocol, legacy) for the legacy /zen/v1 origin vs the newer /inference origin), replacing the map-level shapeAnonymousPayload. Both lanes were measured live from this box and answer 200 for anonymous free-tier traffic, so the fork keeps upstream's lane order. Fork behaviour preserved: - zero-delivery stream replay with attempt-count continuation (doUpstreamCounted restored on top of upstream's 3-value doUpstream, replay body wrapped in RenameStreamReader so tool aliases stay correct) - SSE heartbeat, stop/tail census (ForwardStream/TranscodeStream outcome plumbing), length rescue on partial reset - 499 client-cancel reporting in both the chat and System One paths - offline probe guard (gotResponse) so a boot with no route reports no_upstream_contact instead of disabling a working free model - tcp4 dial pin + TLS session resumption, merged with upstream's pool transport rules (ForceAttemptHTTP2/DisableKeepAlives/TLSNextProto) - RandomID math/rand fallback when the host RNG fails Fork behaviour retired (converged back to upstream): - request-bound proxy health check (upstream PR jasonxu114514#80 was closed on this: proxy health is gateway-scoped, so a cancelled request must not abort the check); refresh_test now pins that semantics - anonymousUpstreams only leads with the hardcoded public legacy origin when upstream.anonymous lives on the same host, so a custom mirror or test server is never bypassed toward a third-party origin Gates: gofmt clean, go vet clean, go test ./... green, go build -trimpath ./cmd/opencode2api.
…h variant - FORK.md: v1.4.1 merge section (took upstream's per-lane anon shaping, kept fork replay/heartbeat/census/probe-guard/transport pins, retired the request-bound proxy health check after PR jasonxu114514#80 closed), fresh fork header (upstream v1.4.1 a9470df, merge history, backups), live health numbers, explicit push-remote note. - AGENT.md: HEAD + backup state, finding D superseded with the gateway- scoped reasoning, new finding E for the anonymous lane list, request path and attempt-loop shape post-merge (doUpstreamCounted, per-lane shaping, guarded 499 block). - ZEN-FREE-TIER.md: the two anonymous lanes and their different tool bars.
verifyProxyAfterError detaches its health check with context.WithoutCancel, so verifications outlive client disconnects and server shutdown: each runs the full 10s against a dead network while holding the checking flag, serializing later checks behind pointless work.
WithTimeout on the caller context keeps the timeout cap for hung checks; cancellation only ends checks nobody waits for.
Validation: go vet clean, go build -trimpath clean, gofmt clean. Failure-path only.