Repository navigation
refactor(skills): prepare embedded library entries asynchronously - #148679
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. |
|
Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 10:33 AM ET / 14:33 UTC (Revision 11). ClawSweeper reviewWhat this changesPrepares saved skill Library entries asynchronously and publishes the combined workspace and Library cache only after preparation succeeds. Merge readiness✅ Ready for maintainer review The PR remains useful: current main and the latest release still contain the synchronous read and premature cache publication. The previous timing request is satisfied, and this review found no blocking defect. Priority: P2 Review scores
Verification
How this fits togetherSkill preparation combines workspace skills with revisions saved in a session’s Library selections. Embedded agents and CLI runners consume these entries when preparing their skill prompts. flowchart TD
A[Session skill selections] --> B[Capture pins and storage context]
B --> C[Prepare workspace skills]
C --> D[Read Library metadata in worker]
D --> E{Caller and sources current?}
E -->|Sources changed| C
E -->|Yes| F[Publish complete cached entries]
F --> G[Agent and CLI skill prompts]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +32, Tests +365, Docs +11. Total +408 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the existing worker-backed Library reader while preserving immutable selections, sandbox isolation, and complete cache publication. Do we have a high-confidence way to reproduce the issue? Yes, from source: an uncached load performs synchronous Library reads, and a Library failure leaves workspace-only entries cached on current main. This review did not execute that failure path. Is this the best way to solve the issue? Yes. The patch uses the existing asynchronous owner and moves publication after complete preparation without changing selection, schema, or configuration contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a3f9972a981e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
ae1c055 to
ebba6cd
Compare
c92562d to
edc38df
Compare
09d71c6 to
d21c12d
Compare
edc38df to
71e6005
Compare
b0682aa to
b2ca321
Compare
71e6005 to
9d8ab6e
Compare
Use the shared reader for pinned Library descriptions. Capture pin values and state admission before workspace preparation, publish complete entries only while the caller and source version remain current, and preserve the first completed cache publication. Prove cold reads, mutation during workspace waits, admission invalidation, concurrent publication, and embedded/CLI caller behavior. No schema, retention, durability, permission, configuration, or dependency change is introduced.
9d8ab6e to
7d4cd6e
Compare
|
Merged via squash.
|
…enclaw#148679) Use the shared reader for pinned Library descriptions. Capture pin values and state admission before workspace preparation, publish complete entries only while the caller and source version remain current, and preserve the first completed cache publication. Prove cold reads, mutation during workspace waits, admission invalidation, concurrent publication, and embedded/CLI caller behavior. No schema, retention, durability, permission, configuration, or dependency change is introduced.
What Problem This Solves
Rebuilding embedded or CLI skill entries reads pinned Library metadata synchronously on the Gateway thread and can publish a workspace-only cache before Library preparation succeeds.
User Impact
Skill entry preparation keeps pinned revisions, duplicate ordering, workspace filtering, and sandbox-only isolation while moving Library metadata reads to the shared reader worker. Failed or obsolete preparation cannot publish partial entries. No configuration or data migration is required.
Why This Change Was Made
The lazy Getter captures Library pin values and state admission before workspace preparation can yield, using the capture and preparation owners landed in #148560. It publishes combined entries only after both stages and current-owner checks finish. Workspace source changes retry the unfinished load; completed results stay stable, and concurrent loads retain the first complete publication.
The shared reader remains the owner of lifecycle, admission, error-phase, and retained cleanup; the carry preserves those current-main contracts. Workspace plugin discovery keeps its existing metadata path; this change does not claim that all skill discovery is SQL-free.
Evidence
The original qualified candidate
9d8ab6e19fa7fb134433360c0694d0617dbb45adpassed 225 selected tests, the full selected static gate, independent P0–P2 review, a normal build, and cold compiled Node/Bun proof. Its four fresh readers positively calibrated construction plus seven SQLite methods, then recorded zero through imports, Getter calls and close while preserving exact entries, duplicate order, lazy caching and workspace-only isolation. Those full build/runtime receipts remain pinned to that original candidate.The current carry
7d4cd6e8796bb658a7640fce3cabcc36b4f5c141is based on actual main7c7c148cac3f45dcdc6601f0bdfd72289ef57e6c. Its stable patch ID is identical to the original, and the Getter production file and both changed test files are byte-for-byte unchanged. The existing P2 review is reused for that unchanged patch. Fresh qualification passed 99 tests across seven files covering the Getter, Library resources, shared-reader cleanup, snapshot admission and session-snapshot preparation, plus production types and the affected state-logging/services test-type graphs. Formatting and diff checks also passed.The previous public-head CI run failed in Discord pacing. Actual main now includes
761725d03f294aaddc399a759a0755d34a0e1ecf, which fixes premature fixture readiness by waiting for encoded audio consumption. The controlled regression proves that premature-readiness defect; it does not establish the cause of the historical hosted pacing failure. This carry includes the landed repair and preserves current main's Shared/Flow/Projection and snapshot owners; the old CI run was not retried. The current carry has not been rebuilt or rerun through the compiled harness, and the older runtime proof is not presented as fresh current-main qualification.Exact-head CI run 35607177457 passed. Native landing remains pending. No visual UI change, new configuration, schema, durability, retention, permission or dependency change is introduced by this Getter patch.
Changed-test cost
Measured once per changed file on
7d4cd6e8796bb658a7640fce3cabcc36b4f5c141withpnpm test <file> --maxWorkers=1:src/skills/runtime/embedded-run-entries.test.tssrc/skills/runtime/embedded-run-entries.library-read.test.tsThese are separate fresh test-process invocations on the previously qualified checkout with existing dependencies and compiler artifacts, not clean-cache benchmarks. The first invocation reported a compiler-cache hit and 34.398 seconds of preparation; its Vitest time was 91% transformation. The second reported 86% transformation. Command wall includes wrapper preparation and teardown; source hashing is excluded. All 47,655 tracked-source fingerprints, HEAD and tree matched before and after both runs.
The long wall time is dominated by preparation/transformation, while the reported test cases took less than five seconds per file. The real-reader file exercises state-root capture, admission invalidation and actual worker-backed revision loading that mocked publication tests cannot establish.
Timing from successful CI run 35607177457 at
7d4cd6e8796bb658a7640fce3cabcc36b4f5c141:src/skills/runtime/embedded-run-entries.test.tssrc/skills/runtime/embedded-run-entries.library-read.test.tsCI does not report isolated per-file elapsed time. Case-time sums exclude transformation, imports and setup. The unit shard spans 214 files (212 passed, two skipped); the reader shard spans 54 passed files. Job times include setup, multiple shard plans and cleanup; their Node test steps took 467 s and 577 s respectively. These values are separate from the local single-file, single-worker wall measurements.