Skip to content

fix(pool): completion record for an unparseable spec; correct the reconcile-loop claim (#1149) - #1235

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/1149-pool-leftovers
Oct 20, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/1149-pool-leftovers

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1149

What was left on main

The visibility-timeout comment in cmd/pool.go was already fixed in v0.136.0, but pkg/taskpool/queue.go's CreateQueue doc still said "The caller sizes it from the task TTL", so I fixed that too. The other two items were still open.

Changes

  • Unparseable spec gets a record. Worker.runOne now runs taskproto.ParseSpec before Exec. If the spec fails to parse (malformed JSON, failed validation, or an unknown field), the worker writes completion.json and .exitcode itself and then acks. The record has state failed, exit_code -1 (the terminal-flush hook's "never returned a status") and retry_class spec_error. The record goes to the key task status reads: spawn-results-<account>-<region>/tasks/<task_id>/, or the spec's results_prefix if it is valid JSON and sets one.
  • New retry class spec_error, not retryable. It's additive like instance_health (task run: a container task at default sizing fails, because Docker's install is OOM-killed on t4g.nano (and is classified app_error) #1180) and listed in the adapter RFC. staging_error would have been wrong: it means an input S3 copy failed.
  • If the record write fails, the task is still acked. Leaving the message would redeliver it every visibility timeout. Each redelivery resets the worker's idle clock, so a pool holding one bad spec would never drain (a cost leak).
  • spored pool-worker wires Results/AccountID/Region through a new newPoolWorker.
  • docs/pooled-task-execution-design.md §2, §4 and §7: as shipped, provisioning is one-shot. There is no top-up and reclaimed Spot workers are not replaced. What survives a lost worker is its task, which SQS redelivers. The comments in queue.go and worker.go are corrected to match, and runOne's doc now says plainly that an execer error after parsing writes no record.

Gates (each watched failing against a compiling revert)

  • TestWorker_UnparseableSpecWritesFailedRecordBeforeAck uses a fake queue and a fake results store, with three bad-spec shapes. Reverting with if _, perr := ParseSpec(...); false && perr != nil made it fail: the execer ran and nothing was written. Swapping the record and the ack also made it fail ("record written with 0 message(s) on the queue, want 1").
  • TestWorker_UnparseableSpecHonoursResultsPrefix failed under the same revert.
  • TestWorker_UnparseableSpecAckedEvenIfRecordWriteFails checks the cost-leak property.
  • TestNewPoolWorker_WiresTheResultsWriter (cmd/spored) failed with Results: nil.
  • TestFakeFetcherDefaultParses: the old default fixture {"task_id":"x"} doesn't parse, and would have quietly routed every existing worker test down the new path, making their execer assertions vacuous.

Checks

make check passes except check-build-tags, which also fails on unmodified main because of /private/tmp paths. golangci-lint (root, --allow-parallel-runners, since another agent held the lock) reports 0 issues; semgrep is clean; make api-snapshot is committed (additive only). No help text changed.

Not run on AWS.

@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.75758% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/taskpool/record.go 82.35% 3 Missing and 3 partials ⚠️
pkg/taskpool/worker.go 70.00% 4 Missing and 2 partials ⚠️
cmd/spored/pool_worker.go 66.66% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

…correct the reconcile-loop claim (#1149)

A pooled task whose staged spec failed to parse was acked with no
completion record, so spawn task status reported it unknown forever. The
worker now validates the spec before running it and, for one that fails,
writes a failed record (exit_code -1, retry_class spec_error, not
retryable) at the key task status reads, then acks. A spec that is valid
JSON can still name its results_prefix, which is honoured.

The pooled-execution design doc and pkg/taskpool comments no longer claim
a reconcile loop tops the pool up or replaces reclaimed Spot workers:
pool create reconciles once. The queue's visibility-timeout comment no
longer says it is sized from the TTL.
@scttfrdmn
scttfrdmn force-pushed the fix/1149-pool-leftovers branch from dd91b73 to fe08414 Compare October 20, 2026 19:50
@scttfrdmn
scttfrdmn merged commit 93197b4 into main Oct 20, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1149-pool-leftovers branch October 20, 2026 20:11
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.

spawn pool: visibility-timeout comment, design-doc reconcile loop, unparseable spec acked with no record

1 participant