Repository navigation
fix: keep workspace preparation pending during source contention - #184672
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR shares the existing creation contention budget across registered-source preparation, checkout publication, and final session binding. Example: A registered repository remains busy for 35 seconds during workspace creation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a current-main workspace-creation failure, preserves existing ownership and cancellation checks, and has no actionable findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway session creation passes selected project access into the managed-worktree service, which reserves capacity, prepares a checkout, publishes its registry record, and binds it to the session. flowchart TD
A[Session creation] --> B[Shared contention budget]
B --> C[Registered source acquisition]
C --> D[Capacity reservation]
D --> E[Checkout and setup]
E --> F[Registry publication]
F --> G[Final session binding]
B --> G
Technical reviewBest possible solution: Retain one acquisition-only budget across preparation and final binding while preserving immediate reservation, current-source checks, cancellation, and completed setup. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the separate 30-second limit, and the linked issue documents a real registry/Git/SQLite failure supported by the inspected baseline screenshot. Is this the best way to solve the issue? The patch corrects the competing deadline at the existing accounting owner, covers later preparation stages, and moves discovery helpers without creating a parallel implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eaaa6f1b1376. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +75, Tests +256, Docs 0. Total +331 across 12 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 26, 2026, 1:11 PM ET / 17:11 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
64d6c9e to
7878055
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: accepted workspace requests now wait through temporary repository contention and continue without repeating completed setup. |
…nclaw#184672) Keep accepted workspace preparation pending during temporary source contention, sharing the existing wait budget through checkout and final session binding without repeating setup. Fixes openclaw#184272.
Fixes #184272
What Problem This Solves
An accepted workspace request can fail after about 30 seconds when another operation temporarily owns its registered repository. The workspace service already has a longer shared contention budget, but project acquisition uses a separate limit. The same premature failure can occur before checkout, between preparation stages, or while binding the completed workspace to its session.
User Impact
Registered-source waits now use the existing 30-minute creation contention budget. When access returns, preparation continues at its current stage with the selected source, owner, name and base. An already completed checkout or setup is retained while publication waits.
Unrelated repositories keep the allocation independence delivered by #184138. The hard capacity limit, source checks, native-process settlement and cleanup policy are unchanged. There is no new configuration option, persistent representation or public protocol field. Cancellation continues through the existing request owners. This change incorporates the landed hidden-spawn cancellation and committed-child cleanup fixes from #184345 and #184420.
Why This Change Was Made
Related draft #184304 addresses service-side waiting. This contribution also carries the budget through Gateway preflight, the required foreground title read, and final session binding, with the native caller regressions described below.
One acquisition helper uses the existing wait-budget owner and stops charging when the source callback begins. Its budget type lives in the shared worktree contract, so callers do not import the allocation implementation for that type. Gateway preflight, service creation and final binding share the same request-local budget. Immediate reservation attempts retain their typed busy outcome, so the existing safe release-and-reentry path still runs outside global allocation. Later source contention waits at the affected stage rather than restarting creation or setup.
Optional title generation keeps its independent background lifetime and existing deadline; only its required foreground read shares preparation waiting. Existing project-source discovery helpers move into one module to keep the preparation owner within the repository's line limit.
Evidence
The real registered-project/Git-queue/SQLite reproduction on 95a3ccd completed an unrelated workspace, then failed the waiting request after 32.4 seconds. A later oracle on main at 5f1d487 still fails all three source-wait cases: reservation, publication after setup, and Gateway preparation/final binding. The patched composition passes those owner paths and the native Git cleanup-uncertainty check.
The current tree passes changed formatting/lint, the line-cap and import-cycle guards, all selected production/test type groups, and 65 tests across default-base recovery, pending worktree slots, and Gateway preparation. The newly landed recovery caller imports the wait-budget type from its shared owner; no runtime statement changes in that adaptation.
Real Gateway/browser proof keeps the original request pending past 34 seconds and reload, then completes the same session and run after source release. A separate Stop case observes
chat.abortand verifies no late checkout, branch or provider request. An unrelated repository completes while the source remains held. These browser cases use the real default sandbox and a scripted loopback model. The matched baseline recording shows the original failure; its later obsolete-locator assertion failed, so the entire baseline command is not reported as passing.A separate actual OpenAI case through the OpenClaw runtime passes: the agent uses a tool to read a fresh marker from the persisted workspace and returns it, with selected commit, owner, session cwd and binding verified. The three CLI/session/workboard caller suites also pass. Those results and the captures recorded on 64d6c9e, plus the tested 5f1d487 composition, remain applicable after the type-only caller adaptation and qualified upstream changes; current default-base interaction tests cover the newly landed recovery capability.
One earlier worker-authority test had an inherited message mismatch. Exact base/candidate comparison preserved its original assertion and verified no dispatch, binding or leaked checkout on both. Main carries the expectation correction in #184667; this PR does not relax the assertion.
Five alternating ordinary-path pairs after one excluded warmup show unchanged work counts. First-create median/p95 was 1469/1472 ms on the baseline and 1450/1454 ms on the candidate; subsequent creates were 544/550 ms and 541/544 ms. Both made three source acquisitions and four project resolutions, with 22 Git starts for the first create and 21 subsequently. No 20% timing-regression threshold was triggered. These are measurements of that recorded registered-source workload, not production throughput claims.
Current-head hosted CI passes. Independent review is clean, and automated review reports Platinum with no findings.
Visual evidence
Original request continues after release; a separate request is stopped while waiting
workspace-source-wait.mp4
Visual verification
64d6c9eb1681fc67c7dd91141386db1f8dcb368a