Skip to content

task run: env doesn't reach a container; --wait exits 0 when an output fails to upload; Spot→on-demand fallback drops mounts #1133

Closed

Description

@scttfrdmn

Found in code while writing the tasks guide for spore-host/spore-host#585 part 3. 1 was confirmed by generating a wrapper with taskproto. 2 and 3 come from reading the code; none were run on AWS.

  1. env never reaches a container.
    • pkg/taskproto/wrapper.go:133-140 exports each env key in the host shell.
    • The container line (:487) is sudo docker run --rm --user … <mounts> <image> <cmd>, with no -e/--env-file, and sudo would drop the exports anyway.
    • A generated wrapper shows export SHARD='007' and then a docker run without it. Host-mode tasks are fine.
  2. task run --wait exits 0 when a declared output didn't upload.
    • On OUT_RC != 0 the wrapper sets STATE='failed' and RETRY_CLASS=output_delivery_error, but writes "exit_code": $rc, the command's 0 (wrapper.go:328-357).
    • cmd/task.go:658 exits only on rec.ExitCode != 0.
    • task status --check-complete checks the state correctly (:971).
    • So a script that trusts the exit code treats a task with missing outputs as a success.
  3. Spot→on-demand fallback launches without the task's storage and flush hook. The first Provision passes StorageScript and TaskFlushScript (cmd/task.go:587-590), but the retry passes launcher.Options{} (:596). A fallback instance loses its EFS/FSx/volume mounts and the terminal flush that writes a completion record on a TTL kill.

Minor:

  • cmd/task.go:501 says resources.results_prefix, but the field is top-level results_prefix.
  • spawn task --help Short/Long (cmd/task.go:36-39) mentions only diagnose, not run/status.

Gates:

  • (1): a container-mode wrapper must pass every env key into docker run.
  • (2): for each failure RETRY_CLASS, --wait must exit non-zero.
  • (3): both Provision calls must get the same Options.

Activity

  1. scttfrdmn commented on Oct 19, 2026

    @scttfrdmn
    ContributorAuthor

    Item 1 (env doesn't reach a container) duplicates #1059, filed 2026-10-16. Track it there. This issue keeps items 2 and 3, plus the minor ones.

  2. scttfrdmn commented on Oct 19, 2026

    @scttfrdmn
    ContributorAuthor

    Split into: #1143 (--wait exits 0 on output_delivery_error, item 2), #1144 (Spot→on-demand fallback drops StorageScript/TaskFlushScript, item 3), #1145 (minor: results_prefix message, task --help text). Item 1 (env doesn't reach a container) is a duplicate of #1059 and is tracked there. Closing as split.

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