Skip to content

test(ai): cover run_subagent tool - #1069

Open
mydd7 wants to merge 1 commit into
crynta:mainfrom
mydd7:test/coverage-14
Open

test(ai): cover run_subagent tool#1069
mydd7 wants to merge 1 commit into
crynta:mainfrom
mydd7:test/coverage-14

Conversation

@mydd7

@mydd7 mydd7 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What

Adds a unit test for the run_subagent AI tool, the last untested tool on the AI
tool surface. Test-only.

Why

With the earlier fs, edit, terminal, shell, agent, context and todo tool PRs,
run_subagent was the only tool in src/modules/ai/tools/ without a test.

How

Follows the established vi.hoisted mock pattern: runSubagent and the chat
store are mocked so the test exercises the tool's result mapping and error
handling.

Locked behavior:

  • Success maps the subagent result fields (summary, stepCount, durationMs)
    alongside the requested type and description.
  • A failing subagent yields an error result carrying the type, instead of
    throwing.

Testing

Ran the full suite plus type-check and lint locally on Windows.

  • pnpm lint clean (unchanged: 103 pre-existing warnings, none introduced)
  • pnpm check-types clean
  • pnpm test clean (the new suite passes; see reviewer note on one
    pre-existing suite)
  • Manual smoke-test of the affected feature - N/A, test-only, no runtime change
  • (If you touched src-tauri/) cargo clippy - N/A, no Rust changes
  • (If you touched src-tauri/) cargo nextest - N/A, no Rust changes
  • (If you changed a #[tauri::command] signature) - N/A
  • (If UI) tested in pnpm tauri dev - N/A, no UI change
  • Platforms tested: Windows
  • Shells tested (if relevant): N/A

Screenshots / GIFs

N/A - no UI change.

Notes for reviewer

  • Test-only. No public API, behavior, dependency, or config change.
  • Branched a couple of commits behind current main on purpose (my token lacks
    the workflow scope). Only adds a new file; should merge cleanly.
  • Same unrelated pre-existing failure noted before: src/app/eager-budget.test.ts
    fails locally under Windows with git core.autocrlf=true; the committed blob is
    LF and it passes on CI.

run_subagent is the last untested tool on the AI tool surface. Lock that it maps the subagent result fields (summary, stepCount, durationMs) alongside the requested type and description on success, and that a failing subagent yields an error result carrying the type instead of throwing.
@mydd7
mydd7 requested a review from crynta as a code owner July 28, 2026 22:07
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mydd7, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d877835d-5d83-4d99-8bb4-44ef4fc85e5c

📥 Commits

Reviewing files that changed from the base of the PR and between 2141d16 and 46c684f.

📒 Files selected for processing (1)
  • src/modules/ai/tools/subagent.test.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant