Skip to content

feat(task): 'spawn task status' + 'task run --wait' completion poller (spawn#386) - #405

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/386-task-status
Jul 19, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/386-task-status

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Summary

Second of two stacked PRs for spawn#386 increment 2 — the read side of the task protocol. Stacked on #404 (review/merge that first; this diff is against that branch).

spawn task status <task-id>

Fetches the durable completion record from s3://spawn-results-<account>-<region>/tasks/<task-id>/completion.json and prints it (-o json for the raw record). If the record isn't there yet, the task is still running. --check-complete mirrors spawn status exit codes (0=completed, 1=failed, 2=running, 3=error) for scripting/adapters.

spawn task run --wait

Blocks until the completion record appears (polling every --poll-interval, default 15s, until the TTL elapses), prints it, and exits with the task's own exit code — a synchronous run for callers who don't want to poll themselves.

aws.Client.GetS3Object

New exported S3 GetObject helper with an ErrS3NoSuchKey sentinel, so pollers distinguish "not there yet" (task running) from a real error via errors.Is.

Testing

  • cmd: TestWaitDeadline (TTL+slack, fallback cap); the fetchCompletion/poller paths need S3 (gated e2e).
  • TestFlagConventions/TestTier0 pass (task classified; new leaf sub-command fine, no --json).
  • docs-gen regenerated; Semgrep clean; only the pre-existing TestCatalogValid fails in cmd (unrelated, fails on main too).
  • No billable EC2.

Refs #386 (increment 2; container execution + adapter migration remain later increments)

@scttfrdmn
scttfrdmn force-pushed the feat/386-task-status branch 3 times, most recently from ae14486 to aeb876b Compare July 19, 2026 20:43
@scttfrdmn
scttfrdmn changed the base branch from feat/386-task-run to main July 19, 2026 20:45
…ller (spawn#386)

The read side of the task-execution protocol. 'spawn task status <task-id>'
fetches the durable completion record from
s3://spawn-results-<acct>-<region>/tasks/<id>/completion.json and prints it
(-o json for raw); absent record = still running; --check-complete mirrors
spawn status exit codes (0/1/2/3) for scripting.

'task run --wait' polls that record (every --poll-interval, default 15s) until
it appears or the TTL elapses, prints it, and exits with the task's own exit
code — a synchronous run for callers who don't want to poll.

Adds aws.Client.GetS3Object with an ErrS3NoSuchKey sentinel so pollers
distinguish 'not there yet' from a real error.

Refs #386 (increment 2; container execution + adapter migration remain later increments)
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 8.39161% with 131 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/task.go 9.91% 109 Missing ⚠️
pkg/aws/s3.go 0.00% 22 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 17fdd9a into main Jul 19, 2026
7 checks passed
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