Repository navigation
perf(skills): reuse unchanged sandbox skill snapshots - #121379
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Gate reuse on the watcher-owned snapshot version and persisted entry manifest, while keeping safe paths process-owned and reconciling only changed skills. Cache config fingerprints by object identity and reset them at the applied-config lifecycle owner.
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 11:54 PM ET / August 10, 2026, 03:54 UTC. ClawSweeper reviewWhat this changesThe PR reuses a versioned sandbox-skill snapshot and cached config fingerprint so unchanged sandboxed agent turns avoid rediscovering and copying skill trees. Merge readiness✅ Ready for maintainer review No actionable correctness or security finding was identified. This maintainer-owned PR remains necessary for repeated sandbox setup performance; let exact-head CI complete before normal maintainer review. Priority: P2 Review scores
Verification
How this fits togetherA session snapshot describes the skills available to an agent turn. Sandbox setup materializes those skills into a read-only workspace tree before the embedded agent reads or invokes them. flowchart LR
A[Session skill snapshot] --> C[Sandbox setup]
B[Skills watcher version] --> C
C --> D[Manifest and cache check]
D -->|changed| E[Reconcile copied skills]
D -->|unchanged| F[Reuse materialized skills]
E --> G[Read-only sandbox skills]
F --> G
G --> H[Embedded agent turn]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +163, Tests +332, Generated 0. Total +495 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Land the versioned-manifest synchronization after the current-head CI gate is green, retaining its process-owned cache and read-only skill-mount boundary. Do we have a high-confidence way to reproduce the issue? Yes—current main visibly clears, rediscovers, and copies the sandbox skill tree for every synchronization; the PR's focused tests encode the unchanged-snapshot case. Is this the best way to solve the issue? Yes—the synchronization owner receives the watcher-owned snapshot and decides reuse from version, manifest identity, and process-owned paths, avoiding a duplicate cache layer at callers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 592bf90b079c. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
cb3b44a to
697e26c
Compare
|
Merged via squash.
|
Gate reuse on the watcher-owned snapshot version and persisted entry manifest, while keeping safe paths process-owned and reconciling only changed skills. Cache config fingerprints by object identity and reset them at the applied-config lifecycle owner.
What Problem This Solves
Sandboxed agent attempts rediscover every eligible skill, wipe the sandbox skill tree, and recursively copy the same files again on every turn even when the watched skill snapshot has not changed. The same hydration path also serializes, redacts, and hashes the whole config repeatedly to rediscover an unchanged fingerprint.
Why This Change Was Made
The watcher already owns the authoritative skill snapshot version, so sandbox synchronization now pairs that version with a small persisted entry-identity manifest. Safe destination and read paths remain process-owned, unchanged entries are retained, and version or identity changes trigger an incremental reconcile. Config fingerprints are memoized by config object identity in a WeakMap and reset only by the applied-config lifecycle owner, so source-only reload work cannot evict the active runtime's memo.
This is AI-assisted work. The final rebased diff was inspected, focused-tested, and passed the repository autoreview gate with no accepted or actionable findings.
User Impact
Repeated sandboxed turns reuse unchanged skill trees instead of rediscovering and recursively copying them. This lowers turn setup latency and filesystem churn without adding or changing configuration.
Evidence
node scripts/run-vitest.mjs src/skills/loading/workspace-sync.test.ts src/agents/sandbox.resolveSandboxContext.test.ts src/agents/embedded-agent-runner/run/attempt-setup.test.ts src/skills/runtime/snapshot-config-fingerprint.test.ts— 37 tests passed across four shards.node scripts/run-vitest.mjs src/gateway/server-reload-handlers.test.ts -t 'applies a current in-process hot config|refreshes owner refs when only the resolved source snapshot changes'— 2 passed, 208 unrelated tests filtered.git diff --check origin/main...HEAD— clean.tbx_01kzmrza9nsfj2fqjnabn2t01d, Actions run 31350660086 — green.tbx_01kzmsw3jc47yzzpbxfj5gbyt6, syncsync_67e828304b5d, Actions run 31351394396.The behavior comparison used baseline
8430fc0e3b864dee6840cf663d3724f5cbcc7076and pre-rebase headd7cdb2e60b7a1ed0e46d9e4c8f82bde4f2d122cfplus dirty diff SHA-256dcb28dc2f7ff2fceb1ad97c7a048534f1911e3d1f9d953bc21e954a60b876893; the lease stopped cleanly. Limitation: the performance run predates the final rebase. The source patch applied without conflict, the generated SDK baseline was regenerated against currentmain, and focused tests plus autoreview were rerun on the final head. Exact-head PR CI remains the authoritative landing gate.Production LOC is
+205/-42(net+163); tests are+333/-1; the generated SDK hash baseline is+3/-3. The positive production growth establishes the ownership/performance invariant: a process-owned safe-path cache and identity-only manifest make unchanged reuse possible, while version changes, entry changes, and interrupted copies still reconcile safely. The added tests cover reuse, tamper resistance, incremental add/remove, watcher refresh, interrupted copy recovery, sandbox snapshot plumbing, and config-apply invalidation.