Skip to content

emrg: GUI renderer sessionsBySid state table — P3 slice 1 (GUI multi-session rant P3) - #632

Merged
argszero merged 1 commit into
masterfrom
feature/gui-p3-sessions-bysid
Aug 10, 2026
Merged

emrg: GUI renderer sessionsBySid state table — P3 slice 1 (GUI multi-session rant P3)#632
argszero merged 1 commit into
masterfrom
feature/gui-p3-sessions-bysid

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Second slice of P3 (multi-container chat views) from the GUI multi-session rant (2026-08-10T15:07:19): renderer per-session state table (sessionsBySid). This is the rant's renderer state 改造 step — global busy/ownStreamRequestId/mode become live views of the active session's entry, so events routed by sid (from #629/#630) update the correct session without touching others. Fully backward-compatible.

Changes

renderer/js/app.js

  • state.sessionsBySid: Map<sid, {busy, ownStreamRequestId, mode, autoScroll}> — get-or-create via sidState(sid)
  • state.busy / state.ownStreamRequestId / state.mode redefined via Object.defineProperty getters/setters delegating to the active session's entry — all existing call sites (sendMessage, switchSession G65 gate, delete-session guards) work unchanged
  • handleEvent done / cancelled / disconnected / error now release the event-sid entry's lock (background session's broadcast done / cancelled / error no longer clears the active session's busy); composer re-enable only when the event belongs to the active session (or sid absent)
  • switchSession no longer clears the marker on switch — each session's entry keeps its own state (P4: switching back resumes mid-stream generation per rant acceptance)

Tests

  • renderer.smoke 36→40 (+4): busy/ownStreamRequestId route to active-session entry (get-or-create); switching sessionId moves the state pointer (entries independent); done with sid releases only that sid's entry (background done doesn't clear active; active done + composer re-enable); cancelled with sid scoped, no-sid falls back to active
  • GUI 146→150 (43 dc + 17 cm + 40 renderer smoke + 22 + 15 + 7 + 3 + 3); 680 pytest green (doc-count guard); node --check clean
  • No overlap with other open PRs; builds on emrg: GUI renderer per-session chat state isolation — P3 slice 0 (GUI multi-session rant P3) #630's chat isolation

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

Verified locally on the PR head: GUI suite 150/150 (40 renderer smoke — active-entry routing via defineProperty getters, per-sid busy isolation on switch, done/cancelled/disconnected/error release the event-sid entry with active-composer re-enable only for the active session; all 146 pre-existing green = zero regression), 680 pytest green (doc-count guard 150 breakdown), node --check clean. Matches rant P3: renderer sessionsBySid state table with two-layer split (renderer UI state per sid; main DaemonClient = connection-layer state).

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

Verified locally on the PR head: GUI suite 150/150 (40 renderer smoke — busy/ownStreamRequestId route to the active-session entry via defineProperty getters (get-or-create); switching sessionId moves the state pointer with entries independent; done with sid releases only that sid's entry (background done doesn't clear active; active done + composer re-enable); cancelled scoped by sid with no-sid fallback to active; disconnected/error release the event-sid entry), 680 pytest green, doc-count guard passes (150 = 43 dc + 17 cm + 40 renderer smoke + 22 + 15 + 7 + 3 + 3 synced in Agent.md/README/README.cn), node --check clean.

Code review: sessionsBySid Map with defineProperty delegation keeps all existing call sites (sendMessage, switchSession G65 gate, delete guards) working unchanged; event-sid lock release is correctly scoped (background broadcast done no longer clears active busy); switchSession no longer clears the marker so each session keeps its own state (P4: switching back resumes mid-stream). Matches the rant's renderer state 改造 step; builds cleanly on #630's chat isolation.

@pm25coder

Copy link
Copy Markdown
Contributor

Tested branch `feature/gui-p3-sessions-bysid` (2fb904a) locally — full suite 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-171645

Re-verified on head 2fb904a (master unchanged): GUI suite 150/150 (40 renderer smoke — active-entry routing via defineProperty getters, per-sid busy isolation on switch, done/cancelled/disconnected/error release the event-sid entry with active-composer re-enable only for active-session events, no-sid falls back to active), 680 pytest green (doc-count guard 150 breakdown), node --check clean. PR CI 31373700416 SUCCESS. Matches rant P3 renderer-state step: per-sid UI state table, connection-layer state stays in main DaemonClient (two-layer split).

@argszero
argszero merged commit 966dbb0 into master Aug 10, 2026
1 check passed
@pm25coder

Copy link
Copy Markdown
Contributor

Post-merge verification on master 966dbb0:

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