Repository navigation
feat(taskproto): container /tmp is its own tmpfs; empty directory inputs fail stage-in (#1270, #1207) - #1282
Merged
Merged
Conversation
…uts fail stage-in (the size AL2023 gives the host's /tmp) instead of the image overlay on the root disk. Staged directories under /tmp are mounted on top. A manifest path directly in /tmp keeps the host /tmp bind mount (Docker refuses both on one path). command.log says which. fails stage-in as staging_error with a message naming the prefix. New per-input field allow_empty restores the old behaviour; Validate rejects it on a file input or an output. Fixes #1270 Fixes #1207
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
scttfrdmn
force-pushed
the
feat/1270-1207-task-staging
branch
from
October 24, 2026 01:38
fc7f8fd to
e026fb1
Compare
Merged
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.
Fixes #1270
Fixes #1207
Two owner-approved behaviour changes in
pkg/taskproto/wrapper.go.#1270: a container task's /tmp
docker runnow gets--tmpfs '/tmp:rw,exec,nosuid,nodev,mode=1777,size=50%'.size=50%: the kernel works it out when Docker mounts the tmpfs, on the instance, as half of RAM. systemd's tmp.mount sizes AL2023's host /tmp the same way. The wrapper has nothing to compute or parse, so it can't get the size wrong, and the line stays small for the user-data budget. I checked against Docker 29.9.2:df /tmpinside the container was exactly MemTotal/2.exec. Docker's--tmpfsdefaults tonoexec. I checked this: without the flag the mount showsnoexec, so a staged script or tool run from /tmp would fail.mode=1777lets the non-root--useruid write.docker run --tmpfs /tmp -v host:/tmp/in: the bind is visible on top of the tmpfs, writes reach the host, and the non-root user can write and exec in /tmp./tmp/p2-task.sh). Today this makes /tmp itself a mount dir. I kept today's behaviour: host /tmp is bind-mounted and there is no--tmpfs. Docker refuses the pair:Duplicate mount point: /tmp(checked). The other option, binding each such file over the tmpfs, does not work for an output file that doesn't exist yet: Docker creates a missing bind source as a directory. Either way scratch is RAM-backed and half of RAM, because the host /tmp on AL2023 is that tmpfs. So the two cases behave the same except for what else is visible in /tmp.command.logprints one line: eitherspawn: container /tmp is tmpfs, size=50% of RAM (N GiB)orspawn: container /tmp is the host /tmp (bind-mounted: a manifest path is directly in /tmp).#1207: an empty or missing directory input
/. When one stages no regular file under its destination (find "$dest" -type f | head -n 1), stage-in fails:spawn: input s3://… copied no objects: the prefix is empty or missing (set allow_empty: true on this input if that is expected). It setsSTAGE_RC=1inside the input's existingif [ "$STAGE_RC" -eq 0 ]block. That is the same path a missing single object takes, so the record isfailed/staging_errorand the command does not run. The check is emitted as one shell function plus one line per input.customizations/s3/filegenerator.pyL367) only yields a key withSize == 0that ends in/fordelete. For a download it is skipped, so the most a marker-only prefix leaves behind is a directory. Counting-type ftherefore treats it as empty. The test covers this with a stand-in that creates nested directories only.Manifest.AllowEmpty(allow_empty,omitempty) restores the old behaviour. Validate rejects it on a single-object input and on outputs.spawn task run --help(and the regenerateddocs-gen/task.md) anddocs/workflow-adapter-protocol-rfc.md.api/public-surface.txtregenerated (one added field).Gates (each watched failing against a revert that compiles)
tmpFlag = ""TestContainerTmpIsItsOwnTmpfs,TestContainerTmpfsReachesDockerRunArgv(exec, argv captured)--tmpfsadded even when /tmp is bind-mountedTestContainerTmpStaysHostBindWhenAManifestPathIsDirectlyInTmpchecksEmptyDirInput→ false)TestEmptyDirectoryInputFailsStageInSTAGE_RC=1TestEmptyDirectoryInputFailsStageInfind -mindepth 1(counts dirs)TestEmptyDirectoryInputFailsStageIn/folder_marker_onlyallow_emptyignoredTestDirectoryInputStagesWhenAllowedEmptyOrNonEmptyTestValidateAllowEmptyruntimeStandInBinnow also linksfind,head,awkandtouch.Wrapper size (gzip)
Checks
make check: fmt, vet, GOOS vet, staticcheck, golangci-lint (0 issues in 10 modules), hermetic tests and tidy all pass. Five nested lambda builds failed with ENOSPC because the internal disk was full; I re-ran their build, vet and test by hand and they pass.check-build-tagsfails the same way on unmodified main (the/private/tmppath issue).make check-docsandsemgrep scan --config=auto --error .are clean. Launcher and tasklaunch user-data budget tests pass.Not verified: AL2023's own Docker package (25.x) with
size=50%andexec. I tested only against Docker 29.9.2. moby passes the--tmpfsdata options through to the kernel, which takes a%size.