mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
Fixes #11803. **Problem** `tool_search` builds a tool's search text from its parameter schema but never followed `$ref`. MCP servers (Pydantic, FastMCP) often put nested models in `$defs`: ```json { "properties": { "options": { "$ref": "#/$defs/options" } }, "$defs": { "options": { "properties": { "mode": { "description": "reconciliation" } } } } } ``` Search text was `Inspect records options`, so `tool_search("reconciliation")` found nothing. Durable's copy of `tool_search` had the same gap. The codemode `resolves to` summary had the same blind spot for output schemas: a field behind a `$ref` showed as `structuredContent?` with no field names. **Fix** - pi-codemode exports its existing local JSON Pointer resolver as `resolveSchemaRef(ref, root)`. A malformed percent escape now resolves to nothing instead of throwing `URIError` (this also affected `schemaToType()`). - coding-agent and Durable `schemaText()` follow local `$ref`s. Each referenced subschema is read once, so recursive and shared definitions neither loop nor inflate BM25 term counts. Unreferenced `$defs` and remote refs stay out. - coding-agent `describeFields()`/`describeUnionFields()` resolve `$ref` chains against the output schema root. **Tests** - `packages/codemode/test/declarations.test.ts`: escaped, remote, missing, malformed refs. - `packages/coding-agent/test/tool-search.test.ts`: refs, escaped segments, recursion and shared definitions, unused definitions. - `packages/coding-agent/test/suite/agent-session-codemode.test.ts`: summary through root, field, const, and union refs. - `packages/durable/test/tool-search.test.ts`: end-to-end load via a ref'd description; unused definition does not match. `npm run check` passes. |
||
|---|---|---|
| .. | ||
| regressions | ||
| agent-session-bash-persistence.test.ts | ||
| agent-session-boundaries.test.ts | ||
| agent-session-codemode.test.ts | ||
| agent-session-compaction-model-overrides.test.ts | ||
| agent-session-compaction.test.ts | ||
| agent-session-mcp-oauth.test.ts | ||
| agent-session-mcp.test.ts | ||
| agent-session-model-extension.test.ts | ||
| agent-session-prompt.test.ts | ||
| agent-session-queue.test.ts | ||
| agent-session-retry-events.test.ts | ||
| agent-session-runtime.test.ts | ||
| agent-session-tool-orchestration.test.ts | ||
| agent-session-tool-result-images.test.ts | ||
| harness.ts | ||
| lax-message-content.test.ts | ||
| mcp-oauth-server.ts | ||
| README.md | ||
| virtual-models.test.ts | ||
Coding agent suite tests
Use test/suite/ for the new harness-based test suite around AgentSession and AgentSessionRuntime.
Rules:
- Use
test/suite/harness.ts - Use the faux provider from
packages/ai/src/providers/faux.ts - Do not use real provider APIs, real API keys, network calls, or paid tokens
- Keep these tests CI-safe and deterministic
- Do not use or extend the legacy
test/test-harness.tspath unless a missing capability forces it