Skip to content

fix(browser-handoff): tighten recheck backoff cap from 5 minutes to 2 - #240

Merged
convyusboy merged 2 commits into
boonfrom
ridho/browser-handoff-recheck-backoff
Sep 23, 2026
Merged

convyusboy merged 2 commits into
boonfrom
ridho/browser-handoff-recheck-backoff

Conversation

@convyusboy

@convyusboy convyusboy commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

A live end-to-end test of the browser-handoff automatic sign-in recheck flow (sign in → automatic detection → automatic profile pull → automatic customer notification, verified working in #239) took about 14 minutes from sign-in to notification. That's too long for a customer to reasonably wait without feeling like nothing is happening.

Why This Change Was Made

The recheck uses an exponential backoff (FIRST_RECHECK_DELAY_MS → doubling → capped at MAX_RECHECK_DELAY_MS) so it doesn't poll boon-core tightly while the customer is doing 2FA/CAPTCHA by hand. The previous cap was 5 minutes, giving a curve of 30s/60s/120s/240s/300s/300s/... — once the customer is actually done and only boon-core's own async profile-snapshot step is left pending, a terminal result could sit undetected for up to 5 minutes before the next poll happens to catch it.

Lowered the cap to 2 minutes: 30s/60s/120s/120s/120s/... This roughly halves the worst-case detection lag once the human-driven part of the wait is over, without meaningfully increasing poll volume over the course of a multi-minute wait (it's still the same handful of checks, just spaced closer together in the steady state).

Left unchanged:

  • FIRST_RECHECK_DELAY_MS (30s) — already fast, and asserted by an existing test (tool.test.ts).
  • MAX_TOTAL_WAIT_MS (180 minutes) — deliberately tied to Anchor Browser's own session max_duration cap (confirmed against docs.anchorbrowser.io/advanced/session-timeout), not an arbitrary guess.

User Impact

Customers using the BuildingConnected (or any) browser-handoff sign-in flow should see the automatic "you're signed in, here's your profile" follow-up land sooner on average, once they've actually finished signing in — without changing the plugin's behavior in any other way (same one-shot recheck design, same total wait cap, same fallback messaging).

Evidence

  • node scripts/run-vitest.mjs extensions/browser-handoff — 43/43 (existing tests for the backoff ordering and first-delay value are unaffected; they don't assert the cap's absolute value).
  • pnpm tsgo:core — clean.
  • oxlint + oxfmt --check on the changed file — clean.
  • Manually computed the new schedule: 30s, 60s, 120s, 120s, 120s, 120s, ... (cumulative 0.5, 1.5, 3.5, 5.5, 7.5, 9.5, 11.5, 13.5 min) vs the old 30s, 60s, 120s, 240s, 300s, 300s, ... (cumulative 0.5, 1.5, 3.5, 7.5, 12.5, 17.5 min) — confirms meaningfully tighter detection latency in the steady state.

🤖 Generated with Claude Code


Summary by cubic

Lowers the browser-handoff sign-in recheck backoff cap from 5 minutes to 2 minutes so a completed sign-in is detected sooner.

  • Polling schedule becomes 30s/60s/120s/120s/... instead of 30s/60s/120s/240s/300s/300s/..., roughly halving worst-case detection lag once the customer finishes 2FA and only boon-core's async profile snapshot remains.
  • Steady-state poll volume about doubles (one check every 2 minutes instead of every 5), a deliberate trade for catching that snapshot's terminal result sooner.
  • The first-delay and total-wait caps are unchanged.

Written for commit 4ebc130. Summary will update on new commits.

Review in cubic

Live-observed on arief-openclaw-test: a real end-to-end sign-in-to-notification
flow took ~14 minutes with the 5-minute cap (backoff curve 30s/60s/120s/240s/
300s/300s/...). Requested to shorten the customer's typical wait.

Lowering the cap to 2 minutes (30s/60s/120s/120s/120s/...) roughly halves the
worst-case staleness once the customer is done and only boon-core's own async
profile-snapshot step is left pending, without materially increasing poll
volume over a multi-minute wait. Left FIRST_RECHECK_DELAY_MS (asserted by an
existing test) and MAX_TOTAL_WAIT_MS (tied to Anchor's own session cap)
unchanged -- this only tunes the steady-state polling cadence.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@convyusboy
convyusboy requested a review from a team September 23, 2026 08:13

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread extensions/browser-handoff/src/tool.ts Resolved
… comment

cubic-dev-ai flagged: the comment said the tighter 2-minute cap avoids
"meaningfully changing total poll count", directly contradicting the same
sentence's own admission of trading "a bit more poll volume" -- and the real
number is a genuine ~2x increase in steady-state polls (one check every 2 min
instead of every 5). Reworded to state the actual interval change and own the
tradeoff plainly instead of downplaying it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@convyusboy
convyusboy enabled auto-merge (squash) September 23, 2026 10:47

@augusteo augusteo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved (via sweep backstop — original request was dropped by the gateway).

Single-constant tuning of the recheck backoff cap (5 min -> 2 min) with the comment block updated to match. Verified:

  • Backoff curve with multiplier 2 is now 30s/60s/120s/120s/... as described.
  • tool.test.ts only asserts FIRST_RECHECK_DELAY_MS (30s); nothing pins the old cap, so no test breakage.
  • MAX_TOTAL_WAIT_MS (180 min) left deliberately tied to Anchor's session cap — sound reasoning.
  • No security or correctness concerns; poll volume increase in steady state is modest and intentional.

Non-blocking suggestion: a small test pinning MAX_RECHECK_DELAY_MS would guard against future accidental regressions.

@convyusboy
convyusboy merged commit 476b3aa into boon Sep 23, 2026
137 of 140 checks passed
@convyusboy
convyusboy deleted the ridho/browser-handoff-recheck-backoff branch September 23, 2026 11:06
convyusboy added a commit that referenced this pull request Sep 28, 2026
…249)

* chore(release): bump version 2026.6.11-boon.46 -> 2026.6.11-boon.47

Root version, 135 plugin manifests synced via scripts/sync-plugin-versions.ts, changed npm-shrinkwrap.json files regenerated, CHANGELOG section for boon.47.

Shipping: #236/#239 (a plugin tool's own execute() handler can now reliably schedule/unschedule a cron-backed session turn, fixing the browser-handoff recheck across three sequential live-found bugs), #240 (recheck backoff cap tightened 5m -> 2m), #242 (recheck messages the customer before attaching the browser), #241 (delivery.mode: "none" cron jobs can deliver an explicit message-tool send), #243 (Chrome MCP stderr drained before connect, not after), #247 (distinct exec-trajectory label for boon-projects schedule append/list), ENG-20030 (shared turn-resume-instruction wording for boon-core/anychat-boon-web), #248 (Docker build no longer OOMs 8 GB CI runners).

Base = 2026.6.11-boon.46. Gateway plus @openclaw/slack, @openclaw/msteams and @openclaw/diagnostics-prometheus bumped in lockstep; no separately published plugin source changed in this train, so a gateway roll delivers all of it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(release): regenerate stale extension npm-shrinkwrap.json versions for boon.47

pnpm plugins:sync bumps each plugin's package.json version but does not touch its checked-in npm-shrinkwrap.json, so 65 published extension shrinkwraps still embedded version 2026.6.11-boon.46 despite package.json already reading boon.47. Since npm-shrinkwrap.json ships inside the npm artifact, this would have published every affected plugin with a mismatched embedded version.

Bumped the version field(s) in all 65 (plus the openclaw peerDependency range where present) to 2026.6.11-boon.47, matching the pattern boon.46's bump commit already applied to these same files.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
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