Skip to content

feat(pool): resilient restart-on-error workers (#465) + task-bucket IAM flags (#70) - #470

Merged
scttfrdmn merged 2 commits into
mainfrom
fix/70-pool-followups
Jul 31, 2026
Merged

feat(pool): resilient restart-on-error workers (#465) + task-bucket IAM flags (#70)#470
scttfrdmn merged 2 commits into
mainfrom
fix/70-pool-followups

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

The two follow-ups from the now-green pool validation (#70).

#465 — resilient workers (restart-on-error)

The on-instance worker ran spored pool-worker once at boot, so any early exit (a transient AWS error, an SQS blip, a spot pre-warm race) left a running-but-idle instance billing until its TTL. buildPoolWorkerCommand now wraps it in a bounded restart-on-error loop with the exit-code contract:

  • exit 0 (worker idle-drained cleanly) → stop, let on-complete terminate the instance → scale-to-zero preserved.
  • non-zero → sleep 10s and re-exec, up to 20 attempts (a hard crash-loop can't busy-spin the whole TTL; the TTL is the ultimate backstop).

Tests: asserts the loop shape + valid bash (bash -n), and a functional test with a stubbed spored proving exit-0 runs exactly once (no restart on clean drain).

#70 follow-up — per-task-bucket IAM

Workers got S3 on the results/work bucket only, so a task staging from/to a third bucket failed (documented limitation when the scoped profile landed). New spawn pool create --s3-read <bucket> / --s3-write <bucket> (repeatable) widen the worker policy: read buckets → GetObject + List; write buckets → Get/Put/Delete + List. Least-privilege default unchanged (results bucket only). s3://bucket/prefix forms are accepted and trimmed to the bucket for the ARN.

Test asserts the extra grants appear, prefixes are stripped, and a read-only bucket never gets DeleteObject.

All new tests + the cmd SDK-import/flag-convention gates pass. (TestCatalogValid fails on main independently — private ECR images in the shipped catalog, #392 — not touched here.)

Refs #70, closes #465.

…3-write for task buckets (#70)

#465: on-instance worker now runs under a bounded restart-on-error loop — a
transient exit re-execs, a clean idle-drain (exit 0) stops and lets the instance
terminate. No more billing-but-idle stranded workers.

#70 follow-up: --s3-read/--s3-write grant workers access to a task's own
input/output buckets beyond the results bucket, closing the documented
per-task-bucket IAM limitation. Least-privilege default (results bucket only).
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.87879% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/pool.go 87.87% 7 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 196c4c2 into main Jul 31, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the fix/70-pool-followups branch July 31, 2026 14:26
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.

Pool worker should survive an early spored pool-worker exit (restart-on-exit), not run once at boot

1 participant