Skip to content

refactor: consolidate filesystem observation helpers - #175127

Closed
steipete wants to merge 2 commits into
mainfrom
deslop/z16-13-filesystem-helpers-20261015
Closed

steipete wants to merge 2 commits into
mainfrom
deslop/z16-13-filesystem-helpers-20261015

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Related: #173431

What Problem This Solves

Filesystem discovery and optional-stat helpers are copied across core and bundled plugins, with subtly different missing-path and executable policies obscured by repeated implementations.

User Impact

No user-visible change or migration is intended. Existing missing-path, access-mode, symlink, error, permission, and durability behavior remains unchanged.

Why This Change Was Made

Extend the existing path-existence, errno, and descriptor owners; migrate the matching callers and delete their private copies. Expose only narrow official-plugin runtime reexports and register them through the existing canonical SDK generator. Filesystem observations do not authorize later effects.

Keep ENOENT-only worktree behavior distinct from ENOENT/ENOTDIR discovery, exact Node errno classification distinct from broader portable errors, asynchronous access-first discovery distinct from synchronous stat-first discovery, and existing Windows access modes. Share the unchanged flush/hash/finally-close descriptor sequence without removing durability or integrity operations. Phase E, persisted schemas, public configuration, security authority, and dependency versions are untouched.

Fresh-main strict production count at base b8e70ec60630a6eee18e67f0e83953d1ca0613d0: 46 production files, +185/-360, 175 net production lines removed, including SDK source/export metadata. Two test files add 54 lines separately; the documentation addition and shrink-only assertion baseline deletion are excluded. The whole change has 50 paths. This area split completes the original helper family; its size floor is coordinator-waived.

Best-effort tradeoffs accepted

  • Optional directory discovery still returns an empty list on a real readdir failure. The catch now belongs to the actual read rather than also hiding failures in the typed internal loop afterward. Unexpected broken internal Dirent/path operations now surface instead of being mistaken for an empty directory; no such production incident is asserted or security boundary removed.
  • Native skill scanning now treats an unexpected non-object thrown value as a non-missing scan failure, rather than throwing a secondary error while reading its code. Real Node errno behavior, incomplete-scan reporting, and authority checks remain unchanged.
  • All other cuts consolidate equivalent implementations, not security or durability protections. No speculative concurrency mechanism is removed.

Evidence

The complete 43-file source/test component is independently scoped-clean P0-P2 across two full-module review passes. Fresh-main reconstruction preserves intervening backup manifest/PostgreSQL/config-capture changes and applies only the disjoint optional-stat hunk there; the other 42 source/test paths have no main-side drift. The six metadata/docs changes separately received a scoped-clean P0-P2 review. Canonical SDK export generation and its check mode passed while preserving the landed owner's registrations; unrelated JSON wrapping was excluded. git diff --check and canonical formatting of all 43 source/test files passed. First exact-head CI required removal of the now-obsolete native-skill-isolation assertion baseline entry (actual zero versus grandfathered one); the source cast is already gone, and no retained allowance is enlarged. That one-row repair passed the assertion-safety ratchet and a separate scoped-clean P0-P2 review; production source is unchanged.

Retained input-identical owner proof: two files, 17 passing tests, covering default/strict optional lstat, ENOTDIR, dangling links, executable/access policies, and owned descriptor closure on flush failure. Both owner modules, errno, and the two owner test files have SHA-256 identities matching the reviewed/proved preparation. The mandatory suppression check completed serially with one worker and isolated state, including again before the repair push: two cases passed; one failed on the inherited backup-restore preserve-caught-error count (actual 2, expected 1). Both determining files are unchanged from this branch's base; no lint-suppression allowance was changed. First-head hosted build and package-boundary checks passed. Final exact-head SDK/API/surface/build/cycle checks remain the broad gate; no broad local suite or build is claimed. Package-boundary declarations are absent locally and require the prohibited broad SDK build, so typing remains a hosted gate.

A pre-publication consumer attempt selected only browser Playwright-cache discovery and Codex native-skill isolation, serially with one worker and isolated state. The sparse preparation first failed before assertions because it lacked a test-runner source prerequisite. The full installed donor, with all 43 reviewed source/test hashes verified identical and the reviewed registration hunks applied, then exhausted the unchanged 600-second outer budget during cold compiled-subprocess preparation (exit 124/child 143), also before assertions. Neither attempt establishes a product failure or a passing consumer verdict; no timeout, retry, skip, or baseline was changed. Final exact-head hosted CI remains the broad gate.

Initial CI's node-worker-launch-wire E2E failed at line 439 with a missing deployed config/sessions/session-transcript.worker.mjs, also reproduced on the independent plugin area. The existing exec capability-read path requires this subprocess, while the unchanged portable archive allowlist/stager cannot ship it. The determining producer/consumer files are unchanged from the CI base; this is an inherited packaging defect, not a generic timeout or a failed SDK-build consequence. Security and permission checks remain intact. The failure is recorded for the packaging owner rather than hidden by deleting helper migrations.

Final exact-head CI attribution

Head cbd7b00485af4665b755a143e90fb493b463eb1f, run 39006398214, attempt 1: 175 jobs, 154 successful, 18 skipped, two failed and one cancelled. All 246 current-head check runs and three commit-status contexts were enumerated; no additional red or active check was omitted. Build artifacts, package boundary, baseline ratchets and the selected UI E2E shards passed. Skipped jobs are not passing coverage.

Job Failure and attribution
checks-node-changed-23 / 117320294771 Worker-launch case 439 reaches the missing deployed transcript worker. Scheduled-main run 39002992814 at 737a0ac25447438a039295a6200ced99d6bc4a6d, job 117309836508, has the identical assertion and missing-module signature. The actual tested merge preserves the unchanged archive/staging/capability-read chain.
PostgreSQL conformance / 117320293921 The job reached its explicit 30-minute limit after two real assertions. The retained-root case at 220 timed out at 300000 ms, identically to scheduled-main job 117309835227 in run 39002992814. Subsequent recovery at 144 selected the shared Vitest HOME config, not its written matrix-port fixture config. Unchanged fixture cleanup can restore baseline selectors after the earlier timed-out callback settles; the exact interleaving remains unreplayed. Config preflight fails before the migrated Matrix directory helper executes. This is attributed inherited fixture behavior with incomplete coverage, not green CI or a clean infrastructure-only cancellation.
openclaw/ci-gate / 117325697258 The aggregate reports the accounted node failure and PostgreSQL cancellation; it is not another independent defect.

The actual tested merge is 37852d8ddf59a1a72105e37e070fe3a15dff40c1, with parents 15a39da700dab0966debe2c033b4020e44fba1df and the exact candidate head. Its 50 changed paths do not modify the determining fixture, environment-selector, Doctor preflight, test setup, conformance driver or workflow paths. The inherited filesystem dependency upgrade is main-owned; this PR does not alter the lockfile or Vitest version.

PostgreSQL completed the infra project with 294 passing and two failing tests. Only three command diagnostics assertions finished before cancellation; no complete commands summary, extension database-worker project or Matrix account-state project ran to completion. That remaining coverage is explicitly unproven. No CI rerun, timeout, retry, skip, suppression or allowance change was used to obtain a different result. Native inherited-failure landing remains pending a supported admission route for this fully disclosed PostgreSQL cancellation.

@clawsweeper

clawsweeper Bot commented Oct 17, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T05:09:04.208360Z e9ce966 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Oct 17, 2026
@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. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR consolidates filesystem discovery and descriptor helpers across core and bundled plugins.

Example: Browser discovery checks /opt/chromium/chrome on Linux.

  • Before: A plugin-local helper requires an executable regular file.
  • After: The shared helper preserves that requirement and still rejects searchable directories.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source changes are coherent and no actionable defect was found; validation confidence rests on focused owner tests and incomplete consumer coverage.
Proof confidence 🦐 gold shrimp (3/6) The maintainer-authored refactor is outside the ordinary contributor proof gate; retained owner-test results support filesystem contracts, while shipped consumer execution is not demonstrated.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-directed change reduces duplicated policies under existing owners, with explicit acceptance of the two narrow error-handling differences.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed consolidation is useful, the obsolete assertion baseline is corrected, and no introduced code defect was found.

Priority: P3
Reviewed head: cbd7b00485af4665b755a143e90fb493b463eb1f

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped-entry-point discovery or recovery run is supplied, and the attempted browser/Codex consumer suites stopped before assertions.
Agent review details

How this fits together

Core and plugin discovery pass paths and access modes into shared filesystem observers, which return metadata or availability; callers retain responsibility for authorization and later effects.

flowchart TD
  A[Core discovery] --> C[Filesystem observation owner]
  B[Bundled plugins] --> D[Private SDK facade]
  D --> C
  C --> E[Node filesystem and fs safe]
  E --> F[Metadata and availability]
  F --> G[Caller decisions]
Loading

Technical review

Best possible solution:

Retain the shared observation owners and complete normal exact-head CI before landing.

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

This is a refactor without a reported product defect; inspection verifies the duplicated policies and their replacements without executing target code.

Is this the best way to solve the issue?

The change extends existing filesystem owners, removes equivalent local implementations, and preserves caller-specific policies and effect checks.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Shared filesystem discovery keeps the original intent (a84961c: Centralize distinct discovery policies while preserving access modes, error handling, and containment behavior.)
  • Worktree optional lstat keeps the original intent (0acd851: Managed worktree creation, provisioning, snapshots, and restoration distinguish absent paths from other filesystem failures.)
  • Migration target inspection keeps the original intent (54eb03f: Preserve path-resolution and copy safety, including dangling-link destination detection and regular-file restrictions.)
  • Optional directory and native-skill scan errors changes intended behavior with a stated reason (refactor: consolidate filesystem observation helpers #175127: The current maintainer-authored body explicitly accepts surfacing broken internal directory operations and safely recording non-object scan failures.)
  • Recovery descriptor lifecycle keeps the original intent (f1e333d: Share pinned-descriptor primitives while preserving digest fields, synchronization, and descriptor ownership.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Follow-up scope verified: The follow-up removes only the native-skill-isolation assertion baseline row; production source is unchanged from the previously reviewed head. (config/assertion-safety-baseline.txt:128, cbd7b00485af)
  • Distinct filesystem contracts retained: Optional lstat retains selectable ENOENT-only handling, worktree callers explicitly select it, and executable discovery preserves access order, regular-file checks, and Windows modes. (src/infra/path-existence.ts:31, cbd7b00485af)
  • Recovery compatibility inspected: Both recovery consumers replace identical open, fsync, hash, and finally-close sequences; persisted formats, backup verification, repair predicates, and authority checks are unchanged. (src/infra/file-descriptor.ts:119, cbd7b00485af)
  • Private SDK cutover: The new official-plugin runtime facade is registered in package exports, canonical entrypoints, private-local subpaths, declaration paths, and the SDK documentation; existing public exports remain. (src/plugin-sdk/path-existence-runtime.ts:1, cbd7b00485af)
  • Imported dependency contract verified: The patch directly reexports fs-safe helpers. At the pinned v0.26.6 source, hasNodeErrorCode uses exact code equality and safeStatSync retains its existing followed-target behavior. (src/path.ts:60, 9445e65094f6)
  • Sibling skill-discovery contract inspected: The changed Codex consumer depends on native skill discovery. The sibling implementation distinguishes missing roots from scan errors and records incomplete inventories; this PR retains those distinctions and the isolation rules. (codex-rs/ext/skills/src/loader/discovery.rs:65, c1382380de69)

Likely related people:

  • Peter Steinberger: Raw commit a84961c adds src/infra/path-existence.ts:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a84961cdc577; files: src/infra/path-existence.ts)
  • Vincent Koc: Raw commit c50533f adds src/infra/path-existence.ts:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c50533f9d944; files: src/infra/path-existence.ts)

PR surface

Source -184, Tests +54, Docs +1, Config +7, Other +1. Total -121 across 50 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 42 175 359 -184
Tests 2 54 0 +54
Docs 1 1 0 +1
Config 2 8 1 +7
Generated 0 0 0 0
Other 3 2 1 +1
Total 50 240 361 -121

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is behavior-preserving maintenance without a claimed urgent user-facing defect.
  • merge-risk: 🚨 compatibility: The PR adds a private official-plugin SDK subpath and migrates bundled consumers; the maintainer-approved direction includes synchronized registrations without removing an existing public contract.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-17T05:25:25.080Z sha e9ce966 :: needs changes before merge. :: none

Reviewed October 17, 2026, 1:36 AM ET / 05:36 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The follow-up commit only removes the obsolete assertion-safety baseline row required by the deleted cast. The local ratchet passes and the narrow independent review is clean; production source is unchanged. The PR body records retained proof, the inherited suppression-count mismatch, and the separately traced portable-worker packaging failure.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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 Oct 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Preserving this slice under the coordinator's unattended parking rule, rather than leaving a PR slot blocked on an unsupported native admission contract.

Exact source head: cbd7b00485af4665b755a143e90fb493b463eb1f; 175 net production lines removed. The original source branch is retained, and deslop/z16-parked-postgres-native-20261015 preserves the same head. This is not a rejection of the helper consolidation or a passing-CI claim.

Run 39006398214, attempt 1: 175 jobs, 154 successful, 18 skipped, two failed, one cancelled. All 246 head checks were enumerated; separate dependency/security statuses succeeded.

Non-passing job Attribution / remaining proof
117320294771 Missing transcript-worker case 439 matches scheduled-main job 117309836508 in run 39002992814.
117320293921 PostgreSQL conformance reached its own 30-minute deadline after the scheduled-main-matching retained-root timeout and the subsequent wrong-shared-HOME fixture preflight error. Determining fixture/environment/Doctor/workflow paths are unchanged in the actual tested merge. Exact timing remains unreplayed; remaining commands and extension conformance coverage is unproven.
117325697258 Aggregate gate follows those roots.

The current native cancellation contract supports other job shapes, but not the PostgreSQL conformance cancelled step plus its actual assertion annotations. This is a supported-route capability gap, not two infrastructure failures and not authority for direct fallback. No failure is omitted or relabeled green. No job was rerun, test weakened, gate changed, or merge attempted. The slice can resume from the preserved head when that native route is available; closing this PR frees the bounded factory slot for the next independent area.

@steipete steipete closed this Oct 17, 2026
@RomneyDa
RomneyDa deleted the deslop/z16-13-filesystem-helpers-20261015 branch October 22, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: feishu Channel integration: feishu channel: matrix Channel integration: matrix channel: reef Channel integration: reef channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes docs Improvements or additions to documentation extensions: anthropic extensions: browser extensions: codex extensions: crabbox extensions: diffs extensions: llama-cpp extensions: memory-wiki extensions: onepassword 1Password plugin extensions: qa-lab extensions: xai merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: linux-node plugin: migrate-claude plugin: migrate-hermes plugin: mxc rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: L 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.

1 participant