Repository navigation
fix(gateway): live sessions stall or reorder across agent identities - #128265
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 1:02 PM ET / 17:02 UTC. ClawSweeper reviewWhat this changesThe PR canonicalizes live transcript queue keys by agent and persisted session identity so cross-agent global sessions do not stall each other and aliases or SQLite markers for one transcript remain ordered. Merge readinessKeep open. Current main still keys transcript lanes by raw session strings or file markers, while this head canonicalizes agent identity before queueing; the prior marker-order finding is addressed and no blocking correctness defect was found. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherGateway receives internal transcript-update events after session storage changes and projects them to subscribed operator clients. Its per-transcript queue serializes updates before session-message and session-change events are sent over WebSockets. flowchart LR
A[Transcript write] --> B[Internal update event]
B --> C[Canonical session identity]
C --> D[Per-transcript queue]
D --> E[Gateway projection]
E --> F[Operator WebSocket clients]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +20, Tests +85. Total +105 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one canonical queue identity derived before the first asynchronous transcript read, retain the focused ordering regressions, and merge only after exact-head checks validate the delivery surface. Do we have a high-confidence way to reproduce the issue? Yes: current main’s raw lane selection is source-proven, and the focused handler cases provide a high-confidence reproduction path for cross-agent global and marker/canonical ordering; this read-only review did not execute it. Is this the best way to solve the issue? Yes: canonicalizing identity before queue selection is the narrowest fix because later projection cannot restore ordering once two updates entered different lanes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 917fab24a50d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…penclaw#128265) * fix(gateway): isolate transcript lanes by agent identity * fix(gateway): order marker-only transcript updates correctly
What Problem This Solves
Fixes an issue where operators viewing multiple agents could see one agent's live
globalsession stop updating while another agent waited for transcript projection. The same session could also display messages out of order when successive updates used its bareglobalkey and its agent-qualified alias, or when a marker-only SQLite transcript update was followed by its canonical session key.Why This Change Was Made
Gateway transcript broadcasting already promises one ordered lane per transcript, but it keyed lanes by the raw session string instead of the transcript's agent-qualified identity. Reuse the existing canonical session subscription key and resolve ownership at the transcript producer boundary, preserving explicit agent ownership, legacy SQLite markers, configured fixed-store owners, compatibility defaults, unresolved legacy events, and existing same-session ordering. Resolve marker-only updates to their authoritative persisted session key before assigning the queue so they share the canonical transcript's lane.
User Impact
Different agents' live session updates no longer block one another, while messages for the same session remain correctly ordered across legacy and agent-qualified names. No public API, protocol, configuration, authentication, security, or storage contract changes.
Evidence
936b3d15b2b3c278b95f534244e3c1d0d32686af.node scripts/run-vitest.mjs src/gateway/server-session-events.test.ts src/gateway/server-runtime-subscriptions.test.ts src/gateway/server-node-subscriptions.test.ts src/gateway/server.node-chat-subscriptions.test.ts src/gateway/server-chat.agent-events.test.ts --configLoader runner --experimental.fsModuleCachePath /private/tmp/openclaw-autoqa-gateway-agent-vitest-correction-cachepassed 428 tests, including real isolated localhost WebSocket delivery.node scripts/run-vitest.mjs src/sessions/transcript-events.test.ts --configLoader runner --experimental.fsModuleCachePath /private/tmp/openclaw-autoqa-gateway-agent-vitest-unit-cachepassed 21 producer tests.git diff --checkpassed.