Skip to content

refactor(ui): split new-session page into draft owners - #122413

Merged
steipete merged 3 commits into
mainfrom
steipete/new-session-split-0811
Aug 12, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/new-session-split-0811

Conversation

@steipete

@steipete steipete commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The lazy new-session page had grown to roughly 2,535 lines and owned gateway identity, project/filesystem browsing, destination selection, recovery, and submission in one custom element. That made state ownership and stale-request invalidation difficult to reason about and forced tests through private page-shaped seams.

Why This Change Was Made

This splits the page into four concept owners behind the existing lazy page entry: DraftGatewayState, DraftPlaceBrowser, DraftPlaceState, and DraftSubmissionFlow. Each mutable field now has one owner, controllers exchange narrow snapshots and callbacks, route-side imports remain unchanged, and CSS/component registration stays in the lazy page module.

A follow-up cleanup in the same stack removes the dead page type export, empty recovery branch, duplicate recovery projection, duplicate create-parameter assembly, duplicate browser reset blocks, and the unused three-state folder submission mode. The max-lines baseline is then ratcheted separately.

User Impact

This is behavior-preserving. New-session route ownership, project recents, cloud handoff, attachment recovery, access gating, workspace validation, destination switching, and immediate navigation continue to behave as before. The practical impact is a smaller page shell and explicit ownership boundaries for future changes.

Evidence

  • Focused UI units: 4 files, 15 tests passed.
  • Catalog reconnect + workspace validation E2E: 2 files, 22 tests passed.
  • Cloud startup/failure + prompt attachments + operator scopes E2E: 4 files, 28 tests passed.
  • Places + workspace memory + GitHub projects E2E: 3 files, 26 tests passed.
  • Focused late-create cleanup regression after CI feedback: 1 file, 7 tests passed.
  • pnpm build: passed; the page remains lazy and catalog-target remains a separate dynamic asset.
  • pnpm check:max-lines-ratchet --base origin/main: passed, 933 grandfathered entries.
  • pnpm check:import-cycles: passed, 0 runtime value cycles.
  • pnpm lint:tmp:export-name-collisions: passed.
  • pnpm check:wrapper-shadowing: passed, 0 current and 0 baselined.
  • pnpm plugin-sdk:surface:check: passed, 152 public subpaths verified.
  • Autoreview: clean on every commit and corrective fixup before autosquash.

LOC split from git diff --numstat origin/main...HEAD:

  • Production: +2,877 / -2,311 (net +566). Most additions are moved owner code plus explicit controller snapshot/callback seams; no new product capability was added.
  • Tests: +367 / -217 (net +150).
  • Tooling: +0 / -1 (max-lines baseline ratchet).

No pathfinder bugs were found, so there are no separate behavior-bearing commits.

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 12, 2026 03:40
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Aug 12, 2026
@steipete
steipete force-pushed the steipete/new-session-split-0811 branch from ea8fd49 to 8d94f45 Compare August 12, 2026 03:58
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 12:04 AM ET / 04:04 UTC.

ClawSweeper review

What this changes

This PR splits the lazy new-session web page into gateway, place-browser, place-state, and submission-flow owners while preserving its existing route and UI behavior.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer review: no blocking regression was found in the refactor, but the protected maintainer label requires an explicit landing decision after exact-head CI completes.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch cleanly separates established state owners with focused regression coverage and no confirmed review defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored refactor is exempt from the external-contributor real-behavior-proof gate; the PR body supplies focused test and build evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored refactor is exempt from the external-contributor real-behavior-proof gate; the PR body supplies focused test and build evidence.
Evidence reviewed 5 items Owner-boundary wiring: The page shell constructs the four state owners and connects them through narrow callbacks while retaining the existing route-level rendering boundary.
Submission behavior preserved: The submission owner retains regular creation, cloud recovery fencing, attachment handoff, session selection, and navigation in one lifecycle-aware flow.
Focused regression coverage: New tests cover route-owned draft retention, recent-place fallback, and cloud-startup handoff/navigation.
Findings None None.
Security None None.

How this fits together

The new-session Control UI gathers gateway identity, project or folder selection, and draft content before creating or opening an agent session. Its output is a selected session and navigation into chat, with cloud startup handed to the application owner.

flowchart LR
  Route[New-session route] --> Shell[Lazy page shell]
  Shell --> Gateway[Gateway and preferences]
  Shell --> Place[Project and destination state]
  Place --> Submit[Session submission]
  Submit --> Cloud[Cloud startup when selected]
  Submit --> Chat[Selected chat session]
Loading

Decision needed

Question Recommendation
Should this maintainer-owned new-session refactor land once the remaining exact-head checks complete? Land after exact-head CI: Merge the refactor once the remaining checks pass on the reviewed head.

Why: The submitted patch has no concrete blocking defect, but the maintainer label requires a human landing choice for this large behavior-preserving UI ownership change.

Before merge

  • Resolve merge risk (P1) - Direct @lit/task source inspection was unavailable because this partial checkout has no installed package and GitHub DNS was unavailable; the refactor retains the existing local Task usage pattern, but upstream internals were not independently re-read.
Agent review details

Security

None.

PR surface

Source +566, Tests +150, Other -1. Total +715 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 7 2877 2311 +566
Tests 4 367 217 +150
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 12 3244 2529 +715

Review metrics

Metric Value Why it matters
Production versus test LOC production +2,877/-2,311 (net +566); tests +367/-217 (net +150); tooling 0/-1 The production growth is primarily explicit owner seams replacing a 2,276-line page deletion; no config, default, protocol, or persisted-data surface changed.

Stored data model

Persistent data-model change detected: serialized state: ui/src/pages/new-session/draft-submission-flow.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the slim page shell and the four explicit owners, then land only once the remaining exact-head UI, type, and build checks confirm the behavior-preserving split.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the slim page shell and the four explicit owners, then land only once the remaining exact-head UI, type, and build checks confirm the behavior-preserving split.

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

Not applicable: this PR refactors an existing flow rather than reporting a distinct defect; the relevant route, browsing, and cloud-submission paths were traced in source.

Is this the best way to solve the issue?

Yes: moving stateful behavior into four focused owners while retaining the lazy route shell is a cleaner long-term boundary than preserving the 2,535-line monolith or adding wrappers around it.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a behavior-preserving maintainability refactor with no demonstrated user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored refactor is exempt from the external-contributor real-behavior-proof gate; the PR body supplies focused test and build evidence.

Label justifications:

  • P3: This is a behavior-preserving maintainability refactor with no demonstrated user-facing regression.
  • 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 maintainer-authored refactor is exempt from the external-contributor real-behavior-proof gate; the PR body supplies focused test and build evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Recent commits own the project picker and identity-synced new-session preferences that this refactor separates. (role: recent area contributor and feature owner; confidence: high; commits: 8876528f7c0e, cd0a1235a30c, cbf94c0d8b2b; files: ui/src/pages/new-session/new-session-page.ts, ui/src/pages/new-session/place-picker.ts)
  • Vincent Koc: Recent history includes the route-loading draft-preservation repair, which shares this refactor's reset and draft-ownership boundary. (role: adjacent route-state contributor; confidence: medium; commits: de13b4b1b864; files: ui/src/pages/new-session/new-session-page.ts)

Rank-up moves

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

  • Let the remaining exact-head CI checks finish before merge.

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 merged commit 6b0be02 into main Aug 12, 2026
109 checks passed
@steipete
steipete deleted the steipete/new-session-split-0811 branch August 12, 2026 04:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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