Repository navigation
perf(skills): coalesce passive refresh off the Gateway thread - #170341
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
04c69f4 to
266dca3
Compare
|
Codex review: needs changes before merge. What this changesThis PR replaces local skill watchers with one background discovery worker, periodic passive scans, and immediate refresh after explicit actions. Example: Edit ~/workspace/skills/guide/SKILL.md with automatic refresh enabled.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the maintainer-approved worker cutover is useful, but the previously reported pending-reader eviction defect still blocks merge. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherSkill discovery combines bundled, plugin, managed, personal, and workspace files into entries and prompt snapshots consumed by agent preparation and Gateway status requests. flowchart TD
A[Skill files] --> B[Discovery worker]
C[Minute timer] --> B
D[Explicit skill actions] --> B
B --> E[Discovery owner]
E --> F[Agent snapshots]
E --> G[Gateway status and events]
Technical reviewBest possible solution: Keep the single discovery owner, retain active readers through result delivery, and trim completed source residency afterward. Do we have a high-confidence way to reproduce the issue? Source establishes failure when 129 distinct preparation requests are admitted before discovery settles; this read-only review performed no runtime reproduction. Is this the best way to solve the issue? The approved worker cutover simplifies discovery ownership, but cache residency must not decide whether an active reader receives its result. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f2b90298e053. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
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 (4 earlier review cycles)
Reviewed October 12, 2026, 9:36 PM ET / October 13, 2026, 01:36 UTC (Revision 5). |
ab6f9f1 to
ce682dd
Compare
ce682dd to
7d48354
Compare
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
The inherited failure is the Telegram durable-ingress coalescing job: its first album case timed out at 120 seconds, then cleanup hooks cascaded until the one-hour job limit. The same first timeout reproduced on unchanged main All 148 other successful jobs include build, types, lint and security. All 75 sibling test files in the touched skill directories, Gateway refresh E2E, and export/closure/CI-plan guards passed. |
…aw#170341) * perf(skills): coalesce passive refresh off the Gateway thread * fix(skills): preserve discovery worker environment and fixtures * test(skills): migrate remaining watcher lifecycle proof * test(skills): await remote probe start without polling
Configuration publications refresh skills because skills can depend on arbitrary config paths. Reuse the published model-list cache when the existing catalog facts still match, while rebuilding commands and other skill-dependent metadata. Model, auth, plugin, catalog and owner changes keep their existing invalidation and read-authority boundaries. Fixes the repeated projection work exposed by 877301a (#170341): scheduled main run 38339144048 rebuilt model lists after each of six UI preference writes. The prepared-model regression also reproduced the unnecessary second projection before this change. Preserve the original integration assertion and verify that skills-dependent commands refresh alongside retained model projections. Validation: prepared-model regression fails before the repair and passes after (2/2 tests; 257.74s on the loaded host). Targeted lint, formatting and diff checks pass. Independent Codex review completed with no actionable findings. The full Gateway freshness integration remains assigned to canonical CI.
Configuration publications refresh skills because skills can depend on arbitrary config paths. Reuse the published model-list cache when the existing catalog facts still match, while rebuilding commands and other skill-dependent metadata. Model, auth, plugin, catalog and owner changes keep their existing invalidation and read-authority boundaries. Fixes the repeated projection work exposed by 044ae43 (openclaw#170341): scheduled main run 38339144048 rebuilt model lists after each of six UI preference writes. The prepared-model regression also reproduced the unnecessary second projection before this change. Preserve the original integration assertion and verify that skills-dependent commands refresh alongside retained model projections. Validation: prepared-model regression fails before the repair and passes after (2/2 tests; 257.74s on the loaded host). Targeted lint, formatting and diff checks pass. Independent Codex review completed with no actionable findings. The full Gateway freshness integration remains assigned to canonical CI.
* improve: simplify workspace and memory plugin messages * test(reef): match stored-key generation diagnostic * fix(webchat): stage offloaded images for file tools (openclaw#168537) fix(webchat): stage offloaded WebChat images into the managed workspace WebChat images above the inline threshold reached vision input but were not handed to managed workspace staging, so file tools couldn't find them. Offloaded WebChat images now expose their media-store path for staging, path-less transcript images hydrate from the staged sandbox copy, and images already staged are not staged again. Vision still receives exactly one image. Proof: built Gateway chat.send with a 3,147,780-byte PNG: on main the image reached vision but exec found no staged file; on the candidate exec finds the staged PNG. A 378-byte inline image works the same on both. A live gpt-5-mini turn also found the staged image through exec. Thanks @synthalorian. Co-authored-by: Ayaan Zaidi <[email protected]> * fix(gateway): retain model lists across skills refreshes Configuration publications refresh skills because skills can depend on arbitrary config paths. Reuse the published model-list cache when the existing catalog facts still match, while rebuilding commands and other skill-dependent metadata. Model, auth, plugin, catalog and owner changes keep their existing invalidation and read-authority boundaries. Fixes the repeated projection work exposed by 044ae43 (openclaw#170341): scheduled main run 38339144048 rebuilt model lists after each of six UI preference writes. The prepared-model regression also reproduced the unnecessary second projection before this change. Preserve the original integration assertion and verify that skills-dependent commands refresh alongside retained model projections. Validation: prepared-model regression fails before the repair and passes after (2/2 tests; 257.74s on the loaded host). Targeted lint, formatting and diff checks pass. Independent Codex review completed with no actionable findings. The full Gateway freshness integration remains assigned to canonical CI. * test(gateway): resolve auth-policy session targets in workers The synchronous fixture lookup could create a database after a Gateway worker captured its absence, triggering the physical identity guard and closing admission before the initial turn. Use existing read-only worker discovery for both fixture targets, matching neighboring authority tests. Preserve all retained and revoked grant, final-write, and transcript assertions. No production guard or authorization behavior changes. * fix(plugins): retain inspected config for decision diagnostics Plugin inspection resolved the explicitly supplied config, then discarded it while projecting decision providers and consulted the runtime snapshot instead. Cold inspection could fail with an unprepared runtime config; a prepared but different runtime could also report the wrong configured model. Carry the resolved config through the existing inspection context. Cover single and all-plugin inspection with different explicit and ambient models. Plugin loading, decision execution, and lifecycle ownership are unchanged. Original ambient-config lookup: 0a54fc6 (openclaw#152237), exposed by 5dbf215 (openclaw#169714). Scheduled main 38334375513 repeats nine trust-diagnostics failures. Focused proof: loader.trust-diagnostics 11/11 and status 9/9 passed. The two new cases take 29ms and 15ms; loaded-host wrapper wall 1794.74s is dominated by worker build and module transforms. Independent review found no actionable defects. * fix: allow test builds in containers without systemd (openclaw#170640) --------- Co-authored-by: synth <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
* improve: simplify gateway, protocol, and security diagnostics * fix(webchat): stage offloaded images for file tools (openclaw#168537) fix(webchat): stage offloaded WebChat images into the managed workspace WebChat images above the inline threshold reached vision input but were not handed to managed workspace staging, so file tools couldn't find them. Offloaded WebChat images now expose their media-store path for staging, path-less transcript images hydrate from the staged sandbox copy, and images already staged are not staged again. Vision still receives exactly one image. Proof: built Gateway chat.send with a 3,147,780-byte PNG: on main the image reached vision but exec found no staged file; on the candidate exec finds the staged PNG. A 378-byte inline image works the same on both. A live gpt-5-mini turn also found the staged image through exec. Thanks @synthalorian. Co-authored-by: Ayaan Zaidi <[email protected]> * fix(gateway): retain model lists across skills refreshes Configuration publications refresh skills because skills can depend on arbitrary config paths. Reuse the published model-list cache when the existing catalog facts still match, while rebuilding commands and other skill-dependent metadata. Model, auth, plugin, catalog and owner changes keep their existing invalidation and read-authority boundaries. Fixes the repeated projection work exposed by 044ae43 (openclaw#170341): scheduled main run 38339144048 rebuilt model lists after each of six UI preference writes. The prepared-model regression also reproduced the unnecessary second projection before this change. Preserve the original integration assertion and verify that skills-dependent commands refresh alongside retained model projections. Validation: prepared-model regression fails before the repair and passes after (2/2 tests; 257.74s on the loaded host). Targeted lint, formatting and diff checks pass. Independent Codex review completed with no actionable findings. The full Gateway freshness integration remains assigned to canonical CI. * test(gateway): resolve auth-policy session targets in workers The synchronous fixture lookup could create a database after a Gateway worker captured its absence, triggering the physical identity guard and closing admission before the initial turn. Use existing read-only worker discovery for both fixture targets, matching neighboring authority tests. Preserve all retained and revoked grant, final-write, and transcript assertions. No production guard or authorization behavior changes. * fix(plugins): retain inspected config for decision diagnostics Plugin inspection resolved the explicitly supplied config, then discarded it while projecting decision providers and consulted the runtime snapshot instead. Cold inspection could fail with an unprepared runtime config; a prepared but different runtime could also report the wrong configured model. Carry the resolved config through the existing inspection context. Cover single and all-plugin inspection with different explicit and ambient models. Plugin loading, decision execution, and lifecycle ownership are unchanged. Original ambient-config lookup: 0a54fc6 (openclaw#152237), exposed by 5dbf215 (openclaw#169714). Scheduled main 38334375513 repeats nine trust-diagnostics failures. Focused proof: loader.trust-diagnostics 11/11 and status 9/9 passed. The two new cases take 29ms and 15ms; loaded-host wrapper wall 1794.74s is dominated by worker build and module transforms. Independent review found no actionable defects. * fix: allow test builds in containers without systemd (openclaw#170640) --------- Co-authored-by: synth <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
* improve: simplify agent, exec, and automation messages * fix(webchat): stage offloaded images for file tools (openclaw#168537) fix(webchat): stage offloaded WebChat images into the managed workspace WebChat images above the inline threshold reached vision input but were not handed to managed workspace staging, so file tools couldn't find them. Offloaded WebChat images now expose their media-store path for staging, path-less transcript images hydrate from the staged sandbox copy, and images already staged are not staged again. Vision still receives exactly one image. Proof: built Gateway chat.send with a 3,147,780-byte PNG: on main the image reached vision but exec found no staged file; on the candidate exec finds the staged PNG. A 378-byte inline image works the same on both. A live gpt-5-mini turn also found the staged image through exec. Thanks @synthalorian. Co-authored-by: Ayaan Zaidi <[email protected]> * fix(gateway): retain model lists across skills refreshes Configuration publications refresh skills because skills can depend on arbitrary config paths. Reuse the published model-list cache when the existing catalog facts still match, while rebuilding commands and other skill-dependent metadata. Model, auth, plugin, catalog and owner changes keep their existing invalidation and read-authority boundaries. Fixes the repeated projection work exposed by 044ae43 (openclaw#170341): scheduled main run 38339144048 rebuilt model lists after each of six UI preference writes. The prepared-model regression also reproduced the unnecessary second projection before this change. Preserve the original integration assertion and verify that skills-dependent commands refresh alongside retained model projections. Validation: prepared-model regression fails before the repair and passes after (2/2 tests; 257.74s on the loaded host). Targeted lint, formatting and diff checks pass. Independent Codex review completed with no actionable findings. The full Gateway freshness integration remains assigned to canonical CI. * test(gateway): resolve auth-policy session targets in workers The synchronous fixture lookup could create a database after a Gateway worker captured its absence, triggering the physical identity guard and closing admission before the initial turn. Use existing read-only worker discovery for both fixture targets, matching neighboring authority tests. Preserve all retained and revoked grant, final-write, and transcript assertions. No production guard or authorization behavior changes. * fix(plugins): retain inspected config for decision diagnostics Plugin inspection resolved the explicitly supplied config, then discarded it while projecting decision providers and consulted the runtime snapshot instead. Cold inspection could fail with an unprepared runtime config; a prepared but different runtime could also report the wrong configured model. Carry the resolved config through the existing inspection context. Cover single and all-plugin inspection with different explicit and ambient models. Plugin loading, decision execution, and lifecycle ownership are unchanged. Original ambient-config lookup: 0a54fc6 (openclaw#152237), exposed by 5dbf215 (openclaw#169714). Scheduled main 38334375513 repeats nine trust-diagnostics failures. Focused proof: loader.trust-diagnostics 11/11 and status 9/9 passed. The two new cases take 29ms and 15ms; loaded-host wrapper wall 1794.74s is dominated by worker build and module transforms. Independent review found no actionable defects. * fix: allow test builds in containers without systemd (openclaw#170640) --------- Co-authored-by: synth <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Skill discovery should not route passive filesystem events through the Gateway thread. This is the explicitly requested single-worker design: coalesce passive discovery to about once per minute while explicit actions stay immediate. The independent repeat is performance-neutral within observed noise; this change is justified by its ownership simplification and removal of per-event machinery, not a claim of repeatable main-thread speedup.
User Impact
Passive on-disk edits may take up to about one minute to appear. Explicit skill install/update/remove, Workshop changes, configuration changes, and Gateway startup await an immediate worker refresh.
skills.load.watch=falsedisables only passive automatic rescans. Existing configurations withskills.load.watchDebounceMsare normalized by Doctor; that obsolete knob is removed.Why This Change Was Made
Passive skill watching routes unrelated filesystem activity through Gateway-thread work. This candidate replaced the local watcher registry, per-event classification and stability waits with one background discovery worker and a coalesced 60-second scan. Explicit skill actions, configuration changes and startup await immediate refresh;
skills.load.watch=falsedisables passive refresh. Guarded identity/alias checks remain in the scan owner, and snapshots publish atomically. Documentation and dependent tests were updated. Production LOC delta with the requested exclusions: +1102 / -2665 = -1563.Evidence
Measurements
Synthetic workload on an isolated Linux sandbox: 500 turns, 500 updates, 2,000 history reads, 500 probe rounds, four subscriptions and 20 excluded warmup turns per fresh process. Main
1bfbdceca349; candidate production source treee4c12e3c8f1f. Later headab6f9f1f8dedchanges only tests/routing metadata. Sources, builds, runtime, affinity and common harness were pinned and verified before/after.The initial mean depended on a slow main control: 152.319 versus 127.702 CPU seconds. That run did less logical work and had higher scheduler wait; it was retained, not discarded. The repeat was 128.780 → 128.432 CPU seconds, 152.480 → 153.120 FIFO seconds, and 140/237 → 141/244.5 ms queue p50/p95. Total process CPU rose 0.5% in the repeat. The native watcher thread's CPU did fall by about 70%, but that did not translate into a repeatable Gateway-thread or queue improvement.
All twelve workload proofs and trace validations passed. Every candidate run recorded at least two actual scans, all off-main at approximately 60-second intervals. Queue values average per-run quantiles. This five-times workload is not directly comparable in absolute duration to earlier lane reports.
Earlier-head validation
The branch was rebased onto current main at
335d12304b01; all three commits remained patch-identical according togit range-diff. The superseded watcher machinery stays deleted. The three focused files (discovery.integration,refresh.workspace, andremote) passed 53 tests in 87.62 seconds wall time. Changed-file formatting passed; repository lint completed without diagnostics. Fresh isolated independent review found no actionable P0–P2 issues. Exact-head PR CI run 38325587933 completed with all build, type, lint, security and own-scope behavior gates passing; inherited failures are recorded below. No Testbox/Crabbox leases are used for normal validation.The retained behavior tests cover explicit additions/edits/removals before refresh resolves, passive edits at the minute boundary, shared worker ownership,
watch=false, workspace replacement/missing-root recovery, per-source environment isolation, and immediate Gateway RPC refresh.Exact-head CI completed: 146 successful jobs, 19 skipped jobs, three directly failing test jobs, one cancelled test job, and the failed aggregate. All 75 skill sibling files passed. The managed-worktree Gateway refresh E2E passed (35.111 seconds test time, 68.11 seconds shard wall time), as did the export collision guard, eager-import closure (17 cases), PR wrapper source closure (3 cases), and matching CI plan tests. Independent review is clean at P0–P2.
The earlier head qualified for the authorized inherited-failure exception, preserving its red result. Baseline qualification used unchanged main
335d12304b01; the relevant inputs match the actual tested main parenta8f00d61f689:600versus500font assertion (35.30 seconds). The desktop canvas timeout did not recur in the filtered replay or full 12-case file (45.63 seconds); the entire UI tree and mocked Gateway fixtures are byte-identical between the main parent and tested merge. This timing failure remains unreproduced, not a claimed fix.No CI rerun or push-for-green was used. The superseded pre-rebase run was cancelled automatically. Normal validation used no Testbox/Crabbox lease and no standalone local application build, typecheck lane or test suite.
Subsequent conflict and test synchronization repair
Main advanced during the landing checks. Rebased again onto
31f23a54ecaa; the only conflict was the generated config documentation hash, regenerated throughpnpm config:docs:gen. The lane’s production changes remained patch-identical. The focused rerun passed the discovery/publication cases and exposed one-second polling deadlines in two existing remote-probe tests on the saturated host. Both now await explicit start signals from their existing mocks; all final coalescing, generation and published-bin assertions remain intact. The remote file passes all 36 tests (51.16 seconds wall), and the test-only repair has an independent clean P0–P2 review. Final head11e7abb9fb80completed CI; its final qualification follows, and the earlier run above remains historical evidence.Final-head validation and landing qualification
CI run 38332340589, attempt 1, tested
11e7abb9fb80in merge1329f21385ffwith main parent8e0d08ad52a0. It completed with 148 successful jobs, 18 skipped jobs, one cancelled test job and the failed aggregate. Build, all typechecks, lint, security, all 75 sibling test files in the touched skill directories, the actual Gateway skill-refresh E2E, export collision guard, eager-import and PR-wrapper closure tests, and matching CI-plan tests passed. The two independent reviews are clean at P0–P2. The final remote file passed all 36 cases (11.95 seconds of reported CI test time; 51.16 seconds local command wall time), and the Gateway refresh E2E file passed in 38.322 seconds of CI test time.The sole remaining root is Telegram ingress coalescing. Its first failing album case has the same 120,000 ms timeout reproduced on unchanged main
335d12304b01; subsequent cleanup hooks cascade until the recorded one-hour job limit. That test, its fixture, dispatch owner, runtime-config owner, runtime setup and channel tree are byte-identical in the reproduction, actual tested main parent and tested merge. The focused baseline also exposes an unprepared-runtime-config rejection; the cancelled CI run does not print its final unhandled-error summary, so the same error message is not claimed from CI. This qualifies the inherited-only exception; CI is not represented as green. Earlier Teams, QA-child and mocked-UI failures are no longer red on this final head. No job was rerun or branch update made solely for green.