Adds `TestExecuteLocalTools_ProviderToolRunner`. No test ran a
`ProviderTool` runner (the local half of a provider-defined tool, such
as OpenAI computer use) through `ExecuteLocalTools`, 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_search` call.
The runner is in neither `Tools` nor `ActiveTools`. The test checks that
only the runner call gets a result, and that the result has the runner's
output and its `ResultProviderMetadata`.
## Why it can fail
Each mutant is `chatloop.go` with one change, run with `go test
-overlay`. Each one fails the new test, and all other `chatloop` tests
pass with it.
| Mutant | New test fails with |
|---|---|
| Runners are not added to the tool map | `Tool not found: computer` |
| Runners are not exempt from the active-tool check | `Tool not active
in this turn: computer` |
| `ResultProviderMetadata` is not attached | nil metadata |
| Provider tools without a runner are not skipped | nil pointer panic |
| Both `ProviderExecuted` filters are removed | 2 results |
Removing only one of the two `ProviderExecuted` filters, in
`ExecuteLocalTools` or in `executeTools`, fails no test, because the
other filter still runs. #30938 deletes the one in `executeTools`.
`go test ./coderd/x/chatd/` also passes with runners left out of the
tool map and the metadata attachment removed. Its subtest
`TestActiveServer_ToolExecutionAndPolicy/provider_runner_executes_and_preserves_metadata`
replays 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 `executeTools` and the 15-parameter
`executeSingleTool` in `chatloop` with methods on one `toolBatch` type,
and resolves tool name aliases in one place. Production behavior does
not change.
1. #30937 Cover provider tool runners in `ExecuteLocalTools`
2. #30938 Replace `executeTools` and `executeSingleTool` with
`toolBatch`
3. #30939 Resolve tool name aliases in one `toolBatch` method
> Xum, an AI agent, opened this PR for @ibetitsmike and wrote this
description.