Skip to content

fix: reduce Gateway stalls under filesystem pressure - #197510

Merged
steipete merged 65 commits into
mainfrom
steipete/fix-session-reader-async-locator
Nov 15, 2026
Merged

steipete merged 65 commits into
mainfrom
steipete/fix-session-reader-async-locator

Conversation

@steipete

@steipete steipete commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Synchronous filesystem calls in Gateway requests and timers turn host I/O stalls into Gateway-wide pauses. This change deletes redundant polling, carries prepared facts forward, and moves necessary I/O through existing async/worker owners. Physical replacement checks, mutual exclusion, FIFO, current authority and accepted-work settlement remain enforced. No configuration option or lane-owned SQLite schema change is added.

Published head: d22df936d67764d6ec6cb1e1c6c015651f8d853f, tree f0aae30ce01407014503685feb023c519df107be, direct descendant of bbf464. The only successor change is two browser-test lines: use one keystroke for same-draft undo/redo instead of depending on 19 keystrokes landing within CodeMirror's 500 ms history group. Every route, focus, composition and draft-ownership assertion remains. The original exact-main case passed locally (4.982 seconds, NONREPRO); the repaired case passes in 3.351 seconds. Independent Codex review completed one pass with zero findings; pnpm check:changed --base bbf4643d968cd5dc005da8647e9b222ff4e2147e passes in 209.977 seconds. Production bytes and net LOC are unchanged. The single maintainer-authorized failed-job rerun is complete on this exact head. Attempt 2 remains failed with independently qualified inherited failures; the original WebKit and subagent cases passed. ClawSweeper reviewed this exact head with zero open items and zero findings. Native landing uses the documented inherited-failure exception; no all-green CI claim is made.

Current landing state

Merged through native scripts/pr at 2c4413a6abbfeb4ac23cd07b775a105586548af1 on 2026-11-15 14:47:14Z. The exact attempted head was d22df; the verified landed parent was 636454ee16af5d125bfe3c680e66bbcf371efe75. RomneyDa’s co-author credit is present in the squash commit. The sole plain failed-job rerun, attempt 2 of CI 43716051582, completed with 150 successful, 23 skipped and six failed jobs (five test leaves plus the aggregate). The original WebKit animation case passed in 39.530 seconds, matching its independent Linux x64 main non-reproduction; it is recorded as hosted-intermittent under the maintainer decision. The subagent case passed in 2.751 seconds; its original exact-parent failure remains inherited evidence, without a causal-fix claim. The five remaining leaves are archived RPC, Models refresh, scheduled reset, older-history readiness, and the independently qualified whole-shard UI budget failure below. Security-fast passed, and final-head ClawSweeper remains zero-open. No further retry was submitted or authorized.

Retained attempt-1 evidence: Exact-head CI 43716051582, attempt 1, finished with 150 successful, 23 skipped and six failed jobs (five test leaves plus the aggregate). Its actual tested merge is b2d1b3f025c6622c7b237c875ee4020a9bc087c0, with ordered parents 81ca4f4d712a67c012c7dc0311e0fa37ac576490 and d22df936d67764d6ec6cb1e1c6c015651f8d853f. The final ClawSweeper report has zero unchecked items, zero findings, high confidence on d22df. Native scripts/pr review validation and preparation completed for this head; the native admin-evidence route completed and its landing-parent audit matched.

Failed case Exact-parent evidence and disposition
Archived-session RPC error shape Original fails on actual main 81ca in 61.610 seconds. Added retryable: false came from 6f8b9fa083f6 / #199575, leaving an old exact-object assertion. Newly identified main regression.
Models account refresh Original fails on actual main 81ca in 33.198 seconds. Retained attribution: 28c26865b241 / #137092 and 1c576b0a0fa0 / #142766.
Scheduled command after reset Original fails on actual main 81ca in 54.638 seconds. 3bbf67501123 / #199512 deliberately changed reset survival without updating this refusal assertion. Newly identified main regression.
WebKit older-history readiness Scheduled main CI 43714039580 checked out exact 81ca and failed the identical original case: 190 expected, 30 received, prefix space present. The single-wheel setup was introduced by 3588c0514ac8 / #198710; a2892e8cd710 / #199181 named the assertion fields. This is a main regression; the underlying missed-input mechanism remains unresolved.
Subagent terminal event Inherited from main, explicitly accepted by the maintainer. The unchanged original fails on exact CI main parent 81ca4f4d712a67c012c7dc0311e0fa37ac576490 in 36.845 seconds (one failed case, zero unhandled errors). Later passing diagnostic and current-main replays do not erase that independent reproduction. No causal fix or introducing-commit claim is made. Temporary diagnostics were removed.
WebKit animation retention CI loses its browser context at newPage() before the assertion. Exact-parent original passes on Mac and Linux ARM64. Independent scheduled-main run 43718942643, exact 07ed3bfd1927e1410e36aa47cbc1fa4664cdd9d2, passes the original case in 39.408 seconds on Linux x64/Node 24.22.1. The maintainer classified this as hosted intermittent and authorized exactly one plain failed-job rerun at d22df. Attempt 2 passes the original case in 39.530 seconds; the closure did not recur. No causal source fix is claimed.

The two original UI cases passed together on exact main 81ca on Mac (32.441 seconds) and Linux ARM64 (32.828 seconds; history 7.746 seconds, animation 6.504 seconds), with unchanged source and clean browser/process joins. These passes remain NONREPRO; Linux ARM64/Node 26 differs from CI x64/Node 24. The independent exact-main native CI failure establishes history's baseline evidence; it does not clear the unrelated animation failure. Both reset and subagent cases in the combined leaf now have accepted inherited-main evidence. The sole plain failed-job rerun was submitted through the supported protected CLI and confirmed as attempt 2 at exact d22df. The earlier debug request was refused before dispatch and executed no retry. The WebKit case passed; terminal attempt-2 failure accounting now controls native exact-head admission. The failure classifier itself timed out, so the qualification uses inspected exact-parent logs and source instead of claiming a hosted classification table. No further retry is authorized.

Newly observed inherited CI budget failure

Attempt-2 UI3 completed 157 modules / 596 cases, all passing, then the whole Test Control UI end-to-end action hit its 20-minute deadline as the final file began. Exact main parent 81ca UI2 independently completed 157 modules / 626 cases, all passing, before the same aggregate deadline. These are different partitions under the same unchanged budget owner, not the same individual test failure. Independent main UI3 completed the matching 158-module partition in 1,147.137 seconds.

The full workflow, budget, sequencing/weighting inputs and final test files are byte-identical between 81ca and tested merge b2d1. The 20-minute step deadline was introduced by 8d50df8c2698; hosted PR-retry routing came from #120997. This is an inherited CI budget defect that needs its own repair, not noise. No timeout increase, assertion change or extra retry was made. No claim that every timing difference is caused by host load; the timed-out shard is still failed.

Models attribution also preserves scope: the failed test and 18 catalog/publication/handler inputs are unchanged. Three inspected auth/retention modules do change; their diffs are retained in the native evidence. The original exact-81ca replay independently produces the same stale-account assertion without those changes; there is no blanket whole-path equivalence claim.

Evidence

Measured result and limits

On packaged source 097dad72, a synthetic Linux/btrfs fixture with a 35 GiB agent DB, about 5,000 sessions and 62,000 workspace files measured 39,322 → 62 selected main-thread filesystem syscalls per 60 seconds (99.84% reduction). The sole fully covered baseline and five fully covered candidate windows completed the workload; intercepted main-thread synchronous filesystem APIs changed 14,157 in 60.048 seconds → 0 in each candidate window. The workload completed 35 turns and 70 provider requests.

All 62 remaining calls are Node's native /proc/self/stat RSS opens: real main-thread I/O outside the API spy. Cold paths outside the workload and retained artifact-cleanup source/identity guards are not proven clear. Worker I/O is outside these totals. The original VM with 8 GiB RAM, accumulated state and A/A controls remain pinned; subsequent owner fixes and larger build-VM resources are not relabeled measurements. Unaffected owner measurements are reused, with affected correctness/work-count proofs rerun. No final-tree CPU/allocation equivalence, all-runtime-zero or outage-immunity claim is made.

Adverse costs, A/A controls and measurement limitations

Moving work off the main thread increases some total costs. These adverse results are retained:

Actual 097 owner workload Before → after / paired change
CPU sampler, five A1/B/A2 timing and allocation triplets Process CPU 11.944/12.140 → 116.300 µs/sample; main CPU 9.969/10.132 → 66.227 µs; sampled main allocation 3.41/3.48 → 11.88 KB. Paired process CPU +871.70%, allocation +244.61%. At the existing active schedule, B projects 6.978 ms process CPU and 0.713 MB sampled allocation/minute; this is arithmetic, not a measured minute.
Four-file warm bootstrap, small/large fixtures Main synchronous API calls 44 → 0/turn. Total CPU +163.29%/+246.74%, median latency +76.82%/+179.74%, total V8 heap allocation +331.44%/+1465.52%. B rereads 16 KiB/2 MiB per turn after removal of the content cache.
Source-mode bootstrap cold start About 3–5 ms → 903/942 ms, including construction/import of two actual workers. One cold main-thread realpathSync resolves the TypeScript loader; ordinary packaged worker URLs do not take that branch. This is not a packaged Gateway startup measurement.
Other retained owner costs Cold skills wall 1,048 → 1,446 ms, CPU 1,074 → 1,297 ms; detached transcript +0.54–0.65 ms and +41–43 KB sampled allocation/read; three-artifact cleanup wall 6.578 → 246.209 ms and isolate allocation 1.008 → 118.113 MB.

All 94 CPU/bootstrap rows completed with their A/A controls. CPU controls drifted only about 0.7–2%; the owner increases are not dismissed as noise. Main allocation sampling, exact cross-isolate V8 allocation and OS-returned bytes are different measurements, not interchangeable totals.

Untraced Gateway B versus A2 showed main CPU +3.76%, process CPU +4.09%, main allocation −4.08%, median turn latency +6.49%, p95 −35.13% and process-tree RSS +11.10%. However, original A/A already drifted +25.51%/+30.86% in main/process CPU, and incoming schema/build changes, request bytes, cumulative state and a VM reboot differ. No causal whole-Gateway CPU, allocation or latency improvement is claimed. Auxiliary RSS observers exited 137 without completion markers, with final sampling gaps of 2.036/1.441 seconds; complete RSS coverage is not claimed. Kernel/API coverage and primary completion remain qualified.

Final behavior and owner proof

  • Filesystem owners: lock maintenance, session/agent-DB admission, skills/workspace preparation and credential reads consume owner-held facts or existing invalidation. Necessary physical identity/descriptor work runs asynchronously or in workers. Competing-process tests prove lock exclusion. The sandbox execution contract's optional preparation callback is additive; inspected bundled consumers migrate with it.
  • Cold Talk: RomneyDa's reentrancy repair lets an already-admitted foreground writer finish during cold discovery while excluding worker-held reservations. Its original pre-fix 120-second deadlock witness and passing repair are retained. Both contributor commits remain in ancestry.
  • Released processes: the owner retains immediate custody and asynchronous birth observation, prevents overlapping reaps and distinguishes proven live, gone and unavailable identity. Unknown observation cannot authorize signaling or successful exit confirmation. On 3b005, Linux 14 passes, including uncertain-stop/retry and strict-process consumers. Twelve actual five-second callbacks with 16 survivors change 192→0 synchronous filesystem API entries and 192→0 native-identity entries. This is a one-minute cadence equivalent, not kernel syscalls/minute or an elapsed-minute benchmark, and the categories are not an additive 384-syscall census. Four earlier setup failures remain setup-only. Incoming main 918 one-shot-handoff semantics are qualified by four Mac and four Linux cases: explicit handoff may report a survivor with unavailable fresh identity, without signaling it or asserting death. Later descendants and detached macOS daemon custody remain explicitly accepted upstream limits, not repairs claimed here.
  • Goal replacement: the original Gateway case fails on 1373 and passes on exact main 5370661. Payload depth missed already-accepted but preparing controller input, admitting stale automatic work. The repair uses the existing controller queued-work fact under existing owner/source contexts; the completing input excludes itself while other accepted work stays visible. Original Gateway case, 84 unit cases and 10 consumer cases pass—three invocations, not 95 necessarily unique cases.
  • Worker admission: carry access-check priority through the session read, target and sharing owners into the existing reserved worker lane. Preserve native transaction authority and worker cleanup settlement. The 25 owner cases pass; the affected actual Gateway replay passes on unchanged c3df source before the final snapshot syntax correction.
  • Provider retention: the projection now preserves open versus restrictive plugin allowlists. The original held-rebuild lifecycle case fails before the two-line repair and passes afterward, removing an excluded provider immediately while discovery remains pending and retaining unchanged providers.
  • UI fixture: Details closes through its existing action under the native Send-tooltip precondition. The controlled pair and final uninstrumented original case pass. The controlled red was intercepted Expand, not the historical CI composer-count assertion; Mac ARM/Node 26 also differs from Linux x64/Node 24. Historical CI causality remains unproven.

The retained 48de 978-path census has 975 exact matches to previously qualified reviewed blobs or the retained mechanical resolution, plus three source-qualified incoming compositions: host-hooks documentation, wrapper registrations and lint-suppression entries. Both directions of those independent compositions match their recorded inputs; they are not fresh native whole-file reviews. The chain retains the 22-pass full review, incremental reviews, separate five-path Goal/UI repair and final 12-target/33-context integration review. The successor main 932 integration adds the separately completed 22-target, two-pass review and focused Node/UI/static checks; the old census is not relabeled as an independent final-tree census. The main 71fe successor has a separate two-pass/13-target/39-context clean review. Task-authority regression proof is red → nine passing cases → two passing cases after simplification. The CI anchor fixture reproduces red and all ten cases pass with the exact entry filter. The reviewed helper extraction passes all 27 publication cases, zero unhandled errors; the final alpha-only lint/format/diff check passes in 7.916 seconds. The complete earlier check:changed failure is not relabeled green; new-main Knip failure attribution is 032227/#199338. The incoming main 8f successor adds six completed native review passes with zero findings. Its actual Gateway case passes (66.837 seconds native test, zero unhandled errors, Chromium exit 0), with nine earlier UI cases retained only through their unchanged-input bridge. This runtime was on c3df, before the final set-snapshot Array.from rewrite; its later bytes have targeted static proof, not a relabeled runtime replay. The next main 6c57 integration adds two clean native review passes and seven passing owner cases. The actual Mac logger performs zero synchronous calls under its guard; the Linux interrupt branch remains for CI. This is targeted correctness/work-count proof, not a new main-thread measurement campaign. The service-file cap grew from 991 to 994 lines on exact main 6c57 and fails there too (1.657 seconds), introduced by 04615c68/#199572: a main regression, not a future-CI waiver. Incoming #199571 fixes the earlier unused-media Knip failure. The full scoped check finished with 36 passing and two failing stages (473.697 seconds): inherited service cap and the subsequently repaired private-helper default-argument ordering. The final targeted check passes in 8.996 seconds; the earlier full check is not relabeled green. Original failed runs stay recorded.

Data compatibility

The completed compatibility response identifies the actual tested 4b4f6e8 Linux package: 404 declarations, tar SHA256 2620da53afd542eccd2a16157b137f89ca8eb8e952219e01b6f35b36fce8e03e. Fresh five assertions, stable 2026.11.3 upgrade, 49 phases and historical Projects startup, 35 phases pass with zero overlays and exact 18,464-file installed identity. Two healthy starts/clean stops and six snapshots preserve two sessions, four transcript rows, timestamps, project/worktree rows and four sentinels; only existing nullable-GC normalization and Doctor's expected workspace field differ. All 40 raw files/receipts were hash-verified. This proves backup custody/preservation, not that a specific deleted archive exercised multi-member gzip.

The 1373 bridge binds 51 retained inputs and 20 changed owner/test pins, with 27 startup/cut/handoff consumers and four UI cases. Newly reachable owners are separately audited; 51 pins are not claimed as the entire closure. The five-path Goal/UI bridge preserves those inputs; original roles execute no Goal turns, whose changed behavior has separate proof. The e6d7 bridge preserves all 51 prior inputs and repaired Goal pins; of 20 preceding startup/rewind pins, only the separately qualified telemetry classifier changes. Ten existing workspace/CAS/catalog/worker-inheritance/privacy cases pass (47.808 seconds, 37 unselected, zero unhandled errors). The separately executed final Linux four-case selection is now green. The actual artifact remains 4b4f; no new package or full Doctor rerun is claimed.

The retained f7ed compatibility bridge verifies all 114 previously referenced source paths against its actual 48de parent. Seven affected Node owner cases pass (six in the original selection, then the omitted anchor case separately), including emitted service-anchor execution and the incoming 16 MiB worker nursery contract. Eight UI cases pass (six initially, then two E2E cases after correcting a zero-selection pattern). The selector setup failures remain recorded. This binds the unchanged actual package proof and newly changed owners to f7ed without relabeling the package; these remain their actual source scopes. The successor’s two affected UI cases pass on maintained source-server routes; this is not production-bundle proof. The retained 78f010 compatibility bridge verifies all 127 prior pins and the changed-owner proofs, including 27 publication cases, without relabeling the original artifact. The 78f010 review coverage accounts for its 981 PR paths: 974 retained qualified paths and seven freshly reviewed targets, with the final alpha rename mechanically verified.

All 156 retained Doctor inputs are unchanged. The completed compatibility bridge binds actual commit bbf4643d968cd5dc005da8647e9b222ff4e2147e and its changed-owner proofs; the actual 4b4f artifact is preserved without a new execution claim.

CI and review gates

Retained completed product CI is run 43693443686, attempt 1, for 1373b51. Tested merge 7a553f3 has actual main parent 5370661. Result: 148 successful, 8 failed, 23 skipped jobs; seven leaves contain ten cases, plus the aggregate failure.

Cases Disposition for that exact run/parent
UI ownership inventory 1 Reproduced on exact main; introducer 1d1d2b5f/#199102.
Models 1 Reproduced on exact main; 28c26865/#137092 and 1c576b0a/#142766.
Talk 4 Reproduced on exact main; bf0b8002/#198100 and cee0906f/#163379.
Goal 1 Candidate regression; repaired locally as above. The failed CI run stays failed.
WebKit older-history 1; question-footer 1; worker-overload count 1 Original replays pass; causes remain unresolved. The footer fixture repair does not establish its historical CI cause. No inherited waiver.

Generic-controller source-after/dependency-continuity limits remain with their receipts. Exact-parent reproductions and introducing commits qualify inherited-red consideration, not automatic waivers for a different successor parent.

The f7ed CI run 43701288121 completed with 152 successful, 23 skipped and four failed jobs (three test leaves plus the aggregate). Its anchor ten-case failure is repaired locally. Models 1 and Talk 4 reproduce on its actual main 550 parent with causal receipts; these qualifications do not transfer automatically to a successor parent.

The ClawSweeper report cleared exact 78f010a with zero open items and no findings, explicitly resolving the prior P1 allowlist defect. Original held-rebuild red 19.068 seconds → green 38.119 seconds remains valid for the unchanged repair; clearance is historical for the successor.

The 78f010 CI run 43705392494, attempt 1, completed with 153 successful, 23 skipped and three failed jobs. Two test leaves contain Talk 4 and Models 1; the third failure is the aggregate. Every failed case reproduces on actual tested main 369 with introducing commits and continuity evidence. The repaired anchor leaf and UI pass. Context-heading successor run 43706509622 passes exact 78f010. These inherited-red qualifications and hosted clearance do not transfer automatically to the next head. Normal push, local proof and the actual-commit Doctor bridge are complete. The bbf CI run 43711285142 completed with 151 successful, 23 skipped and five failed jobs (four test leaves plus the aggregate). Six Node cases reproduce on its exact actual-main parent b09: Talk4 (74.015 seconds), Models1 (71.106 seconds), and scheduled reset (38.565 seconds), all with zero unhandled errors. The reset mismatch is a newly observed main regression from 3bbf67501123/#199512: production now follows the conversation across reset while this assertion still requires refusal. Talk introducers remain bf0b800/#198100 and cee0906/#163379; Models introducers remain 28c2686/#137092 and 1c576b0/#142766. These failures are not noise and do not automatically qualify a successor main parent. The fourth leaf is the browser history case addressed by d22df; its passing original local replay was not labeled inherited.

The exact-bbf ClawSweeper report has no code findings but one unchecked confidence item, following a historical-prefetch limit (5,206 requested blobs; 5,000 fetched). The final-head response supplies bounded comparisons and complete local review accounting; it is not a waiver. The final d22df review has cleared zero-open; the terminal CI dispositions above now control landing. No blanket inherited waiver is claimed.

Retained failed-run history and limits
Earlier evidence Preserved outcome; no transfer to final head
bf740 CI 43663138872 149 success/7 failure/23 skipped. ACP/startup repairs were proved separately. x64 lint OOM and geometry cause remain unresolved; ARM passes are not x64 proof. Lower-memory-policy candidate was rejected and never included.
c4e59 CI 43670254370 139 success/2 failure/23 skipped/15 cancelled. Benchmark-await repair and exact-parent auth-wording attribution are separate; cancellation is not passing proof.
6e711 CI 43672309057 147/9/23. Exact 669 inherited rows stay parent-bound. Workspace FIFO, cleanup and announcement repairs have separate local proof; font diagnostics do not establish original CI causality.
4b4f CI 43679646675 151/5/23. Exact 37d Models/Talk reproduced; WebKit/restart/auth remained NONREPRO.
Review/coverage history Full reviews and incremental dispositions retain their actual trees. Earlier local cap/type/export/lint failures remain failed; affected repairs were checked separately. Exact-eb1 33-cap/four-SDK attribution stays parent-bound. CLI 13-pass/1-native-JIT-trap plus unchanged single-case replay remains NONREPRO, trigger unknown.
Compatibility history Earlier artifact identities, capacity/network/capsule setup failures and the DTS-build OOM with no artifact remain recorded. Setup failure is not a product verdict; guarded retries do not erase it.

Size and credit

Final landed-parent accounting is +8,838 production / +10,534 full lane, including 15 merged prerequisites (+1,696). The squash versus its actual parent 636454e has 16,989 production additions and 8,151 deletions across 503 paths; all nets were cross-checked against literal blob line counts. Tests/helpers are +13,636 across 425 paths, other/tooling +4,898 across 56 paths. The production total matches the earlier integration census. Net≤0 remains unmet. The provider projection repair retains its two production lines preserving eligibility semantics. Earlier main overlap (−8 production/−29 tests) is not a new lane absorption.

Applied absorptions remove 65 production lines, with a separate four-line Git-listener correctness deletion. Goal repair adds 14 production lines because accepted-work visibility needs the existing owner/source scopes: removing them self-blocks completion or misses preparing input. Remaining growth carries physical identity/custody, FIFO, live authority and settlement; moving these contracts to another wrapper would relocate them, while cached absence would need invalidation/polling. No irreducibility claim is made, and adverse costs remain explicit.

The GitHub profile-directory component uses independent random bytes, not credential-derived naming. Thanks @RomneyDa; preserve Co-authored-by: RomneyDa <[email protected]>.

@clawsweeper

clawsweeper Bot commented Nov 12, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T12:02:15.424771Z bbf4643 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: M labels Nov 12, 2026
@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 Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Moves Gateway filesystem preparation and recurring inspections into asynchronous operations and existing workers while preserving ordering and cleanup ownership.

Example: The reported Linux/btrfs workload used a 35 GiB agent database, about 5,000 sessions, and 62,000 workspace files.

  • Before: The measured baseline performed 39,322 selected main-thread filesystem syscalls per minute.
  • After: Candidate source 097dad7 performed 62; this measurement is explicitly pinned to that earlier source.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, supported by shipped-entry-point and upgrade evidence, with no new actionable finding in the inspected scope; exact-head CI remains pending.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Supplied evidence exercises packaged Gateway filesystem behavior on 097dad7 and fresh/stable-upgrade/startup flows on 4b4f6e8, with later changed-owner qualifications; the reviewed successor changes only a browser test and does not relabel those earlier executions.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Slow host filesystem operations can pause unrelated Gateway requests and timers.
Reason: The measured reduction addresses the stated responsiveness problem, and the maintainer-authored PR explicitly records the adverse resource costs and remaining coverage limits.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR addresses a concrete Gateway responsiveness problem that remains on main. The inspected repairs and test-only successor introduce no identified blocker; current-head CI is still running.

Priority: P2
Reviewed head: d22df936d67764d6ec6cb1e1c6c015651f8d853f

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway requests and timers prepare session, workspace, credential, and process facts; existing workers perform necessary I/O and return results to the owning runtime.

flowchart LR
  A[Gateway requests and timers] --> B[Runtime owners]
  B --> C[Async preparation]
  C --> D[Existing workers]
  D --> E[Filesystem and databases]
  D --> F[Results and settlement]
  F --> B
Loading

Technical review

Best possible solution:

Keep necessary filesystem work with existing asynchronous owners while retaining physical identity, FIFO ordering, and accepted-work settlement.

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

Fetched main contains synchronous filesystem operations in affected Gateway paths, and the supplied packaged workload quantifies their removal on its pinned candidate; no target code was executed during this review.

Is this the best way to solve the issue?

The inspected changes follow the existing-owner approach: remove redundant work, carry prepared facts, and move required I/O while preserving native authority and settlement contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 81ca4f4d712a.

Provenance checked

  • SQLite admission and committed publication keeps the original intent (da67a08: Keep committed facts recoverable and avoid replaying acknowledged mutations when publication fails, as documented in fix(storage): preserve committed facts when publication fails #167570.)
  • Session discovery reuse changes intended behavior with a stated reason (f0c671e: Reuse immutable discovery results while preserving physical replacement, registry invalidation, and scoped authority checks.)
  • Adopted-process identity uncertainty keeps the original intent (36b62fc: Keep live commands tracked when identity inspection fails and refuse unverified destructive signaling.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

PR surface statistics unavailable: the file list is incomplete.

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Reduces Gateway-wide exposure to filesystem stalls without evidence requiring emergency prioritization.
  • merge-risk: 🚨 compatibility: The plugin-visible sandbox execution contract gains optional asynchronous preparation; the owner-authored documentation and bundled consumers describe and implement the additive contract.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-11-12T12:57:40.364Z sha 2935560 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-12T13:47:08.224Z sha 6a551d0 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-12T14:34:40.622Z sha f9680e4 :: blocked before merge. :: none
  • reviewed 2026-11-15T08:23:20.137Z sha 1373b51 :: blocked before merge. :: none
  • reviewed 2026-11-15T08:49:50.596Z sha 1373b51 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-15T10:05:26.272Z sha f7ed312 :: needs changes before merge. :: [P1] [P1] Preserve open-versus-restricted plugin allowlist semantics
  • reviewed 2026-11-15T10:51:45.876Z sha 78f010a :: needs maintainer review before merge. :: none
  • reviewed 2026-11-15T12:07:43.366Z sha bbf4643 :: blocked before merge. :: none

Reviewed November 15, 2026, 8:01 AM ET / 13:01 UTC (Revision 12).

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: XL and removed size: M labels Nov 12, 2026
@steipete steipete changed the title fix(sessions): resolve reader locators off the main thread fix: move session path checks off the Gateway thread Nov 12, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The previous hosted review has zero open checklist items. The existing PR now contains the coherent runtime-owner successor at 27738873cb6783b4eadb61179c59813bce0fe8d1, with its body rewritten around the final scope and measured tradeoffs.

  1. Original physical custody now reaches the existing native effect owner (physical validation). The documented legacy guard still performs the original candidate identity check (guard); an actual same-path/new-inode replacement is refused by all three authority paths.
  2. Measurement probes are now count-only (watcher probe boundary). Earlier instrumented results remain qualified; separate corrected A/A controls and meaningful CPU/allocation costs are disclosed in the body.
  3. Local Codex review covered the full foundation and final successors. The current-main reconciliation passes production types, 20 affected attempt tests, 14 prefix tests, and the exact 400+2,273 test budget. The broad reply-spy failure from separately attributed admission/maintenance work remains explicitly recorded; no whole-runtime-zero claim or inherited-failure exemption is asserted. Final integrated Gateway proof and exact-head CI remain pending.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: d22df936d67764d6ec6cb1e1c6c015651f8d853f
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/auth-profiles/authorization-enrollment-runtime.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/candidate-stores.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/file-state.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/inline-usage.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/persisted-rows-receipt.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/runtime-snapshots.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/shared-store-bootstrap-async.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/sqlite-read.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/sqlite.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store-update-commit.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store-update.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store-updater.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/types.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/upsert-with-lock.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/usage-write.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/auth-profiles/write-execution.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/agents/sandbox/backend-handle.types.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/backend.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/browser.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/container-engine.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/container-keyring-recovery.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/context.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/dependency-template.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/docker-backend.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • 24 additional sensitive files; see the workflow summary.

Carefully review these changes before merging.

@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. labels Nov 12, 2026
@jalehman

Copy link
Copy Markdown
Contributor

Post-merge A/B RSS soak

I ran a counterbalanced A/B memory soak of the merge commit against its parent. Whole-process RSS rose by +24 MiB (+0.85%), which is within run-to-run noise. Worker-thread heap rose by +62 MiB (+6.7%), from two to three additional live workers. RSS growth rate did not increase.

Setup

  • Base 636454ee16af5d125bfe3c680e66bbcf371efe75 (landed parent) vs candidate 2c4413a6abbfeb4ac23cd07b775a105586548af1 (this PR's squash). Both were built from scratch in the same container.
  • Crabbox local-container lease cbx_a7b462e372e1 on a Mac Studio host, Linux container, 8 CPUs / 24 GB, image node:24.22.1-trixie (sha256:f1e034976f948cf212ef1f659c12e5dd58ac7eab947831813e81a62401ca38be), Node 24.22.1.
  • scripts/perf/team-shape-stress.ts --mode timing --minutes 20 --pairs 2 --aa-pairs 1 --worktree-tool-churn. Default fixture: 10,800 sessions, 128 MiB of transcripts, 65 clients, 40 plugins, mock-provider turns with real tool calls and subagents.
  • Runs went AB, then an A/A control, then BA. Each arm used a fresh fixture, a 1-minute warmup and a 20-minute window. The campaign exited 0.

End-of-window comparison (mean of 2 pairs)

Metric Base Candidate Δ
Process RSS 2,851 MiB 2,875 MiB +24 MiB (+0.85%)
Main heap 553 MiB 549 MiB −0.7%
Old gen after GC 403 MiB 403 MiB ~0
Worker heap (complete census) 918 MiB 980 MiB +62 MiB (+6.7%)
Live workers 35 37–38 +2–3

The A/A control (base vs base) differed by −7.6 MiB in RSS. End RSS across the three base runs spanned 2,782–2,866 MiB (84 MiB), so the +24 MiB RSS delta is not distinguishable from noise.

Worker heap attribution (mean of the pairs)

  • fs-safe-copy.worker.js: 0 → 2 workers, +35 MiB. This is the new shared runFsSafeFilesystemTask pool (maxWorkers: 2, idleTimeoutMs: 30_000), which stayed warm under continuous load.
  • git-operation.worker.js: 2 → 3 workers, +37 MiB.
  • session-transcript.worker.js: 7 → 6.5 workers, −21 MiB.
  • All other worker scripts changed by less than ±6 MiB.

Growth over the 20-minute window (least-squares slope of the per-minute RSS samples)

  • Base: +26.3 and +27.4 MiB/min. Candidate: +20.1 and +22.9 MiB/min. A/A control: +24.3 and +22.4 MiB/min.
  • Every arm, including the A/A control, grows at a similar rate, so this comes from the workload filling its fixture rather than from this change. Main-heap slopes were 1–3 MiB/min in all arms.

In the same runs, sessions.list p99 was 70.0 → 58.1 ms (−17%) and event-loop p99.9 was 57.5 → 52.1 ms (−9%).

Limits

  • Two pairs and 20-minute windows measure growth rate over a short window, not long-term stability.
  • Worker heap is JS heap per isolate, not each worker's share of native RSS.
  • The extra pool workers are idle-timeout bounded. On a less busy Gateway they would retire between bursts.

RomneyDa added a commit that referenced this pull request Nov 17, 2026
Allow initial guest PR preparation from the recorded project's published
history while preserving unpublished work and original PR identity.

(cherry picked from commit 2757947)

Stable adaptation: preserve the existing linked-identity fixture; expand
its options type and allocate exactly 89 regression LF instead of 84.
Production and documentation patches are unchanged from the source.

Companions: #188785 is present-equivalent. Later #188784, #190223,
#190576, #190542, #195413, #197229, #197243, #199717, #195787,
#197510, #193664, #199851, #199864, #197656, #198851, #193873,
#197594, #189006, #188904, #194025, #196200, #192283, #189010,
#188816 and e0466ff are not prerequisites to this scoped repair;
retain their separate intake dispositions. No later PR-number mentions.

Proof: baseline 4 failed/20 passed through registered agent action;
fixed 41/41 across preparation, refresh and base-action suites.
Type-aware lint4, formatting5, docs MDX1419 and diff check pass.
No live GitHub or full release qualification claim.

Co-authored-by: RomneyDa <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 17, 2026
The jump brought upstream growth into seven files whose fork additions
already sat near the cap, so full lint at a71cde4 had seven errors
neither 51ff02d nor 9122a49 has. Each fork addition moves into
its existing owner (no disables):

- status-text.ts: the continuation line's resolution joins its formatter
  in status-continuation-line.ts.
- system-events.ts: managed-delivery's restore takes the wake pool, and
  a consumed copy keeps its pool through managedDelivery.keepPool.
- user-turn-transcript.ts: the delivery-ack replacement guard moves into
  user-turn-transcript.delivery-acks.ts, and the input-run stamp's state
  into user-turn-transcript-input-run.ts, which reads sentToProvider from
  the admission owner.
- config/sessions/types.ts: continuation's session-entry fields and the
  post-compaction delegate type move to session-entry-continuation.types.ts.
- memory-core manager-database-context.ts: writeReindexFailure delegates
  to publishMemoryReindexFailure in manager-reindex-failure.ts.
- telegram-ingress-drain.test.ts: the fork's two cancelled-turn cases and
  their mocks move to telegram-ingress-drain.cancelled-turn.test.ts.
- session.test.ts: drop the createDeferred import; the fork moved its last
  user to session.continuation-reset.test.ts and upstream's openclaw#197510 stopped
  using it in the it.each case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
mcaxtr added a commit that referenced this pull request Nov 18, 2026
Keep provider config and secret retirement checks at admission and settlement.
The transport guard continues to enforce consumer consent and caller authority,
and shares the terminal consumer outcome with provider checks across cleanup
and retries. Preserve caller and consumer cancellation, retain authority errors,
and count each rejection once. Record consumer cancellation on the pending
request so an earlier provider/deadline abort cannot hide it; enforce the
request deadline before dispatch.

Update the inherited item-conflict assertion to the current recovery message.
Remove the parent-fs.watch fixture test superseded by main's helper-process
watcher migration (#197510); retain fixture cleanup and owner lifecycle tests.

Allocate 971 excess test lines for distinct group consent, CLI/room-event,
queue, transcript, conversation-evidence, and reply-path contracts. The net
test change is 1371 lines, including the standard 400-line allowance.

Validation: 202 affected tests passed on Blacksmith (one existing Bun skip).
After the final admission repair, all 105 Decision runtime and inference tests
passed again, along with core typecheck, targeted lint, and the line budget.
The retry regression failed before the repair with three forbidden dispatches;
caller and consumer cancellation each failed with one forbidden dispatch.
Deadline dispatch and consumer closure after earlier aborts also failed before
their owner-level repair.
The separate workspace-pause failure also occurs on scheduled main and remains
outside this repair. No full tests or build were run locally.

Final autoreview of 3449604 through the staged repair found no actionable
P0-P2 defects after the verified findings were repaired.
steipete added a commit that referenced this pull request Nov 18, 2026
Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies #197510 as the first failing first-chat authorization boundary; #199565 had repaired other cold-registration orderings.

The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 97b03f7 and attributed to #200533, #198455, and #200817. Preserve peer cleanup scope in #201019.
steipete added a commit that referenced this pull request Nov 18, 2026
…200966)

* perf(agents): materialize selected rows for simple completions

* style: satisfy selected completion lint checks

* test: bind isolated registry measurement to concrete instances

* test: align participant custody with requester ownership

Follow #200952: Alice owns sessions she requests even when Bob supplies execution authority. Preserve autonomous agent ownership expectations. All 174 spawn-boundary, child-custody, and provenance tests pass; Codex scoped review is clean.

* fix: retain missing-session facts across database creation

Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies #197510 as the first failing first-chat authorization boundary; #199565 had repaired other cold-registration orderings.

The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 97b03f7 and attributed to #200533, #198455, and #200817. Preserve peer cleanup scope in #201019.
mcaxtr added a commit that referenced this pull request Nov 18, 2026
Keep provider config and secret retirement checks at admission and settlement.
The transport guard continues to enforce consumer consent and caller authority,
and shares the terminal consumer outcome with provider checks across cleanup
and retries. Preserve caller and consumer cancellation, retain authority errors,
and count each rejection once. Record consumer cancellation on the pending
request so an earlier provider/deadline abort cannot hide it; enforce the
request deadline before dispatch.

Update the inherited item-conflict assertion to the current recovery message.
Remove the parent-fs.watch fixture test superseded by main's helper-process
watcher migration (#197510); retain fixture cleanup and owner lifecycle tests.

Allocate 971 excess test lines for distinct group consent, CLI/room-event,
queue, transcript, conversation-evidence, and reply-path contracts. The net
test change is 1371 lines, including the standard 400-line allowance.

Validation: 202 affected tests passed on Blacksmith (one existing Bun skip).
After the final admission repair, all 105 Decision runtime and inference tests
passed again, along with core typecheck, targeted lint, and the line budget.
The retry regression failed before the repair with three forbidden dispatches;
caller and consumer cancellation each failed with one forbidden dispatch.
Deadline dispatch and consumer closure after earlier aborts also failed before
their owner-level repair.
The separate workspace-pause failure also occurs on scheduled main and remains
outside this repair. No full tests or build were run locally.

Final autoreview of 3449604 through the staged repair found no actionable
P0-P2 defects after the verified findings were repaired.
RomneyDa pushed a commit that referenced this pull request Nov 18, 2026
Select the admission-bound read access, native owner capture, heartbeat lifecycle, and async FIFO/descriptor dependency chain from main PR #197510. Replace the release-only ambient read-access implementation. Preserve existing bounded pre-dispatch contention retry and extra-descriptor retirement contracts.

Backport-of: 2c4413a

Co-authored-by: RomneyDa <[email protected]>

Co-authored-by: vincentkoc <[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 app: web-ui App: web-ui channel: mattermost Channel integration: mattermost cli CLI command changes commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: codex extensions: memory-core Extension: memory-core gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: migrate-hermes proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts security-sensitive-changed size: accepted-large Maintainer-accepted large change; exempts ClawSweeper size closure, not review or CI. size: XL 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.

4 participants