Skip to content

fix: prevent archive tests from leaking native filesystem mode - #154138

Merged
steipete merged 1 commit into
mainfrom
codex/fix-skill-test-native-mode
Sep 20, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-skill-test-native-mode

Conversation

@steipete

@steipete steipete commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Related: #154115

What Problem This Solves

Fixes the Claw artifact close-failure test failing when skill archive fault tests run earlier in the same worker.

User Impact

No production behavior changes. The skill tests stop leaving filesystem configuration behind for subsequent tests.

Why This Change Was Made

The archive read-fault test captured fs-safe's effective native mode, forced its fallback, then restored that effective value as a programmatic override. Restoring auto this way prevented a later test's environment setting from selecting fallback mode, so its close-failure injection was bypassed.

Scope the read-fault test's environment through the existing withEnvAsync helper instead. It restores the original value or absence without creating an override. All fault, close-count, publication, and cleanup assertions remain unchanged, including the Claw test that exposed the leak.

Evidence

  • Linux Blacksmith Testbox, Node 26.8.2, fs-safe 0.17.0; native support verified before the experiment.
  • Original file order in one worker: archive read/close cases pass, then Claw close-failure case fails because the artifact resolves. Its environment mode is off but effective mode is auto.
  • Same order with this producer-only fix: all 3 cases pass; the Claw test observes effective mode off.
  • Both full sibling files: 59 passed, 1 Windows-only case skipped, including both golden artifact digests. Combined single-worker Vitest duration: 11.28 s. No new tests, serial configuration, or worker setting is committed.
  • Exact-head CI passed: the changed archive test file ran 31 tests, all passing, in 21.19 s of Vitest time (22.53 s wrapper time), including the read- and close-fault cases. CI test log.
  • Formatting with the repository's oxfmt 0.67.0 and git diff --check passed. Fresh independent review found no actionable issues through P2.
  • Proof source at 23462b4048ec47e01264cba145f4323013be8f05 matches the relevant source at this branch's base 6e5a6c6c5a7c00feee802c997a35ee740c73bb9d byte for byte. The original CI failure was on Node 24 with two workers; the controlled reproduction establishes the ordering mechanism on Node 26, not the historical worker assignment.

The proof runner's final index-byte restoration check failed after the tests passed. Independent reconciliation verified all 47,080 staged mode/blob/path entries still match the base commit, both touched files have their original bytes, and the checkout has no staged or working changes. The original failed check was retained; tests were not rerun to suppress it.

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 20, 2026
@steipete
steipete marked this pull request as ready for review September 20, 2026 22:56
@clawsweeper

clawsweeper Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 20, 2026, 7:04 PM ET / 23:04 UTC.

ClawSweeper review

What this changes

The skill archive tests scope fallback filesystem mode to the read-failure operation and restore the original environment without leaving a programmatic override behind.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this is a focused, source-supported repair that current main still needs. No introduced correctness or security defects were found; the documented flake-validation requirement remains outstanding.

Priority: P2
Reviewed head: 6c4da30dda0bc1d2d3d214da638a7206bf488286

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, maintainable repair with convincing mechanism evidence and no code findings; the repository’s repeated flake-validation evidence remains to be recorded.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor runtime-proof gate does not apply to this member-authored test-only repair; the reported Testbox experiment directly exercises the changed test-state lifecycle and downstream artifact assertion.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor runtime-proof gate does not apply to this member-authored test-only repair; the reported Testbox experiment directly exercises the changed test-state lifecycle and downstream artifact assertion.
Evidence reviewed 8 items Pinned introduced change: The merge-base-to-head patch replaces configuration getter/setter calls with withEnvAsync, preserving fault injection, handle-close, publication, and cleanup assertions. The verified test-merge comparison also changes only this test file.
Existing restoration owner: withEnvAsync awaits the operation and restores captured environment keys in finally; captureEnv distinguishes an absent key from a configured value.
Dependency precedence verified: The removed imports delegate directly to fs-safe/config, establishing the dependency signal. Repository ownership and the v0.17.0 tag were verified through GitHub. configureFsSafeNative merges into overrideConfig, and getFsSafeNativeConfig prefers that override over FS_SAFE_NATIVE_MODE; restoring effective auto therefore masks a later environment setting.
Findings None None.
Security None None.

How this fits together

Skill installation tests exercise archive extraction and file cleanup through fs-safe. Its process-wide configuration can affect later Claw artifact tests running in the same worker.

flowchart LR
  A[Archive fault test] --> B[Scoped environment helper]
  B --> C[Filesystem mode selection]
  C --> D[Archive extraction and cleanup]
  D --> E[Restore prior environment]
  E --> F[Later Claw artifact tests]
Loading

Before merge

  • Complete next step (P2) - Complete and record the flake-triage guide’s 20 clean standalone runs and three clean original-shard runs; reuse any existing matching evidence and retain the reported sibling coverage.
Agent review details

Security

None.

PR surface

Tests -1. Total -1 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 11 12 -1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 11 12 -1

Review metrics

None.

Technical review

Best possible solution:

Keep filesystem fault configuration local to its test operation while preserving downstream tests’ ability to select their own mode.

Do we have a high-confidence way to reproduce the issue?

Yes: run the archive read/close fault cases before the Claw close-failure case in one native-capable worker. Source confirms the precedence leak and the body reports before/after results; this read-only review did not execute tests.

Is this the best way to solve the issue?

Yes: repairing the producer with the existing environment helper removes the persistent override without weakening the downstream assertion or changing production code.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 33f18c3dc131.

Labels

Label changes:

  • add P2: This repairs a concrete cross-test state leak with limited scope and no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: This repairs a concrete cross-test state leak with limited scope and no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head patch replaces configuration getter/setter calls with withEnvAsync, preserving fault injection, handle-close, publication, and cleanup assertions. The verified test-merge comparison also changes only this test file. (src/skills/lifecycle/install-download.test.ts:907, 6c4da30dda0b)
  • Existing restoration owner: withEnvAsync awaits the operation and restores captured environment keys in finally; captureEnv distinguishes an absent key from a configured value. (src/test-utils/env.ts:140, 6c4da30dda0b)
  • Dependency precedence verified: The removed imports delegate directly to fs-safe/config, establishing the dependency signal. Repository ownership and the v0.17.0 tag were verified through GitHub. configureFsSafeNative merges into overrideConfig, and getFsSafeNativeConfig prefers that override over FS_SAFE_NATIVE_MODE; restoring effective auto therefore masks a later environment setting. (src/native-config.ts:85, 38b312a51900)
  • Downstream regression contract: The Claw artifact test selects fallback mode through withEnvAsync, injects a file-close error, and requires rejection, exactly one close attempt, and an empty output directory. This assertion remains unchanged. (src/claws/project.test.ts:92, 6c4da30dda0b)
  • Still necessary on fetched main: Fetched main retains the effective-config capture and programmatic restoration. No merged replacement was established. The latest-release blob inspection failed because a required Git object could not be retrieved, so no release inclusion is claimed. (src/skills/lifecycle/install-download.test.ts:874, 33f18c3dc131)
  • Reported before-and-after validation: The captured PR body reports a Linux Testbox run with Node 26.8.2 and fs-safe 0.17.0: the original same-worker ordering fails downstream, while the producer-only repair passes all three focused cases. Both sibling files reportedly produced 59 passes and one Windows-only skip in 11.28 seconds. It explicitly distinguishes this from the historical Node 24 two-worker assignment and records the reconciled proof-runner index-check failure. These are supplied observations, not reviewer-executed tests. (6c4da30dda0b)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

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

  • Document the required standalone and original-shard validation runs, retaining the existing sibling-test results.

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.

@steipete
steipete merged commit b6a518e into main Sep 20, 2026
166 checks passed
@steipete
steipete deleted the codex/fix-skill-test-native-mode branch September 20, 2026 23:23
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant