Skip to content

refactor(chat): keep web and terminal sessions synchronized - #115377

Merged
steipete merged 7 commits into
mainfrom
codex/web-tui-session-sync-stress
Jul 28, 2026
Merged

steipete merged 7 commits into
mainfrom
codex/web-tui-session-sync-stress

Conversation

@steipete

@steipete steipete commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users opening the same OpenClaw conversation in the web UI and terminal could see different prompts, missing committed messages, duplicated replies, stale history, or pre-reset messages when clients reconnect, stream, branch, import transcripts, or submit concurrently.

Why This Change Was Made

Makes the existing browser-safe Gateway client the single owner of canonical session projection, source-qualified message identity, bounded run state, snapshot reconciliation, and connection-scoped subscription leases. Dedicated SQLite-sequencing, renderer-identity, and terminal-projection modules preserve ownership boundaries and project lint limits. SQLite turns publish final active-branch messages in committed order; unsafe batches trigger one scoped authoritative refresh. Lease cleanup is safe when release callbacks throw. No new package, dependency, Gateway protocol version, configuration surface, or SQLite schema migration.

User Impact

The web UI and terminal converge on the same conversation during simultaneous sends, identical prompt text, colliding imported source IDs, attachments, streaming and tool finals, resets, history races, throwing subscription callbacks, aliases, reconnects, and multi-message commits. Genuine duplicate deliveries are deduplicated without dropping independently authored messages.

Evidence

  • Exact full three-worker Control UI CI command: all 6,642 tests across 460 browser, node, and jsdom files pass.
  • All 1,593 focused assertions across 25 shared-client, SQLite, Gateway, web, terminal, background-maintenance, and full-suite regression files pass.
  • Real authenticated web and terminal Gateway connections receive the same active-branch messages in exact commit order.
  • Real dual-client Gateway verifies one targeted, private-data-safe history invalidation for unprovable committed batches.
  • Real Chromium: all 19 messaging and session-list scenarios pass, including distinct same-text bubbles, colliding imported sources, stale history, reload, streaming, configured-agent filtering, and latest-main debounced list refresh.
  • Real PTY: all 64 interactive terminal scenarios pass, including a second real Gateway client, restart and reconnection, reset, steering, and follow-up queues.
  • Final callback regressions prove that successful unsubscribe, mixed owners, and connection reset remain authoritative even when user callbacks throw.
  • Complete production type-aware lint passes across all core, plugin, and script shards; all five affected TypeScript projects, production build, plugin SDK, browser build, database-first/SQLite guards, changed-file gates, formatter, and renderer max-lines guard pass.
  • Fresh independent whole-branch adversarial review identified real edge cases; all were fixed, regression-tested, and independently re-reviewed with no remaining findings.

@steipete
steipete marked this pull request as ready for review July 28, 2026 18:46
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Jul 28, 2026
@steipete
steipete force-pushed the codex/web-tui-session-sync-stress branch from b68c486 to 2c7215d Compare July 28, 2026 19:23
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jul 28, 2026
@steipete
steipete merged commit 18ecde3 into main Jul 28, 2026
129 checks passed
@steipete
steipete deleted the codex/web-tui-session-sync-stress branch July 28, 2026 20:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 28, 2026
…etwork-none

* origin/main: (74 commits)
  fix(ui): make Control UI ownership and permissions reliable (#115364)
  feat(system-agent): host memory import in Ask OpenClaw (#115376)
  fix(chat): preserve literal Markdown image examples (#113904)
  refactor(chat): keep web and terminal sessions synchronized (#115377)
  fix(ui): order model picker by provider strength (#115380)
  feat(ui): make Memory settings a destination page with live overview and dreams (#115383)
  docs(security): fix warning line wrap (#115388)
  fix(memory-core): avoid cubic MMR similarity rescans (#113359)
  fix(discord): preserve code-leading reasoning chunks (#103166)
  fix(slack): protect outbound hooks from previews
  fix(ui): keep explicit navigation ahead of chat canonicalization (#115366)
  fix(exec): safely cancel pending node approvals (#115373)
  fix: make Code Mode reliable across gateway and provider lifecycles (#115379)
  perf(ui): debounce event-driven session list refreshes and right-size child paging (#115374)
  feat(talk): support GPT-Live realtime voice over ChatGPT OAuth (#115226)
  feat(system-agent): guide gateway configuration in Ask OpenClaw (#115363)
  fix(agents): make overflow recovery append-only via branch-and-reappend (#115271) (#115310)
  fix(macos): bound websocket ping so a dropped pong cannot orphan its continuation (#115362)
  fix(codex): isolate native hook relay startup (#115078)
  fix(ci): stop reviving superseded pull request workflows (#115378)
  ...

# Conflicts:
#	CHANGELOG.md
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
…#115377)

* refactor(chat): unify web and TUI session synchronization

* refactor(chat): extract canonical projection and transcript owners

* test(gateway): verify private transcript store identity

* test(agents): protect public transcript storage boundary

* fix(chat): harden cross-client identity and subscription lifecycles

* fix(gateway-client): preserve type-safe release callback rejection

* test(ui): complete shared sidebar gateway fixture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui gateway Gateway runtime maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant