fix: pre-release review fixes for pings, DeepSeek Harness cleaning and GLM quota - #208
Merged
Merged
Conversation
…or a dead upstream Two gaps in the keep-alive pings added for Claude Desktop: - The timer restarted on every upstream chunk, including SSE comments (DeepSeek's `: keep-alive` while queued, OpenRouter's processing notes) that conversion drops. The upstream never looked silent while the client received nothing, so a long queue still hit the client's five-minute idle limit. The timer now runs from the last bytes the client actually got. - Pings never stopped. A half-open upstream connection yields no more bytes and the gateway has no read timeout, so pinging forever kept the client waiting forever. After ten minutes without a single upstream byte the gateway stops pinging and lets the client's own timer end it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yLMu6J4y8DLa8LiWygfzA
…nd keep every beta line - Only generating requests were cleaned, so a count_tokens call from DeepSeek Harness still reached a non-DeepSeek upstream with its user and session id headers, and with the session log if the body carried one. Cleaning now applies to every request Harness sends elsewhere. - anthropic-beta sent as several header lines: all lines were dropped and only the first was filtered and forwarded, so betas on the other lines were lost. All lines are now joined before filtering. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yLMu6J4y8DLa8LiWygfzA
… from a key that had a plan - The quota view asked every configured GLM upstream, disabled ones included, so a key the user had switched off was still sent to the quota endpoint and still showed a quota card. - A no-plan answer is business code 500, which a transient server error also returns. Taken at face value it cleared the key's quota from the UI and stopped asking for an hour. When the previous answer for the same key was a quota, the first no-plan now counts as a failure and is retried after the usual backoff; a second one in a row is believed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yLMu6J4y8DLa8LiWygfzA
This was referenced Sep 25, 2026
Merged
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.
Requested by F · project thread
What this changes
Fixes six bugs found while reviewing #203, #204, #205 and #206 before v0.50.0. There is one commit per area.
: keep-alivewhile a request is queued, OpenRouter's processing notes. The upstream therefore never looked silent, the client got nothing, and it hit its five-minute idle limit anyway. The timer now runs from the last bytes the client actually received.PING_FOR), the gateway stops pinging and the client's own timer ends the request.count_tokenscall from dsh reached a non-DeepSeek upstream with thex-deepseek-harness-*headers, and withdsh_*fields such as the session log if the body had them.anthropic-betasent on several header lines survives (feat(gateway): clean DeepSeek Harness requests for non-DeepSeek upstreams #205). All lines were dropped, and only the first line was filtered and forwarded, so betas on the other lines were lost.Why
Pre-release review of the changes going into v0.50.0.
How it was verified
mainand passes here:upstream_comments_that_never_reach_the_client_do_not_hold_pings_back,pings_stop_once_the_upstream_has_been_silent_too_long,counting_tokens_elsewhere_is_cleaned_too,betas_sent_on_separate_lines_all_survive_the_cleaning,a_key_that_had_a_plan_must_say_no_plan_twice, and a disabled case inonly_a_glm_upstream_with_a_key_is_asked.cargo fmt --check,cargo clippy --workspace --all-targets -D warnings,cargo test --workspace(1691 passed) andscripts/smoke.sh(60 passed, 0 failed) all pass.Notes for review
PING_FORis 10 minutes. An upstream that is healthy but completely silent for longer than that (no comments at all) would lose its pings. Anthropic upstreams send their own pings, and DeepSeek sends keep-alive comments while a request is queued.nonminimal_boolintw-dialect/src/convert.rs:276. That code predates this PR and is left untouched.🤖 Generated with Claude Code
https://claude.ai/code/session_014yLMu6J4y8DLa8LiWygfzA
Generated by Claude Code