Skip to content

refactor(ui): skip rescanning unchanged worktrees - #207398

Merged
vyctorbrzezowski merged 3 commits into
mainfrom
openclaw/loop-ui-r2-worktrees-2811
Nov 29, 2026
Merged

vyctorbrzezowski merged 3 commits into
mainfrom
openclaw/loop-ui-r2-worktrees-2811

Conversation

@vyctorbrzezowski

Copy link
Copy Markdown
Member

What Problem This Solves

The Worktrees tab walks every checkout to rebuild its repository choices whenever the page receives a Gateway snapshot, even when the worktree list has not changed and the chooser is closed.

User Impact

The same rows appear in the same activity order. Opening the repository chooser still shows each path once, and refreshing the worktree list updates both the rows and the choices. No action or migration is required.

Why This Change Was Made

The page model already replaces the records array on a successful list read or a Gateway identity change. The view now observes that array rather than treating every page notification as a new inventory. It builds the repository choices only while they have a consumer, keeping the first occurrence of each path. No Gateway request, worktree operation, or owner lookup changed.

Related: #199323 (repository choices on the Worktrees tab).

Evidence

Mounted the production Worktrees view with the same synthetic Gateway, 64 worktrees across four repositories, and five notifications that reported the connection was still up. The same worktree button stayed mounted and both revisions made exactly one list request.

Repository-path reads Before After
First display, chooser hidden 320 256
Five notifications, chooser hidden 320 0
Five notifications, chooser visible 320 0

These are field-read counts, not elapsed-time measurements. The focused regression also replaces the inventory and checks that the new repository appears in both the row and the chooser, without the old option. On the parent it detects one unnecessary read after one unchanged notification; on the candidate it detects none.

  • All 27 Worktrees page tests passed on c82f0f3bce35 (6.03 s wall time). Focused TypeScript, lint, formatting, and diff checks passed. The production delta is +11/−8 lines; the single regression adds 33 test lines. No layout, copy, or styling changed.
  • Local ClawSweeper was unavailable. Local autoreview (Codex, P0–P3) found no actionable issues in d79f9830c07c..c82f0f3bce35; it reviewed the diff and supplied model, projection, and chooser sources, without running code.

🦞 Made with OpenClaw

@clawsweeper

clawsweeper Bot commented Nov 28, 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.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 28, 2026
@clawsweeper

clawsweeper Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR narrows Worktrees rendering updates to inventory changes and lazily derives repository choices.

Example: Display 64 worktrees across four repositories, then receive five unchanged Gateway notifications.

  • Before: The supplied mounted-view measurement reports 320 repository-path reads.
  • After: The same measurement reports zero repository-path reads while retaining the displayed rows.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported optimization with relevant boundary coverage; performance evidence is limited to a synthetic-Gateway mounted view.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is exempt from contributor proof requirements; its reported mounted-view counts and regression support the changed derivation, but no shipped-app performance measurement is supplied.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: The Worktrees page repeats inventory-derived work on unrelated Gateway notifications, including while the creation form is hidden.
Reason: The maintainer-authored direction removes demonstrated redundant work with a small presentation-only change and preserves existing outputs.

Merge readiness

✅ Ready for maintainer review

Keep this useful maintainer-authored draft open; the focused optimization preserves inventory updates, and no actionable introduced defect was found.

Reviewed head: c82f0f3bce35e19214ae03229555a180f731a6b6

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI Worktrees model accepts Gateway inventory responses; its reactive projection supplies activity-ordered rows and repository choices to the page.

flowchart LR
  A[Gateway inventory] --> B[Worktrees model]
  C[Gateway notifications] --> B
  B --> D[Owner projection]
  D --> E[Records memo]
  E --> F[Worktree rows]
  E --> G[Lazy repository choices]
Loading

Technical review

Best possible solution:

Keep the narrow records memo and lazy repository derivation with the existing model retaining inventory ownership.

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

Current-main source shows every owner notification invalidating the repository scan through view().records; this read-only review ran no target code.

Is this the best way to solve the issue?

The change uses the existing immutable inventory boundary and supported lazy-memo pattern without introducing another store, request path, or invalidation mechanism.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Repository choices keeps the original intent (f7c6804: Offer known repositories from managed-worktree records while preserving custom entry and existing creation ownership.)
  • Worktrees readiness and retained presentation keeps the original intent (02a1caa: Present admitted list reads through Solid loading and error boundaries while leaving operations and recovery with the plain model.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit da60d41 adds ui/src/pages/worktrees/worktrees-page.tsx:30 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: da60d4146d57; files: ui/src/pages/worktrees/worktrees-page.tsx)
  • Vyctor H. Brzezowski: Raw commit 84365ae adds ui/src/pages/worktrees/worktrees-page.tsx:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 84365ae0b647; files: ui/src/pages/worktrees/worktrees-page.tsx)
  • RoboClaw: Raw commit f7c6804 adds ui/src/pages/worktrees/worktrees-page.tsx:36 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: f7c680434384; files: ui/src/pages/worktrees/worktrees-page.tsx)

PR surface

Source +3, Tests +33. Total +36 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 11 8 +3
Tests 1 33 0 +33
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 44 8 +36

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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.

Reviewed November 28, 2026, 4:01 AM ET / 09:01 UTC.

@vyctorbrzezowski
vyctorbrzezowski marked this pull request as ready for review November 29, 2026 17:06
@vyctorbrzezowski
vyctorbrzezowski merged commit 2caadba into main Nov 29, 2026
61 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the openclaw/loop-ui-r2-worktrees-2811 branch November 29, 2026 17:06
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
…207547)

## Problem

`ui/src/e2e/linked-session-navigation.e2e.test.ts:76` fails on main in `checks-ui-e2e (6/10)`: both cases time out after 30 s waiting for the worktree owner "Session" link to be visible.

Log signature (CI run 46147302963, shard 6): `locator.waitFor: Timeout 30000ms exceeded … waiting for locator('openclaw-worktrees-page').getByRole('link', { name: 'Session', exact: true }) to be visible`.

The failure looked order-dependent, but it is not. The file fails alone on main 440945f. #203716 (1a05dca) moved the owner link into the row's collapsed `<details class="worktree-row__details">` (`ui/src/pages/worktrees/worktrees-page.tsx:315-328`) and did not update this test. The CI failure screenshot shows the row collapsed with the link hidden. Main CI skips ui-e2e through changed-file selection, so the red shows only on PRs that select the shard.

## Solution

The test now opens the row's repository details, as a user does, before it waits for the link. The click and href identity checks do not change.

## Impact

- Test-only. No product change.
- Users: no change. With #203716 the owner Session link is one disclosure click away. This PR keeps that design. Putting the link back outside the disclosure is a separate product decision.

## Evidence

- Red on main: alone on 440945f, 2/2 cases time out at the same locator.
- Green on this branch: `linked-session-navigation.e2e` 2/2 and `worktrees.e2e` 9/9.
- `pnpm check:changed`: typecheck, lint and format pass. The dead-export scan fails on 5 existing main exports that this PR does not touch.
- Shard proof: the 109-file CI shard-6 set, run locally 3 times on this head. `linked-session-navigation.e2e` passed 2/2 in every run. Two runs passed 109/109. The third run, on a heavily loaded host, failed 3 unrelated files: two initial-roster load timeouts and an `openclaw-id-menu.e2e:178` geometry check, which is tracked separately.
- PR CI: `checks-ui-e2e (1/2)` ran `linked-session-navigation.e2e`, and it passed 2/2.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 27036be)

Companion audit: #207883 adds worktree cleanup statuses, not delete-dialog path identity. #207398 optimizes scans, #207547 checks owner navigation, and #203819/#201422/#207982/#207579 touch styles, strings, or other fixtures; no prerequisite established.

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
* fix(worktrees): identify the checkout before deletion

Co-authored-by: vyctorbrzezowski <[email protected]>

* fix: show the exact checkout before deleting a worktree

Worked on by:
- @vyctorbrzezowski

Co-authored-by: vyctorbrzezowski <[email protected]>
OpenClaw-Publication: 4b537414-6701-8ad6-bf14-7f1def12956c

* fix: keep exact checkout identity in compact worktree rows

Co-authored-by: vyctorbrzezowski <[email protected]>

* fix: satisfy lint in the touched test

* fix: satisfy lint in the Worktrees page

* fix(ui): reuse Settings layout constraints for worktree rows

---------

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
(cherry picked from commit 1a05dca)

Companion audit: #207883 adds worktree cleanup statuses, not delete-dialog path identity. #207398 optimizes scans, #207547 checks owner navigation, and #203819/#201422/#207982/#207579 touch styles, strings, or other fixtures; no prerequisite established.

Release adaptation: Use stable list records for repository labels, keep stable create and removal behavior, and show the exact checkout in both existing confirmation dialogs.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 30, 2026
* refactor(ui): skip unchanged Worktrees inventory scans

* test(ui): follow Worktrees repository disclosure markup
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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