pedroreyesalavrado opened a new pull request, #8637:
URL: https://github.com/apache/texera/pull/8637
What changes were proposed in this PR?
Adds an AI Fix tab to the result panel. When a Python UDF operator fails,
the user clicks Analyze with AI; the tab sends the error, the operator's code,
its input schema and its configuration to an LLM through the existing LiteLLM
proxy (/api/chat/completions), and shows the proposed fix as a one-line diff
with a confidence badge. Apply and re-run patches the operator through
setOperatorProperty (so it is undoable) and re-executes the workflow; Discard
drops it.
It handles four error shapes and says so plainly for anything else ("This
error type is not yet supported for automatic fixing."):
Error Fix the model is asked for
KeyError: 'col' closest column name from the input schema
TypeError: unsupported operand an explicit cast
ValueError: ... NaN / NullPointerException .dropna() or a null guard
model not found / 404 the corrected model field in the operator config
Design notes for review:
Explicit trigger. The model is only called when the user clicks Analyze.
ResultPanelComponent.displayError() runs on every panel re-render, so analysing
on render would fire a request each time.
State lives in a service (AiWorkflowFixerService), because
clearResultPanel() destroys and rebuilds every frame on re-render.
Python UDF errors are read from the console, not from fatal errors. A UDF
exception never becomes a WorkflowFatalError: the worker pauses and the
traceback arrives as an ERROR ConsoleMessage while the execution stays Running.
The tab is therefore registered next to the console frame when the operator has
an ERROR message, in addition to the Failed path.
Gated on copilotEnabled, the flag the LiteLLM proxy already checks.
Apply is guarded: if the operator's code no longer contains the suggested
snippet (edited meanwhile), nothing is written and the panel reports an error
instead of a silent no-op replace.
demo-workflows/ holds six small broken workflows used for the hackathon
demo; missing_column_textinput.json needs no dataset and reproduces the
KeyError case end to end. Happy to drop that folder or move it under
src/assets/ if you prefer it out of the PR.
Any related issues, documentation, discussions?
Hackathon submission for #8520 (Universidad Panamericana – Apache Texera
Hackathon).
Known limitation, found while rebasing: with the per-user warehouse feature
enabled and no warehouse selected, executeWorkflow now refuses to run (upstream
refuseToRunWithoutWarehouse). Apply would then patch the code but not re-run,
while the panel reads "re-running"; a toast still tells the user why. The
feature is off by default.
How was this PR tested?
Unit tests, TDD: 13 for the service (classification of each pattern plus
near-misses and empty input, the full idle→analyzing→ready cycle,
fenced/malformed/incomplete model replies, transport failure, snippet
replacement preserving other properties, property-change patching,
stale-snippet guard, graph rejection, discard, state surviving
re-subscription), 13 for the frame (analyze wiring from a fatal error and from
a Python traceback, every UI state, apply/discard delegation), and 3
regressions in the result panel for the console-error registration path (ERROR
present, only PRINT, copilot disabled).
cd frontend && yarn test
--include="src/app/workspace/component/result-panel/**/*.spec.ts"
End to end on a local stack (Windows, native services, LiteLLM + Claude
Haiku 4.5): imported demo-workflows/missing_column_textinput.json, ran it, got
KeyError: 'lines' from the Python worker, clicked Analyze. The model returned -
title = tuple_["lines"] / + title = tuple_["line"] with high confidence; Apply
patched the operator and the re-run completed with no errors.
Was this PR authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Code (Claude Opus 5)
🤖 Generated with Claude Code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]