Skip to content

fix: reject incomplete Skill Workshop directory reads - #138082

Merged
steipete merged 5 commits into
mainfrom
codex/perf8-skill-bundle-walk
Sep 4, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/perf8-skill-bundle-walk

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

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, .clawdhub and .openclaw metadata 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 include and descend separately, stops at maximum depth without setting truncated, and records directory failures in failedDirs. 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.js and walk.d.ts. Local execution remains on 0.7.0; no new 0.7.1 runtime execution or atomic snapshot guarantee is claimed. The maintainer label is retained under the authorized landing workflow, with repository-native review, required checks and merge gates unchanged.

@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 4, 2026, 10:41 AM ET / 14:41 UTC.

ClawSweeper review

What this changes

The PR makes Skill Workshop reject unreadable or over-depth directory trees and prevents legacy collection backups from restoring omitted deep content.

Regression provenance

Possible 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
Reviewed head: ddb53bc5163397856fac9c150c9e7bfb3a64eb69
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The repair is coherent and well-covered in source, but dependency-contract verification and legacy-restore compatibility acceptance remain material before merge.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate is not applicable to this maintainer-labeled PR; its body describes real-filesystem regressions, while this read-only checkout could not independently execute or inspect the fs-safe dependency source.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate is not applicable to this maintainer-labeled PR; its body describes real-filesystem regressions, while this read-only checkout could not independently execute or inspect the fs-safe dependency source.
Evidence reviewed 9 items Current main still accepts incomplete target trees: Current main returns an empty tree when the target is absent and otherwise only rejects a truncated walk; it does not inspect over-depth entries or failed directories.
Introduced reader repair is at the owning boundary: The PR reads one extra level, rejects a depth overflow or truncated traversal, and propagates directory-read failures except a missing root create target.
Evaluation revalidates before persistence: Evaluation builds the tree snapshot under the target lock and rereads its hash before recording results, so an incomplete or changed tree cannot publish an evaluation.
Findings None None.
Security None None.

How this fits together

Skill 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]
Loading

Decision needed

Question Recommendation
Should OpenClaw intentionally refuse automatic restore of legacy retained backups that cannot be completely verified, requiring the documented manual recovery path? Accept fail-closed recovery: Keep the documented manual-recovery path for incomplete legacy backups so restore never overwrites a current tree using an incomplete digest.

Why: This PR changes the upgrade behavior of existing backup data: it trades automatic restore for protection against resurrecting unverified deep content.

Before merge

  • Resolve merge risk (P1) - Existing legacy backups whose retained original contains content beyond the new traversal boundary will no longer restore automatically and instead require operator-led manual recovery.
  • Resolve merge risk (P1) - The repair relies on fs-safe walker semantics that could not be independently inspected in this read-only, dependency-less checkout.
  • Complete next step (P1) - Confirm the legacy-backup fail-closed compatibility policy and verify the fs-safe walker semantics used by current main before merge.
  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +26, Tests +237, Docs +40. Total +303 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 3 43 17 +26
Tests 3 242 5 +237
Docs 1 40 0 +40
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 325 22 +303

Review metrics

Metric Value Why it matters
Production versus regression coverage production +26/-17; tests +242/-5; docs +40/-0 The net production growth establishes completeness checks at the existing reader and restore owners, while focused tests cover the new failure boundaries.

Merge-risk options

Maintainer options:

  1. Accept the fail-closed restore policy (recommended)
    Confirm that incomplete legacy retained backups should require the documented manual recovery process rather than automatic overwrite.
  2. Pause for a versioned backup policy
    If automatic restoration of these legacy backups must remain supported, pause this PR for an explicit complete-backup format and migration design.

Technical review

Best 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.

Labels

Label justifications:

  • P1: The PR addresses a restore/evaluation path that could silently accept incomplete skill-directory input and overwrite a workspace tree.
  • merge-risk: 🚨 compatibility: Legacy collection backups that formerly restored can now intentionally require manual recovery when their retained original cannot be completely verified.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate is not applicable to this maintainer-labeled PR; its body describes real-filesystem regressions, while this read-only checkout could not independently execute or inspect the fs-safe dependency source.

Evidence

What I checked:

  • Current main still accepts incomplete target trees: Current main returns an empty tree when the target is absent and otherwise only rejects a truncated walk; it does not inspect over-depth entries or failed directories. (src/skills/workshop/proposal-bundle.ts:74, 523221e3767f)
  • Introduced reader repair is at the owning boundary: The PR reads one extra level, rejects a depth overflow or truncated traversal, and propagates directory-read failures except a missing root create target. (src/skills/workshop/proposal-bundle.ts:76, ddb53bc51633)
  • Evaluation revalidates before persistence: Evaluation builds the tree snapshot under the target lock and rereads its hash before recording results, so an incomplete or changed tree cannot publish an evaluation. (src/skills/workshop/service-evaluation.ts:61, ddb53bc51633)
  • Restore validates retained originals before mutation: Manifest validation now completely reads saved originals for retained result directories before restore checks current hashes or prepares change hooks; drop-only paths retain their separate absent-result guard. (src/skills/workshop/collection-backup.ts:152, ddb53bc51633)
  • Regression coverage exercises the affected boundaries: The added cases cover unreadable directories, allowed versus over-depth files, root metadata exclusion, pre/post-evaluator revalidation, and unchanged, edited, deleted-file, and deleted-subtree legacy restore states. (src/skills/workshop/collection-restore.test.ts:202, ddb53bc51633)
  • Recovery and limit documentation matches the repair: The documentation distinguishes the eight-component draft limit, sixteen-component evaluator limit, root-only metadata exclusion, and manual recovery for non-verifiable legacy backups. Public docs: docs/tools/skill-workshop.md. (docs/tools/skill-workshop.md:156, ddb53bc51633)

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the fail-closed policy for existing legacy backups.
  • Verify the fs-safe walker depth, include/descend, and failed-directory contract for the version used by current main.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-04T08:47:52.294Z sha f54e789 :: blocked before merge. :: none
  • reviewed September 4, 2026, 5:10 AM ET / 09:10 UTC sha unknown :: blocked before merge. :: none
  • reviewed 2026-09-04T10:48:15.574Z sha 76789df :: blocked before merge. :: [P2] Cover fail-closed legacy restore behavior
  • reviewed 2026-09-04T13:02:57.325Z sha 50026be :: blocked before merge. :: none
  • reviewed 2026-09-04T13:18:58.130Z sha bc7735b :: blocked before merge. :: none
  • reviewed 2026-09-04T13:57:19.568Z sha bc7735b :: blocked before merge. :: [P1] Fence legacy backup hashes from deep-file deletions | [P2] Document root metadata exclusions

@steipete
steipete force-pushed the codex/perf8-skill-bundle-walk branch from f54e789 to 76789df Compare September 4, 2026 10:39
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@steipete
steipete force-pushed the codex/perf8-skill-bundle-walk branch from 76789df to 8d5b9d8 Compare September 4, 2026 12:28

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 4, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P2 Normal backlog priority with limited blast radius. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 4, 2026
@steipete
steipete merged commit 54ef5b3 into main Sep 4, 2026
190 of 192 checks passed
@steipete
steipete deleted the codex/perf8-skill-bundle-walk branch September 4, 2026 15:16
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 4, 2026
…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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants