Skip to content

test(auto-reply): preserve plugin hook runner lifecycle exports - #117647

Merged
steipete merged 1 commit into
mainfrom
codex/qa-hook-runner-partial-mock-c539
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-hook-runner-partial-mock-c539

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The non-isolated core unit-fast CI shard deterministically fails bundled-plugin source-checkout activation after a reply directive test leaks an incomplete global hook-runner module mock.

Why This Change Was Made

The registry-bundle refactor added getGlobalPluginRegistry() to plugin activation, but the existing reply-test support owner replaced the entire hook-runner module with three exports. Reuse the adjacent typed importOriginal partial-mock pattern so every real current and future lifecycle export remains available while preserving the three intentional test overrides.

User Impact

Unrelated OpenClaw pull requests no longer fail the shared core unit-fast CI shard because of this cross-file test mock. Production behavior is unchanged: exactly one existing test-support owner changes, with no production files or new test files.

Evidence

  • Frozen commit: eefe009a5edc437850dfc57750c3e53cbbed7614; parent: c539192b5cdd8369c16c6be03258cc68deac17ef.
  • Exactly one changed owner: src/auto-reply/reply.directive.directive-behavior.e2e-mocks.ts.
  • Authentic owner-first RED: node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts src/auto-reply/reply.directive.directive-behavior.shows-current-verbose-level-verbose-has-no.test.ts src/plugins/source-checkout-runtime.test.ts --no-isolate --maxWorkers=1 --fileParallelism=false --reporter=verbose; nine reply tests passed, then the bundled-plugin runtime test failed with No "getGlobalPluginRegistry" export is defined, pointing to src/plugins/loader-shared.ts:349.
  • Authentic owner-first GREEN: node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts src/auto-reply/reply.directive.directive-behavior.shows-current-verbose-level-verbose-has-no.test.ts src/plugins/source-checkout-runtime.test.ts --no-isolate --maxWorkers=1 --fileParallelism=false --no-cache --reporter=verbose; the same nine reply tests run first and the bundled-plugin runtime test then passes: 2 files, 10 tests passed. --no-cache prevents Vitest's failed-first result cache from reversing the regression order.
  • Four fresh independent hostile immutable-source reviews found no P0–P3 findings.
  • Official commit-mode autoreview used gpt-5.6-sol with high reasoning and P3 coverage; native TruffleHog 3.96.0 was clean; exit 0, no findings, confidence 0.96.
  • Existing targeted formatter check and git diff --check passed. No production code changed; no full-suite or remote CI result is claimed.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 21:35
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P2 Normal backlog priority with limited blast radius. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 5:40 PM ET / 21:40 UTC.

ClawSweeper review

What this changes

The PR changes the shared reply-directive Vitest mock to spread the real plugin hook-runner exports before overriding the three hooks that these tests intentionally control.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer merge handling. The branch repairs a real test-order regression by retaining the hook-runner module’s newly required lifecycle export, and the maintainer label prevents automated cleanup; the patch is narrow, source-consistent, and has credible ordered terminal proof.

Priority: P2
Reviewed head: eefe009a5edc437850dfc57750c3e53cbbed7614

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-aligned test repair with credible ordered behavior proof and no actionable correctness or security findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body includes a concrete ordered terminal RED/GREEN run of the two affected tests in one non-isolated worker, showing the missing export before the change and 10 passing tests after it.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body includes a concrete ordered terminal RED/GREEN run of the two affected tests in one non-isolated worker, showing the missing export before the change and 10 passing tests after it.
Evidence reviewed 6 items Current-main consumer requires the omitted export: Current loader-shared.ts imports and calls getGlobalPluginRegistry() while activating a plugin registry, so a leaked complete-module mock that omits it can fail a later source-checkout activation test.
PR preserves the lifecycle contract: The proposed mock obtains the real module with Vitest’s importOriginal, spreads its exports, then replaces only getGlobalHookRunner, initializeGlobalHookRunner, and resetGlobalHookRunner; this retains getGlobalPluginRegistry and future exports without changing production code.
Export contract is concrete: The hook-runner module currently exports getGlobalPluginRegistry() in addition to the three functions deliberately overridden by the test mock.
Findings None None.
Security None None.

How this fits together

Reply-directive tests install a shared module mock before exercising command behavior. In the same non-isolated Vitest process, bundled-plugin activation later reads the hook-runner registry export, so the mock must preserve unrelated lifecycle exports while retaining its test-specific overrides.

flowchart LR
  A[Reply directive test] --> B[Shared hook-runner mock]
  B --> C[Real hook-runner lifecycle exports]
  C --> D[Plugin activation]
  D --> E[Bundled source-checkout test]
  B --> F[Intentional test overrides]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main and two exact-head checks were still in progress in the supplied status context; merge only after the final mergeable head has its required CI result.
  • Complete next step (P2) - The protected maintainer label reserves this otherwise ready, narrowly scoped repair for normal human merge handling rather than automated cleanup or repair dispatch.
Agent review details

Security

None.

PR surface

Source +4. Total +4 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 9 5 +4
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 9 5 +4

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused partial-mock repair after exact-head CI completes, retaining the three explicit test overrides while preserving the hook-runner module’s public lifecycle exports.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the focused partial-mock repair after exact-head CI completes, retaining the three explicit test overrides while preserving the hook-runner module’s public lifecycle exports.

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

Yes. The source establishes the same non-isolated test order: the reply test installs the shared mock, then bundled-plugin activation calls the omitted export; the PR body provides a matching ordered RED/GREEN terminal transcript.

Is this the best way to solve the issue?

Yes. A typed partial mock is the narrowest maintainable repair because it retains the three intentional test controls while preserving the module’s real lifecycle surface for later tests.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 47bb0378eb1c.

Labels

Label changes:

  • add P2: This is a bounded regression in shared unit-fast test execution that can make unrelated pull requests fail, without affecting production runtime behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes a concrete ordered terminal RED/GREEN run of the two affected tests in one non-isolated worker, showing the missing export before the change and 10 passing tests after it.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes a concrete ordered terminal RED/GREEN run of the two affected tests in one non-isolated worker, showing the missing export before the change and 10 passing tests after it.

Label justifications:

  • P2: This is a bounded regression in shared unit-fast test execution that can make unrelated pull requests fail, without affecting production runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes a concrete ordered terminal RED/GREEN run of the two affected tests in one non-isolated worker, showing the missing export before the change and 10 passing tests after it.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes a concrete ordered terminal RED/GREEN run of the two affected tests in one non-isolated worker, showing the missing export before the change and 10 passing tests after it.

Evidence

What I checked:

Likely related people:

  • Dallin Romney: Introduced the current shared reply-directive mock that contains the incomplete hook-runner module replacement. (role: test-support owner; confidence: high; commits: fb9c8e74e619; files: src/auto-reply/reply.directive.directive-behavior.e2e-mocks.ts)
  • steipete: Has recent history on the same shared auto-reply mock path and authored the narrowly scoped repair after the lifecycle export became required. (role: recent area contributor; confidence: medium; commits: a88f3ffc9609, eefe009a5edc; files: src/auto-reply/reply.directive.directive-behavior.e2e-mocks.ts)

Rank-up moves

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

  • Wait for the in-progress exact-head checks to complete before merging.

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 2fcb1f7 into main Aug 1, 2026
160 of 168 checks passed
@steipete
steipete deleted the codex/qa-hook-runner-partial-mock-c539 branch August 1, 2026 21:50
@steipete

steipete commented Aug 1, 2026

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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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