Repository navigation
test: consolidate agent tool suites - #117886
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 3:48 AM ET / 07:48 UTC. ClawSweeper reviewWhat this changesThe PR consolidates OpenClaw agent-tool Vitest coverage from many narrowly scoped files into fewer thematic suites without changing production code. Merge readinessThis PR remains necessary: current Priority: P3 Review scores
Verification
How this fits togetherAgent-tool tests verify how OpenClaw assembles tools from run context, policy, filesystem boundaries, and channel capabilities before agent runs expose them to a model. This PR changes the organization of that coverage while preserving the assertions around resulting tool behavior. flowchart LR
RunInputs[Agent run inputs] --> ToolAssembly[Agent tool assembly]
Policies[Channel, provider, and filesystem policies] --> ToolAssembly
ToolAssembly --> AvailableTools[Available agent tools]
AvailableTools --> ThematicTests[Thematic test suites]
ThematicTests --> Validation[Vitest, lint, and type checks]
Before merge
Agent review detailsSecurityNone. PR surfaceTests -129. Total -129 across 19 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the thematic consolidation, preserve its explicit mock and cleanup boundaries, and merge after successful exact-head or merge-result lint and test-type validation. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR reorganizes tests rather than repairing a reported runtime failure. The relevant verification is the before/after focused Vitest evidence and CI validation on the exact head. Is this the best way to solve the issue? Yes, conditionally: grouping compatible cases by runtime boundary is a maintainable solution because the moved suites retain their mock factories and cleanup behavior. The unresolved check failures must be diagnosed before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9fd56e6d6529. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
82af459 to
81179d5
Compare
81179d5 to
99e3948
Compare
|
Merged via squash.
|
* origin/main: (99 commits) test: consolidate agent tool suites (openclaw#117886) fix: remove duplicate plugin CLI registry mock (openclaw#117894) fix(gateway): resume shared terminal after slow viewer leaves (openclaw#117847) refactor(gateway): remove deferred channel load flag; 503 plugin routes until runtime ready (openclaw#117852) test(agents): consolidate OpenClaw tool suites (openclaw#117870) fix(ci): repair release validation regressions (openclaw#117723) fix(media): reject empty generated assets (openclaw#117875) fix: release channel delivery resources reliably (openclaw#117855) refactor(cli): unify config-guard policy across dispatch paths (openclaw#117880) test: consolidate WhatsApp monitor suites (openclaw#117854) fix(heartbeat): retain configured account for accountless commitments (openclaw#117521) fix(agents): cap DeepSeek DSML recovery buffer at 256 KB (openclaw#117175) [AI] fix(line): downgrade row-overflow tables to ordered bullet text (openclaw#117481) fix(agents): fallback after replay-safe silent errors (openclaw#117356) fix(telegram): serialize approval ingress sessions (openclaw#117861) fix(agents): report truthful embedded startup stages (openclaw#117879) test(sqlite): align flip-proof request budgets (openclaw#117878) fix(ui): advance gateway-owned channel setup progress (openclaw#117877) fix(media): preserve canonical attachment facts across every agent owner (openclaw#117841) test(protocol): consolidate validation fixtures (openclaw#117873) ...
* test(agents): consolidate agent tool suites * test(agents): fix consolidated suite lint * test(plugins): remove duplicate loader mock
What Problem This Solves
The
src/agents/agent-tools*test family was fragmented across 29 files, including many one-purpose shards whose repeated imports and setup obscured the larger behavior themes.Why This Change Was Made
This consolidates compatible cases into 18 thematic suites while keeping mock-isolated and order-sensitive cases separate. It changes no production code, introduces no test DSL, and preserves every executed test name and assertion path.
Red-main repair
This PR also carries the one-line repair required to land onto the current red
main. Two independent merges added duplicateloadPluginRegistryHandlemock keys insrc/plugins/cli.test.ts: #117749 added the passthrough entry, while #117723 added theactivate: falsevariant. JavaScript's later-key-wins behavior meant the latter was already the executed mock. The duplicate passthrough entry is removed, retaining theactivate: falsebehavior that matches the realloadPluginRegistryHandleimplementation insrc/plugins/loader.ts.Old file to new case mapping
agent-tools-agent-config.exec.test.tsAgent-specific exec tool defaults(distinct shell mock boundary)agent-tools-agent-config.test.tsAgent-specific tool filteringagent-tools.abort.test.tsagent-tools.runtime.test.ts→wrapToolWithAbortSignalagent-tools.availability.test.tsagent-tools.runtime.test.ts→tool availabilityagent-tools.before-tool-call.approval.test.tsagent-tools.before-tool-call.embedded-mode.test.ts→before_tool_call approval snapshotsagent-tools.before-tool-call.e2e.test.tsagent-tools.before-tool-call.embedded-mode.test.tsagent-tools.before-tool-call.integration.e2e.test.tsagent-tools.create-openclaw-coding-tools.adds-claude-style-aliases-schemas-without-dropping-g.test.tsagent-tools.create-openclaw-coding-tools.test.ts→createOpenClawCodingTools read behavioragent-tools.create-openclaw-coding-tools.test.tsagent-tools.cron-scope.test.tsagent-tools.construction-routing.test.ts→ cron scopeagent-tools.deferred-followup-guidance.test.tsagent-tools.exec-notify-session.test.tsagent-tools.construction-routing.test.ts→ exec notification routingagent-tools.message-provider-policy.test.tsagent-tools.create-openclaw-coding-tools.test.ts→ message provider policyagent-tools.model-provider-collision.test.tsagent-tools.params.test.tsagent-tools.schema.test.ts→assertRequiredParamsagent-tools.policy.test.tsagent-tools.read.arg-value-suffix.test.tsagent-tools.read.workspace-root-guard.test.ts→ malformed XML/path normalizationagent-tools.read.host-edit-access.test.tsagent-tools.read.host-operations.test.ts→ host access mappingagent-tools.read.host-tilde-expansion.test.tsagent-tools.read.host-operations.test.ts→ tilde expansionagent-tools.read.workspace-root-guard.test.tsagent-tools.read.workspace-root-lazy.test.tsagent-tools.ring-zero-context.import-boundary.test.tsagent-tools.ring-zero-context.test.tsagent-tools.runtime.test.ts→ ring-zero tool contextagent-tools.safe-bins.test.tsagent-tools.sandbox-mounted-paths.workspace-only.test.tsagent-tools.workspace-paths.test.ts→tools.fs.workspaceOnlyagent-tools.schema.test.tsagent-tools.workspace-only-false.test.tsagent-tools.workspace-paths.test.ts→FS tools with workspaceOnly=falseagent-tools.workspace-paths.test.tsNo literally identical test cases were merged; all 510 named rows remain independently executed.
User Impact
No user-visible impact. Maintainers get 11 fewer test files and clearer thematic ownership with unchanged coverage.
Evidence
node scripts/run-vitest.mjs src/agents/agent-tools*.test.ts --reporter=verboseorigin/main: same command/Users/steipete/Projects/openclaw/node_modules/.bin/oxfmt src/agents/agent-tools*.test.tsgit diff --cached --check: passed.gpt-5.6-sol, high reasoning, one complete bundle; clean with no accepted/actionable findings.node scripts/check-changed.mjs: classified the test-only change and attempted remote delegation; local proof stopped because no Crabbox provider was ready. Hosted CI covers the heavy gates.node scripts/run-vitest.mjs src/plugins/cli.test.ts --reporter=verbose— 22 passing.src/plugins/cli.test.ts— passed.