Repository navigation
fix(worktrees): explain session creation failures for repositories without commits - #140251
Conversation
… collapsing them session-worktree-preparation.ts replaced WorktreeRepositoryError messages with a fixed "agent workspace is not a git checkout" string, hiding the actual cause (e.g. missing commits, mismatched origin). Use formatErrorMessage(error) so the thrown message reaches the operator. Closes openclaw#140204
|
🦞👀 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. Reviewed September 7, 2026, 12:36 AM ET / 04:36 UTC. ClawSweeper reviewWhat this changesPreserve specific worktree session-creation errors, explain how to recover from a repository without commits, and update the regression assertion and troubleshooting documentation. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still replaces the actionable repository error with a misleading checkout message. The focused repair and reported real Gateway verification support merging, with no blocking findings. Priority: P2 Review scores
Verification
How this fits togetherManaged worktrees give OpenClaw sessions isolated Git branches and checkouts. Gateway session creation validates the source repository through shared preparation code, which returns either a prepared checkout or an operator-facing error. flowchart TD
A[Session creation request] --> B[Shared worktree preparation]
B --> C[Validate source repository]
C --> D{Valid committed checkout?}
D -->|Yes| E[Prepare session worktree]
D -->|No| F[Specific error and recovery guidance]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +1, Docs +2. Total +3 across 4 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep repository validation authoritative and carry its redacted, actionable diagnosis through both synchronous and deferred session creation. Do we have a high-confidence way to reproduce the issue? Yes: an initialized repository without HEAD reaches the specific repository error, which current main replaces with the wrong message. Source and the existing real-Git regression establish the path; this read-only review did not run it. Is this the best way to solve the issue? Yes: forwarding the existing diagnosis fixes all affected callers at their shared boundary without duplicating validation or changing accepted repositories. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6223cf8b7480. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
Thanks @SunnyShu0925! Proof: Real Gateway WebSocket checks verified missing-commit diagnostics, initial-commit recovery, synchronous and deferred preparation, rejected-request state, distinct repository errors, and normal worktree creation. Independent behavior validation and source review cover the full acceptance contract. CI passed.
Merged as abd2d6f. No CI exception was needed. |
…thout commits (openclaw#140251) Preserve specific repository errors during session worktree preparation and tell operators to create an initial commit before retrying an empty repository. Extend the existing regression assertion and document recovery. Real Gateway checks cover synchronous and deferred errors, rejected-request state, distinct repository failures, and successful committed-repository creation. Closes openclaw#140204. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #140204
What Problem This Solves
Creating a worktree session in an initialized Git repository with no commits incorrectly reports that the folder is not a Git checkout.
Why This Change Was Made
Preserve the repository service's specific diagnostic through the shared session-preparation path. Add the instruction to create an initial commit and retry at the existing missing-commit check. Error codes and Git validation remain unchanged.
User Impact
Operators see the actual cause and a recovery action. Non-Git folders, mismatched origins, wrong worktree ownership, and unavailable metadata retain distinct errors.
Evidence
Real Gateway WebSocket
sessions.createproof used task-owned Git repositories:not a git checkoutmessagegit checkout has no commits; create an initial commit and retryRejected synchronous requests created no session, branch, or managed worktree. Restoring the original Git metadata allowed normal reuse after the ownership controls. No model or provider call was needed.
The existing real-Git regression test requires both cause and recovery. Pinned formatting, independent source review, and CI run 34082629999 passed. Runtime proof used the run's compiled merge of this exact repair with its base; build identities are retained with the evidence.
Original diagnostic-propagation fix by @SunnyShu0925. AI-assisted repair and verification.