Skip to content

emrg: gui: fix open-session button for task session IDs + full-chain switch logging - #958

Merged
argszero merged 1 commit into
masterfrom
feature/gui-session-open-fix
Aug 24, 2026
Merged

emrg: gui: fix open-session button for task session IDs + full-chain switch logging#958
argszero merged 1 commit into
masterfrom
feature/gui-session-open-fix

Conversation

@argszero

Copy link
Copy Markdown
Owner

What

Fixes the GUI task panel "Open session" (打开会话) button, which always failed for fixed task sessions, and adds full-chain logging across the switch-session path for future troubleshooting.

Root cause: daemon_client.js SESSION_ID_RE only accepted interactive session IDs (s_<6-digit date>_<4-digit time>_<hex id>), so fixed task session IDs like emrg-evolution-<task-name> were rejected with invalid session_id — the "Open session" button could never work for task sessions.

Changes (6 files)

  1. daemon_client.js — widened SESSION_ID_RE to also accept emrg-evolution-<task-name> (fixed task session IDs). Both forms flow through the GUI switchSession/打开会话 path and are now accepted.
  2. main.jsemrg:switchSession now logs every entry point: request, rejections (invalid id / invalid project path / cap exceeded / own stream busy), prev→target switch, open success/failure with error, session-not-found fallback. Added an emrg:log IPC bridge (level whitelist, 2000-char truncation) so the renderer writes into the same ~/.emrg/emrg-gui.log timeline as main.
  3. preload.js — exposed emrg.log(level, msg) bridge to the renderer.
  4. renderer/js/app.js — switchSession/switchView now log enter/abort/IPC call/return/exception/view transitions.
  5. renderer/js/dialogs.js — task panel open-session click path logs: click, missing session_id skip, switchSession call/resolve/throw.
  6. conn-manager.jsopen() logs start/reuse/create/connected/resume send/OK/FAILED, so connection-level failures are visible in the log chain.

Verification

  • GUI unit tests: 252 pass, 0 fail, 8 skipped (npm test in emrg/gui/)
  • Full pytest: 1039 passed, 1 skipped (unchanged, no daemon-side impact)

Rant: 2026-08-24T14:29:37 (GUI 任务管理「打开会话」按钮失效 — SESSION_ID_RE 正则拒绝任务会话 ID + 全链路日志排障)

@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 180730

Re-verified: head f904d42 unchanged, MERGEABLE/CLEAN, CI green (test + test-windows). Reviewed all 6 GUI files: SESSION_ID_RE widened to accept emrg-evolution-* task session IDs (root-cause fix), plus full-chain logging (conn-manager open path, switchSession entries/rejections, emrg:log IPC bridge with level whitelist + 2000-char truncation, renderer click chain). Local: GUI 252 pass / 0 fail, pytest 1039 pass / 1 skip.

@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 181352

Re-verified: head f904d42 unchanged, MERGEABLE/CLEAN, CI green (test + test-windows). Code re-read: SESSION_ID_RE now accepts both s_... and emrg-evolution-* forms; full-chain logging covers open/reuse/create/connected/resume/FAILED plus switch entries/rejections and renderer clicks via the emrg:log bridge. No issues found — LGTM.

@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 182004 (3/3)

Re-verified: head f904d42 unchanged, MERGEABLE/CLEAN, CI green (test + test-windows). Three consecutive LGTMs from different cycles (180730/181352/182004), no ❌ in between. Merge approved.

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