SEZ9 opened a new pull request, #12628:
URL: https://github.com/apache/seatunnel/pull/12628
## Benchmark first
`benchmark/runner.py --provider bedrock --model
us.anthropic.claude-haiku-4-5-20251001-v1:0 --preset smoke --level l1` (12
tasks, haiku-4-5):
| | pass@1 | misrouted | generation errors |
|---|---|---|---|
| `dev` (post-#12604) | 75.0% | 0/12 | 0 |
| this branch | 75.0% | 0/12 | 0 |
**Being straight about what that does and does not show:** this change only
affects the path taken *after* a submitted job fails, which is an L3 execution
concern. A `--level l1` static run never reaches it, so the run above is a
no-regression check, not evidence the change works. The evidence for the change
itself is the measurement in #12627 and the tests below.
What actually demonstrates the fix, on a 4107-character trace whose root
cause sits at the end:
| | error code recovered | root cause in forwarded text |
|---|---|---|
| `error_text[:3000]` (before) | none | no |
| tail excerpt (after) | `JDBC-05` | yes |
## Purpose of this pull request
Closes #12627.
`parse_error()` landed in #12537 as a pure function with no caller outside
its tests. This wires it into the one path that has a raw job failure in hand,
and fixes the truncation sitting next to it.
`_show_error_and_diagnose` built its repair prompt from `error_text[:3000]`.
Java prints the outer wrapper first and the innermost `Caused by` last, so
keeping the **front** of an oversized trace discards exactly the part that
names the failure — the model was asked to repair a config while seeing only
`CommandExecuteException: SeaTunnel job executed failed`. `_run_local` in the
same file already tail-truncates its captured output (`proc.stdout[-3000:]`),
so the two paths disagreed.
This is the follow-through on the two commitments I made in the #12537
review thread: parse the **untruncated** text, and cover it with a test using a
>3000-character trace whose root cause is at the end.
## How
- **`_build_failure_report()`** — a module-level helper that parses the
*whole* error text and returns the parsed fields plus a **tail** excerpt,
marked `...(earlier frames omitted)...` when frames were dropped. The parse
deliberately runs on the full text while only the excerpt is bounded: the
structured fields are cheap, so there is no reason to let truncation cost us
the error code. Keeping it module-level and free of `self` is what makes it
testable without standing up the REPL, and lets the planned `--diagnose` path
reuse it.
- **The repair prompt now states the parsed fields before the raw excerpt**,
so the error code survives even when the excerpt had to drop frames, and the
model does not have to re-derive it from the trace.
- **The parsed fields are redacted too.** They are cut from the same trace,
so a `root_cause` line can carry a JDBC URL with a password in it. `signature`
is excluded — it is an internal dedupe key, not a diagnosis.
- **The resolved root cause is printed once** above the repair output, so
the user sees what the failure actually was rather than only the wrapper.
## Does this PR introduce _any_ user-facing change?
One added line of output on a failed job, naming the root cause, e.g.:
```
Root cause: JDBC-05: Connect to database failed
```
No new options or commands. The `Job FAILED` panel is unchanged.
## Check list
* [x] Code changed are covered with tests — `tests/test_failure_report.py`
(5 tests), suite 216 passed
* [x] If any new Jar binary package adding in your PR, please add License
Notice according [New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
— n/a
* [x] If necessary, please update the documentation to describe the new
feature — n/a, no new option
* [x] If you are contributing the connector code, please check that the
following files are updated — n/a
## Notes for the reviewer
- The excerpt limit stays at 3000 characters. This PR changes *which end* is
kept, not how much, so it is not a quiet increase in what gets sent to the
model.
- The `Job FAILED` panel a few lines above still renders `error_msg[:2000]`,
i.e. the front. I left it alone to keep this PR to one behaviour, but it has
the same flaw and is worth a follow-up; the new `Root cause:` line mitigates it
in the meantime.
--
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]