Repository navigation
test(coderd/x/chatd/chatloop): cover provider tool runners in ExecuteLocalTools - #30937
Conversation
…LocalTools No test ran a ProviderTool runner through ExecuteLocalTools, so runner dispatch, the active-tool bypass for runners, and result metadata attachment were uncovered. Add one test that runs a runner call next to a provider-executed call and checks the runner's result and metadata.
|
@codex review
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review
|
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Adds
TestExecuteLocalTools_ProviderToolRunner. No test ran aProviderToolrunner (the local half of a provider-defined tool, such as OpenAI computer use) throughExecuteLocalTools, so nothing checked runner dispatch, the active-tool exemption for runners, result metadata, or the skip of provider-executed calls. #30938 rewrites that code, so this PR pins the behavior first.The test sends a runner call and a provider-executed
web_searchcall. The runner is in neitherToolsnorActiveTools. The test checks that only the runner call gets a result, and that the result has the runner's output and itsResultProviderMetadata.Why it can fail
Each mutant is
chatloop.gowith one change, run withgo test -overlay. Each one fails the new test, and all otherchatlooptests pass with it.Tool not found: computerTool not active in this turn: computerResultProviderMetadatais not attachedProviderExecutedfilters are removedRemoving only one of the two
ProviderExecutedfilters, inExecuteLocalToolsor inexecuteTools, fails no test, because the other filter still runs. #30938 deletes the one inexecuteTools.go test ./coderd/x/chatd/also passes with runners left out of the tool map and the metadata attachment removed. Its subtestTestActiveServer_ToolExecutionAndPolicy/provider_runner_executes_and_preserves_metadatareplays a stored computer-use call and result; it does not run the runner.Validation
go test -race -count=1 ./coderd/x/chatd/chatloop/passes.golangci-lint run ./coderd/x/chatd/chatloop/...reports 0 issues, and the pre-commit hook passed.Stack
This stack replaces the 20-parameter
executeToolsand the 15-parameterexecuteSingleToolinchatloopwith methods on onetoolBatchtype, and resolves tool name aliases in one place. Production behavior does not change.ExecuteLocalToolsexecuteToolsandexecuteSingleToolwithtoolBatchtoolBatchmethod