Skip to content

fix: give agent-observer sub a replay-capable limit#1100

Merged
wpfleger96 merged 2 commits into
mainfrom
duncan/observer-replay-limit
Jun 17, 2026
Merged

fix: give agent-observer sub a replay-capable limit#1100
wpfleger96 merged 2 commits into
mainfrom
duncan/observer-replay-limit

Conversation

@wpfleger96

Copy link
Copy Markdown
Collaborator

Under WARP VPN churn, an agent's active-timer badge sometimes never appeared for a turn that was genuinely in progress: the agent kept working and the turn eventually finished, but the badge was missing the whole time.

The active-agents badge is purely event-driven — activeAgentTurnsStore derives every turn from turn_started / turn_completed / turn_liveness observer frames. The relay client already does gap-recovery on reconnect: it replays each live REQ with a since window to backfill events missed during a drop. The agent-observer subscription opted out of that recovery by passing limit: 0, which the relay's historical path correctly truncates to zero rows (NIP-01: limit 0 means "no historical results"). So on reconnect the observer REQ matched the gap window and was then truncated to nothing — a turn_started that fired mid-drop never re-delivered, and the badge never showed.

The cause is one-sided: the observer sub is the only reconnect-dependent subscription that opted out of replay. The fix mirrors the proven subscribeToChannelLive pattern — a replay-capable limit: 1000 (which clamps cleanly at the DB's max_limit.unwrap_or(1000) cap), with since: now unchanged so launch-time history stays suppressed and only the reconnect replay window changes. Re-delivered frames are idempotent against the store's (timestamp, seq) watermark, so there is no double-count.

A regression-guard test asserts subscribeToAgentObserverFrames requests limit: 1000; store idempotency under replay is already covered by activeAgentTurnsStore.test.mjs.

npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 and others added 2 commits June 17, 2026 18:58
The observer live subscription used limit:0, which the relay's historical path truncates to LIMIT 0 (NIP-01: limit 0 = no rows). On reconnect, the client replays each live REQ with a since window to backfill the gap, but limit:0 truncated that replay to zero — so a turn_started fired during a network drop never re-delivered and the active-agents badge never appeared. Mirror subscribeToChannelLive's limit:1000; since:now still suppresses launch history, only reconnect replay changes.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
The fix's correctness rests on two properties: limit:1000 (reconnect replay can recover missed frames) and since:now (launch history stays suppressed). The guard asserted only the limit, so a future edit dropping since:now would reintroduce up-to-1000 rows of launch backfill while the test stayed green. Pin both halves of the contract.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96 wpfleger96 merged commit 959fc6e into main Jun 17, 2026
23 checks passed
@wpfleger96 wpfleger96 deleted the duncan/observer-replay-limit branch June 17, 2026 23:21
tlongwell-block pushed a commit that referenced this pull request Jun 18, 2026
…te-response

* origin/main: (194 commits)
  Fold agent core memory into the session system prompt (#1112)
  feat(cli): add patches and issues commands for NIP-34 git collaboration (#1073)
  fix(desktop): stop random timeline message loss + page reconnect replay (#1105)
  Update README.md
  fix(desktop): keep thread replies from scrolling channel (#1109)
  fix(buzz-acp): accept siblings under allowlist author gate (#1108)
  feat(deploy): add production Helm chart for Buzz (#990)
  fix(desktop): keep MembersSidebar input usable while an add is in flight (#1106)
  chore(release): release version 0.3.25 (#1102)
  fix(desktop): stop dimming deferred message lists (#1104)
  Smooth channel loading: single-surface timeline state machine (#1099)
  feat: surface base + persona system prompts in observer feed (#1103)
  ci: move reminder e2e to a dedicated backend-integration job (#1098)
  fix: give agent-observer sub a replay-capable limit (#1100)
  fix: make managed-agent spawn and teardown portable to Windows (#1097)
  fix(desktop): constrain message timeline width with min-w-0 (#1092)
  feat(desktop): reminders notifications, snooze, overlay, and inbox view mode (#1093)
  feat(prompt): add memory hygiene and hoist universal engineering discipline to base prompt (#1085)
  fix(desktop): correct thread-unread badge flicker, stale clear, phantom count, mention gate, and nested count (#1080)
  Fix mention chip alignment (#1094)
  ...

# Conflicts:
#	crates/buzz-cli/src/commands/workflows.rs
tlongwell-block pushed a commit that referenced this pull request Jun 18, 2026
…te-response

* origin/main: (194 commits)
  Fold agent core memory into the session system prompt (#1112)
  feat(cli): add patches and issues commands for NIP-34 git collaboration (#1073)
  fix(desktop): stop random timeline message loss + page reconnect replay (#1105)
  Update README.md
  fix(desktop): keep thread replies from scrolling channel (#1109)
  fix(buzz-acp): accept siblings under allowlist author gate (#1108)
  feat(deploy): add production Helm chart for Buzz (#990)
  fix(desktop): keep MembersSidebar input usable while an add is in flight (#1106)
  chore(release): release version 0.3.25 (#1102)
  fix(desktop): stop dimming deferred message lists (#1104)
  Smooth channel loading: single-surface timeline state machine (#1099)
  feat: surface base + persona system prompts in observer feed (#1103)
  ci: move reminder e2e to a dedicated backend-integration job (#1098)
  fix: give agent-observer sub a replay-capable limit (#1100)
  fix: make managed-agent spawn and teardown portable to Windows (#1097)
  fix(desktop): constrain message timeline width with min-w-0 (#1092)
  feat(desktop): reminders notifications, snooze, overlay, and inbox view mode (#1093)
  feat(prompt): add memory hygiene and hoist universal engineering discipline to base prompt (#1085)
  fix(desktop): correct thread-unread badge flicker, stale clear, phantom count, mention gate, and nested count (#1080)
  Fix mention chip alignment (#1094)
  ...

Co-authored-by: Tyler Longwell <tlongwell@squareup.com>
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>

# Conflicts:
#	crates/buzz-cli/src/commands/workflows.rs
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.

1 participant