Files
loki/scripts
g-butandClaude Sonnet 4.6 11a368d989 fix(beacon): wire Claude Code rate-limit notifications into capacityIssue detection
The Notification hook receives a 'message' field from Claude Code (e.g.
"Claude is at capacity. Please try again in 60 seconds.") but the bridge
never read it, so capacity issues were invisible to the auto-switch system.

Fix: handle_notification now extracts 'message', regex-matches it against
rate-limit phrases (same set as looksLikeAgentCapacityIssue), and writes
/tmp/agent-capacity-issue-<tab> with a timestamp when matched.

beacon.py reads and clears this sentinel in _write_beacon_session so the
beacon session gets capacityIssue=true, triggering the auto-switch countdown
instead of the normal continue prompt. Sentinel expires after 5 minutes so
a missed stop hook doesn't poison the next unrelated session.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 00:27:27 +02:00
..