Skip to content

fix(launch): non-interactive stdin (#34) + STS→IMDS identity fallback (#33) - #36

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/noninteractive-launch-and-sts-fallback
Jun 3, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/noninteractive-launch-and-sts-fallback

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Two bugs blocking nf-spawn (spawn invoked from a Nextflow/Java subprocess in aws-microbiome-demo). Both small; grouped because they block the same path.

#34 — spawn launch fails parsing JSON when stdin is a pipe

launch entered "pipe mode" (read truffle JSON from stdin) whenever stdin wasn't a TTY. A caller passing explicit flags from a piped/non-TTY stdin (Java ProcessBuilder) therefore hit failed to parse JSON: unexpected end of JSON input on every launch.

Fix: pipe mode now requires no --instance-type. With an explicit instance type, launch uses flags mode and never reads stdin (TTY or pipe). Extracted the three-way decision into a pure, unit-tested launchMode().

#33 — STS GetCallerIdentity times out behind an STS VPC endpoint

When a VPC has an STS interface endpoint with private DNS, sts.<region>.amazonaws.com resolves to a private IP; from a subnet without a route, every spawn op times out at GetCallerIdentity.

Fix: GetAccountID and GetCallerIdentityInfo fall back to EC2 IMDS (instance identity document → account ID/region) when STS is unreachable; GetCallerIdentityInfo synthesizes a best-effort ARN. The launch audit-identity lookup is now best-effort (account=unknown on total failure) instead of hard-failing the launch.

Cross-account sweep/burst STS calls (devCfg) are intentionally untouched — they need the dev account's identity, which IMDS can't provide.

Tests

TestLaunchMode covers the pipe-vs-flags-vs-wizard matrix incl. the #34 ProcessBuilder case; existing substrate/identity tests cover the STS-success path. Build/vet/test green.

Closes #33, closes #34.

…ck (#33)

Two bugs that block nf-spawn (spawn invoked from a Nextflow/Java subprocess).

#34 — launch read stdin as truffle JSON whenever stdin wasn't a TTY, so a
caller passing explicit flags from a piped/non-TTY stdin (ProcessBuilder) hit
"failed to parse JSON: unexpected end of JSON input" on every launch. Pipe mode
now requires NO --instance-type; with an explicit instance type, launch uses
flags mode and never reads stdin (TTY or pipe). Extracted launchMode() as a
pure, unit-tested predicate.

#33 — GetCallerIdentity hard-failed when an STS VPC interface endpoint with
private DNS resolves sts.<region>.amazonaws.com to an unroutable private IP,
timing out every spawn operation. GetAccountID and GetCallerIdentityInfo now
fall back to EC2 IMDS (instance identity document) for the account ID/region
when STS is unreachable; GetCallerIdentityInfo synthesizes a best-effort ARN.
The launch audit-identity lookup is now best-effort (account=unknown on total
failure) rather than blocking the launch.

Note: the sweep/burst cross-account STS calls (devCfg) are intentionally left
as-is — they need the dev account's identity, which IMDS can't provide.

Tests: launchMode covers the pipe-vs-flags matrix incl. the #34 case; existing
substrate/identity tests cover the STS-success path. Build/vet/test green.
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.37037% with 43 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/client.go 11.11% 24 Missing ⚠️
cmd/launch.go 29.62% 19 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit dc4edf5 into main Jun 3, 2026
2 of 3 checks passed
@scttfrdmn
scttfrdmn deleted the fix/noninteractive-launch-and-sts-fallback branch June 3, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant