fix(agent-manager): make tool requests strict - #13197
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Both previous findings were addressed in the latest commit: Files Reviewed (3 files)
Previous Review Summary (commit db0784b)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit db0784b)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
The strict discriminated-union approach is sound: Files Reviewed (4 files)
Reviewed by kimi-k3 · Input: 134.5K · Output: 6.5K · Cached: 214.6K Review guidance: REVIEW.md from base branch |
Agent Manager tool requests currently flatten start and management operations into one object with optional fields. That makes it easy for a model to send a mixed payload and rely on action precedence, which can dispatch an unintended operation or fail provider-side schema validation.
Use a strict discriminated union for start, list, prompt, stop, and move requests. Each branch advertises only its operation-specific fields, rejects unknown or mixed fields at runtime, and preserves null as the explicit move target for unassigning a worktree. The provider-facing schema omits the incompatible prefix-only session ID pattern while retaining runtime validation.
Add focused coverage for generated branch schemas, valid operations, invalid session IDs, mixed payload rejection, and dispatch protection.