mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2397] [MERGED] Feed agent tool-call errors back to the model instead of aborting the run #5578
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#5578
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2397
Author: @Romuromylus
Created: 6/6/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Romuromylus
Base:
refactor← Head:fix/agent-tool-error-feedback📝 Commits (2)
96cc39eFeed agent tool-call errors back to the model instead of aborting the rune1c53fcMark Spotify play as called only after it succeeds so the fallback still runs📊 Changes
1 file changed (+26 additions, -6 deletions)
View changed files
📝
src/engine/agents-runtime/executor/agent-executor.ts(+26 -6)📄 Description
Linked issue
Closes #2322
Why this change
AgentResult, so a single recoverable tool failure aborted the entire agent turn. The success path already feeds tool results back to the model, and the main generation tool loop (start-generation.ts:3499-3521) already feeds errors back for self-correction — the agent loop was the lone inconsistency.What changed
executeAgentWithTools(src/engine/agents-runtime/executor/agent-executor.ts), a thrown tool error is now pushed back as arole: "tool"message{ error }with the originaltool_call_id, letting the model self-correct within the existingMAX_TOOL_ROUNDS. Cancellation still aborts: a newisAgentCancellationhelper re-throws whensignal.abortedorerr.name === "AbortError".JSON.stringify({ error })(byte-identical tostringifyToolResult({ error })) to avoid an agents-runtime → generation dependency.Refactor impact
Primary owner: engine generation (agents-runtime)
Impact areas reviewed:
src/engine/agents-runtime/executor/agent-executor.ts(executeAgentWithToolstool loop +isAgentCancellation)Boundary notes:
Pressure points touched:
Validation
pnpm checkpasses before PR push/handoffManual verification notes
pnpm vitest run src/engine/agents-runtime/executor/agent-executor.test.ts— 4 passed (2 new, run locally): a thrown tool error is fed back as arole: "tool"message containing the error and the turn still succeeds; a cancellation (AbortError+ aborted signal) propagates instead of being swallowed.pnpm exec tsc -b— clean.pnpm exec eslint …agent-executor.ts— clean.Feature Discoverability
src/features/shell/discovery/Reason:
Docs and release impact
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.