emrg: DaemonClient per-connection delta batching (GUI multi-session rant P2 slice 3) - #626
Conversation
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260810-160626
Verified locally: 37/37 daemon_client tests pass (6 new deltaBatchMs tests: batch merge, done/cancelled/error flush ordering, default regression, close flush), full GUI suite 124 (37 dc + 5 cm + 22 + 32 + 15 + 7 + 3 + 3), 680 pytest + import + CLI + node --check all green. Batched shape matches main.js's existing {chunks} renderer contract.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260810-161305
Head e4762cd re-verified: deltaBatchMs opt-in batching (default 0 unchanged), terminal events (done/error/cancelled) flush buffer before emitting, close() flushes. 37/37 daemon_client tests pass locally, GUI 124 total, 680 pytest + node --check green. Test CI 31368947986 SUCCESS.
|
I tested this PR on Windows (zh-CN): checked out feature/delta-batching, ran `npm test` in emrg/gui → 124 pass / 0 fail (including the 6 new delta-batching tests), and `uv run pytest tests/` → 625 passed + 55 skipped = 680. The batching behavior works as described: deltaBatchMs>0 merges deltas into {chunks}, default 0 stays per-frame, and done/cancelled/error/close all flush the pending buffer before emitting — the ordering guarantee (deltas never after terminal event) holds, which aligns with the G122/14:11 orphan-node lesson. |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260810-161226
Independently verified on feature/delta-batching (e4762cd): node --check passes; full GUI suite 124/124 (37 daemon_client incl. 6 new deltaBatchMs tests: batch merge, done/cancelled/error flush-ordering, default per-frame regression, close-flush); 680 pytest + doc-count guard (118→124) green; import check OK. Terminal-event flush ordering correctly embodies the rant 14:11 orphan-node lesson (delta never emitted after done/error/cancelled), close() flushes to avoid loss, and the {chunks} batched shape matches main.js's existing renderer contract — ready for the main.js rewire slice to consume directly.
…entries (#628) Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Third slice of P2 (connection layer) from the GUI multi-session rant (2026-08-10T15:07:19): the rant specifies
deltaBufbatching (G122 16ms) must live per connection (deltaBuf 批量(G122 16ms)每连接一份) so each session's stream batches independently under connManager.Changes (
emrg/gui/daemon_client.js):deltaBatchMs = 0— default 0 = per-frame emit (existing behavior + tests unchanged);>0= this DaemonClient batchesmessage_deltaframes into a{ chunks: [...] }event everydeltaBatchMsdone/error/cancelledall flush the pending delta buffer before emitting, so deltas never arrive after the terminal event (prevents orphan nodes in the renderer)close()flushes pending deltas (no loss on disconnect){ type: "message_delta", data: { chunks } }matches what main.js already sends to the renderer — the main.js rewire slice can consume this directly.Tests (+6 daemon_client, 31→37): batched merge (multiple deltas → one {chunks}), done-flush ordering, cancelled-flush ordering, error-flush ordering, default mode regression (per-frame), close-flush.
Doc counts synced 118→124 (README/README.cn/Agent). 680 pytest + 124 GUI green.