Skip to content

fix(relay): Live Activity leaves Connecting when the agent starts working - #15349

Open
techparamveer wants to merge 1 commit into
pingdotgg:mainfrom
techparamveer:fix/relay-live-activity-phase-delivery
Open

techparamveer wants to merge 1 commit into
pingdotgg:mainfrom
techparamveer:fix/relay-live-activity-phase-delivery

Conversation

@techparamveer

@techparamveer techparamveer commented Oct 3, 2026 •

Copy link
Copy Markdown

Fixes #12668

Problem

Accepted bug #12668. After a provider session boots, the environment publishes starting and then running a few seconds later, and stays silent while the phase holds. The relay throttles Live Activity updates to one per 15s unless activeCount changed, a row needs attention, or a row went terminal. starting → running keeps activeCount at 1 and is not attention or terminal, so the running update is suppressed and never retried. The lock-screen card stays on Connecting for the whole turn even though an agent is working.

Julius confirmed this in triage and asked for a small relay PR that exempts phase changes and adds a starting→running regression.

#12699 and #12798 already attempt this. This PR is the same suggested fix on current main (not stacked on #12029), with the verification evidence requested on #12798.

Change

shouldUpdateLiveActivity now also delivers when any row entered, left, or changed phase. Timestamp and ordering churn stay throttled. rowPhasesChanged lives next to newlyTerminalRows and reuses the same row identity.

Regression: a delivered starting aggregate followed by a running aggregate 4s later queues live_activity_update.

Scope and approval

One problem: #12668, accepted and triaged. The change matches the suggested fix in the triage comment. No mobile, contract, or Android FCM change.

Verification

On macOS, Node 24.21.0, at this head (based on main @ a21702d0e).

Before the production change, the new test failed:

vp test run src/agentActivity/ApnsDeliveries.test.ts -t "queues an update inside the throttle window when a row changes phase"

Result: expected undefined to be 'live_activity_update'. sendForTarget returned null, so the running update was throttled away.

After the change:

vp test run src/agentActivity/ApnsDeliveries.test.ts

Result: Test Files 1 passed (1), Tests 51 passed (51).

Focused checks:

  • starting→running inside the 15s window: 1 passed
  • timestamp-only churn still suppressed (throttles updates for changed aggregates with stable counts): 1 passed
vp run typecheck

Result: tsc --noEmit exited 0 and printed no diagnostics.

Could not send through APNs or a physical iPhone Live Activity.

…indow

starting→running was dropped by the 15s throttle and never retried, so iOS cards stayed on Connecting while agents worked.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 3, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 3, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 7a45828

Macroscope's review found this PR approvable — This is a narrowly scoped relay bug fix that delivers existing Live Activity phase transitions without weakening throttling for timestamp-only updates. It adds focused regression coverage and does not alter schemas, defaults, deployment, or sensitive code.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

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

@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2cd51ec6-5e73-4a24-a639-1ab5f6af79d5
📥 Commits

Reviewing files that changed from the base of the PR and between a21702d and 7a45828.

📒 Files selected for processing (3)
  • infra/relay/src/agentActivity/ApnsDeliveries.test.ts
  • infra/relay/src/agentActivity/ApnsDeliveries.ts
  • infra/relay/src/agentActivity/agentActivityAlerts.ts

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


📝 Walkthrough

Walkthrough

Live Activity delivery now bypasses the 15-second throttle when aggregate activity counts or row phases change. A test covers a transition from starting to running within the throttle window.

Changes

Live Activity phase updates

Layer / File(s) Summary
Detect and deliver phase changes
infra/relay/src/agentActivity/agentActivityAlerts.ts, infra/relay/src/agentActivity/ApnsDeliveries.ts, infra/relay/src/agentActivity/ApnsDeliveries.test.ts
rowPhasesChanged detects differences in activity counts or matching rows’ phases. shouldUpdateLiveActivity uses this helper to bypass the delivery throttle. A test checks that a running phase with Working status is queued within the throttle window.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 7a458

Live Activity phase and row changes can receive timely updates, while other changes remain throttled. No merge-blocking issue was identified.

Architecture Summary

Architecture risk: 🟡 Medium · up to 7a458

The change affects 1 system.

Changed systems: infra

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — infra (service) was modified; 3 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in infra/relay/src/agentActivity/ApnsDeliveries.test.ts: Adds a test where a starting aggregate was delivered at time 0 and a changed running aggregate is submitted at 4,000 ms. It expects a live_activity_update job containing the running phase and Working status, with no delivery attempts recorded.
  • observed — Modified behavior in infra/relay/src/agentActivity/ApnsDeliveries.ts: The rowPhasesChanged helper is added to the imports from agentActivityAlerts.ts.
  • observed — Modified behavior in infra/relay/src/agentActivity/ApnsDeliveries.ts: shouldUpdateLiveActivity now returns true when row phases changed, so phase transitions are not suppressed by the delivery interval; other changes continue through the existing throttle check.
  • observed — Modified behavior in infra/relay/src/agentActivity/agentActivityAlerts.ts: Added exported rowPhasesChanged, which reports a change when activity counts differ or a next-aggregate row has a different phase from the previous row with the same key.

Reliability and maintainability

  • inferred — Risk-relevant change factors for infra: blast_radius_1; direct_dependents_1
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the Live Activity fix: it leaves “Connecting” when the agent starts working.
Description check ✅ Passed The description covers the problem, change, scope and approval, and focused verification. It reports test results and states that APNs and physical-device testing could not be performed.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@maria-rcks

Copy link
Copy Markdown
Collaborator

Note

Written by claude-opus-5-5 on behalf of Maria

Hi! We are cleaning up open PRs, and this one does not say which model or harness was used to create it. If this change is really important, we recommend rebuilding the PR with a newer model and noting the model and harness in the PR description.

@maria-rcks maria-rcks closed this Oct 11, 2026
@maria-rcks

Copy link
Copy Markdown
Collaborator

Note

Written by claude-opus-5-5 on behalf of Maria

Reopening, this was closed by mistake. Sorry for the noise!

@maria-rcks maria-rcks reopened this Oct 11, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 11, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 11, 2026 06:07

Dismissing prior approval to re-evaluate 7a45828

This branch has not been deployed

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

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: iOS Live Activity stays on Connecting because the relay throttles the running update

3 participants