Skip to content

fix(doctor): canonicalize git checkout detection#85735

Merged
giodl73-repo merged 1 commit into
openclaw:mainfrom
giodl73-repo:fix-82215-doctor-junction-git
May 23, 2026
Merged

fix(doctor): canonicalize git checkout detection#85735
giodl73-repo merged 1 commit into
openclaw:mainfrom
giodl73-repo:fix-82215-doctor-junction-git

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #82215 by canonicalizing the doctor pre-update git checkout comparison. openclaw doctor now compares the git rev-parse --show-toplevel result and the resolved OpenClaw package root by filesystem realpath, so junction/symlink-backed source installs are treated as git checkouts instead of package installs.

This keeps the existing package-manager guidance when git reports a genuinely different root or when git explicitly says the root is not a repository.

Verification

  • corepack pnpm install
  • node_modules/.bin/oxfmt --check --threads=1 CHANGELOG.md src/commands/doctor-update.ts src/commands/doctor-update.test.ts
  • node_modules/.bin/oxlint src/commands/doctor-update.ts src/commands/doctor-update.test.ts
  • git diff --check
  • Testbox-through-Crabbox, provider blacksmith-testbox, id tbx_01ksak2cz5znsggspmnjce91p3, Actions run https://github.com/openclaw/openclaw/actions/runs/26334983419:
    CI=1 NODE_OPTIONS=--max-old-space-size=4096 OPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=900000 OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 corepack pnpm test src/commands/doctor-update.test.ts
    • Result: 1 file / 2 tests passed.
  • Autoreview: /mnt/c/src/claws-hapi/.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main
    • Result: clean, no accepted/actionable findings.

Real behavior proof

Behavior addressed: openclaw doctor no longer shows package-manager update guidance for a source checkout reached through a junction/symlink when that linked package root and git's top-level path resolve to the same filesystem location.

Real environment tested: Blacksmith Testbox through Crabbox (provider=blacksmith-testbox, id tbx_01ksak2cz5znsggspmnjce91p3, GitHub Actions run https://github.com/openclaw/openclaw/actions/runs/26334983419).

Exact steps or command run after this patch: CI=1 NODE_OPTIONS=--max-old-space-size=4096 OPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=900000 OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 corepack pnpm test src/commands/doctor-update.test.ts

Evidence after fix: The regression test stubs git -C <linked-root> rev-parse --show-toplevel to return the real checkout path and stubs fs.realpath so both the linked root and real root resolve to the same canonical path; doctor then offers the git update prompt instead of the not-git/package-manager note. A companion test keeps the not-git note when the canonical paths differ.

Observed result after fix: Testbox reported src/commands/doctor-update.test.ts (2 tests) passed.

What was not tested: A full interactive native Windows junction install was not run in this PR; the covered behavior is the internal doctor decision point that receives the linked package root and git top-level path.
Additional linked-checkout proof after maintainer review:

  • Linked checkout path: /root/src/openclaw-82215-link -> /root/src/openclaw-82215.
  • Command run from the linked path using a real pseudo-terminal: yes n | timeout 75s script -q -e -c "stty cols 120 rows 40; env TERM=dumb NO_COLOR=1 FORCE_COLOR=0 CI=0 OPENCLAW_HOME=<temp> OPENCLAW_STATE_DIR=<temp>/state NODE_OPTIONS=--no-warnings node --preserve-symlinks --preserve-symlinks-main --import tsx ./src/entry.ts doctor" /tmp/openclaw-85735-symlink-doctor-2.log.
  • Environment facts: pwd was /root/src/openclaw-82215-link; pwd -P was /root/src/openclaw-82215; git -C /root/src/openclaw-82215-link rev-parse --show-toplevel returned /root/src/openclaw-82215.
  • Evidence after fix: doctor displayed Update OpenClaw from git before running doctor? and did not print This install is not a git checkout.
  • Observed result after fix: the linked checkout was recognized as a git checkout by the real doctor command path; I answered No to avoid running the update flow.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S maintainer Maintainer-authored PR labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Latest ClawSweeper review: 2026-05-23 15:33 UTC / May 23, 2026, 11:33 AM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • 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.

PR Surface
Source +9, Tests +111, Docs +1. Total +121 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 1 +9
Tests 1 111 0 +111
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 122 1 +121

Summary
The branch canonicalizes doctor git-checkout detection with realpath comparison, adds two focused Vitest cases for linked and different roots, and adds a changelog fix entry.

Reproducibility: yes. Current main compares the raw git top-level string to the package root, so a symlink or junction path and its real checkout path can reproduce the false not-git branch when their strings differ.

PR rating
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Summary: The patch is small, targeted, and now has real terminal proof; remaining confidence is normal maintainer review around the protected label and current checks.

Rank-up moves:

  • none
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

Real behavior proof
Sufficient (terminal): The PR body now includes after-fix terminal proof from a real pseudo-terminal linked-checkout openclaw doctor run that showed the git update prompt and did not print the package-manager note.

Risk before merge

  • The PR has the protected maintainer label, so the remaining merge path is explicit maintainer review and normal check/merge handling rather than ClawSweeper cleanup or repair automation.

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused canonical-path comparison after maintainer review confirms the protected-label workflow and current checks are acceptable.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge
No ClawSweeper repair is needed; the remaining action is explicit maintainer handling of the protected-label PR and normal merge checks.

Security
Cleared: The diff only changes doctor path comparison logic, a focused Vitest file, and changelog text; it does not touch dependencies, workflows, package resolution, credentials, or downloaded code.

Review details

Best possible solution:

Land the focused canonical-path comparison after maintainer review confirms the protected-label workflow and current checks are acceptable.

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

Yes. Current main compares the raw git top-level string to the package root, so a symlink or junction path and its real checkout path can reproduce the false not-git branch when their strings differ.

Is this the best way to solve the issue?

Yes. Canonicalizing both paths before comparing is the narrow maintainable fix, matches the existing update-runner contract, and preserves the different-root and non-repository cases.

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes after-fix terminal proof from a real pseudo-terminal linked-checkout openclaw doctor run that showed the git update prompt and did not print the package-manager note.
  • add rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🐚 platinum hermit, patch quality is 🐚 platinum hermit, and The patch is small, targeted, and now has real terminal proof; remaining confidence is normal maintainer review around the protected label and current checks.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body now includes after-fix terminal proof from a real pseudo-terminal linked-checkout openclaw doctor run that showed the git update prompt and did not print the package-manager note.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a normal-priority doctor/update install-detection bug with a limited affected surface.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🐚 platinum hermit, patch quality is 🐚 platinum hermit, and The patch is small, targeted, and now has real terminal proof; remaining confidence is normal maintainer review around the protected label and current checks.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body now includes after-fix terminal proof from a real pseudo-terminal linked-checkout openclaw doctor run that showed the git update prompt and did not print the package-manager note.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body now includes after-fix terminal proof from a real pseudo-terminal linked-checkout openclaw doctor run that showed the git update prompt and did not print the package-manager note.

Acceptance criteria:

  • node scripts/run-vitest.mjs src/commands/doctor-update.test.ts
  • git diff --check origin/main...HEAD

What I checked:

  • Current main bug path: Current main classifies a checkout as git only when git rev-parse --show-toplevel exactly equals root, so a linked package root and its real checkout path can be misclassified when the strings differ. (src/commands/doctor-update.ts:25, d9f73cfe3349)
  • Existing update-runner precedent: The update runner already resolves comparable paths with fs.realpath(...).catch(() => path.resolve(...)) before comparing locations, which supports this PR's fix shape. (src/infra/update-runner.ts:489, d9f73cfe3349)
  • Live PR diff: GitHub API shows the live PR head is 55a78711b9445a7b27aa4f892cd813c4b409bc51 and touches only CHANGELOG.md, src/commands/doctor-update.ts, and src/commands/doctor-update.test.ts. (src/commands/doctor-update.ts:10, 55a78711b944)
  • Focused regression coverage: The added test stubs matching realpaths for /repo/link and /repo/real and asserts doctor offers the git update prompt, while a companion test keeps the package-manager note when canonical paths differ. (src/commands/doctor-update.test.ts:61, 55a78711b944)
  • Real behavior proof: The updated PR body includes an after-fix pseudo-terminal run from a linked checkout where pwd used the link, pwd -P and git top-level used the real path, and doctor showed the git update prompt without printing the not-git package-manager note. (55a78711b944)
  • Protected label state: Live PR metadata includes the protected maintainer label, so this PR should stay in explicit maintainer handling rather than cleanup closure or automated repair routing. (55a78711b944)

Likely related people:

  • vincentkoc: Local blame attributes the current doctor-update.ts implementation and comparable-path update-runner helper region to commit 15d9134fc6579abad8699698b2744e0cb394ce6e; GitHub path history also shows recent update-runner fixes by this person. (role: introduced current checkout surface in local history and recent update contributor; confidence: high; commits: 15d9134fc657, 769fd0b14a34, 15a0156a8cda; files: src/commands/doctor-update.ts, src/infra/update-runner.ts)
  • steipete: GitHub path history shows recent changes touching src/commands/doctor-update.ts and update-runner adjacent behavior, including CLI conversion and update preflight work. (role: recent adjacent CLI/update contributor; confidence: medium; commits: 1fb2e18f47e0, 1f02abe38139, af0345f8248d; files: src/commands/doctor-update.ts, src/infra/update-runner.ts)
  • fuller-stack-dev: GitHub path history shows a recent src/infra/update-runner.ts fix for npm git update specs, adjacent to install-kind and update-root detection. (role: recent adjacent update contributor; confidence: medium; commits: 84f6b5c7f8de; files: src/infra/update-runner.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against d9f73cfe3349.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Neon Branchling

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: sleeps inside passing CI.
Image traits: location proof lagoon; accessory rollback rope; palette rose quartz and slate; mood patient; pose leaning over a miniature review desk; shell glossy opal shell; lighting bright celebratory glints; background tiny shells and proof notes.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Neon Branchling in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@steipete
steipete force-pushed the fix-82215-doctor-junction-git branch from 7829791 to c89143e Compare May 23, 2026 15:02
@giodl73-repo
giodl73-repo force-pushed the fix-82215-doctor-junction-git branch from 2bcbd1c to 40ea728 Compare May 23, 2026 15:17
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Current-head refresh/proof:

  • Cleaned giodl73-repo:fix-82215-doctor-junction-git back to a linear rebase on current origin/main; new head 40ea7288ba.
  • Local focused proof in the WSL checkout passed: node scripts/run-vitest.mjs src/commands/doctor-update.test.ts --reporter=verbose.
  • git diff --check origin/main...HEAD passed.

This should clear the prior conflict/check-run state; CI is rerunning on the new head.

@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@giodl73-repo
giodl73-repo force-pushed the fix-82215-doctor-junction-git branch from 40ea728 to 5d89c2b Compare May 23, 2026 15:21
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@steipete
steipete force-pushed the fix-82215-doctor-junction-git branch from 1c1a0f8 to 55a7871 Compare May 23, 2026 15:29
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 23, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 23, 2026
@steipete
steipete force-pushed the fix-82215-doctor-junction-git branch from 55a7871 to 4318405 Compare May 23, 2026 15:37
@giodl73-repo
giodl73-repo merged commit c897384 into openclaw:main May 23, 2026
98 checks passed
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doctor misclassifies junction-backed source checkout as non-git install

1 participant