Repository navigation
fix: keep cold credential reads responsive on slow filesystems - #200192
Conversation
Prepare physical identity and inspection budgets asynchronously, preserve reader retirement and usage ordering, and let the read worker validate complete captured identity. Remove redundant host probes and already-known agent lookups. Cold 35 GiB synthetic read proof reduces a two-second injected event-loop stall to 8.8 ms; 78 focused cases pass.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes cold credential identity discovery and SQLite inspection-budget preparation asynchronous while preserving worker-side file validation. Example: A cold credential read encounters an injected 2,000 ms metadata delay.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it addresses a current main-thread blocking path using existing owners, and source review found no concrete introduced defect; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway authentication preparation resolves agent and shared credential stores, prepares physical file identities, and receives credential rows from isolated SQLite readers. flowchart TD
A[Gateway credential request] --> B[Auth profile read owner]
B --> C[Async agent and file identity discovery]
C --> D[Existing reader lifecycle]
D --> E[Isolated SQLite child]
E --> F[Validate identity and read credentials]
F --> B
Technical reviewBest possible solution: Keep asynchronous preparation in the existing auth and inspection owners, with physical identity validation in the isolated reader. Do we have a high-confidence way to reproduce the issue? Current main visibly performs synchronous identity and inspection-budget metadata probes on this path; the PR supplies matching fault-injection measurements, but this review ran no target code. Is this the best way to solve the issue? The diff follows the smallest complete repair: reuse async physical-fact preparation, remove redundant parent probes, migrate callers, and preserve existing lifecycle and usage-ordering owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f4fa17a710be. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +37, Tests +124, Other 0. Total +161 across 44 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 16, 2026, 1:10 PM ET / 18:10 UTC (Revision 2). |
|
|
The previous review has zero open items. Final head 2ed5539 integrates main for a newly added benchmark consumer and migrates its two setup lines to the existing async identity owner. Scripts types/lint and fresh Codex review pass. The separate benchmark watch-mock failure is reproduced on exact CI main parent and attributed to #197445 in the updated body; no passing smoke is claimed. Original production behavior and measurement are unchanged. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…200242) #200203 moved resolveIdentityPathViaExistingAncestor from src/infra/boundary-path.ts to src/infra/path-existence.ts. #200192, merged just before it, added a new import of that function from boundary-path.js in oauth-refresh-peers.ts, so main has failed to typecheck and bundle since 9e66164. Import it from path-existence.js, as #200203 did for the other callers.
…law#200192) * fix: keep cold credential reads responsive on slow filesystems Prepare physical identity and inspection budgets asynchronously, preserve reader retirement and usage ordering, and let the read worker validate complete captured identity. Remove redundant host probes and already-known agent lookups. Cold 35 GiB synthetic read proof reduces a two-second injected event-loop stall to 8.8 ms; 78 focused cases pass. * test: await async identity preparation in auth watch benchmark
…penclaw#200242) openclaw#200203 moved resolveIdentityPathViaExistingAncestor from src/infra/boundary-path.ts to src/infra/path-existence.ts. openclaw#200192, merged just before it, added a new import of that function from boundary-path.js in oauth-refresh-peers.ts, so main has failed to typecheck and bundle since 8ecc0fc. Import it from path-existence.js, as openclaw#200203 did for the other callers.
Backport 9323fb9 (#200192) and 3f33eb9 (#200222) as one credential-owner slice on the 2026.11.6 release base. Reuse native admission preparation without importing replacement execution or snapshot architecture. Preserve physical-alias FIFO reservations, capture shared ownership before awaiting preparation, and retain one-shot cancellation/deadline settlement. Co-authored-by: RomneyDa <[email protected]>
Recheck the canonical registry immediately before publication and retain extra descriptors until joined host or worker retirement. Parent independently reviewed native overlap, generation preservation, and both cleanup paths; 47 targeted tests passed. Follow-up to backports #200192 and #200222. Co-authored-by: RomneyDa <[email protected]>
Follow up the release adaptations of #200136 (59d9759), #200192 (9323fb9), and #200222 (3f33eb9). Preserve validated worker fields across asynchronous admission; restore required imports, await diagnostics, and normalize the nullable path adapter. Parent review complete. Doctor regression failed before the repair; 17 parent tests across Doctor and attachment boundaries pass afterward. Seven-file scoped typed lint, format and whitespace checks pass. Worker session-path suite: 9 passed. Full release qualification remains pending. Co-authored-by: RomneyDa <[email protected]>
Related: #200136
What Problem This Solves
Fixes: cold credential reads can block Gateway requests on synchronous database identity and inspection-budget filesystem probes before reaching the read worker.
User Impact
Credential reads remain responsive while filesystem metadata is slow. The existing worker still validates the complete captured file identity before opening the database and transferring credentials. Runtime retirement and same-root usage ordering remain enforced. No configuration, schema, durability, or dependency changes.
Why This Change Was Made
The Team 25c9790 incident on 2026-11-16 at 05:02 PST exposed a 1.97 s main-thread btrfs transaction wait in catalog lock creation and a 2,002 ms event-loop stall. #200136 deleted that redundant lock. This follow-up repairs the cold credential-read boundary uncovered by the same audit.
The existing async identity owner now prepares the reader's physical file facts; the existing SQLite worker owns complete key/birthtime validation. Redundant host probes and reverse lookups of already-known agent identities are deleted. All internal reader-factory callers await preparation. Unresolved agent discovery participates in the existing read-resource lifetime before yielding, so retirement cannot deliver credentials or admit fresh file/cache state. Usage requests reserve the existing preparation queue before async work, preserving ordering.
Inspection budget preparation also becomes async in the existing session and one-shot read owners. Captured runtime context and accepted-work settlement survive that await. Production grows by 37 lines across 22 modules: async discovery and resource lifetime replace duplicate checks. No new cache, queue, protocol, or authority owner.
Evidence
Final focused proof passes 78 tests across eight files, including actual credential reads, candidate stores, source checks, usage admission, and the broker consumer. Additional OAuth settlement/concurrency proof passes 22 cases. A real read-child regression rejects a wrong captured birthtime that the parent incorrectly accepted. Cold registry-retirement and post-retirement admission regressions fail before their repairs and pass afterward. Existing main-thread FS observation verifies the cold read flow.
The canonical check:changed entry point (
node scripts/check-changed.mjs --base HEAD) completed. Task-owned mock/type findings were repaired; final touched core/services/agents type graphs, lint, format, and diff checks pass. Structural SQLite worker, import, schema, and line gates passed. Unchanged dead exports reproduce on exact parent 6670297 and originate in 24385a2 / #200056: a confirmed main regression, not a baseline waiver. The whole check command is not claimed green.Three isolated Codex passes completed. One P2 was rejected after checking both production callers: usage admission occurs before entering the reservation owner, and its unconditional cleanup releases the reservation. The other passes had no findings; no accepted/actionable findings remain.
Twenty serialized fresh Node 26.12.1 processes exercised a real synthetic 37,641,338,880-byte database containing 5,000 session rows and one synthetic auth row. Each sample verifies returned credentials and disposal. Four identical-baseline controls, four zero-delay A/B pairs, and four A/B pairs with one injected 2,000 ms target metadata delay all completed. No Team data was used. The surrounding 62,000-file workspace is not scanned by this owner.
Candidate delayed heartbeat maximum across all four samples was 15.553 ms. A/A owner median was 4.288 ms, range 3.746–5.951; main CPU 1.876 ms. No-delay latency/CPU differences are within process spread. Allocation controls varied substantially, so the lower candidate allocation median is not claimed as an improvement. During the injected delay, the responsive candidate executes heartbeat/runtime timers for two seconds while baseline blocks them: its measured CPU/allocation includes that extra instrumentation work and does not isolate owner overhead.
These are APFS fault-injection measurements, not direct btrfs measurements. Each measured target has cold application identity/file-state/row-cache admission and an explicit known agent ID; a separate clone warms module/read-worker startup. OS page cache and unknown-directory discovery are not claimed cold. Parent CPU excludes the spawned SQLite child's CPU.
Two earlier native-staging cancellation cases exceeded their original 10 s deadlines. Exact-parent isolated replays passed; a diagnostic replay of the same three files passed 56/56 without changing barriers or deadlines. That does not establish their cause, a fix, or inheritance. Diagnostic-only edits are excluded, and the uncertainty remains for exact-head CI.
Diagnostic/legacy source reads, unknown-directory generic writes, source cohort comparison, and secrets activation/rollback remain separate audited boundaries. No global zero-sync claim. Changed modules have no runtime Control UI import; no Node import was added to a browser-facing module.
Initial CI 43921173131 found a missing consumer migration in the auth-watch benchmark added by #186370 after this lane's base. Main was integrated for this named type failure; fixture setup now awaits the async identity owner before its unchanged assertion. Scripts types, targeted lint/format, and fresh Codex review pass. No production change or compatibility alias was added.
The actual small benchmark smoke separately fails with zero intercepted watch callbacks instead of 64. That identical failure reproduces on exact CI main parent 4a74c61. #197445 / 36afa92 moved all directory watches into the existing child host, while this benchmark still intercepts the parent's fs.watch. This is a confirmed main benchmark regression for follow-up; the smoke is not claimed passing and an unrelated benchmark redesign is excluded.
Final-head CI 43924604188 succeeded on2ed553960fde3a48eb5206aecd8f5b8aacf388ad. Final ClawSweeper review6924641156 has zero open items; native review and preparation are complete. Landing is pending.