Repository navigation
fix(ui): retire stale Gateway event-log observers - #117169
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 10:33 PM ET / August 1, 2026, 02:33 UTC. ClawSweeper reviewWhat this changesThis PR updates the Control UI Gateway store so an event-log callback stops notifying later observers when the socket is replaced/stopped or a nested event has already published a newer log snapshot. Merge readinessThe patch is a focused, source-backed repair for stale Control UI event-log delivery and introduces no actionable correctness or security finding. It should remain open because the PR carries the protected Priority: P2 Review scores
Verification
How this fits togetherThe Control UI Gateway store receives WebSocket events from the selected Gateway client, retains a bounded event history, and publishes that history to subscribers. The Debug page subscribes to this event log, so stale publication can display an obsolete event sequence after a connection lifecycle change. flowchart LR
A[Gateway WebSocket event] --> B[Control UI Gateway store]
B --> C[Record bounded event log]
C --> D{Current client and log snapshot?}
D -->|Yes| E[Event-log observers]
D -->|No| F[Retire obsolete delivery]
E --> G[Debug page event log]
H[Reconnect, stop, or nested event] --> D
Decision needed
Why: The implementation is cleanly mergeable and evidence-backed, but the protected Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +52. Total +54 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one canonical guarded observer-publication rule in the Gateway store and merge this focused repair once the protected maintainer review confirms the exact head. Do we have a high-confidence way to reproduce the issue? Yes, from source: on current main, the first event-log observer can synchronously replace or stop the client, or record a nested event, before later log observers receive the original snapshot. The PR adds focused regressions for all three paths; this read-only review did not execute them locally. Is this the best way to solve the issue? Yes. The repair belongs at the shared event-log publication owner, reuses the existing guarded observer predicate, and avoids a Debug-specific workaround or public API change. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7fba71eb7aeb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157) fix(ui): retire stale Gateway event-log observers (openclaw#117169) fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141) test(voice-call): stress paced audio queue drains fix(voice-call): avoid shifting paced audio queues
* commit '7e78de747b8a64d52f30aee948b697bf4c528691': (359 commits) refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157) fix(ui): retire stale Gateway event-log observers (openclaw#117169) fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141) refactor(ui): unify filtered session list ownership (openclaw#117158) refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149) fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957) refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150) refactor(reply): unify turn lifecycle state ownership (openclaw#117145) fix(ui): preserve emoji agent avatar initials (openclaw#104912) refactor(auto-reply): unify command and directive ownership (openclaw#117143) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909) fix(slack): let durable ingress retry transient thread lookups (openclaw#117135) refactor(doctor): consolidate shipped state migration ownership (openclaw#117142) fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966) fix: guard every migrated session accessor path (openclaw#117140) fix(terminal): measure unicode display width consistently (openclaw#117062) fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123) fix(mistral): reject incomplete streamed tool terminals (openclaw#117137) fix(ai): preserve structured chat content and refusals (openclaw#117136) ...
* commit '6938f7dddb63bad59862c014c427d63f0a41a6f4': (368 commits) fix: allow gateway service commands for named profiles (openclaw#116314) fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041) fix(ollama): honor model requests and pull completion contracts (openclaw#117171) fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168) fix(telegram): confirm polling before long poll (openclaw#116970) fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949) fix(gateway): yield before post-ready background work (openclaw#117083) fix(ui): keep canvas lease renewals lifecycle-owned and timer-safe (openclaw#117173) fix(teams): restore the official square product icon (openclaw#117170) refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157) fix(ui): retire stale Gateway event-log observers (openclaw#117169) fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141) refactor(ui): unify filtered session list ownership (openclaw#117158) refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149) fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957) refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150) refactor(reply): unify turn lifecycle state ownership (openclaw#117145) fix(ui): preserve emoji agent avatar initials (openclaw#104912) refactor(auto-reply): unify command and directive ownership (openclaw#117143) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) ...
Co-authored-by: Peter Steinberger <[email protected]>
* commit '5148236bbe050f6c05ee59190986a7215b41ce1c': (359 commits) refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157) fix(ui): retire stale Gateway event-log observers (openclaw#117169) fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141) refactor(ui): unify filtered session list ownership (openclaw#117158) refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149) fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957) refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150) refactor(reply): unify turn lifecycle state ownership (openclaw#117145) fix(ui): preserve emoji agent avatar initials (openclaw#104912) refactor(auto-reply): unify command and directive ownership (openclaw#117143) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909) fix(slack): let durable ingress retry transient thread lookups (openclaw#117135) refactor(doctor): consolidate shipped state migration ownership (openclaw#117142) fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966) fix: guard every migrated session accessor path (openclaw#117140) fix(terminal): measure unicode display width consistently (openclaw#117062) fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123) fix(mistral): reject incomplete streamed tool terminals (openclaw#117137) fix(ai): preserve structured chat content and refusals (openclaw#117136) ...
* commit '55215cd9edd2b585cbaee5481d5352aabf7e4399': (368 commits) fix: allow gateway service commands for named profiles (openclaw#116314) fix(plugins): invalidate bundled artifact locations after metadata refresh (openclaw#117041) fix(ollama): honor model requests and pull completion contracts (openclaw#117171) fix(agents): prevent fallback after stale lifecycle abort (openclaw#117168) fix(telegram): confirm polling before long poll (openclaw#116970) fix(tlon): wire autoDiscoverChannels through the settings-store round-trip (openclaw#114949) fix(gateway): yield before post-ready background work (openclaw#117083) fix(ui): keep canvas lease renewals lifecycle-owned and timer-safe (openclaw#117173) fix(teams): restore the official square product icon (openclaw#117170) refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157) fix(ui): retire stale Gateway event-log observers (openclaw#117169) fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141) refactor(ui): unify filtered session list ownership (openclaw#117158) refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149) fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957) refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150) refactor(reply): unify turn lifecycle state ownership (openclaw#117145) fix(ui): preserve emoji agent avatar initials (openclaw#104912) refactor(auto-reply): unify command and directive ownership (openclaw#117143) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) ...
* origin/main: refactor(ui): replace duplicated locale bundles with canonical translation memory (openclaw#117157) fix(ui): retire stale Gateway event-log observers (openclaw#117169) fix(agents): keep subagent status consistent after restart and large fan-outs (openclaw#117141) test(voice-call): stress paced audio queue drains fix(voice-call): avoid shifting paced audio queues
Summary
Root cause
recordGatewayEventwas the only application Gateway publication that omitted the canonicalnotifyGatewayObserversownership predicate. A synchronous first subscriber could reconnect or stop its originating client while later log subscribers, including Debug, still received the retired event. A reentrant event likewise published the newest snapshot and then rolled Debug back to its obsolete older snapshot. Capturing the producing client once at the existing owner and fencing delivery to both the current client and exact current log snapshot fixes this owner-boundary invariant without a consumer-side workaround, public API change, compatibility shim, or new dependency.Production delta:
ui/src/app/gateway-store.ts+4/-2 (net +2); one root cause, with three precise regressions. No protocol, configuration, authentication, security, persistence, or SDK surface changes.Exact baseline RED
Frozen baseline
fdcb321bfaaadb5a1e7d123b6be7a934980f8b12with production untouched:node scripts/run-vitest.mjs ui/src/app/gateway-store.observers.test.tsproduced 3 new failures and 10 existing passes:[2, 1]instead of the authoritative[2].Verification
tbx_01kyxj1dsfygk7dtrh7pjsjha8: 120/120 focused tests passed, zero failed, across Gateway owner/observers, app-host lineage and shell, Debug/source replacement, and bootstrap; two Vitest shards.eeffb08840ec43acaaaa4e92e68220b9b7980653Git blob for both changed files: owner5a12523b09e7540a2b21037658322537eb1cdf2d; observer tests6709f64d6899d5b2c5c4c60b04ae67f9cc68e40a. This is patch-identical source proof, not a claim that the workflow checkout HEAD equals the private commit.git diff --checkclean. Remote timing JSONexitCode=0; the lease was stopped and independently verified completed.Agent transcript
fdcb321bfaaadb5a1e7d123b6be7a934980f8b12, authored three focused tests first, and captured the genuine baseline RED before changing production.eeffb08840ec43acaaaa4e92e68220b9b7980653, and had separate agents independently verify real browser/WebSocket behavior and whole-owner P0–P3 correctness.