Skip to content

fix(test): keep extension batches inside requested directories - #162009

Merged
steipete merged 2 commits into
mainfrom
deslop/l232-extension-selection
Sep 30, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/l232-extension-selection

Conversation

@steipete

@steipete steipete commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

pnpm test:extensions:batch policy planned 17 policy files but ran 38 files because the runner emitted bare policy, which Vitest treats as a substring filter. Adding a slash alone still admits sibling paths containing a nested policy/ directory.

User Impact

Default bundled-plugin discovery stays inside the requested plugin directories. Explicit test files, exclusions, database-worker aggregation, watch discovery, and include-file precedence remain intact. Product behavior and plugin contracts are unchanged.

Why This Change Was Made

Preserve canonical plugin roots as directory filters, then narrow plain directory test globs only when their existing owner proves containment. The owner keeps its .test.ts suffix; complex globs retain their existing behavior. This fixes selection at the existing runner and pattern owners without replacing directory discovery with a static file inventory.

Evidence

Corrected head 7d53e88634361a53f2861bcc46dc3c88d46b6e4f completed run 36759052890 with one inherited failed job, checks-node-compact-small-1-3 (child core-tooling-2-hosted-3), plus the aggregate CI gate. The three failures are in test/scripts/plugin-sdk-surface-report.test.ts: registered command joins, pinned public budgets, and callable-growth rejection. Source reports 4,595 exports / 2,699 callable exports, versus budgets 4,594 / 2,698.

The same three cases and counts fail on unrelated current PR #162038 at head 10eedda18c8acc5ceb8045233a93cdd7dca8c9db, run 36758377865, job 110034839635. Our failing CI checkout is merge tree 7a10bc32a87142b955ae9bb52dfce8ed12cb8de8, incorporating main 112df95f5ee65a0b17622735e2b616d2910dc79b. That main contains 6830c82ea080767b8953edce13a3e543eed419da, which adds withUserPathBaseDirectory; the existing infra-runtime wildcard exports it. This PR changes no SDK graph, report, budget, or inputs to those counts. The coordinator owns the inherited budget repair. All affected suites and security checks passed; landing uses the expressly authorized inherited-failure exception pinned to the corrected head, without describing hosted CI as green.

Initial head 0e59de3670ba5f69af6b149788e218daf3cdef5a failed the existing “ordinary QA file” build-admission case in run 36750231892, job 110007133350. The implicit directory operand widened an explicit file selection and caused an unwanted build. Commit 7d53e88634361a53f2861bcc46dc3c88d46b6e4f preserves the prior implicit operand when the canonical CLI parser finds explicit file filters. No assertion was weakened or retried to hide this failure.

  • Correction proof: node scripts/run-vitest.mjs test/scripts/test-extension.test.ts test/scripts/test-projects-build-admission.test.ts --maxWorkers=1 passed 280 tests / 2 files. The formerly failing admission case passed in 9 ms; all default-directory regressions still pass. This overloaded-host run took 1,525.10 seconds wall, including CLI subprocess coverage, worker compilation, and cleanup.

  • All three new runner-to-selector regression cases failed on the original implementation. They also exposed the incomplete slash-only fix; the final repair passes single-plugin, multi-plugin, and watch cases, rejecting sibling filenames, nested sibling directories, similar plugin names, and files outside the owner's suffix.

  • Selection-owner coverage before the explicit-filter correction: node scripts/run-vitest.mjs test/scripts/test-extension.test.ts test/vitest-scoped-config.test.ts test/vitest/vitest.pattern-file.test.ts test/vitest-unit-fast-config.test.ts --maxWorkers=1: 171 passed / 4 files. The shared run took 437.04 seconds wall on the overloaded Mac, including cold worker compilation. Existing watch, include-file intersection, explicit-file, exclusion, extglob, and unit-fast routing coverage passed.

  • Test cost: the three new cases took 37 / 19 / 4 ms on the corrected source. The full runner file took 64.463 seconds of Vitest test time; scoped-config took 30.259 seconds. These files already cover native process/lifecycle and whole-inventory contracts; the additions introduce no processes, timers, polling, retries, or worker configuration.

  • check-changed passed all selected guards, script/test-root typechecks, formatting, and lint before the one-file correction. The correction is additionally checked with script lint/typechecking and both cycle checks. Its optional whole-tree dead-export scan was omitted via the documented OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1 switch for host load.

  • Both scripts/check-madge-import-cycles.ts and scripts/check-import-cycles.ts passed with 0 cycles before push.

  • Independent final review: no actionable P0–P2 findings.

The lane's Blacksmith lease had expired and the sanitized AWS coordinator returned HTTP 401 without allocating a lease. This follow-up used the authorized sequential nice -n 15 local fallback. Hosted CI on the published head remains the merge gate.

Preserve canonical plugin roots as directory filters and intersect plain directory test globs with their owning scope. Prevent policy batches from selecting sibling policy filenames or nested policy directories while retaining watch discovery, explicit files, exclusions, and complex owner patterns.

Add real runner-to-selector regression cases, proven failing before the fix, and keep existing aggregation and scoped-config assertions aligned.
@clawsweeper

clawsweeper Bot commented Sep 30, 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.

@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 30, 2026, 2:38 PM ET / 18:38 UTC (Revision 3).

ClawSweeper review

What this changes

The branch bounds bundled-plugin test batches to requested directories and updates runner and selector tests for directory, watch, and explicit-file selection.

Merge readiness

⛔ Blocked before merge - 2 items remain

Current main still has the reported selection bug, and the latest commit appears to resolve the prior explicit-file finding. I found no further discrete patch defect. The live PR API reports a contributor association, and the supplied after-fix evidence does not yet show a real extension batch run.

Priority: P2
Reviewed head: 7d53e88634361a53f2861bcc46dc3c88d46b6e4f

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 9 items Current-main behavior: Current main still emits each relative plugin root without a directory boundary, leaving the central over-selection problem unresolved.
Introduced runner change: The introduced patch adds a directory suffix to a requested plugin root when no explicit file filter is present.
Selector ownership: The selector narrows a plain directory test pattern only when its root is inside the owning include pattern; complex owner patterns retain their previous treatment.
Findings None None.
Security None None.

How this fits together

The extension batch runner turns requested plugin names into Vitest configuration groups and file targets. Vitest then selects tests, while runtime preparation decides which code to build before they run.

flowchart LR
  A[Requested plugins] --> B[Extension batch planner]
  B --> C[Configuration groups]
  C --> D[Directory and file targets]
  D --> E[Vitest selection]
  E --> F[Runtime preparation]
  F --> G[Executed tests]
Loading

Before merge

  • Resolve merge risk (P1) - The changed selection has been checked after the fix through a mocked Vitest invocation and selector projection; a real batch could still execute or omit files differently.
  • Complete next step (P2) - Add redacted after-fix output from a real extension batch run that shows which files Vitest executed.
Agent review details

Security

None.

PR surface

Tests +57, Other +10. Total +67 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 3 65 8 +57
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 13 3 +10
Total 4 78 11 +67

Review metrics

Metric Value Why it matters
New selector regression cases 3 cases; 60 ms summed reported case time The added cases are inexpensive within the existing, process-heavy runner suite.

Merge-risk options

Maintainer options:

  1. Show a real batch selection (recommended)
    Add redacted after-fix terminal output from the extension batch command showing planned and executed files stay within the requested plugin directories.

Technical review

Best possible solution:

Keep directory selection in the existing runner and selector owners, with a real batch demonstrating that requested plugin directories are respected while explicit-file admission remains stable.

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

Yes. Current-main source emits a bare plugin-name target, and the PR reports a pre-fix policy batch that planned 17 files but executed 38; this read-only review did not run the command.

Is this the best way to solve the issue?

Yes. The patch changes the existing runner and pattern owners, and its latest commit addresses the prior explicit-file regression. Real after-fix Vitest selection remains unobserved.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 112df95f5ee6.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded test-tooling bug that can waste CI work or obscure which plugin tests ran.
  • merge-risk: 🚨 automation: Merging changes which test files extension batches discover and execute, a behavior that ordinary green checks may not fully expose.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-09-30T17:21:50.944Z sha 0e59de3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-30T17:46:42.337Z sha 0e59de3 :: blocked before merge. :: [P2] Preserve explicit-file selection when adding directory targets

@steipete
steipete disabled auto-merge September 30, 2026 17:30
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. 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 Sep 30, 2026
@steipete
steipete enabled auto-merge (squash) September 30, 2026 18:32
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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 Sep 30, 2026
@steipete
steipete merged commit a58e5ba into main Sep 30, 2026
176 of 179 checks passed
@steipete
steipete deleted the deslop/l232-extension-selection branch September 30, 2026 18:58
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
…law#162009)

* fix(test): keep extension batches inside requested directories

Preserve canonical plugin roots as directory filters and intersect plain directory test globs with their owning scope. Prevent policy batches from selecting sibling policy filenames or nested policy directories while retaining watch discovery, explicit files, exclusions, and complex owner patterns.

Add real runner-to-selector regression cases, proven failing before the fix, and keep existing aggregation and scoped-config assertions aligned.

* fix(test): preserve explicit extension file filters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts 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.

1 participant