test(agents): preserve provider hook mock exports#86523
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 25, 2026, 10:50 AM ET / 14:50 UTC. Summary 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 Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge Security Review detailsBest 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 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 changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +4, Tests +3. Total +7 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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 PR egg ✨ Hatched: 🥚 common Moonlit Branchling Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
accf16d to
bb8fdb6
Compare
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-runtimemodule 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.tsgit diff --checkReal 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=30000Evidence 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 --checkpassed.What was not tested: broader agent runtime suites or live provider execution.