Skip to content

improve: stream native sessions as hosts finish - #110211

Merged
steipete merged 4 commits into
mainfrom
codex/session-catalog-progressive
Jul 17, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/session-catalog-progressive

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where opening Chat with native Claude Code or Codex session discovery enabled would wait for the slowest paired computer before showing useful sessions. Sessions created outside OpenClaw also remained stale until a page reload or another unrelated refresh.

Why This Change Was Made

Native catalog providers now publish each host page as it finishes while retaining the existing aggregate RPC response as the authoritative recovery path. The Control UI merges those scoped events, reconciles every 30 seconds while visible, follows observed changes after 5 seconds, and refreshes on focus or paired-node presence changes.

The protocol addition is optional. A new UI connected to a pre-progressive Gateway retries without progressId after the older closed schema rejects it. No config, storage, watcher, or SQLite surface was added.

User Impact

Claude Code and Codex sessions begin appearing host by host instead of after the slowest computer finishes. Sessions created directly in either CLI are picked up within 30 seconds while the page stays visible, or immediately after focus/connectivity invalidation.

Late slow-host results remain usable after the fail-soft aggregate timeout. Stale streams, reconnect races, expanded-page refreshes, duplicate activation events, and temporary host errors cannot overwrite newer healthy state.

Evidence

  • Four-node macOS live benchmark: first useful host page about 1.8 seconds; aggregate response about 9.7 seconds.
  • Live external-session proof: a newly created Codex session appeared in the normal 40-row catalog; a newly created Claude Code session appeared from a connected node without reloading.
  • Production build: 1 minute 58 seconds. Control UI startup JavaScript 365.6 KiB gzip against the 370.0 KiB limit.
  • Browser E2E: 6/6, including a completed host rendered while the aggregate request remained pending.
  • Focused tests: Claude 30/30; Codex 86/86; gateway/protocol 68/68; sidebar 103/103.
  • Full changed-surface Testbox gate passed across core, UI, plugins, docs, formatting, lint, and typechecks.
  • Mandatory pre-commit review completed with no accepted actionable findings.

Release note: Native Claude Code and Codex sessions now stream into Chat host by host and refresh automatically when external CLI sessions appear.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime extensions: anthropic extensions: codex size: XL maintainer Maintainer-authored PR labels Jul 17, 2026
@steipete
steipete force-pushed the codex/session-catalog-progressive branch from 0a69aea to cc8d0a2 Compare July 17, 2026 22:38

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a69aea5ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +340 to +343
const mergedHost =
(params.pageDepths.get(hostKey) ?? 0) > 0
? preserveExpandedCatalogHost(freshHost, currentHost)
: freshHost;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve adopted catalog keys in streamed host merges

When a user continues a catalog session while an older progressive list request is still settling, the provider can later emit a host page built from the pre-adoption adopted snapshot. This branch replaces the existing host with that fresh payload for non-expanded hosts, bypassing the sessionCatalogRevision guard that protects aggregate refreshes after handleCatalogSessionContinued, so the row can lose its stamped openClawSessionKey and reappear as an unadopted duplicate until a later poll reconfirms it. Merge existing per-session openClawSessionKey values, or reject host events older than the adoption revision.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the codex/session-catalog-progressive branch from cc8d0a2 to 2a28b23 Compare July 17, 2026 22:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86221aeb34

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

node,
query,
adoptedSessions: adoptedNodeSessions,
...(params.onHost ? { onHost: params.onHost } : {}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add terminal capability before streaming Codex node hosts

When a paired Codex node supports terminal resume, the progressive onHost callback passed here emits the raw listPairedNode host before codexNodeTerminalCapability(node) is applied on the aggregate return path. Since toGenericCatalogHost only sets canOpenTerminal from host.canOpenTerminalCodex === true, streamed node rows render with terminal clicks/menu disabled, and this persists after an 8s fail-soft timeout until a later full poll repairs the row. Apply the terminal capability before invoking onHost (or wrap the callback) so progressive and final hosts expose the same actions.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 7819130 into main Jul 17, 2026
117 checks passed
@steipete
steipete deleted the codex/session-catalog-progressive branch July 17, 2026 22:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 18, 2026
* perf: stream native session catalogs by host

* fix: satisfy session catalog CI contracts

* fix: retain changed-session refresh timing

* fix: keep catalog refresh helpers private
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation extensions: anthropic extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant