Skip to content

feat: add clientOptions validation for LLM configurations with tests#22

Open
kokatesaurabh wants to merge 3 commits intodanny-avila:mainfrom
kokatesaurabh:main
Open

feat: add clientOptions validation for LLM configurations with tests#22
kokatesaurabh wants to merge 3 commits intodanny-avila:mainfrom
kokatesaurabh:main

Conversation

@kokatesaurabh
Copy link
Copy Markdown

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.

@kokatesaurabh kokatesaurabh changed the title src/specs/llm.utils.test.ts feat: add clientOptions validation for LLM configurations with tests Sep 22, 2025
@kokatesaurabh
Copy link
Copy Markdown
Author

hey @danny-avila can u review it! i would like to contribute

@kokatesaurabh
Copy link
Copy Markdown
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).
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