Repository navigation
feat(server): threads resume on their own after a usage limit resets - #63
Merged
Merged
Conversation
lukemaj
added a commit
that referenced
this pull request
Sep 28, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: 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. |
…61) When a provider's usage limit stopped a thread, nothing brought it back: the user had to return after the reset and type "continue". Three threads stopped this way on 2026-09-28 alone. When a thread the user started fails while its provider instance has an exhausted usage window with a known reset (the data the Usage panel shows), the threads toolkit sends one "Continue. (Sent automatically after the usage limit reset.)" a minute after the latest reset. Starting another turn or archiving the thread first cancels it. Child threads are skipped: Model Router reroutes or blocks Prism jobs itself, and the planner decides what to do with a blocked job once it resumes. Pending resumes live in memory, so a server restart drops them. Upstream Orchestrator V2 has its own "Resume at reset", so this goes away with the V2 port. Done by Claude Opus 5.5 in Claude Code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
lukemaj
force-pushed
the
feat/61-resume-after-usage-limit
branch
from
September 28, 2026 18:12
42e8e1f to
6ffec82
Compare
Knip flagged three exports only used inside mobileShell.ts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Sep 29, 2026
lukemaj
added a commit
that referenced
this pull request
Oct 1, 2026
…limit (#71) A spawn_thread child that stopped on a usage limit waited until the user typed "continue" to the planner and the planner relayed it: #63 skipped every sub.* thread to leave Prism jobs to Model Router. The resume watcher now skips only Prism job threads, recognized by Model Router's "[model-router job ...]" first user message (titles get regenerated, so they are no marker). A resume fires at the earlier of the displayed reset plus a minute, or the first reply any thread gets from the same provider instance after the settle delay: on 2026-09-29 the displayed reset was 2.5 hours later than when requests worked again. A thread whose early resume fails again waits for the reset, so a per-model limit cannot turn replies elsewhere into a retry loop. A resumed child's parent gets one line saying so. Done by Claude Opus 5.5 in Claude Code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
lukemaj
added a commit
that referenced
this pull request
Oct 1, 2026
…limit (#71) A spawn_thread child that stopped on a usage limit waited until the user typed "continue" to the planner and the planner relayed it: #63 skipped every sub.* thread to leave Prism jobs to Model Router. The resume watcher now skips only Prism job threads, recognized by Model Router's "[model-router job ...]" first user message (titles get regenerated, so they are no marker). A resume fires at the earlier of the displayed reset plus a minute, or the first reply any thread gets from the same provider instance after the settle delay: on 2026-09-29 the displayed reset was 2.5 hours later than when requests worked again. A thread whose early resume fails again waits for the reset, so a per-model limit cannot turn replies elsewhere into a retry loop. A resumed child's parent gets one line saying so. Done by Claude Opus 5.5 in Claude Code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
lukemaj
added a commit
that referenced
this pull request
Oct 1, 2026
…limit (#72) * feat(server): direct child threads resume on their own after a usage limit (#71) A spawn_thread child that stopped on a usage limit waited until the user typed "continue" to the planner and the planner relayed it: #63 skipped every sub.* thread to leave Prism jobs to Model Router. The resume watcher now skips only Prism job threads, recognized by Model Router's "[model-router job ...]" first user message (titles get regenerated, so they are no marker). A resume fires at the earlier of the displayed reset plus a minute, or the first reply any thread gets from the same provider instance after the settle delay: on 2026-09-29 the displayed reset was 2.5 hours later than when requests worked again. A thread whose early resume fails again waits for the reset, so a per-model limit cannot turn replies elsewhere into a retry loop. A resumed child's parent gets one line saying so. Done by Claude Opus 5.5 in Claude Code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(server): interrupt_thread cancels a usage-limit auto-continue (#71) A dispatcher interrupts a limit-hit child before replacing it, but that child is already failed, so interrupt_thread had nothing to stop while the pending automatic continue would still restart it next to its replacement. interrupt_thread now cancels that pending continue and marks the stopped turn so a later limit error for it schedules none. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(server): continue only usage-limit errors, and past resets keep watching (#71) Only a turn whose own error reads as a usage limit schedules a continue; an unrelated runtime error while a usage window is exhausted is left alone. An exhausted window whose reset time already passed no longer ends the watch: it keeps waiting for a reply on the instance and re-reads the windows every 5 minutes, resuming at a future reset or once none is exhausted, so a stale reading cannot turn into a continue loop. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(server): resume at a reset only once the window shows it lifted (#71) At a future reset plus the margin the watcher resumed without reading the usage windows again, so a window still at 100 % got a continue anyway. It now re-reads them and resumes only when none is exhausted; otherwise it keeps re-reading every 5 minutes, and a reply on the instance can still resume it early. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 8, 2026
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.
Closes #61.
When a provider's usage limit stopped a thread, nothing brought it back: the user had to return after the reset and type "continue". Three threads stopped this way on 2026-09-28 alone (each turn ended as
errorabout 1 s after starting).When a thread the user started fails while its provider instance has an exhausted usage window with a known reset (the Usage panel's data), the threads toolkit sends one "Continue. (Sent automatically after the usage limit reset.)" a minute after the latest reset. The decision reads the provider's usage windows only, so it covers every provider that reports them, with no error-text parsing.
sub.*) are skipped: Model Router reroutes or blocks Prism jobs itself, and the planner decides what to do with a blocked job once it resumes.The Elon record (cuts and evidence) is on #61.
Proof
vp test run src/mcp/toolkits/threads/usageLimitResume.test.ts: 5 passed on TestClock (resumes once a minute after the reset and not at the reset itself; nothing when not limited; stands down after a newer turn or archive; reset selection across windows).vp test run src/mcp/toolkits/threads/: 36 passed, including the real-engine child report-back test that builds this layer.apps/servertypecheck clean; lint clean on changed files;scripts/fork-check.shOK.Done by Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code