Skip to content

fix(coding/execution): prefer the sink error over the operation deadline - #38

Merged
rsbin1178 merged 1 commit into
mainfrom
fix/execution-sink-error-precedence
Oct 8, 2026
Merged

rsbin1178 merged 1 commit into
mainfrom
fix/execution-sink-error-precedence

Conversation

@rsbin1178

Copy link
Copy Markdown
Owner

The runner took whichever of {process exit, output trigger, context done} arrived
first and kept only that error, so a caller whose sink failed could be told
"context deadline exceeded" instead: the fixture's one-second operation deadline can
expire before the dispatcher goroutine reports the failure, which is what the macOS
sandbox runner hit.

The dispatcher now records the sink's failure beside reporting it on the trigger, and
the run prefers that record: the sink error leads the returned error and any context
error that also happened is joined behind it, so nothing is dropped. The error
classification still sees the preferred error and the status stays canceled.

Measured: a test cancels the caller's context while its sink is running and lets the
sink fail afterwards. Without the preference applied it fails three runs out of three
with "Target error should be in err chain", and with it the caller sees both the sink
failure and the cancellation, twenty -race repetitions.

Evidence

The new runner test cancels the caller context while the sink runs and then fails the sink. With the preference line removed it fails three runs out of three ("Target error should be in err chain"); with it, errors.Is finds both the sink failure and context.Canceled, and the status is canceled. A unit test pins the rule itself: a sink failure leads, a context error is joined behind it, and an already-present failure is not duplicated.

TERM=xterm-256color go test ./... (89 packages), go test -race -count=20 ./internal/coding/execution/ and golangci-lint run --new-from-rev=HEAD~ ./... (0 issues) are clean.

Based on #37, which must merge first.

@rsbin1178
rsbin1178 force-pushed the fix/execution-drain-before-close branch from d780630 to a1de623 Compare October 8, 2026 14:56
@rsbin1178
rsbin1178 changed the base branch from fix/execution-drain-before-close to main October 8, 2026 15:04
@rsbin1178
rsbin1178 marked this pull request as ready for review October 8, 2026 15:04
The runner took whichever of {process exit, output trigger, context done} arrived
first and kept only that error, so a caller whose sink failed could be told
"context deadline exceeded" instead: the fixture's one-second operation deadline can
expire before the dispatcher goroutine reports the failure, which is what the macOS
sandbox runner hit.

The dispatcher now records the sink's failure beside reporting it on the trigger, and
the run prefers that record: the sink error leads the returned error and any context
error that also happened is joined behind it, so nothing is dropped. The error
classification still sees the preferred error and the status stays canceled.

Measured: a test cancels the caller's context while its sink is running and lets the
sink fail afterwards. Without the preference applied it fails three runs out of three
with "Target error should be in err chain", and with it the caller sees both the sink
failure and the cancellation, twenty -race repetitions.
@rsbin1178
rsbin1178 force-pushed the fix/execution-sink-error-precedence branch from b5ed125 to 4d84234 Compare October 8, 2026 15:04
@rsbin1178
rsbin1178 merged commit 114a783 into main Oct 8, 2026
8 checks passed
@rsbin1178
rsbin1178 deleted the fix/execution-sink-error-precedence branch October 8, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant