Repository navigation
Conversation
Avoid repeated path resolution for unrelated sibling events while waiting for an absent watched directory. Retain recursive containment and native-watch recovery. Extend the existing callback benchmark and ancestor regression coverage.
|
🦞👀 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 prepares the expected child name once when watching an ancestor of a missing directory, avoiding repeated path resolution for unrelated events. Example: A watcher awaits /srv/openclaw/agents/work while state.sqlite-journal changes beside the missing agents directory.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this is a useful, focused performance improvement that current main does not provide; no introduced correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe shared directory observer receives native events through the directory-watch helper and delivers scoped invalidations to Git, skills, config, and other filesystem-fact consumers. flowchart LR
A[Filesystem events] --> B[Directory watch helper]
B --> C[Shared observation owner]
C --> D[Prepared ancestor child filter]
C --> E[Recursive containment filter]
D --> F[Consumer invalidations]
E --> F
Technical reviewBest possible solution: Retain the prepared attachment fact in the existing observer and preserve its recursive filtering and recovery contracts. Do we have a high-confidence way to reproduce the issue? The base callback visibly resolves paths for unrelated ancestor events, and the supplied regression reports 12,000 path.resolve calls before the change versus zero afterward; no target code was executed during this review. Is this the best way to solve the issue? This is the smallest complete approach: prepare the next child at attachment, compare names on nonrecursive ancestor events, and retain containment checks where recursive paths require them. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5fb231527f4f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +9, Tests +6, Docs +5, Other +52. Total +72 across 4 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. Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed November 17, 2026, 6:24 AM ET / 11:24 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Avoid repeated path resolution for unrelated sibling events while waiting for an absent watched directory. Retain recursive containment and native-watch recovery. Extend the existing callback benchmark and ancestor regression coverage.
What Problem This Solves
Background Git and skill watchers rebuild absolute paths for every unrelated sibling event while waiting for a missing directory. This creates avoidable CPU and allocation pressure even when none of their watched content changes. The direct-root optimization in #181760 already handles existing roots; this change addresses the remaining ancestor fallback.
User Impact
Lower background allocation and CPU use while watched directories are absent. Directory creation/replacement, native-watch recovery, and recursive subtree filtering retain their existing behavior. No configuration, schema, or dependency change.
Why This Change Was Made
The observation owner already selects a nonrecursive ancestor watch when a directory is missing. Prepare the next child name at attachment and compare native child names directly, preserving Windows case folding. Keep containment checks for recursive subtree routing. Workspace Git discovery subscribes to missing
.gitdirectories at every ancestor; planned skill roots and Gitreftablewatches also use this path.Production delta is +9 lines for the prepared attachment fact and platform comparison. No new cache or scan. The existing benchmark now supports the subprocess-era owner through a synthetic native adapter and can retain the missing subscriber during measurement.
Evidence
Five serial A1/A2/B samples, alternating order, on Node v26.12.1. The acceptance rule required B to beat both control medians for allocation, unprofiled CPU, and owner delivery time, with no >20% regression in comparable latency metrics.
Owner allocation fell at least 95.2%, CPU 97.5%, and owner delivery time 99.2%. Allocation ranges were A1 0.416–0.464, A2 0.418–0.457, B 0.014–0.030 MB/s. CPU ranges were A1 1,855–1,918, A2 1,841–2,376, B 42–69 ms. Paced event-loop p99 medians were 10.92 / 7.45 / 8.68 ms: B is 16.6% above A2 and below A1, within the recorded threshold, with overlapping ranges on a busy host. This is source-owner evidence, not a full-Gateway latency claim.
Allocation sampling includes collected objects: 17 batches of 65 events, 1,750 ms between batches (~37 events/s). CPU samples separately use 4,000 batches without pacing. The synthetic APFS fixture contains 62,000 files totaling 1.14 GB, 5,000 session artifacts, and a sparse 35 GiB size-only placeholder. The observer does not read these contents; this does not measure database I/O or btrfs performance. One A2 sample crossed the benchmark's hourly recovery boundary and was rejected by the exact-notification assertion; it was repeated outside that diagnosed boundary without changing code or thresholds.
Reproduction:
The extended ancestor regression is red on the baseline: 2,000 unrelated sibling events cause 12,000 path.resolve calls. Candidate makes zero and preserves creation/replacement assertions. All 11 owner tests and 76 consumer tests passed across workspace Git, branch caching, skills refresh, agent registry, and auth file state. The real-host missing-root/replacement test passed. One sibling native-host transport test timed out at 120 seconds in the initial combined run; its focused replay passed. That timeout is unclassified, not a claimed flake fix or inherited-CI waiver.
pnpm check:changedfound a separate main regression: unusedvalidateArtifactMetadataexport inscripts/lib/actions-artifact-archive.mjs. The exact parent c8d5cf5 reproduces that finding with Knip 6.40.0 and the repository script-export configuration. Commit 7b0beee (#199838) deleted its last external consumer infull-release-receipt-recovery.mjs. Typechecks, changed-file formatting and lint pass; no exception or ignore was added.Independent Codex autoreview of the final local change against c8d5cf5, P0–P2, completed scoped-clean with no findings. The committed patch is the reviewed implementation. No Control UI import of the changed owner was found.
Exact-head CI and final review
CI 44071220367 attempt 1 completed with one failed test shard:
checks-node-changed-2, ingateway-transcripts-discord-capture.e2e.test.ts/ “fences late Discord STT through the model-selected plugin instance”. The TCP-only socket fence at line 140 rejects native broker IPC asunexpected socket destination null:NaN; cleanup errors derive from that rejection. A clean checkout of exact parentc8d5cf52b417areproduces the same failure withnode scripts/run-vitest.mjs test/e2e/gateway-transcripts-discord-capture.e2e.test.ts --maxWorkers=1.The causal change is 907e17b9ff49 / #200320: model-catalog preparation now calls
createPluginCaptureOwner(src/agents/prepared-model-catalog-worker.pool.ts:75), which opens native IPC (src/process/spawn-broker/resource-client.ts:120). The test only admits loopback TCP to its provider and Gateway ports. Those owners and the test are unchanged between the exact parent, CI baseline5fb231527f4f, and tested merge47dda3f2e66c; this PR changes none of them. All other CI jobs passed or skipped, including security-fast. This is an attributed main regression, not a green CI claim.ClawSweeper final review reviewed exact head
0c25e1e056604with zero findings and zero open checklist items. Its optional request to establish the CI failure cause is answered above. Landing uses the explicitly authorized, pinned-head inherited-failure route with retained reproduction, source and checkout evidence.