Skip to content

fix(worktrees): settle completed disk debt on refused postchecks - #188727

Merged
roboclaw-bot merged 1 commit into
mainfrom
roboclaw/fix-capacity-refusal-settlement
Oct 30, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
roboclaw/fix-capacity-refusal-settlement

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes completed worktree writes keeping each other's disk postchecks blocked when free space reaches the safety reserve.

Split from #186497; this preserves @steipete's capacity settlement work separately from FIFO plugin admission.

Work sessions

User Impact

Concurrent worktree operations can settle completed byte reservations and finish their postchecks. Refused increases still reserve no new capacity, and owner/commit authority checks remain in force.

Why This Change Was Made

The existing worker lowers only the exact owner's completed byte debt in the same transaction when a smaller request is refused. It preserves the owner's payload and safety reserve. Without settlement on refusal, two completed owners can keep counting each other's old debt until cleanup.

No schema, protocol, public SDK, dependency or configuration change.

Evidence

  • Exact current-main production owner 81cf32d99769f179cb3c165feeb3c0cf9edbcdf0 reproduces the intended regression: the second zero-byte postcheck rejects instead of resolving (1 failed, 7 skipped).
  • Candidate full capacity worker suite: 8/8 pass, including refused-growth and final cleanup controls. Targeted agents/tools types, canonical scoped lint (zero warnings/errors), and formatting pass.
  • Fresh independent Codex P0–P2 review: scoped-clean, no actionable findings. pr-simplify complete. Production +37/-4; test +30; separate exact 30-line allocation. Repository test-line ratchet and git diff --check pass.
  • Tests and checks used a fresh frozen install in one private rootless Node24.22.1 container with verified4CPU/8GiB/CapEff0 limits. The container exited0 and was removed. No production Gateway or operator state was touched.

This is an independent worktree capacity fix; it does not claim to resolve the FIFO incident. CI41132534278 finished failure: 33 jobs passed, two failed and 28 skipped. The failed test-line ratchet and derived gate see 1,041 lines of existing ceiling debt in both exact base 59059122a3d9abd58c54c68449f1d5f7ead9c1a3 and tested merge f51693c741cbab85a7b85779240a31d4cc311e21. This PR adds exactly 30 lines and 30 credit, leaving that debt unchanged. Main41130962529/job124321849014 reports the same 1,041-line debt but passes with zero net delta; it is not matching failed-main-job evidence. The maintainer's 23:16Z scoped landing ruling accepts this unchanged 1,041-line baseline debt through the native pre-existing-failure exception with the exact 30-line allocation, following #188560/#188716. CI remains failed. No budgets, ignores or tests were edited, and no CI rerun was requested. Exact-head review, security and live writer-authority checks remain enforced.

Lower completed byte reservations on refusal so concurrent postchecks can finish without admitting refused growth. Preserve exact owner custody and authority checks.

Co-authored-by: steipete <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 30, 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 agents Agent runtime and tooling size: S labels Oct 30, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 30, 2026 21:38
@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lowers completed worktree byte reservations when a disk-space postcheck is refused, without admitting additional writes.

Example: Two owners each reserve 1 MiB, complete their writes, and request zero remaining bytes with exactly 4 GiB free.

  • Before: Both postchecks count the other owner's old reservation and reject.
  • After: The first refusal settles its completed byte debt, allowing the second zero-byte postcheck to succeed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused and source-supported repair with meaningful reported regression coverage; confidence is limited to the in-process boundary and the CI failure remains unattributed.
Proof confidence 🦐 gold shrimp (3/6) The collaborator-authored PR is outside the ordinary contributor proof gate; supplied evidence exercises the production admission kernel through an in-process test with synthetic disk measurements, rather than a shipped CLI or Gateway flow. Compatibility inspection verifies unchanged reservation serialization, preserved owner metadata and reserves, and only smaller existing byte values, requiring no data migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Completed concurrent worktree writes can continue blocking one another's disk-space postchecks near the safety reserve.
Reason: This maintainer-authored repair restores accurate accounting within the existing design and follows the recorded direction to separate it from FIFO admission.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR addresses a concrete capacity-accounting defect still present on main, follows the requested split, and introduces no actionable code finding; the failing CI gate remains unresolved.

Priority: P2
Reviewed head: 307c96a04d892393686ac0169f1cfb194971e6a1

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped-entry-point low-space worktree scenario is supplied; this maintainer-authored PR is outside the ordinary contributor proof gate.
Agent review details

How this fits together

Worktree creation, restoration, and cleanup submit disk demands through their allocation owner to a worker-backed SQLite transaction, which records reservations and returns admission or a capacity refusal.

flowchart TD
  A[Worktree operations] --> B[Allocation and mutation leases]
  B --> C[Disk admission owner]
  C --> D[Capacity worker transaction]
  D --> E[Filesystem capacity measurements]
  D --> F[SQLite reservation rows]
  D --> G[Admission or refusal]
Loading

Technical review

Best possible solution:

Settle completed byte debt in the existing capacity transaction while preserving refusal, owner custody, safety reserves, and cleanup.

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

The main-source refusal path retains old byte debt, and the added two-owner regression gives a precise reproduction with reported parent failure and candidate success; no execution was performed during this review.

Is this the best way to solve the issue?

The patch repairs the shared accounting owner directly, reuses existing storage and transaction boundaries, and adds one regression covering distinct settlement and refused-growth failures without unnecessary machinery.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Worker-backed capacity accounting and settlement keeps the original intent (339c4da: Allow unrelated creation and registered cleanup to overlap while retaining byte debt until native writes settle.)
  • Fixed operational safety reserve keeps the original intent (536a6da: Use a fixed 4 GiB operational reserve instead of excessive volume-percentage reserves; the refusal settlement retains that reserve.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 339c4da adds src/agents/worktrees/capacity.worker.ts:138 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 339c4da81f54; files: src/agents/worktrees/capacity.worker.ts)

PR surface

Source +33, Tests +30, Other +2. Total +65 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 37 4 +33
Tests 1 30 0 +30
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 3 69 4 +65

Labels

Label changes:

  • add P2: Concurrent worktree operations can fail capacity postchecks near the safety reserve, with impact limited to low-space operation.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Concurrent worktree operations can fail capacity postchecks near the safety reserve, with impact limited to low-space operation.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain the failing test-line ratchet diagnostic and determine whether it requires a focused repair or reflects an inherited failure.

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 30, 2026, 5:53 PM ET / 21:53 UTC.

@roboclaw-bot
roboclaw-bot merged commit 41772e3 into main Oct 30, 2026
223 of 226 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/fix-capacity-refusal-settlement branch October 30, 2026 23:22
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…nclaw#188727)

Lower completed byte reservations on refusal so concurrent postchecks can finish without admitting refused growth. Preserve exact owner custody and authority checks.

Co-authored-by: steipete <[email protected]>
tideclaw-bot added a commit that referenced this pull request Nov 5, 2026
Backport accepted fixes onto 2026.11.5-beta.2.

Base: bc061f9
Canonical source tree before commit: e6c0c39

These are adapted/squashed backports; do not claim each is an exact Git cherry-pick.
Source provenance (selected verified commits; other cohorts use their frozen patch/adoption manifests):

runtime-B:
b20a0cc fix(macos): connect with configured credentials despite stale app environment (#191468)
c4c0942 fix(update): failed updates from 10.7–10.9 crash in automatic migration recovery (#189713)
6aae408 fix(update): preserve recovery errors and async triage callbacks (#191495)
8910654 fix(macos): prevent first-launch Gateway failures after upgrades (#191436)
00b2ff4 fix: parent sessions miss child approvals with a custom session store (#189827)
c6142a8 fix: avoid copying managed plugin binaries during Gateway startup (#187865)
e72b356 fix(anthropic): avoid token profile collisions (#187875)
807075d fix(anthropic): set API workspace at login (#186976)
bafe92f fix(exec): preserve no-timeout results from macOS app nodes (#190729)
9b05a64 fix(imessage): use a PostgreSQL-safe recovery cursor key (#184919)
6ba197f fix: session search on PostgreSQL scans every transcript row instead of using the text index (#187909)
4f49aa5 fix(sessions): PostgreSQL session search scans every transcript row again after the 5th search on a connection (#188979)
de3936c fix(macos): Mac tab shows a blank or stale page when a load fails (#185432)
e977080 fix(macos): prevent duplicate voice sends and false sent feedback (#186271)

provider-compaction:
1b43c2e fix(compaction): preserve active request provenance (#180214)
7b0cfe3 fix(google): restore tool calls with Python keyword parameters (#191561)
9039ceb fix(ci): keep compaction attribution helpers internal
d6a1327 feat(google): use the Interactions API for Gemini Flash models (#189395)
fe0f8d1 fix(google): Gemini models ignore configured topP (#190695)

history:
c51d733 fix(sessions): stop expanding archive reads from exhausting memory (#190690)
3c8bd4d fix(sessions): page oversized earlier history instead of failing at 8 MiB (#188450)
b195f61 fix(sessions): page oversized transcript history in both directions (#188483)
b65482e fix(gateway): preserve older history across hidden message gaps (#188557)
3d4fc94 fix(sessions): avoid oversized listing and imported-history reads (#189284)
33e7baf fix(sessions): bound active accounting without blocking writers (#190182)
682ade7 fix: preserve chat history continuation metadata (#188612)

runtime-C:
7e005b0 fix(macos): keep secrets when a Gateway config save fails (#187734)
15cf738 fix(macos): keep Gateway auth when Tailscale exposure is turned off (#187664)
b53a06b perf(update): read candidate state inventory without copying the shared database (#187921)
970fc4e fix: restore CLI message sends with agent tool policies (#188058)
73ad731 fix: stop model fallback when session capability metadata changes (#179312)
32305db fix: subagent turns fail after session metadata changes (#183501)
d13bd0f fix(codex): include relay conversation instructions in trajectory (#189005)
e375530 fix: replies after a plugin reload from Control UI go to the session's last external chat (#190982)
9346376 fix: reasoning-only retry is refused by Anthropic as reasoning_extraction (#184434)

direct-auth-state:
1b15408 fix(models): keep the model list when one plugin-owned provider lacks a credential (#189014)
7d8dc60 fix: recover startup migration with retained worker index (#189023)

capacity:
41772e3 fix(worktrees): settle completed disk debt on refused postchecks (#188727)

command-once-189369:
8269137 fix(plugins): plugin commands that continue the agent run three times on native command turns (#189369)

pg-board-189564:
7232a8d fix(boards): publish widgets with PostgreSQL storage (#189564)

queued-edit-189869:
92b32ca fix: hold queued messages through inline edits (#189869)

Preserve source attribution from original commits. For a genuinely exact individual pick only, use the conventional (cherry picked from commit <sha>) line.
Full file-level provenance: coverage-manifest.json; reviewed patch hashes: artifact-registry.json.
No held136/native82 content adopted by this work. No release or full-candidate qualification claim.

Additional original-source identities (exact adapted hunk scope is in frozen artifacts):
release-guides-185258: 39c37e6 docs(release): define ledger-first hotfix routing (#185258)
UI-history: 10a6e4f fix(ui): scope provider-add discovery warning to its own provider (#188541), 3d7b4c4 fix(ui): never fail loading earlier chat history without a boundary (#188372)
obsolete-cache-188203: 90d82c2 fix: preserve completed reasoning and refill chat snapshots (#188203)
webhook-169778: b1f643f fix(startup): keep webhook decisions startup recorded for channels Doctor left pending (#169778)
schema-lease-188391: ba6cfcd fix(state): keep lease renewal independent of parent admission (#188391)
backfill-188976: c75a8a8 fix(gateway): stop session row backfill once the Gateway is closing (#188976)
canonical-disable-188846: 88b56ee fix(config): auto-enable reads and writes mixed-case plugin policy under the canonical id (#188846)
matrix-177272: 5a6d22c fix(matrix): stop seeding new thread sessions from the room transcript (#177272)
provider-hook-189059: 0588f51 fix(models): isolate every per-provider catalog failure (#189059)
unicode-189868: 87396e7 fix(oc-path): avoid reading and editing a different Unicode key (#189868)
replay-cohort: 2031044 fix(sessions): acknowledge committed input retries without duplicate turns (#188527), 9114431 fix: resume configured fallback after interrupted attempts (#188672)

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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