Skip to content

fix(ui): preserve session updates after agent switches - #150305

Merged
steipete merged 3 commits into
mainfrom
codex/fix-session-mutation-reconciliation-mainb31
Sep 17, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/fix-session-mutation-reconciliation-mainb31

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes the session sidebar losing later updates when an operation finishes for another agent. For example, archive several Main sessions, switch to Research while the archive is pending, and Research can stop receiving new rows even though it remains selected.

User Impact

The selected agent keeps its session list, pagination, and ongoing updates while earlier operations settle. Permission, sharing, and worker actions reconcile the agent they changed without taking over the selected list. After a permission update fails, the picker adopts fresh permission data for that session; another agent's refresh cannot clear its retained choice.

Why This Change Was Made

Operation completion uses the existing mutation reconciliation owner, and the sidebar keeps its subscription bound to the expanded agent. Callers consume scoped refresh outcomes through their existing error owners. Permission recovery uses the existing conversation permission projection, including authoritative list and standalone session reads. A later read of identical saved values advances observation freshness while preserving the confirmed save outcome and its refresh warning. The capability also reuses the existing session-operation method group, with connection retirement and disposal kept private, instead of maintaining a duplicate forwarding list. Gateway, public plugin SDK, and permission-policy contracts are unchanged.

Evidence

  • The final integration is based on main c32a3181. Its initial composition passed 383 tests across 19 files; after the operation-group cleanup, 15 existing lifecycle cases across three files passed. These results retain their source scope and are not added to earlier overlapping proof. All 26 selected checks for the 48 authored files passed, plus MDX checks for docs/gateway/permission-modes.md and docs/web/control-ui/chat.md. The final test-title-only edit passed formatting and exact body comparison. Fresh integration P2 review completed 18 passes with no findings.
  • The original Linux Testbox command compared main b31ad046 with the sidebar repair: 11 passed / 1 failed before; 12 passed after. Active batch archive lost later Research updates. Rename, All-filter, bulk-delete and archive/Undo controls passed in both arms. The retained pictures below illustrate that source-qualified comparison, not a browser run of the newer integration.
  • The permission warning regression was reproduced through the real session capability: an identical accepted descriptor read lost listRefreshError, while the acknowledgement-only and retained-choice controls passed. The repair preserves the confirmed save outcome and warning while allowing fresh observations to retire an uncertain displayed choice.
  • The subsequent two-case Testbox command passed 2/2 in both arms on Linux with Node 24.19 and pnpm 12.4. Both inspected captures are identical and show Workspace plus the saved-permission refresh warning. This browser run did not reproduce the CI interleaving; the controlled local regression is the causal evidence. Command, phase and wrapper exits were zero, while the associated provisioning Actions workflow concluded CANCELLED. This is successful command evidence, not green PR CI, and no cancellation cause is inferred.

The pinned c32a3181 tree still has an inherited Slack ingress/thread-resolution Madge failure. Its runtime value-cycle check passed; newer main contains the separate a13ecd23b32 type-edge repair. The published 2c45d857 revision passed exact-head PR CI, and fresh exact-head CI remains required for this integration before landing. No assertions, deadlines, limits or gates were relaxed.

Browser proof uses the registered Control UI with a synthetic mocked Gateway and fresh contexts. Source restoration and owned process, lease, claim and capsule cleanup are verified. No live Gateway or provider claim is made.

The sidebar before capture ends after the Research-update wait fails. The after capture completes the update, pagination and revisit, so elapsed state and toast visibility differ. The warning repair and internal type move preserve this sidebar flow; the identical warning captures remain executed-state evidence rather than a claimed visual difference.

Before

Research remains selected but its sidebar misses later updates

After

Research receives the new row and keeps pagination

Reconcile completed operations without replacing the selected agent list.
Use conversation permission facts to retire retained recovery choices.
@steipete steipete self-assigned this Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 21:13
@clawsweeper clawsweeper Bot added 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 11:58 PM ET / September 17, 2026, 03:58 UTC (Revision 3).

ClawSweeper review

What this changes

The PR keeps session lists updating after agent switches and reconciles permission-picker recovery using fresh facts for the affected conversation.

Merge readiness

⛔ Blocked before merge - 2 items remain

This repair remains useful: current main still lets completed batch operations replace the foreground query. The merged agent-switch performance work addresses a different problem. No actionable introduced correctness or security defect was found.

Priority: P2
Reviewed head: 3343b4337bbf9fbfb2195dcb2367e0f207fa12ef

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful browser evidence, regression coverage, and no actionable introduced defects.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after images and the recorded Linux registered-UI scenario demonstrate Research updates surviving delayed Main archive completion through the approved mocked-Gateway boundary. The captures retain their earlier source scope; final-integration tests and the controlled permission regression are supplemental, and the later 2/2 browser run is not treated as causal reproduction.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected before/after images and the recorded Linux registered-UI scenario demonstrate Research updates surviving delayed Main archive completion through the approved mocked-Gateway boundary. The captures retain their earlier source scope; final-integration tests and the controlled permission regression are supplemental, and the later 2/2 browser run is not treated as causal reproduction.
Evidence reviewed 11 items Current main still contains the problematic caller: At fetched main, batch completion calls refreshReplacement(agentId), allowing an earlier agent's operation to claim the foreground query.
Existing reconciliation owner reused: The existing mutation owner refreshes matching foreground queries or reads scoped facts without acquiring foreground ownership; the PR moves completion callers onto that owner.
Sidebar selection remains authoritative: The sidebar binds its filtered subscription to the expanded agent and skips an explicit refresh for a different affected agent.
Findings None None.
Security None None.

How this fits together

The Control UI receives session lists and updates from the Gateway. Its session capability reconciles those facts, while sidebar and chat controllers preserve the user's selected agent and conversation.

flowchart TD
  A[Session operation completes] --> B[Session reconciliation]
  C[Selected agent and filters] --> D[Foreground list owner]
  B --> E{Affected agent selected?}
  E -->|Yes| D
  E -->|No| F[Scoped session facts]
  D --> G[Sidebar rows and pagination]
  F --> H[Conversation controls]
  D --> H
Loading

Before merge

  • Resolve merge risk (P1) - Originating-chat screenshot delivery is not verifiable from the supplied context; the repository's two-destination landing gate remains unconfirmed.
  • Complete next step (P2) - Before landing, verify that the inspected before/after screenshots render in both the originating chat and the PR, as required by the current repository policy.
Agent review details

Security

None.

PR surface

Source +63, Tests +265, Docs 0. Total +328 across 48 files.

View PR surface stats
Area Files Added Removed Net
Source 21 146 83 +63
Tests 25 930 665 +265
Docs 2 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 48 1078 750 +328

Review metrics

Metric Value Why it matters
Production versus regression coverage production +63 net lines; tests and helpers +265 net lines Production growth supports scoped reconciliation and error handling while reusing existing owners; most growth strengthens regression coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep foreground selection separate from operation reconciliation, with conversation-scoped permission freshness and errors owned by the affected view.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep foreground selection separate from operation reconciliation, with conversation-scoped permission freshness and errors owned by the affected view.

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

Yes, source inspection supports holding a Main batch archive, switching to Research, then completing the archive and emitting a Research update. The supplied older browser comparison demonstrates that sequence; this review did not execute current main.

Is this the best way to solve the issue?

Yes. Reusing the existing mutation reconciliation owner repairs the foreground-query takeover without adding another cache, public API, or permission policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 035227797aa6.

Labels

Label justifications:

  • P2: Repairs a bounded Control UI race that leaves the selected agent's session list stale after earlier operations finish.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected before/after images and the recorded Linux registered-UI scenario demonstrate Research updates surviving delayed Main archive completion through the approved mocked-Gateway boundary. The captures retain their earlier source scope; final-integration tests and the controlled permission regression are supplemental, and the later 2/2 browser run is not treated as causal reproduction.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected before/after images and the recorded Linux registered-UI scenario demonstrate Research updates surviving delayed Main archive completion through the approved mocked-Gateway boundary. The captures retain their earlier source scope; final-integration tests and the controlled permission regression are supplemental, and the later 2/2 browser run is not treated as causal reproduction.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected before/after images and the recorded Linux registered-UI scenario demonstrate Research updates surviving delayed Main archive completion through the approved mocked-Gateway boundary. The captures retain their earlier source scope; final-integration tests and the controlled permission regression are supplemental, and the later 2/2 browser run is not treated as causal reproduction.

Evidence

What I checked:

  • Current main still contains the problematic caller: At fetched main, batch completion calls refreshReplacement(agentId), allowing an earlier agent's operation to claim the foreground query. (ui/src/components/session-organizer-batch-mutations.ts:80, 035227797aa6)
  • Existing reconciliation owner reused: The existing mutation owner refreshes matching foreground queries or reads scoped facts without acquiring foreground ownership; the PR moves completion callers onto that owner. (ui/src/lib/sessions/session-roster-mutation-refresh.ts:36, 3343b4337bbf)
  • Sidebar selection remains authoritative: The sidebar binds its filtered subscription to the expanded agent and skips an explicit refresh for a different affected agent. (ui/src/components/session-data-controller.ts:518, 3343b4337bbf)
  • Permission recovery and review continuity: Permission observations track conversation-specific fact freshness; identical accepted reads preserve the confirmed mutation object and its refresh warning. The permission projection and picker files have identical blob IDs at the previous reviewed revision and this head. (ui/src/lib/sessions/session-permission-projection.ts:128, 3343b4337bbf)
  • Inspected browser evidence: Both downloaded PR images were inspected: the before image shows Research without the later row; the after image shows the new Research row and additional loaded rows. The captured PR body ties these images to the earlier Linux Testbox comparison against b31ad04, reporting 11 passes/1 failure before and 12 passes after. They are not represented as captures of the final integration.
  • Meaningful browser regression scenario: The registered UI scenario holds a Main mutation, switches to Research, completes the mutation, emits a Research creation event, and verifies the new row, pagination, and revisiting agents across Active and All filters. (ui/src/e2e/session-management.mutation-scope.e2e.test.ts:18, 3343b4337bbf)

Likely related people:

  • Peter Steinberger: Raw commit d4105c1 adds ui/src/lib/sessions/session-roster-mutation-refresh.ts:55 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d4105c12a710; files: ui/src/lib/sessions/session-roster-mutation-refresh.ts)
  • Josh Lehman: Raw commit a5be827 adds ui/src/lib/sessions/session-agent-selection.ts:23 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a5be82716c08; files: ui/src/lib/sessions/session-agent-selection.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-16T21:21:43.519Z sha 29f72cc :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T23:36:10.863Z sha 2c45d85 :: blocked before merge. :: none

Keep the confirmed mutation outcome when an admitted read repeats the saved
permission mode and timestamp. Move the refresh outcome type to its capability
owner to remove the import cycle.
@steipete
steipete merged commit 86a5b15 into main Sep 17, 2026
161 checks passed
@steipete
steipete deleted the codex/fix-session-mutation-reconciliation-mainb31 branch September 17, 2026 05:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 17, 2026
…1148)

The Research fixture returned two rows for a 200-row query. A trailing
refresh after pagination then replaced the appended rows with that short
page. Seed a full first page and return the expanded retained window.
Keep the named-row assertions and verify Active retains its expanded
window while All starts a fresh page on agent re-entry.

Related: #150505 (startup fixture extraction ruled out; the pagination
fixture predates it in #149959 and #150305).
Observed in main run 35272742639, checks-ui-e2e (10/13).
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
* fix(ui): preserve session updates after agent switches

Reconcile completed operations without replacing the selected agent list.
Use conversation permission facts to retire retained recovery choices.

* fix(ui): retain permission refresh warnings after reads

Keep the confirmed mutation outcome when an admitted read repeats the saved
permission mode and timestamp. Move the refresh outcome type to its capability
owner to remove the import cycle.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…nclaw#151148)

The Research fixture returned two rows for a 200-row query. A trailing
refresh after pagination then replaced the appended rows with that short
page. Seed a full first page and return the expanded retained window.
Keep the named-row assertions and verify Active retains its expanded
window while All starts a fresh page on agent re-entry.

Related: openclaw#150505 (startup fixture extraction ruled out; the pagination
fixture predates it in openclaw#149959 and openclaw#150305).
Observed in main run 35272742639, checks-ui-e2e (10/13).
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 gateway Gateway runtime maintainer Maintainer-authored PR 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant