Support TPM throttling error with 60-second retry delay#1
Closed
Copilot wants to merge 3 commits into
Closed
Conversation
Co-authored-by: wenshao <1166785+wenshao@users.noreply.github.com>
Co-authored-by: wenshao <1166785+wenshao@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add handling for throttling error responses
Support TPM throttling error with 60-second retry delay
Feb 10, 2026
wenshao
added a commit
that referenced
this pull request
Mar 11, 2026
- Add constant-time token comparison via crypto.timingSafeEqual (QwenLM#6) - Validate lock file fields before trusting parsed JSON (#4) - Verify daemon identity via /health API before sending SIGTERM (QwenLM#5) - Add session idle timeout (30min) to auto-cleanup unused sessions (#1) - Reject concurrent prompts on same session instead of overwriting (QwenLM#8) - Add max session limit (50) to prevent resource exhaustion (QwenLM#7) - Use server.closeAllConnections() for prompt stop() resolution (QwenLM#15) - Register onStop callback in foreground mode (QwenLM#10) - Fix unhandled promise in onStop callback with void (#3) - Respect encoding parameter in captureWrite (QwenLM#14) - Remove unnecessary env spread in fork options (QwenLM#9) - Add tests for lock file validation and session page serving Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
wenshao
added a commit
that referenced
this pull request
May 20, 2026
Follow-up to the initial harden pass, addressing the inline review comments on PR QwenLM#4340. Rule #1 (worktree mandatory): - Scope it to **same-repo PR reviews** so cross-repo PRs running in lightweight mode (no matching local remote, no worktree) don't read as a contradiction. - Replace "Your very first action" with "After argument parsing and remote detection, the first command that touches code state" — the literal "very first" was wrong since `--comment` parsing and URL/remote disambiguation legitimately run before `fetch-pr`. - Align the forbidden-command list with the Step 1 blockquote (add `git pull` and `git reset --hard`) so a weak model that only reads the Critical rules section sees the same five commands as a model that reaches the blockquote at the point of use. - Add an explicit "cross-repo PRs use lightweight mode" parenthetical so the same model knows where to look for the alternative path. Step 8 skip block: - Drop the redundant third bullet ("no Critical or Suggestion findings with concrete, applicable fixes") — it was both logically equivalent to the "Otherwise" clause below and used a different qualifier ("concrete, applicable" vs "clear, unambiguous"), risking a weak model treating them as two distinct thresholds. - "ANY of the following" → "EITHER" since only two bullets remain. - Fold the no-findings case into the Otherwise clause as a no-op note.
wenshao
added a commit
that referenced
this pull request
May 21, 2026
…#4340) * fix(review): harden SKILL.md against weak-model rule skipping Weak models often skip parts of the long /review prompt and fall back to familiar defaults — `gh pr checkout` instead of the worktree flow, or running the autofix prompt even when the user passed `--comment` (which means "only post inline comments, don't mutate code"). Three reinforcements, all in SKILL.md (no CLI changes): - Promote the two most commonly violated rules to the top of the "Critical rules" list: worktree is mandatory for PR reviews, and `--comment` skips Step 8 entirely. - Add an inline blockquote at the top of the Step 1 PR branch that names the specific forbidden commands (`gh pr checkout`, `git checkout`, `git switch`, `git pull`, `git reset --hard`). - Add an explicit skip block at the top of Step 8 listing the three conditions that bypass autofix — `--comment`, cross-repo lightweight mode, or no fixable findings — so a weak model doesn't have to infer them from scattered earlier text. * fix(review): address /review comments on rule scope + Step 8 dedup Follow-up to the initial harden pass, addressing the inline review comments on PR QwenLM#4340. Rule #1 (worktree mandatory): - Scope it to **same-repo PR reviews** so cross-repo PRs running in lightweight mode (no matching local remote, no worktree) don't read as a contradiction. - Replace "Your very first action" with "After argument parsing and remote detection, the first command that touches code state" — the literal "very first" was wrong since `--comment` parsing and URL/remote disambiguation legitimately run before `fetch-pr`. - Align the forbidden-command list with the Step 1 blockquote (add `git pull` and `git reset --hard`) so a weak model that only reads the Critical rules section sees the same five commands as a model that reaches the blockquote at the point of use. - Add an explicit "cross-repo PRs use lightweight mode" parenthetical so the same model knows where to look for the alternative path. Step 8 skip block: - Drop the redundant third bullet ("no Critical or Suggestion findings with concrete, applicable fixes") — it was both logically equivalent to the "Otherwise" clause below and used a different qualifier ("concrete, applicable" vs "clear, unambiguous"), risking a weak model treating them as two distinct thresholds. - "ANY of the following" → "EITHER" since only two bullets remain. - Fold the no-findings case into the Otherwise clause as a no-op note.
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.
TLDR
When API returns
{"error":{"message":"Throttling: TPM(10680324/10000000)","type":"Throttling","code":"429"}}, system now waits exactly 60 seconds before retry instead of using exponential backoff. Regular 429 errors continue using exponential backoff.Dive Deeper
Detection Logic
"Throttling: TPM"in error messageError.message) and nested (error.error.message) structurestype: "Throttling"for nested formatRetry Behavior
Code Example
Implementation
packages/core/src/utils/retry.ts: AddedisTPMThrottlingError(), modifiedgetRetryAfterDelayMs()packages/core/src/utils/retry.test.ts: 6 new test cases covering TPM detection, delay timing, and pattern specificityReviewer Test Plan
npx vitest run packages/core/src/utils/retry.test.tsnpx vitest run packages/core/src/utils/Test Coverage
Testing Matrix
Linked issues / bugs
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.