Skip to content

fix(preview): prefer visible browser for new agent leases - #767

Merged
rynfar merged 3 commits into
pylonfrom
fix/preview-visible-host-20260924
Sep 25, 2026
Merged

rynfar merged 3 commits into
pylonfrom
fix/preview-visible-host-20260924

Conversation

@rynfar

@rynfar rynfar commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

When several Pylon windows can automate a preview, a new agent session can attach to a window that does not own the visible browser tab, losing its current cookies and DOM. Hosts now report local live tabs and visibility; a fresh unbound lease prefers the visible owner of the target thread/tab. Existing live leases stay pinned, and explicit tab IDs with a known owner fail closed if that owner cannot perform the requested operation. Hosts without ownership reports retain legacy selection. This adapts upstream 894d33419dceb366eecda8e5e27c6fc043c3959e (#13064) while preserving Pylon's capability-rich host preference for multi-operation sessions.

The web host reports only tabs with local web contents, clears ownership when contents close, and retries failed focus reports on the next focus/visibility change. A server snapshot alone no longer claims an automation runtime is available.

Validation: 43 focused broker/web-host tests, scoped lint (one pre-existing React refs warning in an unchanged line), and server, web, and contracts typechecks passed. Independent review passed on the frozen diff. No live browser interaction was performed.

Refs #736.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
pylon-marketing Ignored Ignored Preview Sep 24, 2026 8:50am UTC

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.9 KiB 13.9 KiB +2 B (+0.0%) 15.1 KiB ✅
Codex Thread snapshot wire 7.2 KiB 7.2 KiB −9 B (−0.1%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.7 KiB 6.7 KiB +11 B (+0.2%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 58.0 KiB 58.0 KiB 0 B (0.0%) 66.4 KiB ✅
Codex Live turn messages 9 9 0 (0.0%) 21 ✅
Claude Total thread wire 13.9 KiB 13.9 KiB +6 B (+0.0%) 15.1 KiB ✅
Claude Thread snapshot wire 7.2 KiB 7.2 KiB +6 B (+0.1%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.7 KiB 6.7 KiB 0 B (0.0%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 58.8 KiB 58.8 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 8 8 0 (0.0%) 21 ✅

Baseline: 47bf17d · PR result: e0f29df · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 115.7 KiB
  • Claude decoded thread snapshot: 116.3 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@vercel

vercel Bot commented Sep 25, 2026

Copy link
Copy Markdown

Deployment failed for project pylon-marketing with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/pylon-code?upgradeToPro=build-rate-limit

@rynfar

rynfar commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

Adversarial review found that an existing live provider lease could route an explicit tab ID owned by another host back to its pinned host. This head rejects that mismatch without moving or dropping the lease; a regression verifies the rejection and subsequent pinned operation. Synced onto current pylon after #852; 43 focused broker/web-host tests and server, web, contracts typechecks pass. New exact-head CI is running.

@rynfar
rynfar merged commit edebab3 into pylon Sep 25, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant