fix(bridges): bump idle timeout to 6h + slow-poll after 10min silence#36
Merged
Merged
Conversation
Screenshot from Jaden showed a Failed frame fire at exactly 30:06 in a turn where the agent had legitimately done 4 tools + emitted multiple narration blocks, then went into a thinking phase where /history stopped reporting fresh events for 30 min. PR #35's 30-min idle cap was too aggressive. **Two changes (both bridges):** #1 `IDLE_TIMEOUT_MS` 30 min → 6 hours. Long thinking phases + waiting- on-user scenarios fit comfortably; truly abandoned watchers still get reaped instead of polling forever. The dispatch + auto-cleanup paths already handle the orphan case; this just gives them more room. #2 New `SLOW_POLL_THRESHOLD_MS` (10 min) + `SLOW_POLL_INTERVAL_MS` (30s). After 10 min of silence the alarm interval drops from 180ms to 30s — saves CF Worker invocations, KV reads, and Replicas /history calls during agent thinking phases. When events resume, the next tick notices and cadence snaps back to 180ms. Net: heavy ops + long thinking work unchanged; idle phases cost ~99% less; orphan detection still works on a 6-hour horizon. **Validation** - Matrix: 173/173 ✅ · typecheck clean · deployed `9db5e005` - Telegram: 99/99 ✅ · typecheck clean · deployed `1a87a434` Co-Authored-By: itsablabla <itsablabla@users.noreply.github.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
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
Screenshot showed a Failed frame at 30:06 in a turn where the agent had legitimately done 4 tools + multiple narration blocks, then went into a thinking phase where
/historystopped reporting fresh events for 30 min. PR #35's 30-min idle cap was too aggressive.Two changes (both bridges)
#1
IDLE_TIMEOUT_MS30 min → 6 hoursLong thinking phases + waiting-on-user scenarios fit comfortably; truly abandoned watchers still get reaped instead of polling forever. Dispatch + auto-cleanup paths already handle the orphan case; this just gives them more room.
#2 Slow-poll after 10 min silence
New
SLOW_POLL_THRESHOLD_MS(10 min) +SLOW_POLL_INTERVAL_MS(30s). After 10 min of silence the alarm interval drops from 180ms to 30s — saves CF Worker invocations, KV reads, and Replicas/historycalls during agent thinking phases. When events resume, the next tick notices and cadence snaps back to 180ms.Net
Heavy ops + long thinking work unchanged; idle phases cost ~99% less; orphan detection still works on a 6-hour horizon.
Validation
9db5e0051a87a434Test plan
Workspace · Slack Thread