Skip to content

Keep a lone collab editor off the 2.5 s poll boost when its app picks its own tab id - #7800

Merged
steve8708 merged 2 commits into
mainfrom
collab/own-source-boost
Oct 21, 2026
Merged

steve8708 merged 2 commits into
mainfrom
collab/own-source-boost

Conversation

@3mdistal

@3mdistal 3mdistal commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Merge order

Land this after #7832, the save-request / flush-wake fix. Until that lands, the accidental poll boost removed here helps deliver flushes to editors mid-edit. Removing it first could cause flush timeouts. It merged first anyway: this PR on October 21 at 00:05 UTC, #7832 on October 22 at 04:24 UTC.

Problem

On serverless, a lone Content or Plan editor can poll the shared sync transport every 2.5 seconds while typing. These apps tag document updates with their own tab id, while core only recognized getBrowserTabId() as its own. The editor's updates therefore looked like another participant's activity and repeatedly armed the fast poll cadence.

Fix

Core records the request sources adopted by this tab's collab connections and excludes their events from collaborator activity. Sources stay in a tab-lifetime set after a connection closes, so delayed echoes cannot re-arm the boost while another document remains open. Real peers still trigger the boost. No app code or schema changes; includes a core changeset and collab skill guidance.

Verification

  • Existing regressions reproduce 12 shared polls in 30 seconds on the original implementation and at most one after the fix. Another participant still triggers the fast cadence.
  • The closed-document late-echo regression fails on the first refcounted implementation and passes at 5df6b4f7e1e.
  • Sol round 2 (gpt-6.1-sol, high) found no remaining P1/P2 at that head. Its shared-batch probe measured 0 subsequent polls in 30 seconds for an own echo and 12 for a real peer. These are fake-clock tests, not browser measurements.
  • The prior lane ran the focused 23 tests and the shared-batch probe successfully. Hosted checks are green on 5df6b4f7e1ed95f68e83f793c9aafb655efe9f98.

Measurement

One signed-in tab, alone on a document, typed a character every 250 ms for 120 s and then sat idle for 130 s. It ran in a local production Content build in serverless mode (NODE_ENV=production with AWS_LAMBDA_FUNCTION_NAME set), where the authenticated /events?poll_live=1 returned 204. Requests were counted from the browser's network log.

  • Before: main at 1d31d71a531a with this PR's two core files reverse-applied.
  • After: main as is. The page was confirmed to load the rebuilt chunk containing the own-source check.

Each cell shows before → after, as requests per minute.

Minute Shared transport polls Collab connection polls Update POSTs (all 200)
Typing, 1st 20 → 0 5 → 5 239 → 239
Typing, 2nd 23 → 0 5 → 5 240 → 240
Idle, 1st 23 → 1 5 → 5 1 → 1
Idle, 2nd 5 → 1 5 → 5 0 → 0
  • Before: the shared transport polled every 2.5 s from the collab poll after typing began until about 70 s after the last keystroke. Then it fell back to its 60 s idle cadence; the 5 polls in the second idle minute are that tail.
  • After: it stayed on the 60 s cadence throughout.
  • Collab connection: its own poll ran every 12 s in both builds.

Flush-request delivery latency was not measured.

builder-io-integration[bot]

This comment was marked as outdated.

@builder-io-integration builder-io-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builder reviewed your changes — looks good ✅

Review Details

Incremental Code Review Summary

This update changes own-source tracking from a refcounted registry to a tab-lifetime Set, retaining a collab connection's source after disposal so late echoes do not trigger the poll boost while another doc remains open. The new regression test exercises that late-echo case, addressing the disposal/late-event concern from the previous review. The current call sites use per-tab sources, and the Set is cleared in the test reset path; I found no confirmed runtime defects. This remains standard risk because it affects shared client sync behavior. The PR description still calls out its merge dependency on L4's flush-wake change; preserve that merge order.

Finding

  • 🟡 LOW — The late-echo test does not reuse the source across docs. The closed doc and remaining doc use different request sources, so the test does not lock in the behavior for multiple open docs sharing one tab source. This is a test-coverage gap only; the current Set implementation handles it.

🧪 Browser testing: Skipped — the browser-test-planner agent is unavailable in this environment.

@steve8708
steve8708 merged commit 70e6f58 into main Oct 21, 2026
76 checks passed
@steve8708
steve8708 deleted the collab/own-source-boost branch October 21, 2026 00:05
@github-actions

Copy link
Copy Markdown
Contributor

Here's a visual recap of what changed:

Visual recap

Open the full interactive recap

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.

2 participants