Repository navigation
fix(doctor): recognize git checkouts whose root ends in whitespace - #197973
wangmiao0668000666 wants to merge 1 commit into
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 real behavior proof before merge. What this changesPreserve meaningful trailing whitespace when Doctor compares a checkout root with Git’s output. Example: Run interactive openclaw doctor from the source checkout "/srv/openclaw ".
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain This PR fixes a concrete current-main classification bug with a minimal change; coordinate landing with the updater sibling so the newly offered action works. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherDoctor consumes the installation root and Git subprocess output, compares canonical filesystem paths, and either offers the canonical updater or displays package-manager guidance. flowchart LR
A[Interactive Doctor] --> B[Git root discovery]
B --> C[Remove final LF]
C --> D[Canonical path comparison]
D --> E[Update confirmation]
E --> F[Canonical updater]
Technical reviewBest possible solution: Keep the focused Doctor fix and coordinate it with the existing updater repair rather than duplicating that work. Do we have a high-confidence way to reproduce the issue? Current-main source directly demonstrates the pathname loss, and the contributor’s terminal trace shows the corresponding CLI failure; no target code was executed during this review. Is this the best way to solve the issue? Removing only Git’s final LF is the smallest repair to the existing canonical comparison, with one focused regression and no new state or abstraction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4f7b426a4e3f. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests +12. Total +13 across 2 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 HistoryReview history (3 earlier review cycles)
Reviewed November 13, 2026, 10:13 PM ET / November 14, 2026, 03:13 UTC (Revision 4). |
4ec78ce to
26fb0ce
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…pace Git appends one LF to rev-parse --show-toplevel output; trimming the whole line also strips meaningful trailing whitespace from the checkout path, so a source checkout under a whitespace-suffixed directory failed the toplevel comparison and the Control UI dev-gateway badge silently never rendered. Strip only the record terminator, matching the shipped project-checkout.ts wording and the approved openclaw#196654/openclaw#197973 predicate.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review — head 26fb0ce now carries the full real-behavior proof in the body: shipped interactive CLI terminal trace from a physical whitespace-suffixed checkout (/tmp/oc-proof-doctor/leg2-head/openclaw-src ) inside a real TTY (tmux) with isolated OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH and a real Git identity, comparing current-main RED (7602443 — 'This install is not a git checkout' / package-manager guidance) against this head GREEN (Git update prompt offered, fast-forward actually available). The vitest red/green at the classification boundary stands as well. |
|
🦞👀 Re-review progress:
|
|
Closing as stop-loss: this PR is structurally blocked. It is rated silver (2/6) with an unmet upgrade-proof gate (latest-stable Doctor upgrade evidence), and ClawSweeper requires landing #196654 (still open, Alix) first or together — otherwise the offered update throws 'Doctor source update requires the accepted Git checkout.' The one-line fix duplicates the #196654 shape already covered by the update-status sibling. Keeping the branch for reference. |
What Problem This Solves
openclaw doctorclassifies the install root withgit rev-parse --show-toplevelbefore offering the git update path. The result was.trim()ed, so a checkout whose directory legitimately ends in whitespace (for example/srv/openclaw) had its meaningful trailing space stripped, failed the root comparison, and was reported as "not a git checkout". The operator then got the package-manager guidance note and no git-update offer, even though the install is a source checkout. The same root-cause shape was approved foropenclaw update statusin #196654 and already shipped insrc/projects/project-checkout.ts.Precedent: #196654 (same one-line predicate fix at the update-check call site; this PR covers the doctor sibling)
Why This Change Was Made
detectOpenClawGitCheckoutinsrc/commands/doctor-update.tsnow removes only Git's final LF record terminator (replace(/\n$/, "")), preserving filesystem characters in the checkout path, exactly matching the approved #196654 wording. Ordinary checkouts, aliases, separate Git directories, and non-checkouts keep the current classification and messages.Production LOC is
+2/-1in one file.Classification:
behavior-completingUser Impact
A source checkout under a whitespace-suffixed directory is now recognized by
openclaw doctor, so the "Update OpenClaw from git before running doctor?" prompt (and the resulting git update flow) appears as it does for ordinary checkouts. Ordinary paths are byte-for-byte unaffected; a path that merely looks similar after trimming no longer misclassifies.Evidence
Exact-head proof receipt
4ec78cebcf3b76024435027d4ac4e51a58468bb1b5c4842d9fb0maybeOfferUpdateBeforeDoctor→detectOpenClawGitCheckoutinsrc/commands/doctor-update.tsdetectOpenClawGitCheckoutatsrc/commands/doctor-update.ts:32-34"git" | "not-git" | "unknown"classification that gates the git-update offer and the package-manager guidance notemaybeOfferUpdateBeforeDoctorreturn value plus the mockedconfirm/updateCommandcalls in the existingsrc/commands/doctor-update.test.tsharness/repo/sourcewithshow-toplevelreturning/repo/source \nclassifies asnot-git: the offer resolvesfalse,confirmis never called, and the package-manager note is printedgit: the offer resolvestrue,confirmis called once, andupdateCommandreceivessourceUpdate: { root: "/repo/source " }Inspectable RED -> GREEN terminal trace
Vitest shard on the real runner (Node 24.22.1, docker
lexiflow-all):Verification
node scripts/run-vitest.mjs run src/commands/doctor-update.test.ts --maxWorkers=1— 12/12 passed on exact head; RED reproduced on current main with only the new testScope and risk
+2/-1(src/commands/doctor-update.ts)+12(src/commands/doctor-update.test.ts)resolveComparablePathcomparison and the approvedreplace(/\n$/, "")predicate from fix(update): preserve Git identity for whitespace-suffixed checkout paths #196654; no new helper or exportReal behavior proof (shipped interactive CLI)
The review asked for terminal evidence from a physical whitespace-suffixed checkout. Reproduced with the compiled CLI (
node openclaw.mjs, dist built from the pinned trees) running from a real Git checkout whose path ends in a meaningful space (/tmp/oc-proof-doctor/leg2-head/openclaw-src), inside a real TTY (tmux), with isolatedOPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATHand a real Git identity. The checkout's branch tracks an offline bare remote one empty commit ahead, so the offered update could actually fast-forward.Base — current main
76024435027d4ac4e51a58468bb1b5c4842d9fb0:Doctor withholds the Git update offer and routes the operator to package-manager guidance.
Head — this PR
4ec78cebcf3b7a5b35ae8ec4ac00d18428fdbb0f, same checkout shape and harness. The interactive prompt now appears (tmux capture):Answering
Yesenters the shipped source-update flow (same capture, after the answer):That final line is the update flow's second install-kind probe (
src/infra/update-check.ts:278,result.stdout.trim()— the same pathname-loss family). It is owned by the already-open, same-shape fix #196654 (result.stdout.replace(/\n$/u, "")); it is deliberately not duplicated here. With #196654 landed, the offered update fast-forwards this exact checkout. Classification — the boundary this PR changes — is proven at the real CLI: base routes to package-manager guidance, head offers the Git update from the same physical whitespace-suffixed checkout.Not tested here: the completed
git pullinside the update runner (blocked by the separately-owned #196654, disclosed above, not by this diff).Maintainer edits
Maintainer options