Skip to content

fix(update): stable and beta Git installs download every remote branch on each update check - #176153

Closed
masatohoshino wants to merge 1 commit into
openclaw:mainfrom
masatohoshino:fix/update-git-tag-only-fetch
Closed

masatohoshino wants to merge 1 commit into
openclaw:mainfrom
masatohoshino:fix/update-git-tag-only-fetch

Conversation

@masatohoshino

Copy link
Copy Markdown
Contributor

Closes #176152

What Problem This Solves

Fixes: on a Git install that follows the stable or beta channel, every openclaw update status --json and openclaw update downloads all branches of the release remote into the private inspection repository, then throws them away.

User Impact

User impact: update checks and updates on stable and beta Git installs transfer only the release tags they use. In the reproduction below, each openclaw update status --json drops from about 30 MB to about 2 KB of fetched data. The selected release and the command output stay the same.

Why This Change Was Made

Release channels choose their target from tags only, but fetchGitUpdateTarget also ran a refspec-less git fetch <release remote> --prune --no-tags first, so Git fetched the configured +refs/heads/*. The inspection repository is removed after each run, so that branch data was downloaded again every time and never read. Release channels now skip that branch fetch. The dev channel is unchanged.

#172199 narrowed the same fetch for the dev channel and said that release-tag inventory and detached-target discovery keep their existing contracts. This change keeps both:

  • Release-tag inventory still comes from the forced +refs/tags/*:refs/tags/* fetch, with the same release-remote selection, the same refusal when no release remote can be determined, and operator-only tags still kept.
  • Detached-target discovery is a dev-channel path and does not change.

Update behavior: the fetch runs in the installed updater, so this takes effect once an updater with the fix is running, and no candidate depends on branch refs. An older updater keeps its branch fetch until it has updated itself once, which costs only that extra download. Stable and beta updates no longer fail with fetch-failed because the branch fetch failed.

update-runner-git.tags.test.ts expected the branch fetch, so it now expects only the tag fetch. Its protected-branch case used to expect a non-fast-forward rejection. Since #154160, every Git update fetches into the private inspection repository, so that rejection happened there. On release channels, nothing from that repository's branch refs is imported into the installed checkout; only the dev upstream ref is. The case still checks that the installed protected branch is left untouched.

Evidence

Tested at 632f3245d40 (base upstream/main 847f7fade0d); the After build is from 75a295a5a4d, which differs from it only in docs.

The real built CLI (pnpm build:runtime) on Linux, Node 24.18, Git 2.45.2, run against a synthetic stable-channel Git install. The release remote is a local bare repository served by git daemon behind a TCP proxy that logs bytes per connection (one connection per Git fetch). The install is detached at v2026.10.17. After install, the remote gains one unrelated 30 MB branch, 40 small branches and a release tag v2026.10.18. Each run uses an isolated HOME and state directory, an allowlisted environment, and a network namespace with only loopback.

Before (fetch code from base 847f7fade0d), openclaw update status --json twice in a row:

run 1: exit=0
conn#1 git-upload-pack /openclaw.git sent=7211B received=30037887B duration=864ms
conn#2 git-upload-pack /openclaw.git sent=3110B received=1932B duration=186ms
conn#3 git-upload-pack /openclaw.git sent=198B received=365B duration=44ms
run 2: exit=0
conn#1 git-upload-pack /openclaw.git sent=7211B received=30037762B duration=867ms
conn#2 git-upload-pack /openclaw.git sent=3110B received=1932B duration=188ms
conn#3 git-upload-pack /openclaw.git sent=198B received=365B duration=43ms

trace2: fetch origin --prune --no-tags --no-prune-tags
trace2: fetch --no-tags --no-prune --no-prune-tags origin +refs/tags/*:refs/tags/*

After (this PR), same install, remote and commands:

run 1: exit=0
conn#1 git-upload-pack /openclaw.git sent=3110B received=1938B duration=184ms
conn#2 git-upload-pack /openclaw.git sent=198B received=365B duration=43ms
run 2: exit=0
conn#1 git-upload-pack /openclaw.git sent=3110B received=1938B duration=184ms
conn#2 git-upload-pack /openclaw.git sent=198B received=365B duration=43ms

trace2: fetch --no-tags --no-prune --no-prune-tags origin +refs/tags/*:refs/tags/*

Observed result: the 30 MB branch fetch is gone on both runs; only the tag fetch and the ls-remote check remain. The JSON output is identical to Before, and preferredTarget is still { channel: "stable", tag: "v2026.10.18" }.

Regression test: fetches only release tags before stable candidate admission (next to the tests from #172199) runs a stable update and checks that an unrelated branch's blob is absent from the inspection repository. It fails on the base and passes here, as do the updated tag-fetch expectations. The other 55 tests in the two files pass on both.

Checks: the touched tests (pnpm test <file> --maxWorkers=1, wall time per file in the table below), the lint and typecheck steps of pnpm check:changed (its other reds are in files this PR does not touch), and oxfmt --check on the changed files. The broad suites run in this PR's CI.

Test file --maxWorkers=1 wall
src/infra/update-runner-git.test.ts 13.7 s
src/infra/update-runner-git.tags.test.ts 6.2 s

Simplify pass: the release-channel branch fetch, and the remote authority that existed only to run it, are gone. The tag fetch, its release-remote selection and refusal, and all dev-channel fetch paths are unchanged. Production code: 4 lines added (one is a comment), 5 removed. Tests: one regression test added, and the two release-channel expectations that required the branch fetch updated.

Not covered: openclaw update itself did not run in this harness, because the install borrows its build output through symlinks and update refuses a symlinked dist before it fetches. The update path runs through the same fetchGitUpdateTarget and is covered by the regression test. The first update from an older installed updater was not run; that updater still does its own branch fetch once. The 30 MB branch is synthetic. For scale, a blobless fetch of the branches the public repository advertises, from a checkout whose remote-tracking refs were a few days old, transferred 24.88 MiB (50,856 objects) and took 14 s.

@clawsweeper

clawsweeper Bot commented Oct 18, 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 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Skip branch fetching during stable and beta Git update inspection while retaining release-tag fetching.

Example: A stable Git install checks for v2026.10.18 after its release remote gains an unrelated 30 MB branch.

  • Before: Each update status check downloads approximately 30 MB of unused branch data before fetching tags.
  • After: The supplied CLI trace fetches approximately 2 KB of tag data and selects the same v2026.10.18 release.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-correct, with meaningful shipped-CLI evidence, but required upgrade coverage remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Stable and beta source installations repeatedly download remote branches that release selection never uses.
Reason: Removing the redundant fetch has measurable user value while preserving release choices, configured remotes, and installed refs.

Merge readiness

⛔ Blocked before merge - 1 item remains

Current main still downloads unused release branches, and this PR provides a focused fix with no introduced correctness defect found.

Priority: P2
Reviewed head: 632f3245d402ffbace25e7b235c3353e51dfaf23

Before merge

  • Add real behavior proof - The supplied Linux built-CLI status traces exercise the changed fetch owner through a real Git transport and show repeated removal of the 30 MB branch download with unchanged release selection. However, the update contract requires a published-updater-to-candidate run, and the body explicitly says neither update execution nor the older-updater first hop was exercised. Supply that upgrade result with existing settings and data intact, redacting IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: The repository-required published-updater-to-candidate upgrade run is absent; the supplied regression is reported to fail on the base and pass on the head.
Agent review details

How this fits together

Git update status and execution share a target resolver that fetches into a temporary inspection repository and supplies release candidates to the existing admission and activation owners.

flowchart TD
  A[Update status or execution] --> B[Private Git inspection]
  B --> C[Shared fetch resolver]
  C --> D[Release tags]
  C --> E[Dev source refs]
  D --> F[Release selection]
  F --> G[Status or candidate admission]
Loading

Technical review

Best possible solution:

Remove the unused release-channel branch fetch in the existing resolver while preserving tag authority, release selection, and dev-source behavior.

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

Current-main source establishes the unnecessary branch fetch and temporary-repository cleanup, corroborated by the contributor's repeated built-CLI transfer traces; no target code was executed during this review.

Is this the best way to solve the issue?

The patch repairs the shared owner directly, removes redundant work, and adds a distinct real-Git regression without introducing another path or configuration surface.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Release-channel fetch authority changes intended behavior with a stated reason (25580fb: Scope fetching to the selected authority so unrelated remotes cannot fail updates; the PR explains why release branches themselves are unnecessary.)
  • Private inspection and protected-branch expectations keeps the original intent (refactor(update): simplify update execution and finalization #154160: Consolidate Git updates into private inspection before admission; release activation imports the candidate rather than inspection branch mappings.)
  • Selected-source dev fetch keeps the original intent (24567af: Avoid unrelated branch downloads while preserving configured exclusions, mappings, and fresh-source validation.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main retains the defect: Release channels set authority to tagRemote despite devSource being null, causing a refspec-less branch fetch before the separate explicit tag fetch. (src/infra/update-runner-git-target.ts:463, 5cb47d16571b)
  • Pinned patch removes only the unused release fetch: The introduced hunks leave release-remote selection, forced tag refresh, ambiguous-remote refusal, and dev-channel fetching intact. (src/infra/update-runner-git-target.ts:464, 632f3245d402)
  • Release activation does not consume refreshed branches: Release selection supplies targetRevision to preflight, which resolves that tag directly; selectedDevUpstream remains null, so activation imports no release-remote branch ref. (src/infra/update-runner-git-preflight.ts:489, 632f3245d402)
  • Distinct real-Git regression: The added stable update case checks that an unrelated branch blob is absent before candidate admission and verifies successful activation; updated tag cases preserve operator-only tags and installed protected branches. (src/infra/update-runner-git.test.ts:235, 632f3245d402)
  • Supplied shipped-CLI evidence: The full PR body supplies repeated before/after built-CLI status traces using a real Git daemon and byte-counting proxy, preserving preferredTarget while removing the branch transfer; it explicitly excludes update execution and the older-updater first hop. (632f3245d402)
  • Required update proof contract: The update implementation contract requires a published-driver-to-candidate proof cell and recognizes that the installed updater runs first. Public docs: docs/install/updating.md. (docs/install/updating.md:36, 632f3245d402)

Likely related people:

  • Peter Steinberger: Raw commit b468ba8 adds src/infra/update-runner-git-target.ts:484 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b468ba81403e; files: src/infra/update-runner-git-target.ts)
  • Shakker: Raw commit e8b43f8 adds src/infra/update-runner-git-target.ts:551 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e8b43f875bb2; files: src/infra/update-runner-git-target.ts)
  • RoboClaw: Raw commit 5436b46 adds src/infra/update-runner-git-target.ts:504 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 5436b46ed08d; files: src/infra/update-runner-git-target.ts)

PR surface

Source -1, Tests +26, Docs +2. Total +27 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 5 -1
Tests 2 37 11 +26
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 43 16 +27

Labels

Label changes:

  • add P2: Repeated unnecessary transfers waste bandwidth and slow stable/beta source update checks without establishing a blocked core workflow.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: Repeated unnecessary transfers waste bandwidth and slow stable/beta source update checks without establishing a blocked core workflow.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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 October 18, 2026, 4:53 AM ET / 08:53 UTC.

@steipete

Copy link
Copy Markdown
Contributor

Thank you @masatohoshino. This was an excellent report and fix. The byte-counting proxy repro made the root cause unambiguous.

We landed the same fix as #176155 (41f1624), re-implemented independently per our maintainer workflow, with you credited as co-author in the commit. Stable and beta Git installs now fetch only release tags, and Dev keeps the selected-source scoping from #172199. In an isolated repro, update status went from about 8.4 MB to 1.2 KB of git traffic per run.

Closing this one as superseded. Thanks again!

@steipete steipete closed this Oct 18, 2026
@joec719cramer-svg

joec719cramer-svg commented Oct 18, 2026 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. docs Improvements or additions to documentation size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Git installs on stable or beta download every remote branch on each openclaw update status --json and openclaw update

3 participants