Skip to content

emrg: ConnManager daemon restart recovery (GUI multi-session rant P2 slice 4) - #627

Merged
argszero merged 2 commits into
masterfrom
feature/conn-restart-recovery
Aug 10, 2026
Merged

emrg: ConnManager daemon restart recovery (GUI multi-session rant P2 slice 4)#627
argszero merged 2 commits into
masterfrom
feature/conn-restart-recovery

Conversation

@argszero

Copy link
Copy Markdown
Owner

Fourth slice of P2 (connection layer) from the GUI multi-session rant (2026-08-10T15:07:19): connManager 监听所有连接断开 → 短窗口(1s)多连接同时断 → 判定重启 → 等 daemon 就绪 → 所有 sessionConn 重连 + 重新订阅(复用 open 序列);单条断 → 独立退避重试.

Changes (emrg/gui/conn-manager.js):

  • Each session connection registers a disconnected listener on open → records disconnect timestamp
  • _restartDetected(): all currently-open sessions dropped within the restart window (default 1s) → daemon restart
  • _onDisconnect(sid): on full-window drop, auto-invokes recoverAll() (fire-and-forget with error logging); single drop → no restart detection (left to per-connection backoff, later slice)
  • recoverAll(): closes all session conns → re-opens each via the open() sequence (bootstrap daemon-ready → skipStart session connect → resume_session re-subscribe); per-session failures logged and skipped (don't block the rest); _recovering guard prevents recursion from close→disconnect→recoverAll
  • restartWindowMs configurable for tests

Tests (+3 conn-manager, 5→8): all-drop within window → restart detected + auto recoverAll (single drop does NOT trigger); single-drop never detects; recoverAll re-opens + re-subscribes all sessions (mock-driven, stale-connection exclusion to avoid false counts).

Doc counts synced 118→121 (README/README.cn/Agent). 680 pytest + 121 GUI green.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260810-161305

Verified locally: 8/8 conn-manager tests pass (restart detection both states: all-drop→auto-recover vs single-drop→none; recoverAll re-opens + re-subscribes all sessions with mock driving; stale-connection exclusion prevents false counts), 680 pytest + import + CLI + node --check green.

…c counts to 127 (37 dc + 8 cm + 22 + 32 + 15 + 7 + 3 + 3)
@pm25coder

Copy link
Copy Markdown
Contributor

I reviewed this PR (P2 slice 4 — daemon restart recovery) and found it is currently CONFLICTING with master. The conflict is purely positional in the doc-count lines: the branch base is c472a21 (pre-#626), so Agent.md/README.md/README.cn.md say `121: 31 daemon_client + 8 conn-manager + ...`, but master is now at 95cdea4 (#626 delta batching merged, 118→124), so the current totals are `124: 37 daemon_client + 5 conn-manager + ...`.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260810-162002

Conflict resolved and re-verified on the updated branch (d3c5965, merged master 95cdea4): doc counts resolved to the true 127 (37 daemon_client + 8 conn-manager + 22 + 32 + 15 + 7 + 3 + 3 — 118 base + 6 from #626 + 3 from this PR). Local verification: GUI suite 127/127 (3 new conn-manager tests: all-drop window → restart detect + auto recoverAll with single-drop negative state; single-drop never triggers; recoverAll re-opens + re-subscribes with stale-connection exclusion), 680 pytest green, doc-count guard 3/3. Design matches rant spec: short-window all-drop → restart detect → recoverAll via open() sequence; _recovering guard prevents close→disconnect recursion.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260810-162110

Re-verified on head d3c5965 (post-rebase): local GUI suite 127/127 (8/8 conn-manager tests — all-drop window triggers restart detection + auto recoverAll; single-drop negative state; recoverAll re-opens + re-subscribes both sessions with stale-connection exclusion in the mock driver), 680 pytest green (doc-count guard reads 37 dc + 8 cm + 22 + 32 + 15 + 7 + 3 + 3 = 127), node --check clean. PR CI 31369797451 SUCCESS. Merge commit correctly resolves the #626 doc-count positional conflict to the verified actual 127.

@argszero
argszero merged commit 78a2875 into master Aug 10, 2026
1 check passed
@pm25coder

Copy link
Copy Markdown
Contributor

Post-merge verification (master 78a2875, #627 merged 2026-08-10T08:24:48Z):

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