Skip to content

fix(task): preserve error chain with TaskError and record task errors in TaskRunStatus - #1050

Merged
kyasbal merged 1 commit into
GoogleCloudPlatform:mainfrom
kyasbal:push-szypwuqzxxvs
Sep 28, 2026
Merged

kyasbal merged 1 commit into
GoogleCloudPlatform:mainfrom
kyasbal:push-szypwuqzxxvs

Conversation

@kyasbal

@kyasbal kyasbal commented Sep 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Introduce a typed TaskError in pkg/core/task holding TaskID and Err that implements Error() (preserving the existing formatted message) and Unwrap() so callers of LocalRunner.Result(), InspectionTaskRunner.Result(), and InspectionTaskRunner.DryRun() can inspect the underlying error cause with errors.Is and errors.As.
  • Add Error error to TaskRunStatus and populate it in LocalRunner.markTaskFinished so callers can inspect per-task failure causes from TaskRunStatuses().
  • Remove the premature cancel() before return err inside currentErrGrp.Go in LocalRunner.Run and the unsynchronized r.resultError write in LocalRunner.runTask so errgroup.WithContext records the root task error before cancelling dependent tasks.
  • Add unit tests for TaskError unwrapping and TaskRunStatus.Error in pkg/core/task/runner_test.go and pkg/core/inspection/runner_test.go.
@kyasbal kyasbal added the type:bug Something isn't working as expected label Sep 28, 2026
@kyasbal
kyasbal requested a review from RyuSA as a code owner September 28, 2026 03:48
@kyasbal kyasbal added the area:backend-core Core backend frameworks, DAG task runner, and server API label Sep 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a structured TaskError type to wrap errors occurring during task execution with their corresponding task IDs, enabling proper error unwrapping. It also adds an Error field to TaskRunStatus to capture the error for each task execution. Test suites in both task and inspection packages are updated and expanded to verify the error wrapping, unwrapping, and status reporting behavior. I have no feedback to provide as the changes are well-implemented and thoroughly tested.

@kyasbal
kyasbal added this pull request to the merge queue Sep 28, 2026
Merged via the queue into GoogleCloudPlatform:main with commit 761586d Sep 28, 2026
17 checks passed
@kyasbal
kyasbal deleted the push-szypwuqzxxvs branch September 28, 2026 04:04
@kyasbal kyasbal mentioned this pull request Sep 28, 2026
8 of 10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend-core Core backend frameworks, DAG task runner, and server API type:bug Something isn't working as expected

1 participant