Skip to content

fix(update): preserve Git identity for whitespace-suffixed checkout paths - #196654

Closed
Alix-007 wants to merge 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-update-git-root-path-20261110
Closed

Alix-007 wants to merge 2 commits into
openclaw:mainfrom
Alix-007:alix/fix-update-git-root-path-20261110

Conversation

@Alix-007

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: openclaw update status mistakes a Git checkout for a package installation when the checkout directory ends in whitespace. It drops the Git identity and can select the package update channel instead of the checkout's channel.

User Impact

A checkout under a literal whitespace-suffixed directory retains its Git installation type and actual commit SHA. Ordinary checkouts, aliases and nested package installations retain their classification. This PR corrects read-only discovery; it does not run an update or change a service.

Why This Change Was Made

Remove only Git's final LF record terminator from the top-level path, preserving filesystem characters. One canonical ownership parser covers installation kind, identity and update status together (production +2/-1). The existing real-Git test table covers SPACE/TAB/LF/CR suffixes on POSIX and keeps ordinary Windows coverage, separate Git directories, aliases, nested packages and the no-Git-spawn guard (tests +22/-15, net 7 LF).

The dedicated test allocation is 7 LF and covers only this PR’s actual regression growth; the global baseline is untouched. No new dependency, config/default, protocol/schema, permission or upgrade/migration contract.

Evidence

Product head f56e2bc9ad0faf3acffa753a97a23a1f686c82c2; BASE baccc7e152916c7f4a48596b5cb544c12264ac54. The frozen collector invokes normally built openclaw.mjs --profile update-git-root-proof update status --json --timeout 3 through actual Git discovery and JSON readback. It checks clean HEAD/build stamps and the raw Git path bytes; the physical test directory ends in an actual SPACE, rather than being a symlink alias.

python3 update-git-root-proof.py "$CHECKOUT" "$NEW_OUTPUT" "$NODE26" "$EXPECT"

Set EXPECT=red for the clean baseline in the SPACE directory, EXPECT=green for the fixed head under the same physical name, and EXPECT=control for an ordinary directory. Use fresh output directories.

  • BASE SPACE: exit 0 but installKind=package, no Git identity (8.803s).
  • HEAD SPACE: exit 0, installKind=git, git.sha=f56e2bc9ad0faf3acffa753a97a23a1f686c82c2 (6.509s).
  • Ordinary control: both commits correctly report Git and their actual SHA; HEAD 5.560s.
  • 27 tests pass in the two existing owner/status suites. Canonical scoped types, ordinary typed lint, formatting, test-line ratchet against the actual CI merge context and normal exact-head CLI build pass. The focused test command takes 170.272s, including 133.272s canonical compiled-worker preparation; no timeout was increased.

Inspectable complete CLI output, BASE/HEAD receipts, frozen replay and measured checks. Independent GPT-6.1 Sol code/CLI-proof review found no P0–P3 findings, using the user-authorized agent fallback rather than claiming an official autoreview-helper run.

Cleanup: owned CLI processes exited and isolated configuration stayed unchanged. Not tested: actual update/install/upgrade completion, production Gateway/channels, macOS/Windows live execution or upstream CI. Public registry timeouts and the intentionally closed isolated Gateway's diagnostic remain visible in the captured output; they are separate from installation classification.

@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 10, 2026
@clawsweeper

clawsweeper Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserve whitespace in Git checkout paths when discovering installation kind, Git identity, and update status.

Example: Run openclaw update status --json from a checkout at "/tmp/openclaw ", whose directory name ends with a space.

  • Before: Reports installKind=package, omits Git identity, and can select the stable package channel.
  • After: Reports installKind=git, retains the actual commit SHA, and derives the channel from Git identity.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal, useful correction supported by inspectable shipped-entry-point red/green proof and focused real-Git coverage.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Inspected Linux CLI captures exercise installation discovery through normally built openclaw.mjs and actual Git on a physical SPACE-suffixed checkout: baseline loses Git identity, while exact head retains Git kind, SHA, and Git-derived channel; ordinary-path controls also succeed.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A valid Git checkout can appear to be a package installation and lose its Git-derived update channel.
Reason: The change restores the existing installation-discovery contract with negligible production complexity and no new user setting.

Merge readiness

✅ Ready for maintainer review

This PR fixes a concrete bug still present on current main with a minimal shared-parser change; no actionable defects were found.

Priority: P2
Reviewed head: f56e2bc9ad0faf3acffa753a97a23a1f686c82c2

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A separate base-red run of the committed regression table is not recorded; the shipped CLI captures demonstrate the corresponding baseline failure and fixed result.
Agent review details

How this fits together

Update discovery consumes the installation root and Git subprocess output, then supplies installation kind and repository identity to status reporting and channel selection.

flowchart LR
  A[Update status CLI] --> B[Installation discovery]
  B --> C[Git top-level output]
  C --> D[Remove final LF]
  D --> E[Canonical root comparison]
  E --> F[Git identity and channel]
Loading

Technical review

Best possible solution:

Merge the focused parser correction once the existing exact-head CI gates pass.

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

Current-main source shows the pathname loss directly, and the inspected contributor artifact demonstrates the baseline failure and exact-head correction through the real CLI; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete fix: preserve pathname bytes at the existing discovery owner while removing only Git's record terminator, without adding another parser or changing classification policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against af37a0013eef.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 4dc04b1 adds src/infra/update-check.ts:253 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4dc04b14f0bf; files: src/infra/update-check.ts)
  • Vincent Koc: Raw commit 41bc123 adds src/infra/update-check.ts:47 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 41bc123fcb29; files: src/infra/update-check.ts)

PR surface

Source +1, Tests +7, Other +2. Total +10 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 1 +1
Tests 1 22 15 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 3 26 16 +10

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test growth Production +2/-1; tests +22/-15 One parser correction and an extension of the existing real-Git fixture table provide proportionate regression coverage.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Incorrect update classification affects checkouts with unusual but legal path suffixes; the blast radius is limited.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 10, 2026, 7:21 AM ET / 12:21 UTC.

@roboclaw-bot roboclaw-bot added the clawtributors PR from a clawtributor label Nov 12, 2026
wangmiao0668000666 added a commit to wangmiao0668000666/openclaw that referenced this pull request Nov 13, 2026
…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.
@obviyus

obviyus commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the work here. We're closing this along with the other open PRs that apply the same change one call site at a time. This series changes symlink, physical-path and literal-path handling at each command separately; path resolution policy belongs in one shared owner and needs a maintainer decision. Please open one issue (or one PR at the shared owner) that covers the whole pattern, with a reproduction of real user-visible harm, instead of separate per-site PRs. Further per-site variants of this pattern will be closed.

@obviyus obviyus closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawtributors PR from a clawtributor P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS 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.

3 participants