Skip to content

fix: validate tool_use input and improve runtime robustness#579

Merged
FL4TLiN3 merged 2 commits intomainfrom
fix/validate-tool-use-input-and-improvements
Feb 19, 2026
Merged

fix: validate tool_use input and improve runtime robustness#579
FL4TLiN3 merged 2 commits intomainfrom
fix/validate-tool-use-input-and-improvements

Conversation

@FL4TLiN3
Copy link
Contributor

Summary

  • Validate tool_use input: Add ensureRecord helper to safely coerce unknown tool call inputs to Record<string, unknown>, preventing "Input should be a valid dictionary" API errors when the AI SDK returns invalid inputs (strings, nulls, etc.). Applied at both entry point (classifyToolCalls) and API exit point (toolCallPartToCoreToolCallPart) as defense-in-depth.
  • Fix contextWindowUsage calculation: Use per-call usage instead of cumulative usage when computing context window utilization in generating-tool-call, generating-run-result, and machine states.
  • Async job storage: Make storeJob/retrieveJob async for non-blocking filesystem I/O across runtime, filesystem, and delegation-executor packages.
  • Simplify TUI execution lifecycle: Remove continueTimeoutMs and exit timeout logic; use useRun's isComplete for cleaner completion detection.
  • Improve create-expert testing guide: Add practical verification steps (artifact checks, quality evaluation) to the create-expert instruction.
  • SkillManager delegate improvements: Persist dynamically added/removed delegates in expert definitions and validate delegate existence before expert creation.

Test plan

  • pnpm typecheck — all 23 packages pass
  • pnpm test — all 1107 tests pass (including 9 new ensureRecord tests)
  • pnpm format-and-lint — no new warnings

🤖 Generated with Claude Code

@FL4TLiN3 FL4TLiN3 force-pushed the fix/validate-tool-use-input-and-improvements branch from ba24579 to 62c5245 Compare February 19, 2026 05:00
- Fix contextWindowUsage calculation to use per-call usage instead of
  cumulative usage
- Make storeJob/retrieveJob async for non-blocking filesystem I/O
- Remove continueTimeoutMs from TUI execution, use useRun's isComplete
  for cleaner completion detection
- Improve create-expert testing guide with practical verification steps
- Add delegate persistence and validation in SkillManager
- Remove stopRunByDelegate from STOP_EVENT_TYPES

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@FL4TLiN3 FL4TLiN3 force-pushed the fix/validate-tool-use-input-and-improvements branch from 0c7572c to fce4e3a Compare February 19, 2026 05:05
@FL4TLiN3 FL4TLiN3 merged commit 869ca03 into main Feb 19, 2026
11 checks passed
@FL4TLiN3 FL4TLiN3 mentioned this pull request Feb 19, 2026
@FL4TLiN3 FL4TLiN3 deleted the fix/validate-tool-use-input-and-improvements branch February 25, 2026 13:35
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