Repository navigation
fix(ui): show worktree setup in new sessions - #125100
vyctorbrzezowski wants to merge 5 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 23, 2026, 2:56 PM ET / 18:56 UTC. ClawSweeper reviewWhat this changesThis PR creates a managed-worktree session immediately, shows setup progress in Control UI, and defers the first agent turn until workspace preparation finishes. Merge readiness⛔ Blocked until stronger real behavior proof is added - 7 items remain Keep open: the revised lifecycle still permits revoked delegated authority to reach Git work before its first authority check, so the prior P1 remains unresolved. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherControl UI submits a new session to the Gateway, which allocates its durable identity and prepares a managed Git worktree before admitting the first turn. The new startup state is persisted through Gateway session rows and rendered as a transcript card with recovery actions. flowchart LR
A[Control UI submission] --> B[Gateway session identity]
B --> C[Durable startup state]
C --> D[Managed Git worktree]
D --> E[First-turn admission]
C --> F[Transcript progress card]
E --> F
Before merge
Findings
Agent review detailsSecurityNeeds attention: The deferred startup still permits a revoked authority to reach repository-side effects before its guard runs. PR surfaceSource +1573, Tests +638, Docs +2, Other +44. Total +2257 across 55 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Revalidate the original delegated-authority guard before every startup effect, including stage persistence, fetch, checkout, provisioning, setup, terminal state, and first-turn admission; add a revocation-before-fetch regression test. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: revoke the delegated runtime after the pending session is created but before base resolution, then observe that the current path can still enter Is this the best way to solve the issue? No; the durable session and UI projection are the right owner boundary, but the guard must fence worktree effects before fetch rather than only later commits. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7c7e10ab853e. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
🦞👀 Pull request received. I will update this pull request when review starts. |
5f028a4 to
ac2b004
Compare
|
Heads-up for the next rebase: #130192 landed the preceding unregistered remote-project materialization path as The landed contract is deliberately split:
This does not replace the managed-Worktree startup lifecycle in this PR, but it will overlap |
|
The startup-latency goal is now implemented on main by #131559, merged as 54a5358, which also closes #124966. The landed path extends the admitted-run workspace preparation owner introduced by #130192: create/open the real session before naming, checkout, and setup; restore progress after reload; keep failures and retries in that session; bind the checkout before agent/terminal execution. The PR includes an inspected real-Gateway/Codex recording and green exact-head CI, plus retry/authority and lifecycle regressions. Closing this earlier implementation as superseded so there is one canonical startup lifecycle. This does not claim to include its additional Work locally/setup-output-tail UI; those would be separate UX proposals rather than a reason to retain a second initialization state machine. Thanks for the earlier investigation and proposal, which are linked from the landed PR. |
What Problem This Solves
Closes #124966.
Starting a Control UI session with Worktree selected previously kept the operator on the New Session page while checkout and repository setup ran. The Enter action appeared inert, and the accepted first turn had no visible session identity or progress.
Why This Change Was Made
The Gateway now commits the session and a bounded projection of the first user turn before managed-worktree preparation begins, then returns the real session key immediately. Worktree preparation remains owned by one durable startup lifecycle with exact generation, delegated-authority, cancellation, cleanup, restart-recovery, and first-turn admission fences.
The Control UI navigates immediately, renders the submitted turn and bounded setup tail in the transcript, and keeps participation blocked until the initial turn is admitted. Cancel and Work locally are available during setup. A completed worktree has an explicit recovery action if the Gateway restarts before the first turn starts.
The closeout also:
sessions-create.tsinto focused owners;sessions.create.messagerequest contract.User Impact
After pressing Enter, operators immediately arrive in the new session, see their message, and can follow Checking out files… through Workspace ready. The composer does not show a separate “Preparing workspace…” status and remains blocked only while startup owns the first turn. Failure, cancellation, restart, and work-local choices all produce visible outcomes without duplicate sessions or leaked checkouts.
Evidence
Exact closeout commit:
076bf9eb86b9f120b688b4ff1a1afad91da20182Full flow
The recording asserts: new-session submit → immediate transcript/session → checkout progress with Cancel / Work locally → Workspace ready → startup card removal before first stream → final assistant response.
pr-125100-full-flow.mp4
Before
Desktop
Mobile
All captures were inspected after recording. The progress states show the first turn, setup tail, both recovery actions, and no “Preparing workspace…” composer copy. Ready states show the completed checkout and explicit recovery action across desktop/mobile and dark/light.
Validation
OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs src/gateway/server.sessions.create.test.ts— 242 passed across both Gateway shards.OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/new-session-page.worktree-startup.e2e.test.ts— passed.OPENCLAW_VITEST_MAX_WORKERS=2 node scripts/check-changed.mjs— passed; SwiftLint was unavailable on Linux and remains owned by macOS CI.pnpm build— passed, including Control UI performance budgets and published-surface checks.codex --dangerously-bypass-approvals-and-sandbox review --base origin/main— finalcodex-review-19.log: no actionable correctness defects.New/changed behavioral tests: 8 focused startup cases plus the Control UI E2E and metadata attachment assertion. Each protects behavior absent from the pre-fix flow: optimistic session visibility, authority retention, post-provision rollback, restart recovery, first-turn ordering, bounded metadata, UTF-8 streaming output, and completed-state participation blocking.
Closeout production delta:
+1152/-735; test and test-support delta:+406/-48. The production increase is the durable startup protocol/lifecycle capability;sessions-create.tsitself is reduced by 548 lines and the lifecycle is split into its owning modules.