Skip to content

fix(pr): reclaim finished materialized wrapper copies - #162340

Merged
vincentkoc merged 2 commits into
mainfrom
fix/pr-anchor-lifetime-20261001
Oct 1, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/pr-anchor-lifetime-20261001

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes: supervised PR operations leave their materialized wrapper copies in temporary storage after the operation and its children have finished, accumulating files and inodes.

User Impact

Newly created wrapper copies are reclaimed after proven supervised completion. Existing copies, unsupervised advisory operations, uncertain child custody, and retained operation locks remain untouched. This prevents one source of recurring temporary-storage growth; it does not clean existing installations.

Why This Change Was Made

The creating wrapper holds its directory open across exec and gives cleanup authority only to the same supervisor process. The supervisor derives the path from its own anchored script, strips that authority from children, and removes only the unchanged directory after strict child drainage and the existing completion/lock gates. External dependency symlink targets are preserved. Open notification pipes, interruption, replacement, or missing authority retain the copy.

Evidence

  • Required PR-wrapper inventory test: 1 passed, 15 skipped (5.75 seconds native wall time).
  • Focused real materialization and escaped-notification-pipe tests: 2 passed, 271 skipped (8.71 seconds native wall time). They cover successful removal, external dependency preservation, and retention when drainage is incomplete.
  • Dependency-free lifecycle fixture: 28 passed, 1 skipped, 1 pre-existing restricted-PATH failure. The same failure reproduces with the untouched base runner. New success and validation-failure cleanup tests fail against that base because the copy remains, and pass with this change.
  • Bash syntax, Node syntax, targeted oxfmt, and diff whitespace checks passed.
  • Independent exact-diff review found no remaining correctness or privacy findings.
  • The complete two-file retry with an invocation-local real Git selection finished in 214.24 seconds: 270 passed and 3 stale post-cleanup expectations failed. The test-only correction preserves path-byte and dependency-realpath assertions inside live dispatch, then checks cleanup and external-target preservation. All 4 selected cases pass (13.27 seconds test wall, 14.03 seconds native runner wall); independent scoped autoreview is clean.

The earlier 273-case run remains incomplete, not green: a local Git command shim recursively selected a fixture proxy and the task-owned test runner was terminated through its native lifecycle. The retry above corrects only that invocation's synthetic-fixture Git selection; no global Git/PATH guard was changed. Required prepared-head CI remains a separate landing gate; skipped draft checks are not passing proof.

@vincentkoc vincentkoc self-assigned this Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 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 scripts Repository scripts size: M labels Oct 1, 2026
@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 Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 30, 2026, 11:28 PM ET / October 1, 2026, 03:28 UTC.

ClawSweeper review

What this changes

The PR reclaims temporary copies of trusted PR tooling after supervised completion, while preserving copies when ownership or child completion is uncertain.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this addresses a remaining temporary-storage leak, and no concrete introduced correctness defect was found. The member-authored contribution is actively assigned and retains meaningful work absent from current main.

Priority: P2
Reviewed head: 257f45ca470e621a259e4efde0ad9b954a80fa74

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused lifecycle repair with conservative deletion guards and meaningful boundary coverage; reported validation limitations are clearly disclosed.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository member, so the ordinary external-contributor proof gate does not apply. Inspected production-boundary fixtures and reported focused runs cover deletion, foreign/missing authority, replacement, interruption and dependency preservation; no material unresolved authority case was established. The broader run remains explicitly incomplete, and this review executed no code. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository member, so the ordinary external-contributor proof gate does not apply. Inspected production-boundary fixtures and reported focused runs cover deletion, foreign/missing authority, replacement, interruption and dependency preservation; no material unresolved authority case was established. The broader run remains explicitly incomplete, and this review executed no code. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduced change: Reviewed the merge-base-to-head patch. The verified test merge has the pinned base followed by the exact PR head as its raw parents, and its result changes only the same five paths.
Cleanup ownership and final-effect safeguards: The creator holds directory FD 9 across exec. The supervisor checks its own PID, script locations, directory identity, ownership and permissions, removes the handoff environment from children, and rechecks the held and current directory immediately before recursive removal. Cleanup additionally requires strict drainage, eligible completion and no retained locks.
Current main still needs the repair: The inspected production files on fetched main retain OS temporary-directory reaping and lack the PR's ownership handoff and supervisor cleanup. This comparison establishes remaining work, not a claim that merging removes main behavior.
Findings None None.
Security None None.

How this fits together

OpenClaw's PR tooling can extract trusted wrapper code into a temporary directory when a checkout cannot supply it. Its process supervisor runs the operation, tracks child completion and operation locks, and now controls cleanup of that temporary copy.

flowchart TD
  A[PR command] --> B[Trusted wrapper selection]
  B --> C[Temporary wrapper copy]
  C --> D[Process supervisor]
  D --> E[Operation and child processes]
  E --> F[Completion and ownership checks]
  F --> G[Remove owned copy]
  F --> H[Retain uncertain copy]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Tests +123, Other +90. Total +213 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 142 19 +123
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 95 5 +90
Total 5 237 24 +213

Review metrics

Metric Value Why it matters
Cleanup implementation growth production +90 net lines; tests +123 net lines Production growth implements creation identity, final deletion checks and conservative retention; tests cover distinct lifecycle and ownership failures.

Stored data model

Persistent data-model change detected: serialized state: scripts/pr-lib/process-group-runner.mjs, unknown-data-model-change: scripts/pr-lib/process-group-runner.mjs. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep temporary-copy retirement with the existing supervisor, using creation identity and completed child custody as the deletion boundary.

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

Yes, source establishes the path: force trusted-wrapper materialization, complete a supervised operation, and observe that current main leaves the copy behind. The captured body reports this failing against the base; this review did not execute it.

Is this the best way to solve the issue?

Yes. Extending the existing supervisor avoids a competing cleanup owner and preserves conservative retention when completion or directory ownership cannot be established.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: Recurring temporary-storage growth in maintainer PR tooling is a bounded operational defect without evidence of an urgent product outage.
  • 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 author is a repository member, so the ordinary external-contributor proof gate does not apply. Inspected production-boundary fixtures and reported focused runs cover deletion, foreign/missing authority, replacement, interruption and dependency preservation; no material unresolved authority case was established. The broader run remains explicitly incomplete, and this review executed no code. No stored-data contract changes.

Label justifications:

  • P2: Recurring temporary-storage growth in maintainer PR tooling is a bounded operational defect without evidence of an urgent product outage.
  • 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 author is a repository member, so the ordinary external-contributor proof gate does not apply. Inspected production-boundary fixtures and reported focused runs cover deletion, foreign/missing authority, replacement, interruption and dependency preservation; no material unresolved authority case was established. The broader run remains explicitly incomplete, and this review executed no code. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head patch. The verified test merge has the pinned base followed by the exact PR head as its raw parents, and its result changes only the same five paths. (257f45ca470e)
  • Cleanup ownership and final-effect safeguards: The creator holds directory FD 9 across exec. The supervisor checks its own PID, script locations, directory identity, ownership and permissions, removes the handoff environment from children, and rechecks the held and current directory immediately before recursive removal. Cleanup additionally requires strict drainage, eligible completion and no retained locks. (scripts/pr-lib/process-group-runner.mjs:754, 257f45ca470e)
  • Current main still needs the repair: The inspected production files on fetched main retain OS temporary-directory reaping and lack the PR's ownership handoff and supervisor cleanup. This comparison establishes remaining work, not a claim that merging removes main behavior. (scripts/pr:423, 18659d387600)
  • Latest release retains the old lifetime: GitHub's source endpoint for v2026.9.7 shows the wrapper explicitly leaving its successful materialized copy to OS temporary-directory reaping. Local release-blob inspection was unavailable; the read-only GitHub source check supplied the release evidence. (scripts/pr:425, c074824a27c9)
  • Boundary regression coverage and reported validation: Inspected tests exercise the real supervisor and filesystem for successful deletion, validation failure, external dependency preservation, missing/foreign authority, child authority stripping, directory replacement and interruption. The existing escaped-notification-pipe case now checks retention. The captured PR body reports passing focused runs and before/after failures against the base, while explicitly recording an incomplete broader run and a baseline restricted-PATH failure. No tests were executed during this review. (test/scripts/pr-darwin-process-identity.test.py:228, 257f45ca470e)
  • Related merged work is distinct: fix(pr): give materialized wrappers their dependency context #150504 is merged and fixes dependency-context completion; fix(scripts): prevent host tooling drift from blocking PR workflows #152078 is merged and fixes tooling-root, Git and metadata access behavior. Their inspected descriptions do not implement finished-copy reclamation.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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.

@vincentkoc
vincentkoc marked this pull request as ready for review October 1, 2026 05:08
@vincentkoc
vincentkoc enabled auto-merge (squash) October 1, 2026 05:14
@vincentkoc
vincentkoc merged commit dab8c15 into main Oct 1, 2026
217 checks passed
@vincentkoc
vincentkoc deleted the fix/pr-anchor-lifetime-20261001 branch October 1, 2026 05:17
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
* fix(pr): reclaim finished materialized wrapper copies

* test(pr): check materialized anchors before supervised cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M 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