feat: add clientOptions validation for LLM configurations with tests#22
Open
kokatesaurabh wants to merge 3 commits intodanny-avila:mainfrom
Open
feat: add clientOptions validation for LLM configurations with tests#22kokatesaurabh wants to merge 3 commits intodanny-avila:mainfrom
kokatesaurabh wants to merge 3 commits intodanny-avila:mainfrom
Conversation
Author
|
hey @danny-avila can u review it! i would like to contribute |
Author
|
hello @danny-avila can u review it |
danny-avila
added a commit
that referenced
this pull request
May 5, 2026
… (Codex P1 #22, P2 #23) P1 #22 (LocalExecutionEngine.ts): `buildSandboxRuntimeConfig` is part of the public exports and its return type referenced `SandboxRuntimeConfig` from `@anthropic-ai/sandbox-runtime` — an OPTIONAL peer dep. Generated `.d.ts` then imported the optional peer, so type-checking failed for any downstream consumer that didn't install it (even when they never enabled local sandboxing). Replaced the return type with a structural `BuiltSandboxRuntimeConfig` interface defined locally; the runtime call site to `SandboxManager.initialize()` casts at the boundary, which is the one place the peer is actually loaded. P2 #23 (LocalCodingTools.ts): grep_search's ripgrep branch ignored `exitCode` and reported `matches: 0` on real `rg` errors — same bug glob_search had until P2 #13 fixed it. Now mirrors the glob_search fix: checks `result.timedOut` and `result.exitCode > 1` (rg's "real error" exit, distinct from exit 1 which means "no matches"); on failure returns `grep_search failed: <stderr>` plus an artifact with `{ matches: 0, engine: 'ripgrep', error, exitCode }` so the agent sees the failure explicitly. Test pinned mirroring the glob_search test pattern (injected fake-rg backend).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces validation logic for clientOptions in LLM configurations to ensure correctness and consistency across the codebase.
Key Changes
src/utils/llm.ts
Added validateClientOptions utility to validate LLM clientOptions against provider-specific rules.
src/run.ts
Integrated validateClientOptions into the Run class, ensuring all graphs are initialized with validated client options.
src/specs/llm.utils.test.ts (new file)
Added comprehensive unit tests for validateClientOptions covering valid and invalid client options.
Why this is needed
Prevents misconfiguration of LLM client options (e.g., unsupported params for a given provider).
Improves stability and developer experience by catching errors early.
Provides test coverage for future maintainability.
Testing
All new tests in src/specs/llm.utils.test.ts pass successfully.
Existing test suite continues to pass without regressions.