Skip to content

test: add MCP query-registry agent/runtime test fixture - #99815

Closed
hanZeng-08 wants to merge 4 commits into
openclaw:mainfrom
hanZeng-08:fix/99770-mcp-query-registry-test-fixture
Closed

hanZeng-08 wants to merge 4 commits into
openclaw:mainfrom
hanZeng-08:fix/99770-mcp-query-registry-test-fixture

Conversation

@hanZeng-08

@hanZeng-08 hanZeng-08 commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #99770

What Problem This Solves

Issue #99770: OpenClaw had no test fixture for MCP query-registry workflows. Without one, planner and tool-materialization regressions could silently break the expected context → list → describe → execute ordering for read-only query registries.

Why This Change Was Made

  • Added src/agents/mcp-query-registry.fixture.ts: a self-contained stdio MCP server exposing the four canonical tools (demo_context, demo_queries_list, demo_query_describe, demo_query_execute) with AUD004/CAD005 query ids.
  • The fixture enforces describe-before-execute in server state, preventing callers from skipping discovery and inventing params.
  • Added src/agents/mcp-query-registry.test.ts: five runtime integration tests using a real SessionMcpRuntime and materializeBundleMcpToolsForRun to cover catalog discovery, happy-path ordering, and negative controls (undescribed execute, missing params, unknown query id).
  • Detailed comments explain every policy decision: compact catalog, {queryId, params} shape, and why errors surface in details.status.

User Impact

No user-facing behavior change. This adds deterministic test-only coverage that protects the query-registry agent pattern from future regressions.

Evidence

node scripts/run-vitest.mjs src/agents/mcp-query-registry.test.ts --reporter=verbose
node scripts/run-oxlint.mjs src/agents/mcp-query-registry.fixture.ts src/agents/mcp-query-registry.test.ts
pnpm exec oxfmt --check --threads=1 src/agents/mcp-query-registry.fixture.ts src/agents/mcp-query-registry.test.ts

All 5 tests pass; lint and format checks pass.

Closes #99770.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This PR still needs the requested real-behavior proof, and the branch has been idle since that ask.

Close this stale, proof-deficient test PR: its current head imports a deleted test harness, manually scripts the call order it claims to protect, and has had no contributor update after the proof request.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #99770
Summary: This PR is an unproven candidate implementation for the linked open coverage request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

So I’m closing this for now to keep the review queue honest. Please reopen or open a fresh PR with real-behavior proof (a live run, logs, or a reproducible validation transcript) and it will be reviewed again.

Review details

Best possible solution:

If the linked coverage request is sponsored, implement a rebased agent-level fixture on the current MCP runtime that observes planner-selected ordering and validates each query’s required parameters.

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

Yes: current main lacks the harness imported at src/agents/mcp-query-registry.test.ts:11, so the branch cannot resolve that module after rebase.

Is this the best way to solve the issue?

No: direct scripted tool calls are not the requested planner test, and the fixture does not enforce required parameters per query.

Security review:

Security review cleared: The test-only diff adds no dependency, workflow, permission, package, or secret-handling change.

AGENTS.md: found and applied where relevant.

What I checked:

  • Deleted harness breaks the branch: The PR imports cleanupBundleMcpHarness, but that source file is absent on current main; the current supported public facade exports disposeAllSessionMcpRuntimes instead. (src/agents/mcp-query-registry.test.ts:11, fc94a8651346)
  • Removal provenance: The legacy harness was removed by the agents refactor commit, predating the PR’s current head. (src/agents/agent-bundle-mcp-test-harness.ts, 3a55f8d8009a)
  • Planner behavior is not exercised: The happy-path test directly invokes each materialized tool in the desired sequence, so it cannot detect a regression in an agent planner’s tool choice or ordering. (src/agents/mcp-query-registry.test.ts:100, fc94a8651346)
  • Per-query parameters remain unchecked: The fixture accepts a passthrough params object and the negative test omits the whole envelope; an empty params object for AUD004 would reach the handler without validating filial and data. (src/agents/mcp-query-registry.test.ts:188, fc94a8651346)
  • Existing production-boundary coverage: Current main already has an agent-bundle MCP runtime integration test and a packaged Docker client that exercise a real stdio MCP server through the current runtime and materialization modules. (src/agents/agent-bundle-mcp-runtime.agent-bundle.test.ts:14, 72d55fc12a47)
  • Proof and inactivity: The PR has carried the needs-proof label since 2026-07-04, the head is unchanged since that date, and the body only asserts test commands passed without an inspectable after-fix transcript or artifact.

Likely related people:

  • Sliverp: Current main’s public MCP runtime facade was last refactored in this commit, including the supported teardown export. (role: recent runtime-facade contributor; confidence: medium; commits: 84c7d45f15cd; files: src/agents/agent-bundle-mcp-tools.ts)
  • Vincent Koc: This refactor removed the harness the PR still imports. (role: legacy test-surface refactor author; confidence: high; commits: 3a55f8d8009a; files: src/agents/agent-bundle-mcp-test-harness.ts)

Codex review notes: model internal, reasoning high; reviewed against 72d55fc12a47.

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 4, 2026
@hanZeng-08 hanZeng-08 changed the title Fix/99770 mcp query registry test fixture test: add MCP query-registry agent/runtime test fixture Jul 4, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jul 4, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 23, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test fixture: agent execution over MCP query-registry tools

1 participant