Skip to content

test: send real agent turns through AIMock; fix empty tool results - #59

Merged
hamchowderr merged 1 commit into
mainfrom
claude/project-thread-vhqpgy
Oct 24, 2026
Merged

hamchowderr merged 1 commit into
mainfrom
claude/project-thread-vhqpgy

Conversation

@hamchowderr

Copy link
Copy Markdown
Owner

Requested by Chowderr · project thread

Before: AIMock started on every test run, but no active test sent a model call to it. The one agent test was skipped, and the default models go through the Vercel AI Gateway, which AIMock can't mock. Five custom tools also returned their summary to the model in a field the AI SDK ignores, so after search_history, create_dashboard, save_document, preview_app or create_automation ran, the model saw an empty tool result.

After: four History agent turns run end to end through AIMock: a plain reply, a tool round trip, PII redaction and a provider error. Those tests caught the empty-result bug, which is now fixed in all five tools, and a unit test pins the correct output shape.

How:

  • tests/helpers/aimock.ts points agents at direct anthropic/... model ids with a dummy key, and reads AIMock's request journal so tests can check what was sent.
  • New fixtures are in tests/fixtures/aimock/agent-turns.json. aimock.json and the older fixtures now use Foreman's real tool names and the SDK's parameter names.
  • In the five tools, toModelOutput now returns { type: "text", value } instead of { type: "text", text }.
  • Cleanup:
    • Removed the skipped provider-swap test.
    • Removed the AIMock lines in the web Playwright config, which pointed at files that don't exist.
    • Removed the upstream annotations issue draft, since that bug is fixed upstream.
    • Raised the AIMock floor to ^1.45.1, the version already locked.
  • Added two lines to rules/testing-and-db.md on both points.

Checks: npm test (562 passed), tsc for agents and web, Biome, and verify:aimock. The new tests fail on main and pass here.


Generated by Claude Code

AIMock started on every test run but no active test sent a model call to
it: the one agent test was skipped, and default models go through the
Vercel AI Gateway, which AIMock can't mock.

- tests/helpers/aimock.ts points agents at direct anthropic/ ids with a
  dummy key and reads AIMock's request journal.
- agent-turns.test.ts runs History agent turns end to end: plain reply,
  a tool round trip, PII redaction and a provider error.
- Those tests caught a real bug: five custom tools returned
  { type: "text", text } from toModelOutput. The AI SDK reads `value`,
  so the model always got an empty tool result. Fixed in search_history,
  create_dashboard, save_document, preview_app and create_automation,
  with a unit test pinning the shape.
- aimock.json and fixtures now use Foreman's real tool names and SDK
  parameter names.
- Remove the skipped provider-swap test, the AIMock lines in the web
  Playwright config that pointed at missing files, and the upstream
  annotations issue draft (fixed upstream). Raise the AIMock floor to
  ^1.45.1, the version already locked.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YaNZt6oJYNXatfpSYMnNp5
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
foreman Ready Ready Preview Oct 20, 2026 2:19pm UTC

Request Review

@hamchowderr hamchowderr self-assigned this Oct 20, 2026
@hamchowderr
hamchowderr marked this pull request as ready for review October 20, 2026 14:21
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-20T14:21:28.756989Z 85a7f69 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@hamchowderr
hamchowderr merged commit ea9f064 into main Oct 24, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview — 85a7f694 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants