feat: graceful wind-down on rate limit detection#10
Open
Savolent wants to merge 1 commit intovcarl:mainfrom
Open
feat: graceful wind-down on rate limit detection#10Savolent wants to merge 1 commit intovcarl:mainfrom
Savolent wants to merge 1 commit intovcarl:mainfrom
Conversation
Add a wind-down file IPC mechanism for graceful session lifecycle management. When the Claude API returns a rate_limit_event in the stream-json output, the process runner writes a WIND_DOWN.json file that the orchestrator can poll to halt gracefully. - New file: operator/wind-down-file.ts with read/write/clear/isStale/watcher - process-runner.ts: detect rate_limit_event, write WIND_DOWN.json - TurnResult: add optional rateLimitResetsAt field - Export WindDownSignal type and functions from @roci/core Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
rate_limit_eventin Claude's stream-json output and writesWIND_DOWN.jsonChanges
operator/wind-down-file.tsWindDownSignaltype,writeWindDown(),readWindDown(),clearWindDown(),isWindDownStale(),startWindDownWatcher()process-runner.tsrate_limit_eventin stream, write WIND_DOWN.json with reset time. Triggers on rejection or >75% utilization warning.hypothalamus/types.tsrateLimitResetsAt?: numbertoTurnResultindex.tsMotivation
When API rate limits hit, agents should stop gracefully rather than continue attempting API calls that will fail. The wind-down file provides a filesystem-based IPC signal that any monitoring process can read:
sessionEndTimeisWindDownStale()auto-detects expired signals for cleanupTest plan
npx nx run @roci/core:buildpasses (verified)readWindDown()returns null when no file existsisWindDownStale()returns true for expired signals, false for active onesstartWindDownWatcher()calls callback when signal appears🤖 Generated with Claude Code