Skip to content

test: consolidate agent tool suites - #117886

Merged
steipete merged 3 commits into
mainfrom
test/consolidate-agent-tools
Aug 2, 2026
Merged

steipete merged 3 commits into
mainfrom
test/consolidate-agent-tools

Conversation

@steipete

@steipete steipete commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

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 duplicate loadPluginRegistryHandle mock keys in src/plugins/cli.test.ts: #117749 added the passthrough entry, while #117723 added the activate: false variant. JavaScript's later-key-wins behavior meant the latter was already the executed mock. The duplicate passthrough entry is removed, retaining the activate: false behavior that matches the real loadPluginRegistryHandle implementation in src/plugins/loader.ts.

Old file to new case mapping

Old file New suite / case
agent-tools-agent-config.exec.test.ts Retained: Agent-specific exec tool defaults (distinct shell mock boundary)
agent-tools-agent-config.test.ts Retained: Agent-specific tool filtering
agent-tools.abort.test.ts agent-tools.runtime.test.ts → wrapToolWithAbortSignal
agent-tools.availability.test.ts agent-tools.runtime.test.ts → tool availability
agent-tools.before-tool-call.approval.test.ts agent-tools.before-tool-call.embedded-mode.test.ts → before_tool_call approval snapshots
agent-tools.before-tool-call.e2e.test.ts Retained: loop detection, approval handling, and private-data capture
agent-tools.before-tool-call.embedded-mode.test.ts Retained and extended with approval snapshots
agent-tools.before-tool-call.integration.e2e.test.ts Retained: hook, deduplication, adapter, and client-tool integration
agent-tools.create-openclaw-coding-tools.adds-claude-style-aliases-schemas-without-dropping-g.test.ts agent-tools.create-openclaw-coding-tools.test.ts → createOpenClawCodingTools read behavior
agent-tools.create-openclaw-coding-tools.test.ts Retained: broad construction coverage
agent-tools.cron-scope.test.ts agent-tools.construction-routing.test.ts → cron scope
agent-tools.deferred-followup-guidance.test.ts Retained: deferred follow-up guidance (distinct metadata mock boundary)
agent-tools.exec-notify-session.test.ts agent-tools.construction-routing.test.ts → exec notification routing
agent-tools.message-provider-policy.test.ts agent-tools.create-openclaw-coding-tools.test.ts → message provider policy
agent-tools.model-provider-collision.test.ts Retained: model/provider collision policy (distinct channel mock boundary)
agent-tools.params.test.ts agent-tools.schema.test.ts → assertRequiredParams
agent-tools.policy.test.ts Retained: layered tool policy resolution
agent-tools.read.arg-value-suffix.test.ts agent-tools.read.workspace-root-guard.test.ts → malformed XML/path normalization
agent-tools.read.host-edit-access.test.ts agent-tools.read.host-operations.test.ts → host access mapping
agent-tools.read.host-tilde-expansion.test.ts agent-tools.read.host-operations.test.ts → tilde expansion
agent-tools.read.workspace-root-guard.test.ts Retained and extended with read-path normalization
agent-tools.read.workspace-root-lazy.test.ts Retained: lazy fs-root resolution
agent-tools.ring-zero-context.import-boundary.test.ts Retained: import boundary
agent-tools.ring-zero-context.test.ts agent-tools.runtime.test.ts → ring-zero tool context
agent-tools.safe-bins.test.ts Retained: safe-bin execution policy
agent-tools.sandbox-mounted-paths.workspace-only.test.ts agent-tools.workspace-paths.test.ts → tools.fs.workspaceOnly
agent-tools.schema.test.ts Retained and extended with parameter validation
agent-tools.workspace-only-false.test.ts agent-tools.workspace-paths.test.ts → FS tools with workspaceOnly=false
agent-tools.workspace-paths.test.ts Retained and extended with mounted/workspace-only paths

No 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

  • Before: node scripts/run-vitest.mjs src/agents/agent-tools*.test.ts --reporter=verbose
    • unit-fast: 3 files, 14 passing
    • agents-core: 24 files, 362 passing + 1 skipped
    • e2e: 2 files, 133 passing
    • total: 29 files, 509 passing + 1 skipped
  • After, repeated after rebasing onto fresh origin/main: same command
    • unit-fast: 1 file, 3 passing
    • agents-core: 15 files, 373 passing + 1 skipped
    • e2e: 2 files, 133 passing
    • total: 18 files, 509 passing + 1 skipped
  • Sorted verbose test-name multiset: 510 before, 510 after, empty diff.
  • Formatting: /Users/steipete/Projects/openclaw/node_modules/.bin/oxfmt src/agents/agent-tools*.test.ts
  • git diff --cached --check: passed.
  • Autoreview: Codex 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.
  • Red-main repair: node scripts/run-vitest.mjs src/plugins/cli.test.ts --reporter=verbose — 22 passing.
  • Red-main repair: focused oxlint on src/plugins/cli.test.ts — passed.
  • LOC: production +0/−0; tests +1,675/−1,795 (net −120).

@steipete
steipete marked this pull request as ready for review August 2, 2026 07:07
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Aug 2, 2026
@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 Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 3:48 AM ET / 07:48 UTC.

ClawSweeper review

What this changes

The PR consolidates OpenClaw agent-tool Vitest coverage from many narrowly scoped files into fewer thematic suites without changing production code.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This PR remains necessary: current main still has the fragmented agent-tool test layout, while the thematic consolidation exists only on this branch. Source review found no concrete regression in the moved mocks or cleanup boundaries; merge should wait for the failed exact-head lint and test-type checks to be resolved or identified as unrelated.

Priority: P3
Reviewed head: 81179d58bded45427a98989cd473d9ea55e8838e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has strong scope and equivalence evidence with no source-level defect found; exact-head CI failures still need resolution before merge.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): For this test-only refactor, the PR body provides after-change focused Vitest totals, an unchanged 510-name verbose-test multiset, formatting, and diff-check evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): For this test-only refactor, the PR body provides after-change focused Vitest totals, an unchanged 510-name verbose-test multiset, formatting, and diff-check evidence.
Evidence reviewed 6 items Current-main behavior: Current main still contains the former focused suite files, including the abort, availability, parameter, ring-zero-context, and workspace-only cases; the consolidation has not already landed.
PR-only consolidation: The PR head removes the single-purpose files and introduces thematic destinations such as the runtime, construction-routing, and host-operations suites, with no production file changes.
No later main-branch replacement: No agent-tool test paths changed between the PR base and current main, so a later rewrite has not superseded this branch.
Findings None None.
Security None None.

How this fits together

Agent-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]
Loading

Before merge

  • Resolve merge risk (P1) - The exact PR head reports failed check-lint and check-test-types checks; resolve them or establish that they are unrelated before merge.
  • Resolve merge risk (P1) - The branch is behind current main, so checks and maintainer review should be refreshed against the merge result before landing.
  • Complete next step (P2) - The protected maintainer label and unresolved exact-head check failures require normal human review rather than an automated repair dispatch.
Agent review details

Security

None.

PR surface

Tests -129. Total -129 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 19 1669 1798 -129
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 19 1669 1798 -129

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/agents/agent-tools.read.host-edit-access.test.ts, serialized state: src/agents/agent-tools.read.host-operations.test.ts, serialized state: src/agents/agent-tools.read.host-tilde-expansion.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label justifications:

  • P3: This is internal test-suite maintenance with no production or user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): For this test-only refactor, the PR body provides after-change focused Vitest totals, an unchanged 510-name verbose-test multiset, formatting, and diff-check evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. For this test-only refactor, the PR body provides after-change focused Vitest totals, an unchanged 510-name verbose-test multiset, formatting, and diff-check evidence.

Evidence

What I checked:

  • Current-main behavior: Current main still contains the former focused suite files, including the abort, availability, parameter, ring-zero-context, and workspace-only cases; the consolidation has not already landed. (src/agents/agent-tools.abort.test.ts:1, 9fd56e6d6529)
  • PR-only consolidation: The PR head removes the single-purpose files and introduces thematic destinations such as the runtime, construction-routing, and host-operations suites, with no production file changes. (src/agents/agent-tools.runtime.test.ts:1, 81179d58bded)
  • No later main-branch replacement: No agent-tool test paths changed between the PR base and current main, so a later rewrite has not superseded this branch. (src/agents/agent-tools.workspace-paths.test.ts:1, 9fd56e6d6529)
  • Mock and lifecycle review: The consolidated runtime and construction suites retain explicit mock factories, and the non-isolated agent-test runner clears mocks, globals, module cache, and mocker state between files. (test/non-isolated-runner.ts:336, 81179d58bded)
  • Feature-history provenance: Available history and blame identify Peter Steinberger as a principal recent contributor to the destination agent-tool suites; recent adjacent work also identifies Vincent Koc on central tool-construction behavior. (src/agents/agent-tools.create-openclaw-coding-tools.test.ts:1, ddf54f264b1f)
  • Exact-head check state: The provided status snapshot for head 81179d58 records failures for check-lint and check-test-types; their remote logs were unavailable to this read-only review, so no line-level patch defect is inferred from status alone. (81179d58bded)

Likely related people:

  • Peter Steinberger: Current-suite blame and available family history tie Peter to the destination agent-tool test structure beyond authorship of this PR. (role: recent area contributor; confidence: high; commits: ddf54f264b1f, 81179d58bded; files: src/agents/agent-tools.create-openclaw-coding-tools.test.ts, src/agents/agent-tools.workspace-paths.test.ts, src/agents/agent-tools.schema.test.ts)
  • Vincent Koc: Recent merged work touched central tool-construction and agent completion behavior that the consolidated suites exercise. (role: recent adjacent contributor; confidence: medium; commits: 619682ed010f, e6a96602418b; files: src/agents/agent-tools.create-openclaw-coding-tools.test.ts, src/agents/agent-tools.before-tool-call.integration.e2e.test.ts, src/agents/agent-tools.ts)

Rank-up moves

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

  • Resolve or rerun check-lint and check-test-types for the exact head, with failure output if either remains red.
  • Refresh the merge-result review after rebasing or GitHub's merge queue updates the base.

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-08-02T07:18:33.058Z sha 82af459975850e155a3d2266ca853eb04fb86096 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T07:35:43.561Z sha 82af459975850e155a3d2266ca853eb04fb86096 :: needs maintainer review before merge. :: none

@steipete steipete closed this Aug 2, 2026
@steipete steipete reopened this Aug 2, 2026
@steipete
steipete force-pushed the test/consolidate-agent-tools branch from 82af459 to 81179d5 Compare August 2, 2026 07:42
@steipete
steipete force-pushed the test/consolidate-agent-tools branch from 81179d5 to 99e3948 Compare August 2, 2026 07:50
@steipete
steipete merged commit 86a95b4 into main Aug 2, 2026
95 checks passed
@steipete
steipete deleted the test/consolidate-agent-tools branch August 2, 2026 07:58
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to yetval/openclaw that referenced this pull request Aug 2, 2026
* 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)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* test(agents): consolidate agent tool suites

* test(agents): fix consolidated suite lint

* test(plugins): remove duplicate loader mock
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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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