Skip to content

fix(browser): let idle upload retention survive node updates - #154384

Merged
Patrick-Erichsen merged 7 commits into
openclaw:mainfrom
xialonglee:fix/gap-browser-proxy-upload-retry-cap
Oct 1, 2026
Merged

Patrick-Erichsen merged 7 commits into
openclaw:mainfrom
xialonglee:fix/gap-browser-proxy-upload-retry-cap

Conversation

@xialonglee

@xialonglee xialonglee commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

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's tryPauseForUpdate():

Scenario Before Candidate
Healthy upload retained Update pause refused Pause admitted; file bytes intact
Recovery retry pending Pause refused Pause admitted
Ten ordinary recovery entries during EACCES 10 scans/warnings 1 scan/warning
Cleanup currently running Pause refused Pause refused
Browser starting, retained runtime, or stopping Pause refused Pause refused
Failed recursive deletion Marker lost, payload left Marker and payload retained
Fresh process after repaired/expired interrupted deletion Payload orphaned Payload reclaimed
Healthy retained upload after normal process exit/restart Bytes preserved, busy Same bytes preserved, idle
Invoke after accepted pause UNAVAILABLE response Same explicit UNAVAILABLE response

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 as OpenClaw 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 logged Node 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.1 copy 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 regenerated dist/postinstall-content-inventory.json. Executable code and schema contracts were unchanged.

Real installed flow Observed result
Paired candidate node + Browser plugin + retained upload artifacts Both Browser commands advertised; retained bytes existed before startup.
Public node-command workload held open during candidate download/install/validation Updater logged ready; waiting for active work to finish; retained files stayed intact.
Workload released, normal idle admission and launcher handoff Updater logged restarting into 2026.10.1, then activated 2026.10.1.
Replacement process Supervisor PID 79157 persisted; node host PID changed 79161 → 79461; paired node ID and node identity --json were unchanged.
Retained-upload recovery Healthy file SHA-256 remained 97022d921ee95b5710582a91983da662a512b796273e91b39557c9575568ebaf; replacement startup reclaimed an upload made expired immediately before handoff.
Cleanup Scenario exited 0 in 119.35s; all tracked children joined; an independent PID audit found none remaining.

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-changelog with full declarations/UI build (7m47s), followed by passing tarball integrity validation (27s). Exact candidate tarball SHA-256: fa354be269a1bacd047a1c33c0b4e6810a0a44cf80cbdda81e0e33c05adac3a1. The actual published and candidate node-host-launcher.mjs files were byte-identical (SHA-256 b5e6a4c7f6ff08ef4ee4feb091054bada9577108edb3f0071870356ab3c28ab8).

Changed-test cost: node scripts/run-vitest.mjs run extensions/browser/src/browser-proxy-upload.active-work.test.ts --maxWorkers=1 --reporter=verbose passed 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/openclaw so 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.

@clawsweeper

clawsweeper Bot commented Sep 21, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 6:46 PM ET / 22:46 UTC (Revision 9).

ClawSweeper review

What this changes

The 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
Reviewed head: f0936f547bddc90a5e02b34cc0e20294d2dc3a02

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with convincing production and installed-update evidence, useful regressions, and no blocking finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): Recorded real macOS filesystem and production node-runtime observations cover idle admission, active-work rejection, marker preservation, retry pacing, and restart recovery. Exact-head installed-flow logs additionally show safe published-driver schema deferral and successful same-schema launcher handoff with preserved identity and upload bytes. Both prior proof requests are addressed; this diff changes no stored-data format or schema.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): Recorded real macOS filesystem and production node-runtime observations cover idle admission, active-work rejection, marker preservation, retry pacing, and restart recovery. Exact-head installed-flow logs additionally show safe published-driver schema deferral and successful same-schema launcher handoff with preserved identity and upload bytes. Both prior proof requests are addressed; this diff changes no stored-data format or schema.
Evidence reviewed 8 items Introduced lifecycle repair: The pinned introduced diff excludes retained timers from active work, removes payloads before the ownership marker, caches failed recovery across ordinary commands, and retries pending recovery before upload admission. The complete production owner and changed test file were read.
Still necessary on current main: Comparison with fetched main shows all four production changes remain absent there. No verified merged fixing PR was established, so implementation-based closure is unsupported.
Production admission boundary: Browser command registration exposes the upload owner's active-work predicate and starts recovery through command availability. Node runtime counts in-flight commands and rejects new invocations after update pause; browser runtime ownership remains independently busy.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +10, Tests +114. Total +124 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 24 14 +10
Tests 1 128 14 +114
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 152 28 +124

Review metrics

Metric Value Why it matters
Changed-test runtime 4 cases; 2.43 seconds single-worker wall time The recorded nonroot run includes the permission-fault cases and stays within the repository's per-file cost target.

Technical review

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Recorded real macOS filesystem and production node-runtime observations cover idle admission, active-work rejection, marker preservation, retry pacing, and restart recovery. Exact-head installed-flow logs additionally show safe published-driver schema deferral and successful same-schema launcher handoff with preserved identity and upload bytes. Both prior proof requests are addressed; this diff changes no stored-data format or schema.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): Recorded real macOS filesystem and production node-runtime observations cover idle admission, active-work rejection, marker preservation, retry pacing, and restart recovery. Exact-head installed-flow logs additionally show safe published-driver schema deferral and successful same-schema launcher handoff with preserved identity and upload bytes. Both prior proof requests are addressed; this diff changes no stored-data format or schema.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This bounded browser lifecycle repair restores idle node updating and recoverable upload cleanup without an urgent core outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): Recorded real macOS filesystem and production node-runtime observations cover idle admission, active-work rejection, marker preservation, retry pacing, and restart recovery. Exact-head installed-flow logs additionally show safe published-driver schema deferral and successful same-schema launcher handoff with preserved identity and upload bytes. Both prior proof requests are addressed; this diff changes no stored-data format or schema.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded real macOS filesystem and production node-runtime observations cover idle admission, active-work rejection, marker preservation, retry pacing, and restart recovery. Exact-head installed-flow logs additionally show safe published-driver schema deferral and successful same-schema launcher handoff with preserved identity and upload bytes. Both prior proof requests are addressed; this diff changes no stored-data format or schema.

Evidence

What I checked:

  • Introduced lifecycle repair: The pinned introduced diff excludes retained timers from active work, removes payloads before the ownership marker, caches failed recovery across ordinary commands, and retries pending recovery before upload admission. The complete production owner and changed test file were read. (extensions/browser/src/browser-proxy-upload.ts:42, f0936f547bdd)
  • Still necessary on current main: Comparison with fetched main shows all four production changes remain absent there. No verified merged fixing PR was established, so implementation-based closure is unsupported. (extensions/browser/src/browser-proxy-upload.ts:42, 6d5bb1bd3bd4)
  • Production admission boundary: Browser command registration exposes the upload owner's active-work predicate and starts recovery through command availability. Node runtime counts in-flight commands and rejects new invocations after update pause; browser runtime ownership remains independently busy. (extensions/browser/plugin-registration.ts:158, f0936f547bdd)
  • Exact-head installed updater proof: The captured body and fix(browser): let idle upload retention survive node updates #154384 (comment) record real isolated macOS Gateway/node/updater/launcher execution for the reviewed head. Published 2026.9.7 safely deferred the schema-changing candidate while preserving connection and bytes. A same-schema installed candidate then waited for active work, activated a version-only package, changed the child PID, preserved identity and healthy upload bytes, and reclaimed an expired upload after replacement. These observations complement the recorded permission-fault and node-runtime before/after evidence. (f0936f547bdd)
  • Schema deferral is the existing contract: The updater rejects different state or agent schema versions because binary rollback cannot undo shared-state migration. The documented node update flow likewise delegates schema-changing releases to the normal updater. The published-driver deferral therefore matches the expected outcome rather than demonstrating a failed upload repair. (src/node-host/auto-update-compatibility.ts:27, f0936f547bdd)
  • Prior review requests addressed: The previous completed review had no findings and requested installed-driver evidence plus measured test cost. The latest captured evidence supplies both: four cases passed with nonroot permission faults, 2.43 seconds end-to-end wall time, and a linked browser CI shard taking 21.78 seconds. The shard duration is explicitly distinguished from changed-file cost. (extensions/browser/src/browser-proxy-upload.active-work.test.ts:31, f0936f547bdd)

Likely related people:

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

History

Review history (8 earlier review cycles)
  • reviewed 2026-09-21T04:04:12.170Z sha 327cd53 :: needs real behavior proof before merge. :: [P2] Make the permission-fault tests platform-aware
  • reviewed 2026-09-21T04:42:11.672Z sha db9ae34 :: blocked before merge. :: [P2] Verify storage recovery before resetting the attempt budget | [P1] Resume exhausted cleanup independently of recovery failures
  • reviewed 2026-09-21T05:16:02.237Z sha b621ff3 :: blocked before merge. :: [P2] Validate the complete scan before resetting recovery exhaustion | [P2] Preserve cleanup recovery when removal deletes the ownership marker
  • reviewed 2026-09-21T07:02:59.378Z sha 2cae4e5 :: blocked before merge. :: [P2] Retry exhausted discards before treating them as retained uploads
  • reviewed 2026-09-21T09:11:00.774Z sha 10563b0 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-01T21:16:38.677Z sha c0b8434 :: blocked before merge. :: none
  • reviewed 2026-10-01T21:37:29.432Z sha c0b8434 :: blocked before merge. :: none
  • reviewed 2026-10-01T22:06:57.188Z sha f0936f5 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 21, 2026
… 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.
@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Both P2 findings and the CI failure are addressed in 2cae4e530cc:

  1. Validate the complete scan before resetting recovery exhaustion — the resume probe no longer readdirs only the staging root. stagingRootScanUsable is replaced by stagingRecoveryScanCompletes, which runs the full readOwnedStagedUploads scan; an exhausted budget only unlatches after the complete scan succeeds, so a readable root with an unreadable numbered child keeps recovery latched and silent instead of re-arming the retry loop. Covered by a new fault-and-repair test (chmod 000 descendant under a readable root).

  2. Preserve cleanup recovery when removal deletes the ownership marker — recoverStagedUploads now re-probes removal for exhausted entries in cleanupAttemptCounts that the marker-gated scan no longer sees. Recorded directories are known-owned from an earlier verified scan, so a partially deleted remnant is reclaimed once permissions are repaired; arbitrary unmarked directories stay untouched (negative-control test included). Non-exhausted entries still rely on their pending retry timer.

  3. CI: checks-fast-baseline-ratchets — the new uncommented type assertion is gone with the probe rewrite, and the two pre-existing (error as NodeJS.ErrnoException) assertions now carry // SAFETY: invariants, so the per-file count drops below baseline.

Validation: node scripts/run-vitest.mjs on all three browser-proxy-upload test files (26 passed, including both new fault-and-repair cases through the real production entry points), pnpm tsgo:extensions, oxlint, oxfmt --check, and a local run of check-assertion-safety-ratchet.mts against the merge base (OK).

@clawsweeper

clawsweeper Bot commented Sep 21, 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 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 21, 2026
@Patrick-Erichsen Patrick-Erichsen self-assigned this Oct 1, 2026
@Patrick-Erichsen Patrick-Erichsen changed the title fix(browser): stop upload recovery retry loop blocking auto-update fix(browser): let idle upload retention survive node updates Oct 1, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Reviewed repair now published at c0b84345bf0f69c7e079867a2e4597f87e97f687.

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's tryPauseForUpdate():

Scenario Before Candidate
Healthy upload retained Update pause refused Pause admitted; file bytes intact
Recovery retry pending Pause refused Pause admitted
Ten ordinary recovery entries during EACCES 10 scans/warnings 1 scan/warning
Cleanup currently running Pause refused Pause refused
Browser starting, retained runtime, or stopping Pause refused Pause refused
Failed recursive deletion Marker lost, payload left Marker and payload retained
Fresh process after repaired/expired interrupted deletion Payload orphaned Payload reclaimed
Healthy retained upload after normal process exit/restart Bytes preserved, busy Same bytes preserved, idle
Invoke after accepted pause UNAVAILABLE response Same explicit UNAVAILABLE response

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

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 1, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

The repaired head c0b84345bf0f69c7e079867a2e4597f87e97f687 passed its selected code/test checks, but the CI fail-fast helper failed before running: its checkout used base ac638483c7803d8043990eb040d0385e9196f740, which does not contain scripts/ci-pr-fail-fast.mjs. Failed setup job.

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.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

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 as OpenClaw 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 logged Node 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.1 copy 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 regenerated dist/postinstall-content-inventory.json. Executable code and schema contracts were unchanged.

Real installed flow Observed result
Paired candidate node + Browser plugin + retained upload artifacts Both Browser commands advertised; retained bytes existed before startup.
Public node-command workload held open during candidate download/install/validation Updater logged ready; waiting for active work to finish; retained files stayed intact.
Workload released, normal idle admission and launcher handoff Updater logged restarting into 2026.10.1, then activated 2026.10.1.
Replacement process Supervisor PID 79157 persisted; node host PID changed 79161 → 79461; paired node ID and node identity --json were unchanged.
Retained-upload recovery Healthy file SHA-256 remained 97022d921ee95b5710582a91983da662a512b796273e91b39557c9575568ebaf; replacement startup reclaimed an upload made expired immediately before handoff.
Cleanup Scenario exited 0 in 119.35s; all tracked children joined; an independent PID audit found none remaining.

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-changelog with full declarations/UI build (7m47s), followed by passing tarball integrity validation (27s). Exact candidate tarball SHA-256: fa354be269a1bacd047a1c33c0b4e6810a0a44cf80cbdda81e0e33c05adac3a1. The actual published and candidate node-host-launcher.mjs files were byte-identical (SHA-256 b5e6a4c7f6ff08ef4ee4feb091054bada9577108edb3f0071870356ab3c28ab8).

Changed-test cost: node scripts/run-vitest.mjs run extensions/browser/src/browser-proxy-upload.active-work.test.ts --maxWorkers=1 --reporter=verbose passed 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/openclaw so 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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 1, 2026
@Patrick-Erichsen
Patrick-Erichsen merged commit c9a7893 into openclaw:main Oct 1, 2026
122 checks passed
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…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]>
@xialonglee
xialonglee deleted the fix/gap-browser-proxy-upload-retry-cap branch October 8, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: browser P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

2 participants