Skip to content

feat: retain completed Git update download batches - #185398

Closed
duyufansh2008 wants to merge 2 commits into
openclaw:mainfrom
duyufansh2008:feat/client-resumable-git
Closed

duyufansh2008 wants to merge 2 commits into
openclaw:mainfrom
duyufansh2008:feat/client-resumable-git

Conversation

@duyufansh2008

@duyufansh2008 duyufansh2008 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Related: #185253

What Problem This Solves

An interrupted Git-source update should keep completed downloads when its temporary inspection checkout is removed or the updater process exits.

User Impact

Official public openclaw/openclaw source checkouts can retry using already completed Git batches. Only missing objects are requested again; the interrupted batch can restart.

This is object-batch recovery, not byte-offset continuation inside a pack. A metadata pack can also restart. Multiple requests and separate blob packs can increase first-transfer bytes and latency compared with ordinary Git. Private repositories, forks, other Git services and npm updates retain their existing transport.

Why This Change Was Made

Keep the existing remote, ref and candidate selection owners. Fetch commit/tree metadata first, then hydrate missing history and candidate-tree objects in native compressed Git batches of at most 128 object IDs. Keep Git's object store and negotiation tips in stationary artifact storage under the existing file lock; retain it on failure and remove it after success.

Hydration follows Git's native promisor-fetch contract, including disabled negotiation for missing objects. This also covers a cached pinned commit whose promised blobs are absent. Download work stays within cancellation and the original deadline, before candidate metadata reads, validation and mutation admission. There are no publisher artifacts, release-workflow changes, public options or database migrations.

Evidence

  • 156 related tests passed: existing Git admission/activation/rollback suites, transport restart recovery, named promisor remotes, cached pinned commits, historical rename/deletion and fallback contents, partial clones, cancellation/deadlines, and candidate rejection followed by successful retry.
  • The restart regression transfers a real 128-object batch, interrupts the next batch, destroys the inspection repository, then proves a new instance never requests the completed batch's object IDs.
  • Core and services-test typechecks, targeted production/test lint, formatting and git diff --check passed. Independent autoreview completed with no P0–P2 findings after fixing its cached-pinned-target finding.
  • Live GitHub: fixed target f623a2ccbd6ee80cb5ad1127c5cecfdf6e79d6db, real blob:none metadata fetch, completed first object batch, sustained TLS disconnect during the next batch, then a new Git process requested only the remaining objects. Strict fsck and all twelve historical/fallback trees matched ordinary Git.
  • Real isolated CLI update completed with exit 0/status ok, including retained-runtime preparation, candidate build, Doctor, config/plugins/recovery checks, Gateway startup, admitted-pack import and activation. A new CLI process requested zero of the 654 blobs completed by earlier invocations. Installed source/build/runtime commits agreed afterward, the same isolated state loaded successfully, and the completed download cache was removed. Refused-network and SIGINT runs had previously left the old installation usable.
  • The final promised-root-tree repair has a CI-safe red→green tree:0 regression. It was also compiled and booted separately; full CLI versus final-helper source scopes are stated below. The native published-latest-stable driver qualification also passed; its same-version/different-build source scope and captured result are below.
  • Actual production helper, separate Node processes: first process was SIGKILLed after 128 blobs were imported. A new Node reclaimed the dead owner's cache lock and fetched the remaining 135 objects, with zero overlap against the completed batch. Metadata was not retransferred; strict fsck, historical/fallback content, final tree and the unchanged installed checkout all passed.
Measured costs and proof boundaries

The live three-blob fixture deliberately used one object per batch to exercise interruption between batches. Including its interrupted request, the run used 83,322 server-to-client TLS bytes and 10 HTTP requests; ordinary Git for the same delta used 10,449 bytes and 2 requests. A separate all-three-object batch plus metadata used 68,865 TLS bytes and 4 requests. These are actual proxy-observed wire bytes, not local pack sizes. They demonstrate recovery and its overhead, not a general traffic or speed improvement.

Production uses up to 128 objects per batch. This bounds object count, not compressed bytes. Git object compression is retained; ordinary fetch may choose better cross-version delta bases.

New transport tests took about 2.3 seconds of test execution. The full rejection/retry/activation regression took 8.1 seconds on this host and covers two complete updater runs; helper-only tests would miss that lifecycle boundary. The six-suite run took 123.79 seconds including cold compiler preparation. The final head 5955935c passed openclaw/ci-gate: 70 successful checks, 60 skipped and one neutral, with no failures. Skipped checks are not counted as passed qualification.

The implementation has one internal download owner and uses native Git objects/refs instead of a new manifest, database or publishing protocol. Existing step factories moved to their command owner to keep the updater within its file-size gate. No version is published and no merge is requested.

Captured runtime output and exact scope

Executed through the supported CLI in a task-owned checkout, HOME/state directory and loopback listeners:

pnpm openclaw update --channel dev --no-restart --yes --json --timeout 1200

Selected fields from the captured CLI result and controller:

{
  "exit": 0,
  "seconds": 1074.48,
  "status": "ok",
  "mode": "git",
  "before": "199d263a74fdd30e8225750a38f155beed689423",
  "after": "33b8144615ac38a58b2be2099e1bb02d175dabe5",
  "builtCommit": "33b8144615ac38a58b2be2099e1bb02d175dabe5",
  "sourceRuntimePrepared": true,
  "downloadCacheRemoved": true
}

Selected fields extracted from the actual client-side Git packet trace of the new CLI process:

{
  "previously_completed_blobs": 654,
  "unique_wanted_oids": 91,
  "previously_completed_blobs_requested_again": []
}

The branch moved while the interrupted update was being prepared. These are 91 newly requested object IDs, with no intersection against the 654 already completed blobs.

Captured production-helper SIGKILL/new-Node result:

{
  "firstNodeReturncode": -9,
  "firstCompletedBatch": 128,
  "resumedBatchSizes": [
    128,
    7
  ],
  "repeatedCompletedObjects": 0,
  "metadataPackRetransferred": false,
  "staleLockReclaimedAndReleased": true,
  "strictFsck": "passed",
  "historicalFallback": "matched",
  "installedFilesUnchanged": 31
}

Captured real live-holder contention result. The second Node reached the actual lock timeout, performed no shared-cache initialization, and used the existing Git fallback. After the holder released normally, a fresh Node reused its completed pack:

{
  "liveHolderFirstBatch": 128,
  "contenderObservedLockTimeout": true,
  "contenderCacheInitializations": 0,
  "sharedPackHashesUnchangedDuringContention": true,
  "holderReleasedNormally": true,
  "resumedBatchSizes": [
    128,
    7
  ],
  "repeatedCompletedObjects": 0,
  "strictFsck": "passed",
  "productionSourceSha256ObservedAfterRun": "5bb67fad2d02cfba7eda8bc0a4e02c8733ecaad290e33ed96145bbdf7d62b992"
}

Captured Gateway readiness after the completed upgrade, and again after compiling the final helper repair:

{"ready":true,"coreReady":true,"failing":[],"eventLoop":{"degraded":true,"reasons":["cpu"]}}

The host was running parallel builds during those probes; this is readiness evidence, not a performance qualification.

Source attribution: the full CLI run used the four production files from 10c73200, rebased by the ordinary dev-update flow onto official target 63a05a41365026646b71df6ec7b0e390c506695a; its local installed result was 33b81446. The only later production repair in 5955935c changes how an absent promised root tree is inventoried. That repair has an observed red→green regression, and its exact helper SHA-256 5bb67fad2d02cfba7eda8bc0a4e02c8733ecaad290e33ed96145bbdf7d62b992 matches the live contention proof and a separately compiled/booted isolated build f926e640. The long normal upgrade is not being represented as a byte-identical run of that later repair.

Existing isolated state was reused: agent main remained present; operator settings remained gateway mode local, auth mode token, update channel dev; public schema declarations remained state 34/agent 37. Real Doctor/recovery/Gateway processes consumed those databases. No database schema or storage format changes are introduced here. Existing unknown-writer recovery advisories were retained; this does not claim database bytes stayed unchanged or automatic database restoration was universally available.

Default adoption and its measured transfer-cost tradeoff remain for the update owner to decide; this PR is not a merge or release request.

Published stable driver qualification: captured result

The native scripts/e2e/published-driver-update-docker.sh cell from 5955935c passed locally. It installed the stock npm [email protected] tarball, then used that published updater to install the locally built candidate tarball through openclaw update --tag /tmp/openclaw-current.tgz --yes --json. All native assertions ran, including durable update status, managed Gateway replacement, readiness, running build identity, persisted session content, retained state fixture bytes and incognito cleanup.

Selected fields from the captured result:

{
  "driverVersion": "2026.10.7",
  "beforeBuildId": "2026.10.7-release-157d8c2bc3ea-2026-10-24T02-45-17.235Z",
  "candidateBuildId": "2026.10.7-f926e64082ee-2026-10-27T04-33-00.957Z",
  "nativeExit": 0,
  "seconds": 838.165,
  "phase": "finished",
  "recordedStatus": "succeeded",
  "runningBuildId": "2026.10.7-f926e64082ee-2026-10-27T04-33-00.957Z",
  "managedGatewayPidReplaced": true,
  "durableSessionSentinelPreserved": true,
  "retainedStateSentinelBytesPreserved": true,
  "incognitoContentRemoved": true,
  "readinessHttpStatus": {
    "before": 200,
    "after": 200
  },
  "sameNumericVersionDifferentBuild": true,
  "teardown": {
    "containerRemoved": true,
    "volumesRemoved": true,
    "stopServiceExit": 0
  }
}

This is published stable 2026.10.7 → a different local 2026.10.7 build, not a numeric-version upgrade. Candidate source is the post-upgrade moving-main build f926e640 described above, carrying the exact final-helper SHA-256 from 5955935c; it is not being represented as a package built from the exact PR-head tree. Canonical packaging and integrity checks passed without altering producer receipts or stamps. The container, managed service and disposable volume were settled after the test. This package-compatibility cell supplements the real Git-source update and restart-recovery proofs; it does not change npm-update transport.

@clawsweeper

clawsweeper Bot commented Oct 27, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL labels Oct 27, 2026
@duyufansh2008
duyufansh2008 marked this pull request as ready for review October 27, 2026 03:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-27T03:56:12.494128Z
We couldn’t complete this review. Comment @codex review to try again.
10c7320 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR retains completed Git object-download batches across interrupted official-source updates and removes the cache after success.

Example: An updater process exits after completing a 128-object batch.

  • Before: Removing the temporary inspection repository discards its downloaded objects.
  • After: A new process reuses the completed batch and requests the remaining 135 objects without repeating those 128.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation has meaningful runtime and compatibility evidence with no actionable finding, while default adoption awaits product judgment.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Captured supported-CLI output demonstrates completed activation and reuse of 654 previously downloaded blobs; production-helper output demonstrates SIGKILL recovery and lock contention. The final helper's verified hash matches its runtime evidence, and the body accurately distinguishes that coverage from the earlier full-CLI run, resolving the previous proof blocker.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: Source-install operators can repeat completed downloads after an interrupted update loses its temporary inspection repository.
Reason: The recovery benefit is concrete, but changing the default transport and accepting greater transfer cost requires the update owner's direction.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR provides useful, proven batch recovery with no concrete introduced defect found, but default adoption needs an update-owner decision about transfer overhead.

Priority: P2
Reviewed head: 5955935c3aea6246fe38a38980b6977137e3e01e
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should official-source Git updates enable completed-batch recovery by default despite its additional requests and potentially larger transfers?
  • Recommendation: Accept the recovery tradeoff: Approve default adoption for official-source updates with the documented batch boundary and transfer-cost limitations.
  • Why: Recovery is demonstrated, but the measured uninterrupted three-object batch used 68,865 TLS bytes and four requests versus ordinary Git's 10,449 bytes and two requests; no human update-owner acceptance is recorded.

Before merge

  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Agent review details

How this fits together

The Git updater fetches selected targets into a private inspection repository, prepares and validates candidates, then imports admitted objects before activating source and runtime.

flowchart LR
  A[Selected Git remote] --> B[Filtered metadata fetch]
  B --> C[Locked stationary Git cache]
  C --> D[Missing object batches]
  D --> E[Private candidate inspection]
  E --> F[Validation and mutation admission]
  F --> G[Import and activation]
Loading

Technical review

Best possible solution:

Have the update owner decide whether native batch recovery warrants the measured transfer overhead before adopting it as the official-source default.

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

Current-main inspection storage is temporary, establishing why its downloaded objects do not survive cleanup; supplied runtime output demonstrates the proposed recovery without executing target code during this review.

Is this the best way to solve the issue?

The smallest coherent implementation uses native Git objects, the existing lock and artifact storage, and existing candidate owners; it supplies batch recovery while leaving byte-offset continuation outside this PR.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Git target transport changes intended behavior with a stated reason (41f1624: Release channels fetch only tags to avoid downloading unrelated branches; this PR preserves selection while explicitly documenting the added batch-transfer cost.)
  • Step factories and command recording keeps the original intent (0822917: Keep Git steps beside their consumers while preserving probe, work, recovery deadlines and canonical result recording; the move retains those distinctions.)
  • Cleanup and original failure preservation keeps the original intent (534d727: Preserve primary failures and settle candidate cleanup despite reporting failures; the existing settlement path remains inside the new download disposal lifecycle.)
  • Early candidate Node qualification changes intended behavior with a stated reason (4d68977: Reject incompatible candidates before staging; hydration now precedes manifest reads to prevent disposable lazy downloads, while qualification still precedes candidate staging.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +441, Tests +524, Docs +17. Total +982 across 7 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 4 513 72 +441
Tests 2 524 0 +524
Docs 1 17 0 +17
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 1054 72 +982

Review metrics

Metric Value Why it matters
Measured transport tradeoff 68,865 TLS bytes / 4 requests versus 10,449 bytes / 2 requests The supplied three-object batch fixture quantifies the adoption tradeoff; it does not establish production-wide overhead or speed.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This improves interrupted source updates with limited blast radius and no established urgent regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-27T04:11:10.313Z sha 10c7320 :: needs real behavior proof before merge. :: none

Reviewed October 27, 2026, 1:11 AM ET / 05:11 UTC (Revision 2).

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The branch and PR body are current at 5955935c. The body now includes captured output for the completed real CLI activation, zero repeated requests for 654 previously downloaded blobs, production-helper SIGKILL/new-process recovery, live lock contention, and the successful native published-stable driver qualification with persisted state and Gateway readiness. Full-CLI, final-helper and same-version/different-build qualification scopes are distinguished explicitly. The promised-root-tree regression and final-head CI passed: https://github.com/openclaw/openclaw/actions/runs/40449467396/job/122015287743 .

The transfer-cost measurements and the update owner's default-adoption decision remain explicit; this is a request for review, with no merge or release requested.

@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 27, 2026
@roboclaw-bot roboclaw-bot self-assigned this Nov 1, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Thank you for the careful recovery work and for documenting both the successful restart tests and the transfer costs. Keeping completed object batches is a real capability beyond automatic retries; #189818 (1440bb1), which took over your #184452 with credit, does not provide byte-offset resume or durable recovery of these batches.

After reviewing the complete diff against current main, I am closing this implementation because the added default transport does not meet the updater's reliability/maintenance tradeoff:

  • The retained .artifacts/git-downloads/official/repository.git has no byte limit, expiry, or eviction. OBJECTS_PER_BATCH = 128 limits object count, and INVENTORY_LIMIT limits command output; neither bounds retained disk use. Failed updates retain the store until a later successful update, so repeated failed or changing targets can accumulate objects, including after a disk-full failure.
  • Normal official-source updates would acquire another lock, fetch filtered metadata, inventory missing history/tree objects, and hydrate separate packs. Hydration errors fail the update; they do not return to ordinary Git. That adds a failure surface to every qualifying update. The reported small fixture also costs 68,865 TLS bytes / 4 requests versus ordinary Git's 10,449 / 2 even without its interrupted batch. Those measurements are useful, but do not establish an acceptable default-path tradeoff at production batch sizes.

Main now has the much smaller shared fetch/clone recovery from #189818: up to four attempts, shared deadlines/cancellation, and cleanup before clone retries. I prefer to keep that default while we measure the remaining repeated-transfer problem.

A smaller follow-up would be welcome with a representative interrupted-update case on top of #189818, measured normal/retry transfer costs, and bounded retention/cleanup owned by the existing inspection/transfer lifecycle. It should preserve ordinary Git on the normal path and non-official remotes, and demonstrate safe fallback before mutation when optional recovery storage is unavailable. True byte-offset continuation remains a separate design question in #185253. Thank you again for the contribution and the unusually clear evidence.

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

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants