Skip to content

fix(repair): merge immutable ledger batches server-side - #700

Merged
hxy91819 merged 1 commit into
mainfrom
feature/immutable-ledger-starvation
Jul 19, 2026
Merged

hxy91819 merged 1 commit into
mainfrom
feature/immutable-ledger-starvation

Conversation

@hxy91819

Copy link
Copy Markdown
Member

Summary

  • publish immutable action-ledger batches through a unique temporary ref and GitHub server-side merge after the first direct state-ref race
  • verify every immutable blob after the merge and fail closed on conflicting existing content
  • keep the state credential scoped to the publishing subprocess by reading the checkout credential header

Root cause

Production run https://github.com/openclaw/clawsweeper/actions/runs/29683138589 exhausted 64 client-side rebuild-and-push attempts while the state branch advanced faster than a 150k-entry ledger tree could be rebuilt. A fixed retry budget cannot guarantee progress under sustained writers.

Proof

  • failing-first local race: the old code exhausted all 64 pushes under a 65-write hook
  • the new path succeeds with the same hook after one target push and one temporary-ref push, preserving both concurrent state writes
  • full git-publish test file passes, including the production-sized flat tree fixture
  • pnpm run check
  • local autoreview: 0 findings
  • gitleaks protect --staged: no leaks found

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 19, 2026, 7:12 AM ET / 11:12 UTC.

Summary
This PR adds a GitHub server-side merge fallback for immutable action-ledger batches after direct state-branch push races, with focused tests and setup-action environment wiring.

Reproducibility: unclear. the supplied PR describes a sustained-race test, but no current-main reproduction or executable source inspection was completed because the read-only command sandbox failed before it could run.

Review metrics: 1 noteworthy metric.

  • Patch surface: 4 files affected; 331 additions, 2 deletions. The change spans repair publishing logic, state-action configuration, and targeted integration/workflow tests.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🌊 off-meta tidepool
Patch quality: 🦐 gold shrimp
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Have a repair-area reviewer inspect the temporary-ref merge, conflict verification, and checkout-finalization paths.
  • Attach or link a redacted race-test transcript if maintainers want independently inspectable runtime evidence.

Risk before merge

  • [P2] The GitHub merge fallback changes concurrent durable-state publication semantics; maintainers should verify that concurrent writers and immutable-content conflicts remain correctly preserved.
  • [P2] The new fallback derives a state token from the checkout credential header, so review should confirm the token remains scoped to the intended subprocess and cannot surface in logs, errors, or process arguments.

Maintainer options:

  1. Verify the publication protocol before merge (recommended)
    Review the temporary-ref merge, post-merge verification, and checkout finalization against concurrent-writer and conflicting-content cases.
  2. Pause for protocol redesign if needed
    Hold the PR if the current GitHub merge semantics cannot be shown to preserve the immutable-ledger contract and token boundary.

Next step before merge

  • [P2] This member-authored repair needs focused maintainer review of durable merge semantics and credential handling, not automated repair routing.

Security
Needs attention: The PR introduces credential extraction from Git configuration for a new GitHub merge path, so its token scope and exposure paths need focused review before merge.

Review details

Best possible solution:

Accept the server-side merge fallback only after a maintainer confirms its concurrent-merge semantics, immutable-blob verification, local-checkout recovery, and credential-scoping behavior against the existing ledger contract.

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

Unclear; the supplied PR describes a sustained-race test, but no current-main reproduction or executable source inspection was completed because the read-only command sandbox failed before it could run.

Is this the best way to solve the issue?

Unclear; a server-side merge is a plausible way to avoid retry starvation, but the supplied context is not enough to establish that it is safer than all alternatives for the immutable-ledger protocol.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0cbbd9529b84.

Label changes

Label changes:

  • add P2: This is a bounded but important repair to durable automation behavior under concurrent writers.
  • add merge-risk: 🚨 compatibility: The fallback changes how existing concurrent state-branch updates are merged and finalized.
  • add merge-risk: 🚨 security-boundary: The fallback obtains a state-repository token from Git checkout authorization configuration.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This is a member-authored internal repair PR, so the external-contributor real-behavior-proof gate does not apply; the supplied body nevertheless reports targeted race-test validation.

Label justifications:

  • P2: This is a bounded but important repair to durable automation behavior under concurrent writers.
  • merge-risk: 🚨 compatibility: The fallback changes how existing concurrent state-branch updates are merged and finalized.
  • merge-risk: 🚨 security-boundary: The fallback obtains a state-repository token from Git checkout authorization configuration.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This is a member-authored internal repair PR, so the external-contributor real-behavior-proof gate does not apply; the supplied body nevertheless reports targeted race-test validation.
Evidence reviewed

Security concerns:

  • [medium] Review credential exposure in the merge fallback — src/repair/git-publish.ts:478
    The new helper derives a state token from the checkout authorization header. Confirm that failures, logs, and child-process invocation cannot expose it outside the intended publishing subprocess.
    Confidence: 0.78

What I checked:

  • Member-authored item remains open: The supplied GitHub context identifies the PR author association as MEMBER; repository policy says maintainer-authored items need explicit maintainer judgment and must not be auto-closed. (AGENTS.md:1, 0cbbd9529b84)
  • State-publication protocol changes: The supplied PR diff adds a server-side merge fallback after the first immutable-ledger push race and finalizes the local checkout from the published commit. (src/repair/git-publish.ts:432, bff2e5f41020)
  • Credential-sensitive path: The supplied diff adds a helper that reads a local Git HTTP authorization header to obtain the state-repository token used by the fallback. (src/repair/git-publish.ts:478, bff2e5f41020)
  • Focused test coverage added: The PR adds a sustained immutable-ledger race scenario using a temporary state repository and fake GitHub merge behavior. (test/repair/git-publish.test.ts:1647, bff2e5f41020)

Likely related people:

  • hxy91819: The only supplied commit for the state-publication repair is attributed to this repository member; current-main feature history could not be inspected because the read-only command sandbox failed before execution. (role: proposed patch author and likely repair-area contributor; confidence: low; commits: bff2e5f41020; files: src/repair/git-publish.ts, test/repair/git-publish.test.ts, .github/actions/setup-state/action.yml)
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.

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.

@hxy91819
hxy91819 merged commit f986d7f into main Jul 19, 2026
14 checks passed
@hxy91819
hxy91819 deleted the feature/immutable-ledger-starvation branch July 19, 2026 11:21
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant