Repository navigation
fix(agent-service): classify error-prefixed tool results as failed - #9259
Conversation
|
👋 Thanks for your first contribution to Texera, @oliarmak-web! If you're looking for a good place to start, browse issues labeled You can drive common housekeeping yourself by commenting one of these commands on its own line:
Each command must match exactly: |
Backport auto-label reportThis
|
Automated Reviewer SuggestionsBased on the
|
|
/request-review @bobbai00 |
|
/request-review @yrenat |
bobbai00
left a comment
There was a problem hiding this comment.
🔴 1 must-fix · 1 advisory · 0 polish: fixes the [ERROR] case from #9120; tool calls the SDK rejects still show as succeeded.
Correctness (1)
agent-service/src/agent/texera-agent.ts:587: SDK-rejected tool calls never get a result, so they still render as succeeded (must-fix, see inline)
Simplifications (1)
agent-service/src/agent/texera-agent.ts:591: inline[ERROR]prefix and a producer-less object branch; use one shared predicate (advisory, see inline)
Verification trace
Traced ai 7.0.58: StepResult.toolResults keeps only tool-result parts, and generateText records a call that fails input validation or names an unregistered tool as an invalid tool call plus a tool-error part. Reproduced on this branch with the spec's MockLanguageModelV4: modifyOperator without summary and deleteOperator with {} each leave toolResults: [] and render (succeeded) on the next turn, and in delegate mode the rejected modifyOperator still triggers /api/execution/7/0/run. The PR's own suite passes locally at the head (313/313, tsc --noEmit and prettier clean); the CI build workflows are still awaiting approval.
|
Implemented the requested follow-up in
Validation:
/request-review @bobbai00 |
|
Removing release/v1.2: agent context quality, not a data defect. |
8a34611 to
a35e1ab
Compare
|
Thanks, @xuang7, for clarifying the v1.2 backport decision. Rebased onto current main and resolved the conflicts in Validation: @bobbai00, could you take another look at the updated branch? Comment written by OpenAI Codex on the account owner’s behalf. |
bobbai00
left a comment
There was a problem hiding this comment.
🔴 2 resolved · 0 open · 4 new (4 new = 4 newly introduced · 0 late catches): both round-1 findings are fixed; one new must-fix.
Correctness (2)
agent-service/src/agent/texera-agent.ts:604: thrown tool errors are stored as objects and render as{}(must-fix, see inline)agent-service/src/agent/util/context-utils.ts:127: a call the SDK never ran still reads(succeeded)(advisory, see inline)
Simplifications (1)
agent-service/src/agent/texera-agent.ts:605: the[ERROR]fallback and its #9120 test are now redundant (advisory, see inline)
Polish: 1 quick touch-up (see inline comments).
Verification trace
Checked against ai 7.0.173 at this head. Rejected calls (modifyOperator without summary, an unregistered tool, deleteOperator with {}) now read (failed) with the SDK's message and trigger no delegate run. A tool that throws keeps the raw Error: Stop during a delegate-mode executeOperator shows Error: {} on the next turn, and the suggested change at line 604 shows The operation was aborted. instead. bun test (344/344), tsc --noEmit and prettier pass at this head and with the change; CI builds still await approval.
|
Addressed all four round-2 comments in
Validation: @bobbai00, could you review the updated branch? Comment written by OpenAI Codex on the account owner’s behalf. |
bobbai00
left a comment
There was a problem hiding this comment.
🟡 4 resolved · 0 open · 2 new (2 new = 1 newly introduced · 1 late catch): all four round-2 findings are fixed; two optional touch-ups remain.
Simplifications (1)
agent-service/src/agent/util/context-utils.ts:153: a rejected call's whole input stays in every later prompt (advisory, see inline)
Polish: 1 quick touch-up (see inline comments).
Verification trace
Checked at this head against ai 7.0.173. Stop during a delegate-mode executeOperator now reaches the next turn as - executeOperator (failed) with The operation was aborted., a complete call under finish reason length reads (failed), and SDK-rejected calls are unchanged. Reverting either fix fails the new tests (2 and 4 failures). bun test (347/347), tsc --noEmit and prettier pass; CI builds still await approval.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9259 +/- ##
=========================================
Coverage 91.61% 91.61%
Complexity 5047 5047
=========================================
Files 1284 1284
Lines 57036 57045 +9
Branches 7420 7420
=========================================
+ Hits 52251 52260 +9
Misses 2914 2914
Partials 1871 1871
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Could you confirm which tests or agent workflows exercise #9259, and whether it has reached a release? If you have observed error-prefixed tool results being handled correctly because of this fix, could you share a concrete example or public reference? Comment prepared with OpenAI Codex assistance and posted on the account owner’s behalf. |
…pache#9259) ### What changes were proposed in this PR? Tool failures returned as `[ERROR]` strings and SDK-generated `tool-error` parts must be persisted as failures so subsequent agent turns receive the correct status. This change builds stored results from step content, matches results to calls by `toolCallId`, and reuses normalized failure status to prevent delegate execution after rejected modifications. A shared `isErrorResult` predicate keeps string classification beside `createErrorResult`. Thrown errors are stored as readable messages so they survive JSON snapshots and appear in subsequent context. Calls without a recorded result are marked failed. History formatting uses the normalized `isError` flag. Regression coverage includes error-prefixed output, SDK-rejected calls, reordered results, throwing tools (Error, string and null values), length-limited calls that never execute, and suppression of execution after rejected modifications. ### Any related issues, documentation, discussions? Closes apache#9120 Related: apache#9244, whose tool-history presentation relies on accurate persisted failure status. ### How was this PR tested? From `agent-service`: - `bun test`: 347 passed, 0 failed - `bun run typecheck`: passed - `bun run format:check`: passed - `git diff --check`: passed The new behavior assertions reproduced the failures before the production fix. Validation used Bun 1.3.3 and the repository’s frozen lockfile. The full test run required local socket access for the server tests. GitHub CI results remain separate from these local checks. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex
What changes were proposed in this PR?
Tool failures returned as
[ERROR]strings and SDK-generatedtool-errorparts must be persisted as failures so subsequent agent turns receive the correct status. This change builds stored results from step content, matches results to calls bytoolCallId, and reuses normalized failure status to prevent delegate execution after rejected modifications. A sharedisErrorResultpredicate keeps string classification besidecreateErrorResult.Thrown errors are stored as readable messages so they survive JSON snapshots and appear in subsequent context. Calls without a recorded result are marked failed. History formatting uses the normalized
isErrorflag.Regression coverage includes error-prefixed output, SDK-rejected calls, reordered results, throwing tools (Error, string and null values), length-limited calls that never execute, and suppression of execution after rejected modifications.
Any related issues, documentation, discussions?
Closes #9120
Related: #9244, whose tool-history presentation relies on accurate persisted failure status.
How was this PR tested?
From
agent-service:bun test: 347 passed, 0 failedbun run typecheck: passedbun run format:check: passedgit diff --check: passedThe new behavior assertions reproduced the failures before the production fix. Validation used Bun 1.3.3 and the repository’s frozen lockfile. The full test run required local socket access for the server tests. GitHub CI results remain separate from these local checks.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex