Skip to content

emrg: ConnManager open/close/get — GUI multi-session rant P2 slice 2 - #624

Merged
argszero merged 1 commit into
masterfrom
feature/conn-manager
Aug 10, 2026
Merged

emrg: ConnManager open/close/get — GUI multi-session rant P2 slice 2#624
argszero merged 1 commit into
masterfrom
feature/conn-manager

Conversation

@argszero

Copy link
Copy Markdown
Owner

Second slice of P2 (connection layer) from the GUI multi-session rant (2026-08-10T15:07:19): new ConnManager module — the daemon-lifecycle owner with one DaemonClient per open session (each session = one independent websocket connection, aligned with the TUI multi-open model).

Newemrg/gui/conn-manager.js:

  • open(sid, projectPath): bootstrap ensureConnected() (daemon lifecycle owner — spawn if missing, connect if running, then close the bootstrap) → new DaemonClient → ensureConnected({ skipStart: true }) (only connects to the now-running daemon) → resume_session(sid, cwd=projectPath) auto-subscribes → store. Already-open sid → reuse (no duplicate connection, per P4 semantics).
  • close(sid) / get(sid) / all() / closeAll(): disconnect + remove, route, list, teardown.
  • main.js is NOT rewired yet (single-session no-regression target lands with the rewire slice); this establishes the open/close/get contract with unit tests.

Tests (+5 conn-manager, GUI 111→116): open bootstraps daemon + skipStart session + resume_session payload {session_id, cwd}; same-sid reuse (no second resume_session); get null for unopened; close disconnects + removes + double-close false; closeAll.

Doc counts synced (README/README.cn/Agent). 680 pytest + 116 GUI green.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260810-154529

Verified locally: 5/5 conn-manager tests pass (bootstrap→skipStart→resume_session flow with payload assertions; same-sid reuse; close semantics; closeAll), full GUI suite 116 (29 dc + 5 cm + 22 + 32 + 15 + 7 + 3 + 3), 680 pytest + import + CLI + node --check all green.

@argszero
argszeroforce-pushed the feature/conn-manager branch from 79256f9 to d15ba3dCompareAugust 10, 2026 07:56

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260810-155346

Verified on feature/conn-manager (rebase-conflict resolved onto master 2a202ec; doc counts corrected to the true rebased value):

  • Full GUI suite: 118 passed / 0 failed (31 daemon_client + 5 conn-manager + 22 app-commands + 32 renderer smoke + 15 i18n + 7 integration + 3 commands + 3 build-config — counts verified against the actual run).
  • Full pytest: 680 passed; import check OK.
  • All 5 conn-manager tests pass: open bootstraps daemon + skipStart session + resume_session payload {session_id, cwd}; same-sid reuse (no duplicate resume_session); get null for unopened; close disconnects+removes+double-close false; closeAll.
  • Design check: _ensureDaemon bootstrap then closes; session conns use ensureConnected({ skipStart: true }) (never spawn — matches #623 contract); port-file isolation guard present in test harness. main.js not rewired yet (contract slice only) — as stated.
  • No workflow changes.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260810-155914

Re-verified on current state: head d15ba3d unchanged since cycle 155346 review (rebase-conflict resolved onto master 2a202ec, doc counts 118 verified against actual 118/118 npm test run; pytest 680; import OK). PR CI 31367938221 SUCCESS, mergeable. 3 consecutive ✅ from distinct cycles (154529 / 155346 / 155914), no ❌ — merge condition met.

@argszero
argszero merged commit 511e6d7 into masterAug 10, 2026
1 check passed
@pm25coder

Copy link
Copy Markdown
Collaborator

I tested this PR on Windows (zh-CN): checked out feature/conn-manager, ran `npm test` in emrg/gui → 118 pass / 0 fail (including the 5 new conn-manager tests), and `uv run pytest tests/` → 625 passed + 55 skipped = 680. The ConnManager contract works as described: open() bootstraps the daemon then connects the session with skipStart, resume_session carries {session_id, cwd}, same-sid reuse skips a second resume_session, close disconnects + removes, double-close returns false, closeAll empties the map.

Sign up for freeto 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

@argszero@pm25coder