Skip to content

test(agents): preserve provider hook mock exports#86523

Merged
giodl73-repo merged 1 commit into
openclaw:mainfrom
giodl73-repo:fix-pi-provider-hook-mock
May 25, 2026
Merged

test(agents): preserve provider hook mock exports#86523
giodl73-repo merged 1 commit into
openclaw:mainfrom
giodl73-repo:fix-pi-provider-hook-mock

Conversation

@giodl73-repo

Copy link
Copy Markdown
Contributor

Summary

Keeps the pi-embedded sanitize-session-history provider hook runtime mock aligned with the real module contract.

The test harness now imports the real provider-hook-runtime module and overrides only the hook functions the tests need. This preserves unrelated exports for agent tests while keeping provider hook behavior isolated.

Split out from #85817 so the policy-scoping PR remains policy-only.

Verification

  • OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/tmp/openclaw-pi-provider-hook-mock node scripts/run-vitest.mjs src/agents/pi-embedded-runner.sanitize-session-history.policy.test.ts src/agents/pi-embedded-runner.openai-tool-id-preservation.test.ts -- --reporter=dot --testTimeout=30000 -> 4 files, 12 tests passed
  • /root/src/openclaw-policy-agent-scoped-design/node_modules/.bin/oxlint src/agents/pi-embedded-runner.sanitize-session-history.test-harness.ts src/agents/pi-embedded-runner.sanitize-session-history.policy.test.ts src/agents/pi-embedded-runner.openai-tool-id-preservation.test.ts
  • git diff --check

Real behavior proof

Behavior addressed: pi-embedded sanitize-session-history tests can mock provider hook behavior without dropping real exports from provider-hook-runtime.

Real environment tested: WSL Ubuntu 24.04 checkout under /root/src/openclaw-pi-provider-hook-mock.

Exact steps or command run after this patch: OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/tmp/openclaw-pi-provider-hook-mock node scripts/run-vitest.mjs src/agents/pi-embedded-runner.sanitize-session-history.policy.test.ts src/agents/pi-embedded-runner.openai-tool-id-preservation.test.ts -- --reporter=dot --testTimeout=30000

Evidence after fix: the affected pi-embedded sanitize-session-history tests passed in both agent shards.

Observed result after fix: 4 files and 12 tests passed; oxlint and git diff --check passed.

What was not tested: broader agent runtime suites or live provider execution.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 25, 2026, 10:50 AM ET / 14:50 UTC.

Summary
The PR makes the sanitize-session-history provider-hook mock factory preserve real provider-hook-runtime exports and updates two agent tests to await the async mock factory.

PR surface: Source +4, Tests +3. Total +7 across 3 files.

Reproducibility: no. executed pre-patch repro was run in this read-only review. Source inspection shows the current mock replaces provider-hook-runtime with a narrow object while the real module has additional exports, and the PR body reports the focused shard passing after the patch.

Review metrics: none identified.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Next step before merge
No repair job is needed: the patch is narrow and has no blocking findings, while the protected maintainer label leaves the merge decision to maintainers.

Security
Cleared: The diff is limited to Vitest test files and a test harness, with no dependency, workflow, script, secret, or runtime security-boundary changes.

Review details

Best possible solution:

Land the narrow test-harness update after maintainer review and CI, preserving provider-hook module exports in these tests without changing runtime behavior.

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

No executed pre-patch repro was run in this read-only review. Source inspection shows the current mock replaces provider-hook-runtime with a narrow object while the real module has additional exports, and the PR body reports the focused shard passing after the patch.

Is this the best way to solve the issue?

Yes. For this test harness, importing the real module and overriding only the isolation points is narrower than duplicating the provider-hook export list, and both affected call sites are updated for the async factory.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 277d8fece2e3.

Label changes

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P3: This is a low-risk, test-only harness cleanup for agent tests with no runtime or user-facing behavior change.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes structured after-fix proof with the exact focused Vitest command, observed pass count, oxlint, and git diff --check result from a real WSL checkout.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes structured after-fix proof with the exact focused Vitest command, observed pass count, oxlint, and git diff --check result from a real WSL checkout.
Evidence reviewed

PR surface:

Source +4, Tests +3. Total +7 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 1 +4
Tests 2 22 19 +3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 27 20 +7

What I checked:

Likely related people:

  • Neerav Makwana: Available local blame and shortlog for the touched sanitize-session-history test harness and provider-hook-runtime surface point to the current-source commit 2fcd481. (role: current source contributor; confidence: medium; commits: 2fcd48127606; files: src/agents/pi-embedded-runner.sanitize-session-history.test-harness.ts, src/agents/pi-embedded-runner.openai-tool-id-preservation.test.ts, src/plugins/provider-hook-runtime.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Moonlit Branchling

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: guards the happy path.
Image traits: location flaky test forest; accessory CI status badge; palette plum, gold, and soft gray; mood determined; pose balancing on a branch marker; shell polished stone shell; lighting golden review-room light; background delicate sparkle particles.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Moonlit Branchling in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@giodl73-repo giodl73-repo force-pushed the fix-pi-provider-hook-mock branch from accf16d to bb8fdb6 Compare May 25, 2026 14:45
@giodl73-repo giodl73-repo marked this pull request as ready for review May 25, 2026 14:45
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels May 25, 2026
@giodl73-repo giodl73-repo merged commit 657b246 into openclaw:main May 25, 2026
144 of 147 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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