Skip to content

feat: tab assignment persistence, lifecycle hooks, and extension relay#1

Open
lark1115 wants to merge 3 commits intomainfrom
feat/tab-assignment-rust
Open

feat: tab assignment persistence, lifecycle hooks, and extension relay#1
lark1115 wants to merge 3 commits intomainfrom
feat/tab-assignment-rust

Conversation

@lark1115
Copy link
Copy Markdown
Owner

Summary

  • Tab assignment persistence: New tab_assignments.rs module with TabAssignmentsFile / TabAssignment types, atomic temp+rename writes, flock-based CAS for multi-daemon safety, session name validation against path traversal
  • Browser lifecycle hooks: Restore persisted tab on reconnect (match by target_id → URL → title → index), persist on tab new/switch/close/discovery, shutdown-safe flush with is_shutting_down guard
  • Extension relay connection mode: WebSocket handshake stub for per-tab scoped CDP via Chrome extension relay, with 10s timeout. Sends session identity (sessionName, sessionId, profileId, agentId) for tab reclaim
  • CLI flags: --connection-mode, --relay-url, --profile-id, --profile-directory, --persist-tab-assignment, --agent-id
  • Refactored CDP connect: Split into resolve_cdp_url() + attach_connected_browser() for relay reuse. Relaxed profile+CDP restriction for extension-relay mode

Test plan

  • cargo build passes
  • 6 unit tests pass (roundtrip, default read, CAS rejection, invalid session name, status enum roundtrip, dotfile temp pattern)
  • Cross-reviewed by Claude agent via cmux-review-board (2 rounds, all must-fixes addressed)
  • Manual E2E: launch with --persist-tab-assignment, disconnect, reconnect — verify same tab restored
  • Manual E2E: two agents with different --agent-id connecting to same profile — verify independent tab assignments

🤖 Generated with Claude Code

lark1115 and others added 2 commits March 19, 2026 10:53
…relay support

- Add tab_assignments.rs with persistence primitives, CAS write guard,
  and atomic temp+rename writes
- Add restore/persist hooks in BrowserManager for tab lifecycle events
  (new, switch, close, target discovery/destruction)
- Add shutdown-safe flush with is_shutting_down guard
- Add extension relay connection mode with WebSocket handshake stub
- Add CLI flags: --connection-mode, --relay-url, --profile-id,
  --profile-directory, --persist-tab-assignment, --agent-id
- Refactor CDP connect into reusable resolve_cdp_url + attach_connected_browser
- Relax profile+CDP validation for extension-relay mode
- Store relay handshake metadata for first-attach persistence

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lark1115 lark1115 force-pushed the feat/tab-assignment-rust branch from 3a60f74 to 4f13dbc Compare March 19, 2026 01:54
@lark1115 lark1115 force-pushed the feat/tab-assignment-rust branch from 4f13dbc to 10dc457 Compare March 19, 2026 03:05
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.

1 participant