Skip to content

fix(ui): show sessions while remote projects clone - #130192

Merged
steipete merged 3 commits into
mainfrom
steipete/server-performance-slowdown-000aef
Aug 26, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/server-performance-slowdown-000aef

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #130189.

Related: #124966 and #125100 cover the separate managed-worktree startup lifecycle. This PR fixes the earlier unregistered remote-project materialization step, which still blocks those flows before worktree startup begins.

What Problem This Solves

Fixes an issue where users starting a Control UI session with an unregistered remote GitHub project remained on the New Session page with only a spinner while the Gateway cloned and installed the repository.

In the observed openclaw/openclaw case, projects.add blocked for 141,257 ms before sessions.create began. No authoritative session, navigation target, progress state, or session-owned failure existed during that interval.

Why This Change Was Made

Remote-project intent now enters the existing sessions.create owner. The Gateway persists the session immediately, acknowledges the canonical initial run, emits the existing workspace-preparation status, and binds the prepared project before agent dispatch.

The pending repository intent is bounded, credential-free, durable across Gateway restarts, and private from public/plugin session projections. Exact session, run, lifecycle-generation, cancellation, and runtime-authority checks fence every awaited preparation boundary. Empty repository sessions retain the existing projects.add then projectId path so users can create first and prompt later.

This deliberately does not replace the broader managed-worktree lifecycle proposed in #125100.

User Impact

Users are taken into the real session immediately and see the submitted message plus the animated Preparing workspace… status while cloning runs. Clone or sandbox failures remain visible and retryable in that session, cancellation cannot bind or dispatch late work, and a Gateway restart cannot cause the next message to run silently in the default workspace.

Evidence

Observed live before the fix on Stable:

  • projects.add: 141,257 ms
  • sessions.create: 104 ms, only after project materialization completed
  • subsequent provider HTTP responses: roughly 200–350 ms
  • resulting checkout: approximately 6 GiB (2.8 GiB Git pack + 2.8 GiB node_modules)

Regression proof:

  • Pre-fix browser ordering failed with expected +0 to be 1 because no session existed while projects.add was pending.
  • Pre-fix restart recovery attempted the clone once instead of twice because pending intent was process-local.
  • Pre-fix empty-session coverage showed the remote project no longer used projects.add.

Final local verification:

  • Gateway remote-project lifecycle: 14 tests passed
  • Browser E2E: 2 scenarios passed
  • recovery/privacy and focused UI tests: 78 tests passed
  • remote Worktree compatibility follow-up: 32 focused unit tests and 11 Chromium browser tests passed
  • pnpm check:changed equivalent changed-file gate: formatting, five TypeScript lanes, lint, Plugin SDK boundaries, database guards, and import cycles passed
  • full bundled-protocol lane: 206 tests passed; Swift/Kotlin generation and protocol-since guards passed
  • fresh post-rebase autoreview: no actionable P0/P1 findings
  • git diff --check: passed

The attached proof shows current main waiting on the inert New Session page, the repaired immediate session with workspace preparation, and the actionable failure state. Fixed UI proof uses the mocked Gateway browser harness; the 141-second before timing is from the real Stable Gateway.

Source LOC: +303/-49 (net +254) | Tests: +866/-150 | Generated clients: +4/-0

The production growth is the durable private recovery state plus exact run/session/lifecycle authority needed to prevent restart, cancellation, or stale-workspace dispatch from silently running in the wrong directory.

AI-assisted: yes. The final source and behavior were independently reviewed, and the author understands the ownership and recovery flow.

Before: New Session remains inert while the remote project is materialized

After: the authoritative session opens immediately with workspace preparation progress

After: project preparation failure remains visible and actionable in the session

@clawsweeper

clawsweeper Bot commented Aug 26, 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 26, 2026 15:21
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete steipete closed this Aug 26, 2026
@steipete steipete reopened this Aug 26, 2026
Create remote-project sessions before cloning, expose workspace preparation progress, and retain private restart-safe project intent until the workspace binds.
@steipete
steipete force-pushed the steipete/server-performance-slowdown-000aef branch from 25a227d to d3d1b3d Compare August 26, 2026 15:35
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. 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 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 26, 2026, 11:48 AM ET / 15:48 UTC.

ClawSweeper review

What this changes

This PR creates a remote-project session before cloning so the Control UI can open the chat immediately and report workspace preparation progress.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: the new remote-project path regresses existing remote Worktree sessions with an initial prompt by sending a parameter combination the Gateway rejects.

Priority: P1
Reviewed head: d3d1b3dcff2ed67eab818ed30325c2cf9a2b9e16

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The session-owned preparation design has solid focused coverage, but the P1 remote-Worktree regression blocks merge.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: repository state identifies the author as a member; the supplied mocked-Gateway browser captures remain supplemental and do not affect the blocking source finding.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: repository state identifies the author as a member; the supplied mocked-Gateway browser captures remain supplemental and do not affect the blocking source finding.
Evidence reviewed 6 items Introduced Worktree regression: With a first message and Worktree selected, this condition skips the former project-materialization request, so the next session request retains the remote URL instead of a registered project id.
Incompatible request construction: The builder adds projectGitUrl for an initial turn and independently adds worktree: true.
Gateway rejection: The new validation rejects projectGitUrl combined with worktree, so the affected UI flow fails before session creation.
Findings 1 actionable finding [P1] Keep remote Worktree submissions on the materialization path
Security None None.

How this fits together

The Control UI turns a repository selection and first message into a Gateway session request. The Gateway persists the session, prepares the selected repository, then binds that workspace before agent dispatch.

flowchart LR
  A[Remote project selection] --> B[Control UI session request]
  B --> C[Gateway session creation]
  C --> D[Durable pending project]
  D --> E[Repository preparation]
  E --> F[Workspace binding]
  F --> G[Agent dispatch]
Loading

Before merge

  • Keep remote Worktree submissions on the materialization path (P1) - A remote selection with a first prompt and Worktree now skips projects.add, so the request contains both projectGitUrl and worktree: true; the new Gateway validator rejects that exact combination. Preserve the registered-project path for Worktree starts and cover it with a focused regression.
  • Resolve merge risk (P1) - The bug fix adds production +304/-53 lines for persisted startup state and dispatch fencing; retain that growth only after the existing Worktree path is restored and the new owner boundary remains necessary.
  • Complete next step (P2) - Resolve the P1 compatibility regression under maintainer-owned review; the protected maintainer label rules out automated repair routing.

Findings

  • [P1] Keep remote Worktree submissions on the materialization path — ui/src/pages/new-session/draft-submission-flow.ts:467-470
Agent review details

Security

None.

PR surface

Source +254, Tests +684. Total +938 across 24 files.

View PR surface stats
Area Files Added Removed Net
Source 16 303 49 +254
Tests 8 835 151 +684
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 24 1138 200 +938

Review metrics

Metric Value Why it matters
Production versus test LOC production +304/-53 (net +251); tests +835/-151 (net +684) The production growth adds durable session preparation and fencing, so it warrants review alongside the restored sibling flow.
Gateway create parameter 1 added: projectGitUrl The additive session-create protocol field changes how clients request remote workspace preparation.

Stored data model

Persistent data-model change detected: database schema: packages/gateway-protocol/src/schema/projects.test.ts, serialized state: packages/gateway-protocol/src/schema/sessions-create.ts, serialized state: src/config/sessions/session-accessor.sqlite-session-row.test.ts, serialized state: src/config/sessions/session-entry-projection.ts, serialized state: src/config/sessions/types.ts, serialized state: src/gateway/server-methods/session-create-project.ts, and 10 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #130189
Summary: This PR is the candidate fix for the reported non-Worktree remote-project visibility defect, while the managed-Worktree work remains distinct.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Mantis proof suggestion

A redacted Control UI chat proof would directly demonstrate immediate session navigation and preparation status for the non-Worktree path. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis web UI chat proof: verify that a remote-project session opens immediately and shows Preparing workspace before clone completion.

Merge-risk options

Maintainer options:

  1. Restore remote Worktree materialization (recommended)
    Materialize an unregistered remote project before the Worktree create request, then add a prompted remote-Worktree regression test before merging.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve pre-session project materialization for remote selections with Worktree enabled, add a focused prompted remote-Worktree regression test, and rerun the focused UI and Gateway project suites.

Technical review

Best possible solution:

Use session-owned preparation only for non-Worktree remote first turns; keep pre-session materialization for remote Worktree starts and add a focused regression covering that supported flow.

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

Yes—source establishes the path: select an unregistered remote project, enable Worktree, enter a first prompt, and the UI emits projectGitUrl with worktree:true, which the Gateway rejects.

Is this the best way to solve the issue?

No: session-owned preparation is appropriate for the non-Worktree path, but bypassing materialization must not include the existing remote Worktree flow.

Full review comments:

  • [P1] Keep remote Worktree submissions on the materialization path — ui/src/pages/new-session/draft-submission-flow.ts:467-470
    A remote selection with a first prompt and Worktree now skips projects.add, so the request contains both projectGitUrl and worktree: true; the new Gateway validator rejects that exact combination. Preserve the registered-project path for Worktree starts and cover it with a focused regression.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The patch makes an established remote-project Worktree submission fail deterministically before a session starts.
  • add merge-risk: 🚨 compatibility: Existing Control UI selections can now produce a rejected projectGitUrl plus worktree request.
  • add merge-risk: 🚨 session-state: The PR persists and recovers a private pending repository intent on session entries.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Not applicable: repository state identifies the author as a member; the supplied mocked-Gateway browser captures remain supplemental and do not affect the blocking source finding.

Label justifications:

  • P1: The patch makes an established remote-project Worktree submission fail deterministically before a session starts.
  • merge-risk: 🚨 compatibility: Existing Control UI selections can now produce a rejected projectGitUrl plus worktree request.
  • merge-risk: 🚨 session-state: The PR persists and recovers a private pending repository intent on session entries.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Not applicable: repository state identifies the author as a member; the supplied mocked-Gateway browser captures remain supplemental and do not affect the blocking source finding.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Current-main blame identifies this contributor as the author of the pre-materialization remote-project submission flow that the changed condition replaces. (role: prior submission-flow contributor; confidence: medium; commits: 6a8278d8223a; files: ui/src/pages/new-session/draft-submission-flow.ts, src/gateway/server-methods/sessions-create.ts)

Rank-up moves

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

  • Restore the remote-project materialization path when Worktree is selected.
  • Add and run a focused remote project plus initial prompt plus Worktree regression.

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

Copy link
Copy Markdown
Contributor Author

Addressed the ClawSweeper P1 on head cb77ebed8c950a2647710dfd2e9b787c0592c521.

Remote selections with Worktree enabled now remain on the established projects.add → projectId path before sessions.create; session-first projectGitUrl is limited to non-Worktree remote first turns. Focused coverage now includes prompted and attachment-only remote Worktree starts and proves that session creation waits for materialization, carries projectId + worktree: true, and omits projectGitUrl and cwd.

Proof after the fix:

  • node scripts/run-vitest.mjs ui/src/pages/new-session/draft-submission-flow.test.ts — 32 passed
  • focused Chromium project flows — 8 passed
  • targeted format/type/lint checks and fresh autoreview — clean

Both listed rank-up moves are applied. Exact-head hosted CI is waiting on the active GitHub Actions outage; GitHub Status reports traffic is being ramped back gradually.

@steipete steipete closed this Aug 26, 2026
@steipete steipete reopened this Aug 26, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready at exact head 5f043100a7dcb11e13cf247c518ae34f281bae6a.

The ClawSweeper P1 and both rank-up moves are addressed:

  • unregistered remote Worktree starts retain projects.add → projectId before sessions.create
  • prompted and attachment-only Worktree regressions prove ordering and reject projectGitUrl + worktree
  • generated Swift/Kotlin protocol clients are current

Verification:

Source LOC: +303/-49 (net +254) | Tests: +866/-150 | Generated clients: +4/-0.

Proof gap: the 141-second pre-fix timing is from the real Stable Gateway; the fixed UI states are browser-harness proof rather than a deployed Stable run. The changed owner boundaries and actual clone behavior are covered by Gateway tests using temporary Git repositories.

Provenance: the blocking clone-before-session ordering was introduced by #122906 (89a55076024b), authored and merged by @steipete on 2026-08-13. This PR is also authored by @steipete.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(ui): show sessions while remote projects clone This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit b6662bf into main Aug 26, 2026
207 checks passed
@steipete
steipete deleted the steipete/server-performance-slowdown-000aef branch August 26, 2026 17:38
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
* fix(ui): show sessions while projects prepare

Create remote-project sessions before cloning, expose workspace preparation progress, and retain private restart-safe project intent until the workspace binds.

* fix(ui): materialize remote projects before worktree sessions

* fix(protocol): refresh session create clients
steipete added a commit that referenced this pull request Aug 27, 2026
Selecting a GitHub repo from the new-session project search (or pasting a
clone URL) hid the branch/worktree chip entirely on Local placement and
blocked cloud placement, even though the submit flow already materializes
remote projects via projects.add before creating worktree sessions
(#130192). The draft repository model classified a selected remote repo
as unknown (kind idle) when it is git by construction.

New pending-clone repository state makes remote selections worktree-
capable everywhere availability is consulted: the detail chip renders,
cloud profiles enable, and switching to a device placement no longer
drops the selected repo. Repository discovery now runs through one
planRepositoryDiscovery classifier plus a single adoptResolvedRepository
reconciliation that owns preference restore and non-git rejection for
both immediate and RPC results (previously duplicated across four
branches). The submission-flow test no longer mocks worktreeAvailable.
steipete added a commit that referenced this pull request Aug 27, 2026
…#131100)

Selecting a GitHub repo from the new-session project search (or pasting a
clone URL) hid the branch/worktree chip entirely on Local placement and
blocked cloud placement, even though the submit flow already materializes
remote projects via projects.add before creating worktree sessions
(#130192). The draft repository model classified a selected remote repo
as unknown (kind idle) when it is git by construction.

New pending-clone repository state makes remote selections worktree-
capable everywhere availability is consulted: the detail chip renders,
cloud profiles enable, and switching to a device placement no longer
drops the selected repo. Repository discovery now runs through one
planRepositoryDiscovery classifier plus a single adoptResolvedRepository
reconciliation that owns preference restore and non-git rejection for
both immediate and RPC results (previously duplicated across four
branches). The submission-flow test no longer mocks worktreeAvailable.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
…openclaw#131100)

Selecting a GitHub repo from the new-session project search (or pasting a
clone URL) hid the branch/worktree chip entirely on Local placement and
blocked cloud placement, even though the submit flow already materializes
remote projects via projects.add before creating worktree sessions
(openclaw#130192). The draft repository model classified a selected remote repo
as unknown (kind idle) when it is git by construction.

New pending-clone repository state makes remote selections worktree-
capable everywhere availability is consulted: the detail chip renders,
cloud profiles enable, and switching to a device placement no longer
drops the selected repo. Repository discovery now runs through one
planRepositoryDiscovery classifier plus a single adoptResolvedRepository
reconciliation that owns preference restore and non-git rejection for
both immediate and RPC results (previously duplicated across four
branches). The submission-flow test no longer mocks worktreeAvailable.
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 gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Remote project clone blocks New Session visibility

1 participant