Skip to content

fix: recover tasks after transient Git fetch failures - #147692

Merged
steipete merged 2 commits into
mainfrom
codex/git-network-retry
Sep 14, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/git-network-retry

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes tasks failing before their first reply when workspace preparation encounters a transient Git fetch error, including “did not send all necessary objects.”

User Impact

Managed fetches, remote-ref lookups, and project clones recover from one transient failure automatically. A git/network warning records the operation, attempt count, retry delay, and exit code without exposing command arguments, repository URLs, or raw Git output. No configuration or migration is required.

Why This Change Was Made

The shared Git runner retries the failed network read once after one second, within its original timeout. It preserves stdin bytes, ref-mutation ordering, cancellation, and current workspace/publication authority. The clone owner cleans its failed partial checkout before retrying. Authentication, local storage, interrupted-process, and exhausted-timeout failures remain terminal; push and pull are not blindly replayed, preserving publication outcome reconciliation.

Evidence

  • A real partial-clone worktree regression failed with the reported missing-object error before the fix and passed afterward.
  • 239 focused Git, worktree, project, worker, and publication tests passed; the 66-case retry suite was rerun with the structured-log assertions.
  • Changed-file checks and a full build passed for the retry implementation; the logging-only follow-up passed focused tests, formatting, and lint.
  • Independent review covers the final diff. Hosted CI will verify the published head before landing.

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here.

ClawSweeper will not retry this unchanged revision.

Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 14, 2026 01:47
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Sep 14, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The credential-shaped synthetic test URL was removed entirely in 1860fae. The exact warning-metadata assertion now uses a plain diagnostic marker; no scanner exception or setting changed.

@clawsweeper

clawsweeper Bot commented Sep 14, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 10:16 PM ET / September 14, 2026, 02:16 UTC.

ClawSweeper review

What this changes

Managed Git reads and project clones retry one transient failure within their original timeout, with cancellation checks and sanitized retry logging.

Merge readiness

✅ Ready for maintainer review

Keep open: the recovery remains useful on current main, and no blocking patch defect was found. The requested synthetic-credential cleanup is present without scanner-policy changes.

Priority: P2
Reviewed head: 1860faeed75077d5c817a2b028663c294a09d9f4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused recovery implementation with meaningful regression coverage and no supported blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied maintainer designation exempts this internal Git-reliability PR from the external-contributor proof gate. The body reports partial-clone recovery and focused tests, but supplies no runtime trace independently inspected here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied maintainer designation exempts this internal Git-reliability PR from the external-contributor proof gate. The body reports partial-clone recovery and focused tests, but supplies no runtime trace independently inspected here.
Evidence reviewed 9 items Pinned scope and clean checkout: The independently inspected merge-base-to-head delta matches the supplied introduced file list. The follow-up commit changes only the retry test; diff whitespace checks passed and the checkout remained clean.
Requested logging cleanup: The current test uses a plain diagnostic marker and asserts the exact warning metadata. The production warning contains operation, attempt counts, delay, and exit code, without command arguments or raw Git diagnostics.
Bounded retry owner: The retry owner excludes push, pull, permanent errors, interrupted processes, and exhausted budgets. It waits once, checks cancellation, recomputes the remaining timeout, and invokes the caller's authority guard before the second attempt.
Findings None None.
Security None None.

How this fits together

OpenClaw prepares repository checkouts before running tasks and uses Git to inspect publication state. The shared Git runner turns those requests into subprocess results consumed by workspace and publication owners.

flowchart TD
  A[Task workspace or publication request] --> B[Existing ownership and ordering checks]
  B --> C[Git command runner]
  C --> D{Transient read failure?}
  D -->|No| G[Return command result]
  D -->|Yes| E[Wait within original timeout]
  E --> F[Recheck cancellation and caller authority]
  F --> C
  C --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +156, Tests +276, Docs +20. Total +452 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 8 219 63 +156
Tests 3 278 2 +276
Docs 2 20 0 +20
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 517 65 +452

Review metrics

Metric Value Why it matters
Production versus test growth production +156 net lines; tests +276 net lines Production growth adds one shared Git-specific retry policy and integrates existing callers; tests cover recovery and terminal conditions.

Technical review

Best possible solution:

Keep transient recovery in the shared Git execution owner, with clone cleanup remaining clone-owned and publication writes retaining outcome reconciliation.

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

Yes, from source: a failed missing-object fetch propagates through workspace preparation on current main. The supplied partial-clone regression exercises that path; this review did not execute it.

Is this the best way to solve the issue?

Yes. Retrying the individual Git read preserves task state and existing ordering without replaying an entire task or an uncertain publication write.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs bounded transient repository-preparation failures without changing configuration or persisted formats.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied maintainer designation exempts this internal Git-reliability PR from the external-contributor proof gate. The body reports partial-clone recovery and focused tests, but supplies no runtime trace independently inspected here.

Label justifications:

  • P2: This repairs bounded transient repository-preparation failures without changing configuration or persisted formats.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied maintainer designation exempts this internal Git-reliability PR from the external-contributor proof gate. The body reports partial-clone recovery and focused tests, but supplies no runtime trace independently inspected here.

Evidence

What I checked:

  • Pinned scope and clean checkout: The independently inspected merge-base-to-head delta matches the supplied introduced file list. The follow-up commit changes only the retry test; diff whitespace checks passed and the checkout remained clean. (1860faeed750)
  • Requested logging cleanup: The current test uses a plain diagnostic marker and asserts the exact warning metadata. The production warning contains operation, attempt counts, delay, and exit code, without command arguments or raw Git diagnostics. (src/infra/git-network-retry.test.ts:94, 1860faeed750)
  • Bounded retry owner: The retry owner excludes push, pull, permanent errors, interrupted processes, and exhausted budgets. It waits once, checks cancellation, recomputes the remaining timeout, and invokes the caller's authority guard before the second attempt. (src/infra/git-network-retry.ts:68, 1860faeed750)
  • Worker and publication ownership: Worktree retries remain inside ref admission. The Git worker supplies its host-owned assertion to both execution forms; repository-pack preparation and publication transport forward their existing current-authority checks. Clone retries retain the lifecycle signal and clone-owned partial-directory cleanup. (src/infra/git-worker.ts:142, 1860faeed750)
  • Current-main necessity: Fetched main still calls the subprocess runners once in executeGitCommand and executeGitCommandBytes. The new retry owner is absent from both fetched main and the supplied latest release tree; no merged replacement was established. (src/infra/git-exec.ts:116, d9c45426e163)
  • Release-tree check: The latest supplied release has no src/infra/git-network-retry.ts entry. This review does not claim the proposed recovery has shipped. (3a9d69db306c)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit 005cb0e into main Sep 14, 2026
192 checks passed
@steipete
steipete deleted the codex/git-network-retry branch September 14, 2026 02:46
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

1 participant