Skip to content

refactor(ui): reactive controller consolidations - #113647

Merged
steipete merged 7 commits into
mainfrom
codex/ui-controllers
Jul 25, 2026
Merged

steipete merged 7 commits into
mainfrom
codex/ui-controllers

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Five control UI areas each mixed reactive state with event, resource, or lifecycle bookkeeping, duplicating controller-shaped logic across pages and making cleanup and stale-request handling harder to reason about.

Why This Change Was Made

This consolidates dock layout, realtime camera ownership, gateway request scope across four pages, stream auto-follow, and dropdown lifecycle into focused reactive controllers. Sessions-page gateway scope remains intentionally out of scope.

User Impact

There is no intended user-visible behavior change. The same UI interactions now have clearer ownership for resize persistence, camera rollback and release, stale gateway responses, follow thresholds, focus restoration, and listener cleanup, with 195 fewer net lines.

Evidence

  • Exact-head focused UI proof passed: 14 files and 174 tests.
  • The final changed gate passed, including core/UI typechecks, formatting, i18n, and lint.
  • Testbox sync timed out during the final fallback; the completed local gate was clean and the owned lease was stopped.
  • Final branch autoreview reported no accepted or actionable findings.
  • git diff --check and the sessions-page fence are clean at d2435cb60ac71c1f3810be1f2addf6f2d1dbdc80.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Jul 25, 2026
@steipete
steipete marked this pull request as ready for review July 25, 2026 12:17
@steipete

Copy link
Copy Markdown
Contributor Author

Parking this PR under train 3's substantive-failure escape hatch.

Exact-head CI run 30157729281 fails the gateway source-replacement contract in both the Control UI lane and the compact core/runtime/UI shard:

  • ui/src/pages/gateway-source-replacement.test.ts:626: the diagnostics request expected four calls after source replacement but observed zero.
  • The branch consolidates gateway request scopes across the affected pages, so this overlaps the changed ownership boundary and cannot be classified as an unrelated flake.

The same run also reports a terminal readiness failure and dead-code export failures, but the gateway replacement regression is already enough to require controller-level investigation rather than a trivial lint, format, or snapshot repair. Per the work order, no prepare or merge was attempted; the branch remains at d2435cb60ac71c1f3810be1f2addf6f2d1dbdc80.

@clawsweeper

clawsweeper Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 25, 2026, 8:21 AM ET / 12:21 UTC.

ClawSweeper review

What this changes

This PR replaces repeated Control UI state, event, resource, and lifecycle bookkeeping with shared Lit reactive controllers for dock panels, realtime cameras, gateway-backed pages, live-stream following, and dropdown menus.

Merge readiness

⛔ Blocked until real behavior proof is added - 5 items remain

Keep this PR open for explicit maintainer review. It carries the protected maintainer label and makes a broad behavior-preserving Control UI refactor; the available context supports neither an auto-close nor a high-confidence merge verdict without the required whole-surface source review.

Priority: P3
Reviewed head: d2435cb60ac71c1f3810be1f2addf6f2d1dbdc80
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation has a coherent refactor narrative, but missing inspectable real-behavior proof and an unavailable whole-surface source review prevent a merge-ready rating.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR body reports tests and gates but provides no inspectable after-fix live UI artifact, recording, terminal output, or redacted runtime logs; add representative proof and redact private details before posting. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports tests and gates but provides no inspectable after-fix live UI artifact, recording, terminal output, or redacted runtime logs; add representative proof and redact private details before posting. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 4 items Protected-label handling: The supplied PR context lists the maintainer label; the repository review policy requires protected-label items to remain open for explicit maintainer handling.
Changed implementation surface: The supplied patch introduces shared controllers for dock layout, async gateway scope, stream following, dropdown menus, and realtime camera lifecycle, then moves existing panel and page logic onto them.
Branch provenance: The supplied commit sequence attributes the consolidation series to steipete, ending with the current PR head.
Findings None None.
Security None None.

How this fits together

The Control UI presents browser and terminal docks, realtime chat media controls, gateway-backed administrative pages, activity/log streams, and popup menus. These surfaces consume browser events and gateway snapshots, then render and persist UI state while cleaning up listeners, requests, and media resources.

flowchart LR
  Interaction[User interaction] --> Views[Control UI panels and pages]
  Views --> Controllers[Reactive lifecycle controllers]
  Controllers --> Browser[Browser events and media APIs]
  Controllers --> Gateway[Gateway snapshots and requests]
  Controllers --> State[Layout, menu, and stream state]
  Browser --> RenderedUI[Rendered Control UI]
  Gateway --> RenderedUI
  State --> RenderedUI
Loading

Decision needed

Question Recommendation
Should this protected, multi-surface Control UI refactor be accepted after a refreshed whole-surface review and representative runtime proof? Review and land the consolidation: Confirm each migrated UI surface preserves its existing cleanup, request-generation, focus, and resource-release behavior, then merge after current-head proof.

Why: The repository policy keeps maintainer-labeled items open for explicit maintainer handling, and shared lifecycle ownership affects several independent UI paths.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports tests and gates but provides no inspectable after-fix live UI artifact, recording, terminal output, or redacted runtime logs; add representative proof and redact private details before posting. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The new common controllers now govern cleanup, stale gateway requests, dock reservations, focus restoration, stream scrolling, and camera release across several existing UI flows; behavioral equivalence needs source-level caller, sibling, and test review before merge.
  • Resolve merge risk (P1) - The PR is mergeable but behind main; it needs a refreshed review against the current merge result rather than assuming branch-base behavior is unchanged.
  • Complete next step (P2) - The protected maintainer label and the broad shared-lifecycle surface require explicit maintainer review; no narrow automated repair is identified.
Agent review details

Security

None.

PR surface

Source -217, Tests +22. Total -195 across 25 files.

View PR surface stats
Area Files Added Removed Net
Source 22 913 1130 -217
Tests 3 50 28 +22
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 25 963 1158 -195

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: ui/src/components/session-menu.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Refresh lifecycle proof before merge (recommended)
    Review representative dock, camera, gateway-page, stream, and menu interactions against current main so the shared controllers do not change established Control UI behavior.
  2. Split by controller family
    If the combined review surface remains difficult to reason about, land smaller controller migrations with focused behavioral proof for each family.
  3. Pause the consolidation
    Hold the branch if maintainers prefer the existing duplicated ownership until a narrower refactor plan is agreed.

Technical review

Best possible solution:

Preserve the intended shared-controller design only after a maintainer reviews each migrated surface for lifecycle equivalence and the contributor supplies redacted after-fix proof of representative Control UI interactions.

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

Not applicable: this PR is presented as a behavior-preserving refactor, not a report of a current failing user workflow.

Is this the best way to solve the issue?

Unclear: the controller consolidation is plausible, but a best-fix judgment requires comparing each existing caller, sibling implementation, and focused test against the shared lifecycle behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is presented as a behavior-preserving UI maintainability refactor rather than a reported user-facing regression.
  • add merge-risk: 🚨 compatibility: The patch centralizes existing panel and page lifecycle behavior, so an error could change established UI interaction and cleanup semantics.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.

Label justifications:

  • P3: This is presented as a behavior-preserving UI maintainability refactor rather than a reported user-facing regression.
  • merge-risk: 🚨 compatibility: The patch centralizes existing panel and page lifecycle behavior, so an error could change established UI interaction and cleanup semantics.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.

Evidence

What I checked:

  • Protected-label handling: The supplied PR context lists the maintainer label; the repository review policy requires protected-label items to remain open for explicit maintainer handling. (d2435cb60ac7)
  • Changed implementation surface: The supplied patch introduces shared controllers for dock layout, async gateway scope, stream following, dropdown menus, and realtime camera lifecycle, then moves existing panel and page logic onto them. (ui/src/components/dock-layout-controller.ts:1, d2435cb60ac7)
  • Branch provenance: The supplied commit sequence attributes the consolidation series to steipete, ending with the current PR head. (ui/src/lit/async-gateway-scope-controller.ts:1, d2435cb60ac7)
  • Proof context: The PR body reports focused UI tests and a changed gate, but it does not provide inspectable after-fix runtime media, logs, or a live transcript for the affected UI interactions. (d2435cb60ac7)

Likely related people:

  • steipete: The supplied PR metadata attributes all five commits in this UI controller-consolidation series to this person; current-main feature history could not be inspected because read-only commands were blocked. (role: recent area contributor; confidence: low; commits: b09700a6c0bb, ac9d80c16f48, 6dcee2693b8f; files: ui/src/components/dock-layout-controller.ts, ui/src/lit/async-gateway-scope-controller.ts, ui/src/pages/chat/realtime-talk-camera-controller.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add redacted after-fix proof for representative dock, camera, gateway-page, stream-follow, or menu interactions.
  • Refresh review against the current merge result and inspect the migrated callers, sibling paths, and focused tests.

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.

@steipete steipete self-assigned this Jul 25, 2026
@steipete
steipete force-pushed the codex/ui-controllers branch from d2435cb to 7971c7e Compare July 25, 2026 13:15
@steipete

Copy link
Copy Markdown
Contributor Author

Rebased and repaired at 7971c7eded39f9d3bf93fd8b5e99cbfef0416e76.

Root cause: the async gateway-scope consolidation removed DebugPage's page-owned connected state, so the established same-client source-replacement flow could no longer start its in-flight diagnostics load before replacement. Preserving that through the shared controller would require a page-specific compatibility alias or a capture-time fallback, so I used the escape hatch: reverted the gateway-scope commit and retained the dock, camera, stream-follow, and dropdown controller consolidations. The logs overlap keeps the newer stream-follow controller on top of the restored page-owned gateway generation semantics.

Proof: gateway-source-replacement.test.ts green (17/17); debug/logs/approvals/worktrees set green (49/49); hosted node scripts/check-changed.mjs green on run 30158729258; Codex autoreview clean with no accepted/actionable findings. Fresh CI is attached to the new head (run 30159387907).

@steipete

Copy link
Copy Markdown
Contributor Author

Current-head ClawSweeper rank-up moves are addressed for 7e2f9064f28cfabdb135ebf6c37739144aa80e9c.

  • Representative after-fix proof: exact-head CI run 30159668239, attempt 2 is green, including the full checks-ui job. That job exercises the retained browser/terminal dock lifecycle, Google Live and WebRTC camera enable/release/switch paths, activity/log stream-follow behavior, and catalog/native/session menu focus/Escape/stale-hide contracts. The focused terminal readiness regression also passed locally (6/6), and the two-line cleanup was Codex-autoreview clean. I am using this inspectable terminal proof instead of before/after screenshots because the refactor intentionally changes no rendered output; screenshots would not demonstrate listener cleanup, persisted dock state, media-track release, animation-frame invalidation, or focus restoration.
  • Assigned-reviewer boundary confirmation: I reviewed all four shared controllers, their migrated callers, sibling implementations, and focused tests. The reverted async gateway-scope controller is absent from the current diff; debug/logs/approvals/worktrees retain their page-owned gateway generation and connection state. The remaining dock, camera, stream-follow, and dropdown controllers are acceptable owner-boundary consolidations with one canonical lifecycle path each.

Attempt 1's only remaining failure was unrelated tooling timing noise in test/scripts/test-install-sh-docker.test.ts while reading a descendant PID after a signal. The allowed single rerun passed; there were no touched-surface failures on the final head.

@steipete
steipete merged commit d170459 into main Jul 25, 2026
158 of 160 checks passed
@steipete
steipete deleted the codex/ui-controllers branch July 25, 2026 13:39
@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 26, 2026
* refactor(ui): consolidate dock panel layout

* refactor(ui): centralize realtime camera lifecycle

* refactor(ui): centralize async gateway scopes

* refactor(ui): centralize stream auto-follow

* refactor(ui): centralize dropdown menu lifecycle

* Revert "refactor(ui): centralize async gateway scopes"

This reverts commit 04f120b.

* fix(ui): align controller refactor checks
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 maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant