Repository navigation
feat(frontend, agent-service): report user runs to the agent - #9423
Draft
eugenegujing wants to merge 1 commit into
Draft
eugenegujing wants to merge 1 commit into
eugenegujing wants to merge 1 commit into
Conversation
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9423 +/- ##
============================================
+ Coverage 91.78% 91.81% +0.02%
Complexity 5023 5023
============================================
Files 1283 1284 +1
Lines 56875 57086 +211
Branches 7442 7468 +26
============================================
+ Hits 52205 52412 +207
- Misses 2800 2802 +2
- Partials 1870 1872 +2
*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:
|
The frontend sends a lastRun report with each prompt when the last run was started by the user from this browser and has either finished or, while still in flight, logged an operator error, carrying its errors and each operator's state and row counts. The agent service validates it and renders it in the context until the agent starts a run of its own in that turn, and two prompt rules tell the model to explain a user's run error before changing anything and to read the row counts when a result is empty.
eugenegujing
force-pushed
the
feat/agent-run-errors
branch
from
November 14, 2026 02:06
0066889 to
f6166e1
Compare
eugenegujing
marked this pull request as draft
November 16, 2026 20:39
This branch has not been deployed
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.
What changes were proposed in this PR?
The agent only knew about operators it executed itself through
executeOperator. When the user clicked Run, the agent learned nothing about that run, so it could not answer "why did this fail?" or "why is my result empty?". This PR sends a report on the user's last run with each prompt.How the report travels
sequenceDiagram actor U as User participant B as Browser participant CU as Computing unit participant A as Agent service participant M as LLM U->>B: Click Run B->>CU: Execute request CU-->>B: Initializing Note over B: trackRunOrigin marks the run as the user's CU-->>B: State, errors, row counts U->>B: "Why did this fail?" Note over B: buildLastRunReport rect rgba(46, 160, 67, 0.15) B->>A: Prompt + lastRun Note over A: parseLastRun validates the report A->>M: Context with the Last Run lines end M-->>A: Explanation A-->>B: AnswerIn the UI. A three-operator workflow whose last operator sleeps two seconds per row. The user ran it, stopped it, and asked the agent about the run.
mainScore ordersas not executed, 0 rows. The canvas shows 18 rows in and 17 out.Score orders, the numbers on the canvas.Size and reading order
491 lines of code in 11 files, and 2,257 lines of tests in 8 spec files. The code reads best in the order the report travels.
agent-types.ts(frontend),types/execution.ts,types/ws/client.tsexecute-workflow.service.tstrackRunOrigin)agent.service.ts,workflow-console.service.tslast-run.ts,server.tstexera-agent.ts,context-utils.tsprompts.tsThe agent now sees, under each operator in the dataflow section of its context
and after the operators a
## Last Runblock with the run state, the errors that belong to no operator, and the errors of operators the agent's copy of the workflow does not have.When the frontend attaches a report
Running (not finished)The same rules, and what happens to the report afterwards
flowchart TB ask[The user sends a prompt] --> mine{"Was the run on screen<br/>requested from this browser?"} mine -- no --> none[No report] mine -- yes --> state{Run state} state -- "Completed, Failed,<br/>Killed, Terminated" --> attach[Report attached] state -- "in flight, an operator<br/>has logged an error" --> attach state -- "in flight with no error,<br/>or not started" --> none attach --> ctx["assembleContext renders it<br/>under each operator and in Last Run"] ctx --> own{"Does the agent start<br/>a run of its own this turn?"} own -- no --> keep[Report stays in the context] own -- yes --> drop[Dropped for the rest of the turn]In the report an operator's entry is its fatal error, or else its last ERROR console message, the way the AI Fix tab reads it. Fatal errors the backend files under
"unknown operator"(ErrorUtils.getOperatorFromActorIdOpt(None)in the run's error handler, setup failures inWorkflowWebsocketResource, a lost cluster node) go to a workflow-level list. A long message keeps its first 1500 and last 500 characters. The row counts were suggested by @zyratlo in #9377.How the frontend knows the run is the user's
The browser shows the latest execution on the workflow whoever started it, including the agent's own runs.
ExecuteWorkflowServicenow tracks the origin.Initializingwhile a local run is pendingInitializingfor that runInitializing, orUninitialized(socket reopened)executeOperator,addOperatorormodifyOperatorWhen the frontend cannot tell, it omits the report and the agent behaves as it does today. The cases it gets wrong are under Known limits.
Agent service
last-run.tsvalidates the report with a zod schema. A malformed report is logged and treated as absent, and the prompt is still processed.assembleContextrenders it, marks an operator with a run error as failed and leaves out the agent's older result for that operator. A report is only rendered while it is newer than every result the agent has. The frontend sends none after an agent run, andTexeraAgentdrops it for the rest of a turn once the agent callsexecuteOperator, or anaddOperatorormodifyOperatorthe tool accepted, because those start a run of the agent's own.serializeTaskis untouched because feat(agent-service): show past tool results in the agent's history #9244 edits it.Why from the frontend. Fatal errors live in the computing unit's memory and are not persisted, and no endpoint reads console messages back. Row counts are served by
GET /api/executions/{wid}/stats/{eid}, but the browser already holds them for the same run next to the errors. So this needs no backend change, and the source can move to REST later without changing the agent side.Known limits
Last Runblock, and row counts for them are not shown.getErrorMessages()is empty unless the state is Failed, so every other state carries console errors and row counts only.Initializingis taken as that repeat. Another session's refused request is appended by the backend to the user's failed run as one extra error line.claude-haiku-4.5the model asked first for a UDF runtime error and for an empty result, and fixed a UDF syntax error without asking. It may also act on a reported error during a later, unrelated prompt.Not in this PR. A run in progress that has logged no error, since partial counts alone mislead. And a run the agent starts (
executeOperator, or an acceptedaddOperatorormodifyOperator) shutting down a run the user has in flight, which is existing behavior and deserves its own issue.Any related issues, documentation, discussions?
Closes #9420. Proposed in #9377 (change 1), following up on #9246. Lands after #9244, which edits the same context serialization file.
Note for reviewers: this branch and the docs-tools branch from #9377 both add to
prompts.ts,texera-agent.tsandcontext-utils.ts(and their specs) in neighbouring places, so the two do not apply on top of each other as they are. Whichever lands second will be rebased.How was this PR tested?
cd agent-service && bun test: 403 pass, 0 fail across 20 files (326 before this PR), plusbun run typecheckandprettier --check. Covers the schema with its limits written as literals against what the frontend sends, the rendering for known, unknown and no operators and for final and in-flight states, the in-turn drop for each tool and for rejected calls, the prompt wording, and the malformed-report warning.cd frontend && NODE_OPTIONS="--no-experimental-webstorage" npx ng test --watch=false --include <spec>: 390 passed acrossagent.service.spec.ts(134),execute-workflow.service.spec.ts(101),workflow-console.service.spec.ts(6) andworkflow-editor.component.spec.ts(149), plusprettier --checkandeslint. Covers every attach rule and cap, and each run-origin rule with the ordering that would break it. One test drives the real execution, console and status services through the websocket event stream to show that a previous run's error and counts do not reach the next run.On a local stack running this branch, with three Text Input to Python UDF workflows, the prompt frames read from the browser, and
claude-haiku-4.5"unknown operator")ValueErrorline) and the row counts (Text Input Completed 0 to 1, UDF Paused 1 to 0). The context showedState: Running (not finished). The model explained the error with no tool call and, asked directly, said the run had not finishedexecuteOperatormodifyOperatorhad none, and the model stopped after one edit. Before the in-turn drop it edited the same operator three times in one turnWas this PR authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Code (claude-fable-5-2). Co-authored with Claude; the author reviewed the change before submission.