Repository navigation
feat(runs): show the failure reason in task view [COMP-1655] - #747
Merged
Merged
Conversation
Platform returns why a task failed in Task.errorMessage: the Scheduler's reason for Intelligent Compute tasks, or the exit code message on Google Batch. tw never printed it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Approve: a small additive change that surfaces Task.errorMessage in runs view task, with tests covering each display branch.
What I checked
TaskCmd.parseGeneralDataonly addserrorMessagewhen it is non-null, so JSON output for tasks without an error stays the same. The new key is purely additive.- In
TaskView,general.get("status")holdstask.getStatus().getValue(), which is aString, so"ABORTED".equals(...)compares the right types. - The reason text is printed without going through
ansi(). That's correct: it's free text from the server and could contain@|sequences that Jansi would otherwise read as markup. The underline width (label.length() + 2) lines up with how the existingCommandandEnvironmentheadings are formatted. - The tests cover the FAILED label, the ABORTED label, the no-reason case, and JSON output. The new
mockTaskDetail(mock, status, extra)overload leaves the old callers' behaviour unchanged.
Nits (non-blocking)
replaceAll("\n", ...)leaves a stray\rif the server ever sends CRLF. This matches the existing Command and Environment handling, so I'd only change it if all three are changed together.testTaskDetailHidesReasonWhenNoneasserts that the lowercase stdout contains no "reason" anywhere. That holds against the current fixture, but it will break if any unrelated field intask_detail.jsonever contains that word. Asserting on the absence of the heading would be less brittle.
Coverage note: I couldn't inspect the tower-java-sdk 1.261.0 jar in this environment, so I haven't independently confirmed that Task#getErrorMessage() exists in the pinned SDK. The compile and test jobs on this PR (still pending as I write this) will confirm it.
alberto-miranda
approved these changes
Nov 16, 2026
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.
Summary
tw runs view -i <run> task -t <task>prints aFailure reasonblock under the General table when Platform sends one. That is the Scheduler's reason for a failed Intelligent Compute task (seqeralabs/platform#13662), or the compute platform's message for the exit code on Google Batch.Command, rather than a table row: Scheduler reasons run to hundreds of characters (516 in the example below), and a row would stretch the whole General table to that width.ABORTEDtask the block is labelledReason. This matches the task dialog in seqeralabs/platform#13712 (draft), which gives aborted tasks the reason they were stopped; such a task didn't fail itself. Platform doesn't send a reason for aborted tasks yet, so this label only appears once that PR is released.-o json,general.errorMessageis included whenever Platform sends it.VERSION-APIbump:Task.errorMessageexists since Platform API 1.116.0 and is in SDK 1.261.0. No native-image metadata change:Taskis already registered with all its declared fields and methods.Jira: COMP-1655.
Example
A task from an Intelligent Compute run that asked for more than any instance type offers (Platform dev; rows elided):
Notes
Not included
tw runs view tasks(the task list): no new column. Platform's task list does return the reason, but at hundreds of characters it doesn't fit a table column; the task view is the place to read it.Testing
TaskCmdTestcases: the reason is shown under its heading and on its own line (not in the General table), anABORTEDtask getsReason, nothing is printed when Platform sends no reason, and the JSON has the key. They check the printed text, because the existingtestTaskDetail*cases compare the output with aTaskViewbuilt by the same code.ABORTEDand JSON cases fail. The "none" case passes, as it should.ABORTEDcases.Failure reasonfails theABORTEDcase../gradlew test --tests 'io.seqera.tower.cli.runs.TaskCmdTest': 11/11 pass. Full suite and native build left to CI.FAILEDtask prints the block above;ABORTEDtask of the same run prints no block;-o jsonincludesgeneral.errorMessage.🤖 Generated with Claude Code