Skip to content

fix(ui): keep chat rename and reactions usable while reconnecting - #178176

Merged
steipete merged 6 commits into
mainfrom
steipete/offline-header-rename
Oct 20, 2026
Merged

steipete merged 6 commits into
mainfrom
steipete/offline-header-rename

Conversation

@steipete

@steipete steipete commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

#177558 lets session renames, icon/color/category changes and reactions queue while the Gateway reconnects for the same client identity. In a real browser those controls were unreachable exactly when they should queue. As soon as the connection dropped, the chat header title stopped being a "Rename session" button ("Connect to the Gateway to change sessions.") and every reaction picker disappeared (20 Add reaction controls went to 0 on a ten-message chat).

Why It Happened

The session owner deliberately clears its live roster result on disconnect and keeps a same-identity retained presentation (including deferred metadata) for exactly this case (ui/src/lib/sessions/index.ts). Chat copied the cleared live result into state.sessionsResult, so the header lost its session row and the reaction renderer lost the data it gates on. The deferred admission in readSessionMethodAccess was never reached.

Solution

Chat reads roster data and its paired agent identity exclusively from the session owner's presentation in both chat-pane-context.ts and chat-state-refresh.ts. The owner mirrors live data normally and retains the complete roster across reconnect until the canonical-list revision advances, including when startup or descriptor reconciliation publishes provisional rows first. The header submit already routes through sessions.patch, which reaches the existing deferred-intent owner, so no second queue or submit path was added. The owner still retires the presentation on identity change, offline-recovery retirement and stop, and the controls disappear with it.

User Impact

On a flaky link you can rename the session from the chat header and react to messages while it reconnects. Both apply immediately, count in the footer status ("Reconnecting… · 1 queued") and reach the Gateway on reconnect. Sidebar rename and icon/color/category were already reachable and are unchanged. Category creation and lifecycle actions stay connection-gated.

Evidence

  • Live, real browser against an isolated Gateway behind a TCP fault proxy (refuse plus reset of live connections), Control UI built from this branch with the runtime build identity:
    • Header: "Rename session" button stays enabled at +1s, +4s and +10s of reconnecting. Rename offline shows "Renamed offline" plus "1 queued", the queue drains on reconnect, and the title persists after a full reload.
    • Reactions: pickers stay rendered offline. A 👍 applies optimistically with "1 queued" and is still present after reconnect and reload.
  • Before the fix, the same run showed the plain-text title and no reaction pickers while reconnecting.
  • pnpm test ui/src/pages/chat/chat-pane-offline-metadata.test.ts ui/src/pages/chat/chat-pane-session-presentation.test.ts ui/src/pages/chat/chat-pane-reactions.test.ts ui/src/lib/sessions/session-offline-metadata.test.ts ui/src/pages/chat/components/chat-pane-header.test.tsx ui/src/app/app-shell-view.test.ts --maxWorkers=1: 6 files, 107 tests passed. The new render-level regression failed before the fix.
  • pnpm tsgo:ui, oxfmt and git diff --check clean. Codex autoreview: scoped-clean.

Before, while reconnecting (no rename button, no reaction picker):

Before: offline controls missing

After, rename while reconnecting (title applied, 1 queued):

After: offline rename

After, reaction while reconnecting (applied, 1 queued):

After: offline reaction

Captures are synthetic (mock model, isolated state) and cropped to exclude avatars.

CI repair

The first CI run caught two fixture issues: the new regression assigned readonly context fields, and the approval-title test marked its pane connected while its Gateway fixture remained stopped. The fixtures now construct a fresh context and provide a connected Gateway respectively; production code and every assertion are unchanged.

  • Focused rerun: offline-metadata and chat-pane-identity, 25 tests passed with --maxWorkers=1 (130.73 seconds including two cold test shards).
  • Exact failed config: node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.ui-chat.json --noEmit passed. Formatting and git diff --check passed.
  • Fresh Codex autoreview of the repair: scoped-clean, patch is correct.
  • Additional local oxlint attempt did not reach linting: plugin SDK boundary declaration preparation timed out after 300 seconds. Broad lint remains covered by PR CI.

Reconnect review follow-up

The inline review identified a second gap: hello marks the Gateway connected before the canonical session list returns. The initial follow-up retained presentation until a live result existed; the final repair below extends that to the owner canonical-list fence. A render-level regression holds the list request open, verifies rename and reaction controls after hello, then verifies the returned canonical title. It failed on the previous head at the missing rename-button assertion and passes with the fix.

The new connected rendering exposed an incomplete test response for session.members.listEvidence; the fixture now provides its complete typed response. No assertions were removed or relaxed.

  • Offline metadata, session presentation, and identity tests: 3 files, 47 tests passed with --maxWorkers=1 (59.25 seconds wall time across two test shards; the new delayed-list case took 52 ms).
  • Exact UI-chat test typecheck, formatting, and git diff --check passed.
  • CI on the preceding fixture-repair head completed successfully, including lint. The final pushed head runs its own CI.
  • Fresh Codex autoreview of the final reconnect repair: scoped-clean, patch is correct.

The final CI lint pass flagged no-map-spread in the delayed-list fixture. The fixture now builds its single canonical row directly, preserving the retained row and every assertion. Production behavior is unchanged by this lint correction.

Final lint correction validation: node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json ui/src/pages/chat/chat-pane-offline-metadata.test.ts, oxfmt, and git diff --check passed; all 5 offline-metadata tests passed in 38.00 seconds wall time.

Final presentation-fence repair

Commit 26e7fbe addresses the partial-publication review finding. Both chat copies now consume the owner presentation, so neither hello nor a non-null provisional result bypasses its canonical-list fence. Two regressions cover descriptor and startup publication before the canonical list; both failed before the fix. Canonical archive behavior is covered as well.

Coordinator-verified proof for this head: 8 files, 125 tests passed; tsgo:ui, oxfmt, and git diff --check passed. Fresh Codex autoreview was scoped-clean (patch is correct). The isolated-Gateway offline rename and reaction proof and sanitized screenshots above remain applicable.

CI fixture repair on the final owner contract

CI run 39395855111 failed seven cases across four chat suites: retained presentation, approval requester titles, read markers, and composer settlement. These fixtures called the pane publication callback without updating their synthetic session owner. The real owner mirrors live state into presentation outside the reconnect fence. The fixtures now publish into that owner first; every original assertion remains, and the production fix is unchanged. The composer-settlement failure reproduced locally before the repair.

  • Four affected files: 85 tests passed with --maxWorkers=1, 77.13 seconds wall time across two local test shards.
  • Exact UI-chat test typecheck, targeted oxlint, oxfmt, and git diff --check passed.
  • Simplification: four fixture files, 23 added and 24 removed lines; one unsafe cast removed, no new helper or production mechanism.
  • Fresh isolated Codex autoreview of the fixture repair: scoped-clean, patch is correct; original rows, transitions, and assertions preserved.

Read the session-owned retained presentation when the live roster is cleared on disconnect. Keep header rename and reaction controls reachable for the same recovery identity without changing dispatch authority or introducing another outbox.

Cover rendered controls, identity retirement and stop, optimistic rename and reaction state, and shared deferred replay after reconnect.
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T09:10:12.083865Z 0e4f144 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 89018118d8

ℹ️ 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 thread ui/src/pages/chat/chat-pane-context.ts Resolved
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Keep chat rename and reaction controls available during reconnect by consuming the session owner’s retained presentation.

Example: Rename a conversation to “Renamed offline” while the Gateway reconnects.

  • Before: The header loses its rename button, preventing the change from reaching the existing queue.
  • After: The title updates immediately, the footer shows “1 queued,” and the change sends after reconnect.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused owner-based repair with relevant browser proof, preserved consumer assertions, and resolved prior findings; broad exact-head CI remains pending.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after screenshots and the accompanying isolated-Gateway browser account exercise offline header rename and reactions through the shipped Control UI under TCP connection faults, including queued feedback and reported reconnect/reload persistence; focused owner regressions cover delayed canonical-list publication.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Chat rename and reaction controls disappear during reconnect even though their existing mutations support offline queuing.
Reason: Restores maintainer-approved behavior through the established owner with a narrowly scoped production change.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current-main gap in reconnect behavior. The earlier findings are resolved, and no remaining actionable defect was found; exact-head CI is still running.

Priority: P2
Reviewed head: 0e4f1443c5e2c72966ea490616814d822de9c9c6

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI chat pane receives session roster publications and Gateway connection updates, then projects session metadata into its header, transcript controls, and recovery behavior.

flowchart TD
  A[Gateway connection] --> B[Session capability]
  B --> C[Retained session presentation]
  C --> D[Chat pane and history refresh]
  D --> E[Rename and reaction controls]
  E --> F[Existing deferred intent queue]
  F --> A
Loading

Technical review

Best possible solution:

Use the session owner’s paired presentation in both chat consumers while preserving its canonical-list fence and existing mutation paths.

Do we have a high-confidence way to reproduce the issue?

Current-main source shows chat consuming the live roster that the session owner clears on disconnect, and the supplied before capture shows the resulting missing controls; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete production repair: both consumers use the existing presentation owner without duplicating reconnect policy, state, or dispatch.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2e41793e3ef6.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d708507 adds ui/src/pages/chat/chat-pane-context.ts:135 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d708507a498b; files: ui/src/pages/chat/chat-pane-context.ts)

PR surface

Source +4, Tests +308. Total +312 across 8 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 9 5 +4
Tests 6 340 32 +308
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 349 37 +312

Review metrics

Metric Value Why it matters
Production versus test changes Production +9/-5 lines; tests +340/-32 lines The production repair reuses the existing owner; test growth exercises rendered controls, reconnect publication ordering, retirement, and deferred replay.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster. Replaced prior rating: 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Reconnect temporarily prevents chat metadata actions already supported by the existing queue, with limited blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster. Replaced prior rating: 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-20T06:59:11.852Z sha 8901811 :: needs changes before merge. :: [P2] Keep retained presentation until the canonical reconnect list arrives | [P2] Update the approval-title fixture for the new presentation source

Reviewed October 20, 2026, 5:11 AM ET / 09:11 UTC (Revision 2).

@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: 4844fc5fb9

ℹ️ 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 thread ui/src/pages/chat/chat-pane-context.ts Resolved
Keep chat roster metadata and rename/reaction controls behind the session owner presentation fence while reconnect startup publishes provisional rows. Use the same paired presentation for history refreshes, preserving live loading/errors and scoped history.

Cover descriptor and chat.startup publication before the canonical list, plus canonical archive behavior. Addresses the review finding on #178176.

@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: 26e7fbe8c4

ℹ️ 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".

const decideApproval = vi.fn();
const context: ApplicationContext = {
...createInitializationContext(),
...createInitializationContext(createGatewayBrowserClientFixture()),

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.

P1 Badge Update the owner presentation in this fixture

When this test reaches the second publications iteration, pane.applySessionsState(...) no longer copies the argument's result; the changed implementation reads context.sessions.presentation. This fixture pins that presentation to the one-row “Unrelated pane title” result, so connecting the Gateway here never exposes the requester row and waitForSolid continues seeing “New session” instead of the expected derived title. Publish each test row through the session owner's presentation, as the session-presentation fixture now does.

AGENTS.md reference: ui/AGENTS.md:L14-L18

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The reconnect presentation fence is fixed in 26e7fbe, and both inline findings are resolved. The latest commit, 0e4f144, corrects the remaining synthetic owner fixtures exposed by CI. All 85 tests in the four affected files pass, the exact UI-chat typecheck and targeted lint/format checks pass, and isolated Codex autoreview is scoped-clean. The PR body contains the current proof.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 20, 2026
@steipete
steipete merged commit 7a0c15b into main Oct 20, 2026
85 checks passed
@steipete
steipete deleted the steipete/offline-header-rename branch October 20, 2026 09:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 20, 2026
Align the generated-title fixture with #178176, which intentionally keeps
header rename available while the same Gateway identity reconnects.
Share the sidebar's queued-rename assertions with the header, including
the optimistic title, exact target identity, and single reconnect replay.
Keep the Sessions page disconnect behavior unchanged.

The original header case passes on 7a0c15b's parent and fails after it.
Native focused proof: 8 tests passed. The unchanged cold-load case also
passed five native runs, including the hourly head and concurrent load.
Affected UI-e2e typecheck, scoped lint, format and P2 review passed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
…enclaw#178176)

* fix(ui): retain chat metadata controls while reconnecting

Read the session-owned retained presentation when the live roster is cleared on disconnect. Keep header rename and reaction controls reachable for the same recovery identity without changing dispatch authority or introducing another outbox.

Cover rendered controls, identity retirement and stop, optimistic rename and reaction state, and shared deferred replay after reconnect.

* test(ui): align offline chat fixtures with context ownership

* fix(ui): retain chat controls until reconnect list arrives

* test(ui): build reconnect fixture row directly

* fix(ui): honor retained session presentation in chat

Keep chat roster metadata and rename/reaction controls behind the session owner presentation fence while reconnect startup publishes provisional rows. Use the same paired presentation for history refreshes, preserving live loading/errors and scoped history.

Cover descriptor and chat.startup publication before the canonical list, plus canonical archive behavior. Addresses the review finding on openclaw#178176.

* test(ui): publish session owner state in chat fixtures
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 21, 2026
Align the generated-title fixture with openclaw#178176, which intentionally keeps
header rename available while the same Gateway identity reconnects.
Share the sidebar's queued-rename assertions with the header, including
the optimistic title, exact target identity, and single reconnect replay.
Keep the Sessions page disconnect behavior unchanged.

The original header case passes on f88c469's parent and fails after it.
Native focused proof: 8 tests passed. The unchanged cold-load case also
passed five native runs, including the hourly head and concurrent load.
Affected UI-e2e typecheck, scoped lint, format and P2 review passed.
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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant