Repository navigation
fix(browser): let idle upload retention survive node updates - #154384
Patrick-Erichsen merged 7 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 6:46 PM ET / 22:46 UTC (Revision 9). ClawSweeper reviewWhat this changesThe Browser plugin lets retained uploads survive idle node updates, preserves recovery markers during failed cleanup, and prevents ordinary commands from repeatedly retrying failed recovery scans. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still has the reported lifecycle defects. No blocking patch defect was found, and the latest installed-updater evidence resolves the previous proof requests. Priority: P2 Review scores
Verification
How this fits togetherThe Browser plugin stages files sent from the Gateway onto browser nodes and owns their retention and cleanup. Its active-work signal tells the node updater whether restarting is safe. flowchart TD
A[Gateway upload request] --> B[Browser upload staging]
B --> C[Retained files and ownership marker]
C --> D[Cleanup and restart recovery]
B --> E[Active work check]
D --> E
E --> F[Node update admission]
F --> G[Replacement node process]
G --> D
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +10, Tests +114. Total +124 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep restart-recoverable retention separate from active work while preserving the existing cleanup owner, upload format, quotas, and browser runtime protections. Do we have a high-confidence way to reproduce the issue? Yes: current-main source counts retention and retry timers as active work, and the recorded production runtime demonstrates refused idle admission before the repair. This read-only review did not execute that reproduction. Is this the best way to solve the issue? Yes: the patch repairs the existing upload lifecycle owner without adding competing retry policy or changing public settings, formats, or retention limits. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6d5bb1bd3bd4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
… is proven Recursive mkdir succeeds on a staging root whose permissions still block readdir, so an upload request must not reset an exhausted recovery budget on mkdir alone; gate the reset on a scan capability probe. Cleanup-only exhaustion previously stranded its directory until restart because the staging reset required exhausted recovery attempts: recovery now re-probes exhausted removals whenever it re-runs, and staging drops the cached recovery pass so the re-probe happens before quota admission.
… deleted uploads A readable staging root can still contain a marked upload whose numbered child directory blocks readdir, so the root-only resume probe cleared an exhausted recovery budget while the scan fault persisted and re-armed the retry loop that pins node-update admission. The resume probe now runs the complete recovery scan and only unlatches the budget when it succeeds. Partial recursive removal can also unlink the ownership marker before failing on a file inside a read-only child directory, after which the marker-gated scan can never rediscover the remnant and a repaired fault would leave it stranded. Recovery re-probes removal for exhausted cleanup entries recorded under the staging root that the scan no longer sees; unmarked directories never recorded as owned stay untouched.
|
@clawsweeper re-review Both P2 findings and the CI failure are addressed in
Validation: |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Reviewed repair now published at The local repair separates active upload operations from restart-recoverable housekeeping. It also preserves the upload ownership marker until every payload is deleted, so a failed cleanup cannot become invisible to the next process. Compared against original base
The runtime proof uses a cached plugin registry fixture wired to the production browser idle hook and a local result collector. It runs the real node runtime, browser lifecycle, upload owner and filesystem without module/FS mocks. It does not claim a full authenticated Gateway/package-download/update activation cycle. Launcher and runner source were separately checked: accepted updates finish normally and the launcher waits for child exit before spawning the new process. Regression evidence: the original base and submitted head each fail the three new defect cases; the symlink preservation control passes. Candidate: 20 upload/transport tests plus 120 browser/node/plugin/auto-update sibling tests pass; both extension typechecks, scoped lint, formatting and whitespace checks pass. Permission cases executed on macOS as a nonroot user; they skip where chmod cannot create the fault. Fake-clock tests verify 24h retention, hourly recovery pacing and retry after permissions repair. The final candidate is production +24/-14 (net +10), tests +128/-14. It removes both attempt maps, cap/exhaustion state, extra resume scans and 563 cap-specific test lines. The remaining growth prevents the demonstrated marker-loss orphaning; timer exclusion alone is insufficient. Cleanup-only failures keep their existing hourly retry. Recovery-scan failure can retry immediately on an actual upload, before quota admission. Unexpired failed discards found after restart retain the existing retention deadline; no immediate-restart deletion promise is made. Marker format, retention duration, quotas, config and schemas are unchanged. Latest completed ClawSweeper revision 5 had no outstanding rank-ups. Earlier permission, full-scan and partial-deletion concerns are addressed; immediate cleanup re-probes existed to compensate for retry exhaustion and are replaced by retaining the existing hourly retry owner. This rewrite requires a fresh re-review after publication. Fresh Codex autoreview of the complete candidate against the pinned merge base completed successfully: default P0 scope, no accepted/actionable findings. This is a scoped result, not a broader P2 review. Final published-head CI and native landing results will be recorded before merge. Recorded before/after runtime verdicts{
"base": "49dfd78b30f8b1831b8b05475f79a7ac6d34fd56",
"candidateUploadSourceSha256": "ba5fee56c3a5e5074c69211cd2ddbb9bad5162fb42343ec1d1e8369c3b929ad1",
"runtime": "production prepareNodeHostRuntime/start/tryPauseForUpdate",
"registry": "cached fixture wired to production browser idle hook",
"transport": "local result collector",
"filesystem": "real macOS nonroot permission faults",
"beforeAfter": {
"healthyRetentionPause": [
false,
true
],
"recoveryRetryPause": [
false,
true
],
"cleanupRetryPause": [
false,
true
],
"activeCleanupPause": [
false,
false
],
"browserRuntimeRetainedPause": [
false,
false
],
"partialCleanupMarkerPreserved": [
false,
true
],
"expiredPayloadReclaimedInFreshProcess": [
false,
true
],
"retainedUploadBytesAcrossNormalExit": [
"report",
"report"
],
"pausedInvokeError": [
"UNAVAILABLE",
"UNAVAILABLE"
]
},
"fullAuthenticatedGatewayOrPackageUpdate": false
}Local full changed check completed 21 successful stages, including both extension typechecks, dead-export scans, formatting, and 6 doctor guard tests. It then stopped at the extension-lint declaration-isolation guard: the native PR worktree is nested under another node_modules installation. Exact pushed-head hosted CI will complete lint and remaining checks in its isolated checkout before landing; the local full check is not recorded as passing. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
The repaired head I am reopening the unchanged PR to create a fresh event with current base metadata. This does not waive the failed gate; fresh exact-head CI still has to pass. |
|
Installed node updater × candidate proof passed for f0936f5, addressing the installed-updater and changed-test-cost requests in ClawSweeper revision 8. The actual published For the accepted path, I installed the exact built candidate, then served a version-only
Build/provenance: exact-head immutable source archive; Node 24.19.0; pnpm 12.5.1 frozen install; canonical Changed-test cost: Scope: native macOS, isolated HOME/state/TMPDIR, synthetic owner-format retained uploads, real Gateway/node/updater/launcher processes and filesystem recovery; no provider credentials, mocks of the updater, live services, or user state. macOS sandbox denied the operator's shared |
|
Merged via squash.
|
…w#154384) * fix(browser): bound browser proxy upload recovery retries * fix(browser): resume upload recovery after staging succeeds * fix(browser): resume upload retry caps only after filesystem recovery is proven Recursive mkdir succeeds on a staging root whose permissions still block readdir, so an upload request must not reset an exhausted recovery budget on mkdir alone; gate the reset on a scan capability probe. Cleanup-only exhaustion previously stranded its directory until restart because the staging reset required exhausted recovery attempts: recovery now re-probes exhausted removals whenever it re-runs, and staging drops the cached recovery pass so the re-probe happens before quota admission. * fix(browser): gate recovery resume on full scan and reclaim partially deleted uploads A readable staging root can still contain a marked upload whose numbered child directory blocks readdir, so the root-only resume probe cleared an exhausted recovery budget while the scan fault persisted and re-armed the retry loop that pins node-update admission. The resume probe now runs the complete recovery scan and only unlatches the budget when it succeeds. Partial recursive removal can also unlink the ownership marker before failing on a file inside a read-only child directory, after which the marker-gated scan can never rediscover the remnant and a repaired fault would leave it stranded. Recovery re-probes removal for exhausted cleanup entries recorded under the staging root that the scan no longer sees; unmarked directories never recorded as owned stay untouched. * fix(browser): re-probe exhausted discard uploads before retention scheduling * fix(browser): let idle upload retention survive node updates --------- Co-authored-by: Patrick Erichsen <[email protected]>
What Problem This Solves
Browser upload retention and retry timers keep an otherwise idle node busy, preventing automatic updates. Failed recursive deletion can also remove an upload's recovery marker before its payload, leaving the next process unable to reclaim the copy.
User Impact
Idle nodes can update while retained upload files and hourly housekeeping remain recoverable. Active filesystem operations and live browser runtime ownership still block updates. Ordinary browser commands no longer trigger repeated failed scans between hourly retries.
Why This Change Was Made
Keep the repair in the upload lifecycle owner: count active work, delete payload before ownership marker, retain failed-recovery promise caching across timer callbacks, and retry pending recovery before a real upload's quota admission. Remove retry caps, failure-count maps and extra resume scans. Existing hourly cleanup retries and 24h retention remain unchanged.
Evidence
The local repair separates active upload operations from restart-recoverable housekeeping. It also preserves the upload ownership marker until every payload is deleted, so a failed cleanup cannot become invisible to the next process.
Compared against original base
49dfd78b30f8b1831b8b05475f79a7ac6d34fd56, using real filesystem permission failures and the actual node-host runtime'stryPauseForUpdate():The runtime proof uses a cached plugin registry fixture wired to the production browser idle hook and a local result collector. It runs the real node runtime, browser lifecycle, upload owner and filesystem without module/FS mocks. It does not claim a full authenticated Gateway/package-download/update activation cycle. Launcher and runner source were separately checked: accepted updates finish normally and the launcher waits for child exit before spawning the new process.
Regression evidence: the original base and submitted head each fail the three new defect cases; the symlink preservation control passes. Candidate: 20 upload/transport tests plus 120 browser/node/plugin/auto-update sibling tests pass; both extension typechecks, scoped lint, formatting and whitespace checks pass. Permission cases executed on macOS as a nonroot user; they skip where chmod cannot create the fault. Fake-clock tests verify 24h retention, hourly recovery pacing and retry after permissions repair.
The final candidate is production +24/-14 (net +10), tests +128/-14. It removes both attempt maps, cap/exhaustion state, extra resume scans and 563 cap-specific test lines. The remaining growth prevents the demonstrated marker-loss orphaning; timer exclusion alone is insufficient.
Cleanup-only failures keep their existing hourly retry. Recovery-scan failure can retry immediately on an actual upload, before quota admission. Unexpired failed discards found after restart retain the existing retention deadline; no immediate-restart deletion promise is made. Marker format, retention duration, quotas, config and schemas are unchanged.
Latest completed ClawSweeper revision 5 had no outstanding rank-ups. Earlier permission, full-scan and partial-deletion concerns are addressed; immediate cleanup re-probes existed to compensate for retry exhaustion and are replaced by retaining the existing hourly retry owner. This rewrite requires a fresh re-review after publication.
Fresh Codex autoreview of the complete candidate against the pinned merge base completed successfully: default P0 scope, no accepted/actionable findings. This is a scoped result, not a broader P2 review. Final published-head CI and native landing results will be recorded before merge.
Recorded before/after runtime verdicts
{ "base": "49dfd78b30f8b1831b8b05475f79a7ac6d34fd56", "candidateUploadSourceSha256": "ba5fee56c3a5e5074c69211cd2ddbb9bad5162fb42343ec1d1e8369c3b929ad1", "runtime": "production prepareNodeHostRuntime/start/tryPauseForUpdate", "registry": "cached fixture wired to production browser idle hook", "transport": "local result collector", "filesystem": "real macOS nonroot permission faults", "beforeAfter": { "healthyRetentionPause": [ false, true ], "recoveryRetryPause": [ false, true ], "cleanupRetryPause": [ false, true ], "activeCleanupPause": [ false, false ], "browserRuntimeRetainedPause": [ false, false ], "partialCleanupMarkerPreserved": [ false, true ], "expiredPayloadReclaimedInFreshProcess": [ false, true ], "retainedUploadBytesAcrossNormalExit": [ "report", "report" ], "pausedInvokeError": [ "UNAVAILABLE", "UNAVAILABLE" ] }, "fullAuthenticatedGatewayOrPackageUpdate": false }Local full changed check completed 21 successful stages, including both extension typechecks, dead-export scans, formatting, and 6 doctor guard tests. It then stopped at the extension-lint declaration-isolation guard: the native PR worktree is nested under another node_modules installation. Exact pushed-head hosted CI will complete lint and remaining checks in its isolated checkout before landing; the local full check is not recorded as passing.
Installed updater evidence
Installed node updater × candidate proof passed for f0936f5, addressing the installed-updater and changed-test-cost requests in ClawSweeper revision 8.
The actual published
[email protected]package identifies itself asOpenClaw 2026.9.7 (c074824)and declares state/agent schema 19/24. This candidate declares 20/24. Node auto-update deliberately rejects schema changes, so published-driver → candidate acceptance would be the wrong expected outcome. The real installed driver loggedNode auto-update deferred: the release changes database schemas, stayed paired/connected, preserved the retained upload bytes, and left the activation selector absent.For the accepted path, I installed the exact built candidate, then served a version-only
2026.10.1copy through the repository's npm-registry/package-fixture helpers. A content comparison of all 13,516 package files found only three changed files:package.json,dist/build-info.json, and the regenerateddist/postinstall-content-inventory.json. Executable code and schema contracts were unchanged.ready; waiting for active work to finish; retained files stayed intact.restarting into 2026.10.1, thenactivated 2026.10.1.node identity --jsonwere unchanged.97022d921ee95b5710582a91983da662a512b796273e91b39557c9575568ebaf; replacement startup reclaimed an upload made expired immediately before handoff.Build/provenance: exact-head immutable source archive; Node 24.19.0; pnpm 12.5.1 frozen install; canonical
scripts/package-openclaw-for-docker.mjs --allow-unreleased-changelogwith full declarations/UI build (7m47s), followed by passing tarball integrity validation (27s). Exact candidate tarball SHA-256:fa354be269a1bacd047a1c33c0b4e6810a0a44cf80cbdda81e0e33c05adac3a1. The actual published and candidatenode-host-launcher.mjsfiles were byte-identical (SHA-256b5e6a4c7f6ff08ef4ee4feb091054bada9577108edb3f0071870356ab3c28ab8).Changed-test cost:
node scripts/run-vitest.mjs run extensions/browser/src/browser-proxy-upload.active-work.test.ts --maxWorkers=1 --reporter=verbosepassed all four cases, including the non-root permission-fault cases: 1.57s Vitest duration, 2.18s runner duration, 2.43s end-to-end wall time. Individual case times: 92/5/54/3ms. The exact-head CI browser shard passed 413 tests in 24 files in 21.78s with two workers; the enclosing job took 134s. Those job/shard durations are not the changed-file cost.Scope: native macOS, isolated HOME/state/TMPDIR, synthetic owner-format retained uploads, real Gateway/node/updater/launcher processes and filesystem recovery; no provider credentials, mocks of the updater, live services, or user state. macOS sandbox denied the operator's shared
/tmp/openclawso the canonical secure TMPDIR fallback remained task-owned. This complements the prior real staging/filesystem/node-runtime proof. A managed Gateway schema-19 → schema-20 migration was not run; the published node's intentional schema deferral and the unchanged-code same-schema activation are reported separately. The first harness attempt observed connection before command advertisement; the harness now waits for the exact advertised command set. Product source was unchanged.