Skip to content

fix(server): keep relay catch-up requests working after startup - #22138

Closed
saphid wants to merge 2 commits into
pingdotgg:mainfrom
saphid:fix/relay-repeat-catchup-20261020
Closed

saphid wants to merge 2 commits into
pingdotgg:mainfrom
saphid:fix/relay-repeat-catchup-20261020

Conversation

@saphid

@saphid saphid commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

After the startup activity snapshot succeeds, the relay catch-up consumer exits. Later requests caused by relinking or changing publication preferences remain queued, so active threads are not republished until another thread event occurs.

Keep the consumer alive and parked on its request queue after a successful snapshot. Explicit catch-up requests resume it; existing retry backoff stays in place and successful idle environments do not poll.

Verification: the added regression fails before the fix (one snapshot instead of two). All 33 AgentAwarenessRelay tests pass with the fix, including re-enabling publication, credential changes, and ten minutes of virtual idle with no extra snapshots or secret reads. Targeted lint and format pass. No live relay was used; the test proves consumer lifetime through the service harness.

Model: GPT-6.1-sol. Harness: Codex in T3 Code.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 20, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at e0108ba

Macroscope's review found this PR approvable — This is a focused relay bug fix that keeps the existing catch-up worker alive for explicit relink or preference-change requests, without introducing idle polling or schema changes. A targeted regression test covers repeated catch-up and credential updates.

Notes:

  • All code in this push has already been reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

Only developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 9b3ff3f and e0108ba.

📒 Files selected for processing: 2
  • apps/server/src/relay/AgentAwarenessRelay.test.ts
  • apps/server/src/relay/AgentAwarenessRelay.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 542649db-ff14-42a6-b359-5ed5b8226ef8
📥 Commits

Reviewing files that changed from the base of the PR and between e32814e and 9b3ff3f.

📒 Files selected for processing: 2
  • apps/server/src/relay/AgentAwarenessRelay.test.ts
  • apps/server/src/relay/AgentAwarenessRelay.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

📝 Walkthrough

The relay now retries active-thread snapshot publication until it succeeds, then waits for an explicit catch-up request before publishing again. Startup starts the loop, and tests cover catch-up behavior and the absence of idle polling.

Changes: Active-thread snapshot catch-up

Layer / File(s) Summary
Reconcile active-thread snapshots
apps/server/src/relay/AgentAwarenessRelay.ts, apps/server/src/relay/AgentAwarenessRelay.test.ts
The relay retries snapshot publication until success, then waits for an explicit catch-up request. Startup launches the loop. Tests cover disabled publishing, re-enabling publishing, credential rotation, and no polling during ten minutes without requests.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 9b3ff

Active-thread snapshots now keep reconciling after a successful startup snapshot, resuming on relink or preference changes without polling while idle. No merge-blocking risk was identified.

Architecture risk: 🔵 Low · up to 9b3ff

The change affects 1 system.

Changed systems: apps/server

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — apps/server (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in apps/server/src/relay/AgentAwarenessRelay.test.ts: Added coverage for startup and explicitly requested catch-up: one snapshot read occurs at startup, disabled publishing prevents additional reads, re-enabling publishing and rotating credentials each permit another catch-up, and advancing ten minutes without requests performs no polling.
  • observed — Modified behavior in apps/server/src/relay/AgentAwarenessRelay.ts: Removed the local activeSnapshotPublishedRef state used to stop active-thread snapshot publishing after the first successful snapshot.
  • observed — Modified behavior in apps/server/src/relay/AgentAwarenessRelay.ts: Replaced the one-shot publishActiveThreadsOnceWhenConfigured loop with a continuous reconciliation loop. Successful snapshots now reset the unlinked backoff, wait for catchUpRequests, and rerun; failed or unlinked states continue retrying with the existing 5-second base delay and capped 60-second unlinked backoff.
  • observed — Modified behavior in apps/server/src/relay/AgentAwarenessRelay.ts: Startup now forks publishActiveThreadsWhenConfigured instead of the removed one-shot snapshot publisher.
Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly identifies the server relay catch-up fix and matches the primary change.
Description check Passed The description clearly explains the problem, the fix, and focused verification results. It does not use the template headings or provide explicit scope and approval details, but the content is otherw…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the problem, the fix, and focused verification results. It does not use the template headings or provide explicit scope and approval details, but the content is otherwise sufficiently complete for this focused bug fix.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@macroscopeapp
macroscopeapp Bot dismissed their stale review October 23, 2026 07:19

Dismissing prior approval to re-evaluate e0108ba

Copy link
Copy Markdown
Member

Closing in favour of #25201, which makes the same change. Thanks for the work here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants