Skip to content

Task path discards failure information: a lost output is reported as completed/exit 0, and a stage-in failure can produce no record at all #561

Closed

Description

@scttfrdmn

Summary

The task path computes failure information and then discards it, in two places
that fail in opposite directions. In one, a task that lost a declared output is
recorded as completed, exit 0. In the other, a task that failed stage-in
produced no record at all and burned its whole TTL. Both were hit while
writing a single genomics recipe, and they share a root cause: the wrapper knows
something went wrong and that knowledge never reaches the completion record.

This is the class of bug where the orchestrator reports success and the data
isn't there, so it seemed worth reporting sharply.

1. A failed output upload is reported as success (OUT_RC is written, never read)

pkg/taskproto/wrapper.go:114-118 records stage-out failures:

p("OUT_RC=0\n")
...
p("  aws s3 cp%s %s %s || OUT_RC=$?\n", recursiveFlag(m.Source), shQuote(m.Source), shQuote(m.Destination))

grep -n OUT_RC pkg/taskproto/wrapper.go returns exactly those two lines. It
is never read again. The classification block immediately below it
(wrapper.go:126-133) consults only STAGE_RC and rc:

p("if [ \"$STAGE_RC\" -ne 0 ]; then\n")
p("  STATE='failed'; RETRY_CLASS='%s'\n", RetryStagingError)
p("elif [ \"$rc\" -ne 0 ]; then\n")
p("  STATE='failed'; RETRY_CLASS='%s'\n", RetryAppError)
p("else\n")
p("  STATE='completed'; RETRY_CLASS=''\n")

so a stage-out failure cannot affect state, exit_code or retry_class.

Observed end to end. Task cookbook-uidprobe-r2 declared two outputs; one could
not be written by the container (#555), so its upload failed:

The user-provided path /tmp/pw/out/probe.txt does not exist.

and the durable record says:

{
  "task_id": "cookbook-uidprobe-r2",
  "exit_code": 0,
  "state": "completed",
  "retry_class": ""
}

while the bucket contains only the other output:

$ aws s3 ls s3://…/runs/probe/r2/
2026-09-02 12:38:44         43 from-tmp.txt      # from-subdir.txt absent

spawn task run --wait exits on that record, so it exited 0 for a task with a
missing declared output.
Anything that trusts the exit code — CI, a Nextflow
wrapper, a person — concludes the task produced its outputs. It didn't.

Declaring an output is a statement that the task produces it, so failing to stage
one should be a task failure. Suggested: fold OUT_RC into the classification as
a third branch with its own retry class (it is meaningfully different from
staging_error on the way in — the compute succeeded and only delivery failed,
which is often retryable without re-running the work).

2. A stage-in failure can produce no completion record at all, and burns the TTL

The wrapper looks designed to handle this: wrapper.go:107-109 skips the user
command and sets rc=$STAGE_RC, and wrapper.go:126 classifies it as
failed/staging_error, so the expected outcome is a prompt failed record.

That is not what happened. Task cookbook-uidprobe-r1, identical except that its
input destination was /work/in/probe.txt, hit the mkdir failure in #555 and
then produced:

  • no command.log
  • no completion.json
  • no .exitcode
  • nothing at all under s3://spawn-results-…/tasks/cookbook-uidprobe-r1/

spawn task status reported running (no completion record yet) until the 10m
TTL expired; --wait gave up with timed out waiting for … completion record (past TTL). The sentinel terminated the box correctly, so this is not stranded
spend — but the full TTL was billed for a task that had already failed at second
11, and the only diagnostic anywhere was one line of console output.

I could not find the mechanism from source: the preamble (wrapper.go:60-68) has
nothing that can abort, set -e is deliberately not set, and the console shows
the mkdir error at 10.9s and then nothing further. So I am reporting the
observation rather than a diagnosis — the contradiction with wrapper.go:107-109
is the interesting part, and someone with instance access can pin it down far
faster than I can from outside.

The practical consequence for anyone writing against this API: a task with no
completion record at all should be read as a probable staging failure, not as a
hang.
That is not currently discoverable.

Why these two together

Same shape, opposite directions: one converts a failure into a success, the other
converts a failure into silence. A caller cannot distinguish "worked" from "lost
an output", nor "still running" from "failed at stage-in 10 minutes ago". Item 1
is the one I'd fix first — a false success is worse than a missing answer.

Related: #555 (why the container couldn't write the output),
#556 (other silent narrowings on the task path).

Activity

  1. scttfrdmn commented on Sep 5, 2026

    @scttfrdmn
    ContributorAuthor

    Fixed by #567, shipped in v0.104.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions