Skip to content

fix(ui): preserve selected session ownership in the composer - #133085

Merged
steipete merged 3 commits into
mainfrom
codex/frv-b111-quota-fixture
Aug 30, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/frv-b111-quota-fixture

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The chat composer can lose its usage ring and model-specific /think options after switching agents in global-session mode. The pane resolves the selected session correctly, but the composer repeats a key-only search through the raw session list. That search misses global aliases and can also revive a stale global row the pane rejected for belonging to another agent.

Carry the pane's selected session through the chat view into the composer, and delete both duplicate row searches. Context/quota, goal/progress presentation, and thinking arguments now consume the same selected row. An absent selected row stays absent. There are no configuration, protocol, dependency, persistence, or locale-output changes.

The existing delayed-agent browser regression now uses the real agent picker, consistent global-scope fixtures, and held metadata responses released by exact captured request IDs. It still asserts that delayed Main auth/identity never replaces Work and that the final popover shows Work's account, plan, and quota. Direct-render fixtures now provide the selected row explicitly.

A Linux replay also exposed the upstream producer race: operator identity arriving through presence rehydrated the default Main roster after the picker had selected Work. Identity-only updates now use the existing event-refresh coordinator, preserving both an active query and a queued picker change. New/reconnected clients still bootstrap from the gateway route. This removes the misuse of connection bootstrap for identity events without adding a second refresh owner.

Verification

  • Original consumer: context ownership regressions failed in both directions; the direct /think case passed while the global alias failed. The real picker flow failed on the missing final ring after Work auth had loaded.
  • Fixed consumer: 465 focused tests passed across composer context, chat view, session ownership, pane controls, goals, and thinking; 167 composer sibling tests passed (overlap with the first set is intentional).
  • Real Chromium: all 10 quota and thinking E2E cases passed, including mobile, tablet, desktop, stale Main responses, and final Work quota. Before/after pictures contain synthetic fixture data only.
  • The identity regression failed with a settled Work selection and with an Other selection queued behind initial bootstrap. All 497 session tests pass after routing identity updates through the existing coordinator, including retained filters, owner-first hydration, and reconnect scope.
  • A Linux replay of the original 23 browser files passed all 98 cases on the interim producer fix, including quota and mount recovery. The final coordinator repair also passed all 98 cases across those 23 files on Linux in 137.32 seconds. The first replay's independent mount-recovery failure was a missing Playwright FFmpeg executable before test navigation, corrected with the existing browser preparation script.
  • The refreshed full changed-file gate passed, including core test types, UI types, lint, locale source verification, all three Knip scans, and guards. After adding the authorized release-note bullet, changelog attribution and whitespace checks passed. Independent managed Codex review completed scoped-clean through P2 with no findings.

After merging current main, the only conflict preserved both our held-request fixture and upstream's synthetic OpenAI transcript. The integrated tree passed 819 session/composer/view tests, all five real Chromium quota cases, and another independent P2 review. Hosted CI33294969496 passed for head 52bafb43c5f7ac9c19b00e489e76e81acf4a9696, including the required CI gate. To resolve the latest review's unavailable-main-source limitation, I fetched and tested GitHub's proposed merge 25285007ebf9139117412c21111e30a89ed56813 (parents d5672464f2e8da81e04ef9f2818ac51a259daf50 and this head): 819 focused tests and all five Chromium quota cases passed again. The justified production delta retains one refresh coordinator and one selected-session owner; no separate maintainer repair remains.

Scope and release note

Preserve selected-session ownership in the Control UI composer so global agent switches keep the correct usage, goal/progress, and thinking presentation. The docs also correct an existing stale-usage description: stale token totals remain approximate instead of disappearing.

Production delta is +19/-11 (+8 raw lines): six executable duplicate consumer lookup lines are removed, while the producer distinguishes identity events from connection bootstrap and reuses the existing coordinator. Type wrapping and invariant comments account for the remaining presentation lines. Test delta is +309/-225, largely parameterization indentation; docs +1/-1 and release note +1. No configuration, persistence, or protocol surface changes.

ClawSweeper rank-up disposition: the release-note removal suggestion is skipped under the maintainer's explicit task authorization to include changelog entries for user-facing landed fixes. This is a release-verification repair and the bullet is intentional. The earlier filtered-assertions feedback is addressed by the canonical selected-row tests plus the real picker and stale-response browser assertions; none are weakened.

Nearby follow-up: model-control/thinking-select helpers independently support raw-row lookup and New Session synthetic targets. Their ownership boundary needs a separate reproduction and caller audit; this PR does not claim to repair those controls.

Before / after

Synthetic fixtures only. Before: Work metadata has loaded but the usage ring is missing. After: the context window and Work account quota are available.

Before

After

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 30, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. 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. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 1:40 AM ET / 05:40 UTC.

ClawSweeper review

What this changes

The PR passes the chat pane’s ownership-validated session row to the composer and makes same-connection identity changes refresh the currently selected session roster rather than re-bootstrap the route default.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No concrete introduced correctness or security defect was found. This maintainer-authored, protected PR should remain open while an exact-current-main merge result and its in-progress checks are refreshed.

Priority: P2
Reviewed head: 52bafb43c5f7ac9c19b00e489e76e81acf4a9696

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch follows the existing ownership boundary with focused boundary and browser coverage; no blocking defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the PR supplies a real Chromium scenario and before/after fixture images, but the image hosts could not be inspected from this offline reviewer environment.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the PR supplies a real Chromium scenario and before/after fixture images, but the image hosts could not be inspected from this offline reviewer environment.
Evidence reviewed 6 items Canonical ownership boundary: The pane resolves global aliases and rejects a global row whose roster agent differs from the selected agent before rendering.
Consumer uses the canonical row: The pane forwards its resolved row through the chat view, and the composer uses it for thinking options, context usage, and its rendered active-session state instead of repeating raw key-only searches.
Focused regression coverage: Tests cover an owner-selected global alias, explicit absence for a mismatched global row, and direct plus global-alias thinking options; the browser scenario uses the actual agent picker and checks that delayed Main metadata cannot replace Work’s quota.
Findings None None.
Security None None.

How this fits together

The Control UI chat pane resolves the active agent’s session from Gateway session data, including global aliases. The composer consumes that row to render context usage, goals, progress, and model-specific controls.

flowchart LR
  A[Gateway session roster] --> B[Chat pane]
  C[Selected agent] --> B
  B --> D[Ownership-checked session row]
  D --> E[Chat view]
  E --> F[Chat composer]
  F --> G[Usage goals and thinking controls]
  A --> H[Identity update]
  H --> I[Roster refresh coordinator]
Loading

Before merge

  • Resolve merge risk (P1) - The bug fix has a net production increase of 8 lines; it is justified by separating identity events from connection bootstrap and deleting duplicate consumer lookups, but an exact-current-main validation is still needed.
  • Complete next step (P2) - No repair lane is needed because the review found no actionable patch defect; complete exact-current-main validation before merge.
Agent review details

Security

None.

PR surface

Source +8, Tests +84, Docs +1. Total +93 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 5 19 11 +8
Tests 4 309 225 +84
Docs 2 2 1 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 330 237 +93

Review metrics

Metric Value Why it matters
Production versus test delta production +8, tests +84, docs 0, release note +1 The production growth makes identity-only refresh use the existing coordinator while removing duplicate composer searches; no config, protocol, or persistence surface changes.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the single ownership-validated session flow and complete exact-current-main CI before maintainer merge review.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the single ownership-validated session flow and complete exact-current-main CI before maintainer merge review.

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

Yes, from source: a global alias can resolve to a canonical row while raw key-only searches cannot, and the new tests exercise both the alias and mismatched-owner cases. This read-only review did not execute the browser scenario.

Is this the best way to solve the issue?

Yes: carrying the pane’s already ownership-validated row removes duplicate consumer resolution, while the roster coordinator remains the single refresh owner for identity events.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5553615584dc.

Labels

Label justifications:

  • P2: This repairs Control UI session presentation and agent-switch behavior with a limited user-facing blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is maintainer-authored work, so the external-contributor proof gate does not apply; the PR supplies a real Chromium scenario and before/after fixture images, but the image hosts could not be inspected from this offline reviewer environment.

Evidence

What I checked:

  • Canonical ownership boundary: The pane resolves global aliases and rejects a global row whose roster agent differs from the selected agent before rendering. (ui/src/pages/chat/chat-state-route.ts:27, 52bafb43c5f7)
  • Consumer uses the canonical row: The pane forwards its resolved row through the chat view, and the composer uses it for thinking options, context usage, and its rendered active-session state instead of repeating raw key-only searches. (ui/src/pages/chat/components/chat-composer.ts:75, 52bafb43c5f7)
  • Focused regression coverage: Tests cover an owner-selected global alias, explicit absence for a mismatched global row, and direct plus global-alias thinking options; the browser scenario uses the actual agent picker and checks that delayed Main metadata cannot replace Work’s quota. (ui/src/pages/chat/chat-composer-context.test.ts:18, 52bafb43c5f7)
  • Identity refresh owner: The introduced branch distinguishes client replacement from an identity-only update and delegates the latter to the existing roster event coordinator, whose queued-refresh behavior preserves explicit picker intent. (ui/src/lib/sessions/index.ts:489, 52bafb43c5f7)
  • Branch provenance: The second repair commit introduced the identity-only refresh change; the checkout head merges that commit with the pinned PR base. (ui/src/lib/sessions/index.ts:497, e60d4745c5d5)
  • Current-main limitation: The partial checkout could not read the fetched current-main objects because the promisor remote DNS lookup failed; the local review therefore cannot independently verify the post-base merge result or release inclusion. (5553615584dc)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (3 earlier review cycles)
  • reviewed 2026-08-30T05:05:01.527Z sha 0140d87 :: found issues before merge. :: [P2] Remove the release-owned changelog entry
  • reviewed 2026-08-30T05:10:44.134Z sha 0140d87 :: found issues before merge. :: [P2] Remove the release-owned changelog entry
  • reviewed 2026-08-30T05:32:29.726Z sha e60d474 :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Linux CI reproduction exposed the producer side of the same ownership defect after the original review: presence identity hydration replaced a selected or queued agent roster with the default agent. The new commit routes identity-only updates through the existing event coordinator and retains bootstrap for new connections. Both regression orders and all 497 session tests pass; the full changed-file gate and managed P2 review pass. The PR body records the intentional changelog disposition and browser proof status.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. and removed 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. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 30, 2026
@steipete
steipete merged commit b7f745c into main Aug 30, 2026
166 checks passed
@steipete
steipete deleted the codex/frv-b111-quota-fixture branch August 30, 2026 05:46
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
…w#133085)

* fix(ui): preserve selected session ownership in the composer

* fix(ui): preserve roster intent when operator identity arrives
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 maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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