fix(eve): return tool errors as execute results - #108
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
HugoRCD
force-pushed
the
fix/eve-tool-error-result
branch
from
August 26, 2026 09:38
a8a9a4d to
ff448b0
Compare
Eve's tool-loop logs thrown execute errors without always appending a tool_result, which Anthropic rejects as MODEL_CALL_FAILED. Return { error } so the pairing stays intact.
HugoRCD
force-pushed
the
fix/eve-tool-error-result
branch
from
August 26, 2026 09:41
ff448b0 to
1a5cca3
Compare
…runGithubToolStep` returns `{ error }`, and `listPullRequestFilesToModelOutput` calls `.map` on that object, throwing `TypeError: files.map is not a function` inside model-output formatting.
This commit fixes the issue reported at packages/github-tools/src/eve/steps.ts:28
## Bug
`runGithubToolStep` (`packages/github-tools/src/eve/steps.ts`) was changed to catch execute failures and return an error payload instead of throwing:
```ts
} catch (error) {
return { error: error instanceof Error ? error.message : String(error) }
}
```
Both eve wiring paths pass the `execute` return value into `toModelOutput`:
* `build.ts` (`buildEveToolDefinition` / `buildEveToolMap`): `toModelOutput: (output) => formatGithubEveToolOutput(name, output)`
* `executeGithubEveTool` (used by `@github-tools/eve-extension`) returns the same `runGithubToolStep` result, which eve then feeds to `toModelOutput`.
`formatGithubEveToolOutput` (`registry.ts`) strips `rateLimit` then dispatches to a per-tool formatter. `stripRateLimit({ error })` leaves the object unchanged (no `rateLimit` key). For `listPullRequestFiles` it dispatches to `listPullRequestFilesToModelOutput` (`core/model-output.ts`):
```ts
export function listPullRequestFilesToModelOutput({ output }) {
const files = output as ListPullRequestFilesOutput
return { type: 'json', value: truncatePatchFields(files) } // files.map(...)
}
```
**Trigger:** any failed `listPullRequestFiles` call (e.g. GitHub 404/403, network error). The failure produces `output = { error: '...' }`, an object, so `truncatePatchFields(files)` → `files.map(...)` throws `TypeError: files.map is not a function`. This throws *inside model-output formatting*, re-breaking the tool loop and defeating the whole point of returning a payload (preserving `tool_use`/`tool_result` pairing).
The other array formatters (`getCommit`, `compareCommits`, `getPullRequestContext`) guard `files` with a ternary, and `getFileContent` guards with `'content' in result`, so `listPullRequestFiles` is the one that crashes on the top-level payload. (The others would still return an error payload verbatim, but wouldn't crash.)
## Fix
Short-circuit in `formatGithubEveToolOutput` — the single dispatch point shared by all paths — when the (rate-limit-stripped) output is an `{ error: string }` payload, returning it as `{ type: 'json', value }` without running the success-shaped formatter:
```ts
if (isErrorPayload(stripped)) {
return { type: 'json', value: stripped }
}
```
`isErrorPayload` matches a non-array object with a string `error` field. This is safe because none of the GitHub tool success outputs carry a top-level `error: string` field. Typecheck (`tsc --noEmit`) passes.
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: HugoRCD <hugo.richard@vercel.com>
Merged
3 tasks
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.
Summary
executenow returns{ error }on failure instead of throwing.tool execution failed) but does not always append atool_result, so the next model call dies withMODEL_CALL_FAILED(tool_usewithouttool_result).Stacked on the Connect OIDC PR (this branch →
fix/connect-oidc-env-token→evl-343→main).Approval deny and the stale World
Event id is not slot-numberedspam are still eve/world-local — not fixable in this repo.Test plan
pnpm --filter @github-tools/sdk testexamples/eveand confirm the turn continues with{ error }instead ofMODEL_CALL_FAILED