Repository navigation
fix(server): rotate Claude on hard usage rejection - #125
Merged
tusharbhardwaj-bk merged 1 commit intoAug 20, 2026
Merged
Conversation
tusharbhardwaj-bk
force-pushed
the
tushar/tec-961-claude-hard-limit-rotation
branch
from
August 20, 2026 15:12
be6b240 to
5d192b2
Compare
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
4 tasks done
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.
What Changed
rate_limit_eventmessages whose authoritative rate-limit status isrejectedand whose limit type is supportedclaude-autoswitch --hard-limit <type> --json, validate its exit/JSON/type outcome, and stop only the emitting provider session afterstatus == "switched"Why
Claude can authoritatively reject a request while its local utilization cache remains stale. The healthy 30-second fallback timer then leaves the running provider process pinned to an exhausted startup account for minutes. This hook uses the host-owned atomic election contract immediately and never reads, copies, logs, or moves credentials in application code.
Base / Staging Resync Evidence
At PR creation,
expbkmainwas six commits behindbkmain, so GitHub initially displayed the already-production #123/#124 files beside TEC-961.git rev-list --left-right --count origin/expbkmain...origin/bkmainreturned0 6: zero staging-only commits and six production-side commitsgit merge-base --is-ancestor origin/expbkmain origin/bkmainsucceededexpbkmainwas then fast-forwarded, without force, from9a5596b6to966bcc67per the documented between-experiments reset pathNo experimental commit was discarded or silently mixed. After the resync, this PR is the four-file TEC-961 diff based on
origin/bkmain.Verification
VITEST_MAX_THREADS=2 vp test run apps/server/src/provider/claudeHardLimitRotation.expbkt3.test.ts --maxWorkers=2— 1 file, 7 tests passednode scripts/check-fork-markers.ts— passedvp fmt apps/server/src/provider/claudeHardLimitRotation.expbkt3.ts apps/server/src/provider/claudeHardLimitRotation.expbkt3.test.ts apps/server/src/server.ts docs/operations/claude-account-switching.md --check --threads 2— passedgit diff --check origin/bkmain...HEAD— passedStaging Plan
Merge to
expbkmain, wait for the SHA-addressed deployment, verify/home/ubuntu/.t3/expbkt3-dev/deployed-shaandt3-expbkt3.service, then exercise only the repository-supported controlled validation for: one hard-limit election/recycle, duplicate suppression, unrelated-session isolation, and non-hard-error ignore behavior. The machine-global election will not be triggered live without a quiescent safe gate.Rollback
Set
T3_CLAUDE_HARD_LIMIT_ROTATION=0for expbkt3 and restart onlyt3-expbkt3.serviceto disable the event listener while keepingclaude-autoswitch.timeractive. Revert this PR for a complete application rollback. The validated host rollback copy remains/home/ubuntu/.local/bin/claude-autoswitch.bak-20260820-tec961.TEC-961
https://linear.app/beknown/issue/TEC-961/rotate-claude-immediately-after-a-hard-usage-limit-rejection
Implemented by gpt-5.6-sol via Codex in T3 Code.