Skip to content

fix(bridges): bump idle timeout to 6h + slow-poll after 10min silence#36

Merged
replicas-connector[bot] merged 1 commit into
mainfrom
fix/idle-timeout-tuning
May 30, 2026
Merged

fix(bridges): bump idle timeout to 6h + slow-poll after 10min silence#36
replicas-connector[bot] merged 1 commit into
mainfrom
fix/idle-timeout-tuning

Conversation

@replicas-connector

Copy link
Copy Markdown
Contributor

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 /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. 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 /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

Test plan

  • Typecheck + tests + deploy
  • Smoke: turn that thinks silently for 30+ min should no longer Fail
  • Smoke: confirm cadence is fast (~180ms) during active phases and slow (~30s) after 10 min silence

Created by Jaden (jadengarza@pm.me) with Replicas
Workspace  ·  Slack Thread

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>
@capy-ai

capy-ai Bot commented May 30, 2026

Copy link
Copy Markdown
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.

@replicas-connector replicas-connector Bot merged commit c37e2c7 into main May 30, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants