Repository navigation
fix: reject incomplete Skill Workshop directory reads - #138082
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 10:41 AM ET / 14:41 UTC. ClawSweeper reviewWhat this changesThe PR makes Skill Workshop reject unreadable or over-depth directory trees and prevents legacy collection backups from restoring omitted deep content. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 5 items remain Keep this protected, maintainer-labeled PR open. Current main and the latest release still lack the completeness checks, and the introduced repair addresses the prior deleted-subtree blocker without a concrete new correctness finding; a maintainer must accept the legacy-backup compatibility trade-off and verify the walker dependency contract before merge. Priority: P1 Review scores
Verification
How this fits togetherSkill Workshop reads skill directories to prepare proposals, evaluator inputs, and collection backups. Those directory snapshots determine whether an evaluation can be recorded and whether a restore may replace workspace skill files. flowchart LR
A[Skill directories] --> B[Directory reader]
B --> C[Completeness validation]
C --> D[Proposal evaluation]
C --> E[Backup manifest validation]
D --> F[Recorded evaluation]
E --> G[Workspace restore]
G --> H[Skill files]
Decision needed
Why: This PR changes the upgrade behavior of existing backup data: it trades automatic restore for protection against resurrecting unverified deep content. Before merge
Agent review detailsSecurityNone. PR surfaceSource +26, Tests +237, Docs +40. Total +303 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the fail-closed owner-boundary repair after explicitly accepting manual recovery for affected legacy backups and confirming the fs-safe walker contract used by current main. Do we have a high-confidence way to reproduce the issue? Unclear: current-main source has the incomplete-walk shape, but this review could not independently inspect the external walker implementation needed to prove the precise depth and failed-directory behavior. Is this the best way to solve the issue? Unclear: the repair is at the correct reader and restore owners and covers the earlier deleted-subtree gap, but maintainers must approve the legacy-backup compatibility policy and verify the walker contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 523221e3767f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
f54e789 to
76789df
Compare
76789df to
8d5b9d8
Compare
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Failing on incomplete traversal is the correct integrity boundary. Scanning one level beyond the documented depth to detect hidden content, while treating only a missing create root as empty, avoids silently hashing partial trees.
|
Merged via squash.
|
…9-prep * commit '407a8f453c0f0306af1ddc0aafa8697c1d49a9e7': (312 commits) perf(ui): coalesce automation event refreshes (#138065) fix: reject incomplete Skill Workshop directory reads (#138082) test(ui): decouple rendering checks from generated wording (#138283) perf: avoid temporary entries in bounded JSON traversal (#138017) fix(irc): render complete messages before splitting (#138328) perf: prepare worker trajectory payloads only for recorded events (#138086) fix(mcp): paginated listings no longer time out after a forward clock step (#137206) fix(codex): page native transcripts and bound UI previews (#136282) feat(gateway): apply more settings without restarting (#138112) fix(docs): preserve mirrored ClawHub maturity links (#138241) fix(test): own UI animation and legacy database setup (#138296) fix(tts): preserve literal directives in Markdown code (#138319) fix: load chat widgets behind authenticated gateways (#138074) chore(ui): cover native approval finalization (#137259) fix(cron): cancel conditions before main-session handoff (#138313) fix(backup): preserve text after embedded NUL characters (#138327) fix(android): align composer control sheets (#137442) fix(ci): wait for replacement PR runs instead of stale failures (#138307) fix(sessions): keep Gateway responsive with long transcripts (#138094) fix(computer): map window inputs to delivered image coordinates (#138271) ... # Conflicts: # scripts/release-check.ts # test/release-check.test.ts
* fix: reject incomplete Skill Workshop directory reads * docs: explain manual recovery for older skill backups * test: preserve legacy deep-tree backups on refused restore * test: use immutable restore fixture ordering * fix(skills): verify retained originals before collection restore
Skill Workshop directory drafts and evaluator bundles could silently omit unreadable or over-depth content and still produce a successful proposal or tree hash. Both existing readers now reject incomplete traversal, preserve an absent create target as empty, and exclude root metadata before descent. Collection restore also verifies the saved original of each retained result before accepting an old result digest. Safe reads, sorting, encoding, file validation and evaluation revision checks remain intact.
Production is +26 lines, tests +237 and docs +40. The growth adds the missing completeness boundaries after removing the catch-all existence probe and redundant post-walk filtering. The draft and evaluator readers retain their distinct text, executable-file, binary and missing-target contracts. The restore check reuses the existing bounded reader inside manifest validation. No schema, hash-format or configuration changes are introduced, and no memory or speed improvement is claimed.
The original reader repair has an eleven-case real-filesystem reproduction and regression failures against the old readers; 65 focused/sibling tests, targeted lint and the canonical changed-file gate passed. The earlier permanent restore regression covered unchanged and edited deep content: both failed against the old reader and passed with the repair, preserving current/backup bytes, recursive listings and the manifest, with no committed-change or artifact hooks. That earlier sixteen-test restore suite, formatting, type-aware lint and independent managed Codex reviews through P2 passed. These are historical checks, separate from the late restore extension and exact-head hosted CI.
Restore compatibility and recovery
Twelve earlier original/candidate restore observations used backups created by the original owner. The old reader could overwrite a later edit confined to omitted deep content. The initial repair refused that incomplete current-tree comparison before changing current files or the retained backup. Ordinary readable restores and drop-only legacy backups restored identically; ordinary edited trees remained rejected.
The late P1 review identified a remaining case: deleting an entire omitted subtree removes the evidence from the current tree. A new eight-case before/after witness, using sixteen independently seeded legacy backups, reproduced successful resurrection of the deleted subtree before the fix. After the saved-tree preflight, restore refuses and preserves both the current deletion and backup. Deleting only the deep file remains rejected because its over-depth parent directory still exists. The six earlier controls retain their intended outcomes; a flattened tree may now fail earlier when checking the saved original. Readable ordinary backups and plan-dropped deep originals still restore exactly.
This proof calls the actual original backup/commit owners and real restore, lease, digest and filesystem transaction boundaries. Synthetic writes stand in for the collection rewrite/drop. It ran locally on macOS Node 26.8.1 with fs-safe 0.7.0; it is not an autonomous collection, populated ownership-history, live Gateway or cross-platform proof. All recorded processes joined without forced termination, and the observed process groups and temporary runtimes were verified absent.
The permanent legacy test now covers unchanged, edited, file-deleted and subtree-deleted states. Before the saved-tree fix, the subtree-deleted case failed because restore resolved instead of rejecting; the other three cases passed. The existing ownership test also retains a deep drop-only restore control. Its later update reads only the skill being changed, leaving the restored deep skill intact. These regressions preserve the whole-tree and no-hook assertions.
Final local validation passed all 67 tests across collection restore, collection reconciliation, proposal tree readers and service evaluation. The canonical changed-file gate passed all 29 stages, including core and test typechecks, type-aware lint, formatting and the store/schema guards. A fresh managed Codex review of the three-file restore extension found no actionable P0–P2 findings. The late regression and gate are correctness proof; no new performance measurement is claimed.
Late ClawSweeper disposition
P1 is repaired at the existing restore preparation owner without a coverage marker or blanket rejection of legacy manifests. Collection cleanup copies complete originals and changes only SKILL.md for retained skills. It does not transplant support trees; new results start in absent directories. Any saved deep content that restore could resurrect is therefore still present in the retained original backup, where the complete-read check rejects it. Drop-only originals keep their separate absent-destination guard, and result-only creates have no saved original to check. The stored representation remains unchanged.
P2 is addressed by documenting completeness for included content. Root
.clawhub,.clawdhuband.openclawmetadata entries are excluded; those names nested elsewhere remain included. Directory-draft rules stay distinct. Recovery guidance now explains both current and saved retained-tree checks, while preserving the instruction to pause writes, retain both trees and compare separate complete private inspection copies. Editing hashes or deleting/flattening live files to force a restore is unsupported; selecting and applying real recovery remains operator-owned.Direct dependency inspection resolves the earlier access gap: fs-safe 0.7.0 starts root children at depth 1, applies
includeanddescendseparately, stops at maximum depth without settingtruncated, and records directory failures infailedDirs. The extra inspected level detects omitted deep content. The older release source was also read, but its runtime was not separately executed. Current main's fs-safe 0.7.1 walker and return types were verified byte-for-byte identical to the inspected 0.7.0 files; local execution remains on 0.7.0. No atomic filesystem snapshot guarantee or legacy hash fallback is added.The review's deleted-subtree and root-metadata findings, including the corresponding rank-up requests, are addressed by this owner-level check, permanent coverage and documentation. No earlier Gateway measurement is attributed to the late restore repair.
Maintainer disposition of the 14:41 UTC review
Accept the documented compatibility tradeoff: automatic restore must refuse when the included content of a retained legacy backup cannot be completely verified. Keep both the current tree and backup intact and use the documented operator-owned manual recovery process. Ordinary readable restores and plan-dropped deep originals retain their tested behavior.
The dependency verification above resolves the other Rank-up request: the fs-safe 0.7.0 walker and types were directly inspected, and the integrity-verified 0.7.1 distribution used by current main has byte-identical
walk.jsandwalk.d.ts. Local execution remains on 0.7.0; no new 0.7.1 runtime execution or atomic snapshot guarantee is claimed. Themaintainerlabel is retained under the authorized landing workflow, with repository-native review, required checks and merge gates unchanged.