carlos / platform Public

review: Astra round 2 findings and scoped-check brief, audit-aws-timeouts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev f6d2ea137b3d4eb3bb05532ef09e3250d3837e4a parent 0f6a499
2 files changed, +108 −0
  • docs/superpowers/reviews/CHECK-BRIEF-audit-aws-timeouts-R2-fix.md +34 −0
  • docs/superpowers/reviews/FINDINGS-audit-aws-timeouts-R2.md +74 −0

CI passed — run details

diff --git a/docs/superpowers/reviews/CHECK-BRIEF-audit-aws-timeouts-R2-fix.md b/docs/superpowers/reviews/CHECK-BRIEF-audit-aws-timeouts-R2-fix.md
new file mode 100644
index 000000000..faa954b13
--- /dev/null
+++ b/docs/superpowers/reviews/CHECK-BRIEF-audit-aws-timeouts-R2-fix.md
@@ -0,0 +1,34 @@
+# Scoped check: audit-aws-timeouts, after round 2 (not a review round)
+
+Repo carlos/platform, branch `audit-aws-timeouts`, commit 0f6a4993ef058677b4cedf9ba0d332f94b500cb0.
+
+Round 2 (`docs/superpowers/reviews/FINDINGS-audit-aws-timeouts-R2.md`)
+ended READY AFTER FIXES with three P2s in one fault family (root-worker
+liveness). Stopping rule 2 applied; Paul chose central enforcement. The
+fix is commit b409dee1 (then 55fdf6a2 merges main, 0f6a4993 re-proposes
+the census). AGENTS.md "Stopping rules" rule 1: the review does not
+reopen, but two checks apply to the fix's diff: the census, and review of
+the newly changed production-storage behaviour. This is that check.
+
+Scope: `git show b409dee1` and the census card
+`docs/superpowers/notes/census-proposal-audit-aws-timeouts.md`. Nothing
+else.
+
+Check:
+1. Do the three round-2 P2s close? (a) a non-legacy AWS_DEFAULTS_MODE
+ keeps the body bound; (b) the bounded transport never speaks HTTP/2,
+ including ALPN; (c) a 307/308 redirect body drain is bounded.
+2. Does the fix break anything the bound clients did before: AWS_CA_BUNDLE,
+ s3compat endpoints, IMDS/STS/SSO credential loading, caller-supplied
+ WithHTTPClient (the implementer restored "a caller's own client wins";
+ the guard test keeps such overrides out of root-binary production
+ code), the SDK's redirect policy, connection reuse?
+3. The guard test `TestAWSClientsAreBounded` and its allowlist: does it
+ actually catch an unbounded client in the root binary's graph, and is
+ each allowlist entry justified?
+4. Census: a verdict for every unit and envelope on the card at this tip.
+
+Answer each item: OK, or a finding with file:line, failure scenario and
+fix, marked P1 (unsafe or broken) or P2. End with exactly one line:
+CHECK PASSED, or CHECK FAILED with the P1s. Do not edit files, do not
+spawn reviewers or agents, do not run full test suites.
diff --git a/docs/superpowers/reviews/FINDINGS-audit-aws-timeouts-R2.md b/docs/superpowers/reviews/FINDINGS-audit-aws-timeouts-R2.md
new file mode 100644
index 000000000..add738ff2
--- /dev/null
+++ b/docs/superpowers/reviews/FINDINGS-audit-aws-timeouts-R2.md
@@ -0,0 +1,74 @@
+Reviewed `1325f6ec6d49bdd004ea5a637d7133d901bc50a1`, round **2 of 3**, against merge base `15b1ee6b6a65a52b82075003d8d6c2bcbb100ca5`. The requested tip adds only review documents after the implementation tip named in the brief.
+
+- **R1 P1, healthy chunked transfers aborted: resolved.** Progress is now measured below chunk decoding; the new single-chunk regression test exercises the original failure.
+- **R1 P2, unbounded move-probe client: resolved.** `probeStoreOptions` installs both shared bounds while preserving the delivered credentials, endpoint and checksum settings.
+- **R1 P2, incorrect worst-case duration: resolved.** The implementation comment now distinguishes independent phase limits from whole-call deadlines.
+
+Found **no P1s and three P2s**. These are remaining coverage gaps, with source-verified failure paths; test execution was blocked by the sandbox.
+
+1. **P2 — Non-legacy defaults modes silently disable body-stall protection.**
+
+ **Evidence:** [stall.go:179](/home/paulca/amadan.net/carlos/platform-audit-aws-timeouts/internal/rootaws/stall.go:179) returns the unwrapped response whenever the connection lacks `progressConn`. The installed S3 SDK calls `WithDialerOptions` for supported non-legacy modes at [api_client.go:567](/home/paulca/go/pkg/mod/github.com/aws/aws-sdk-go-v2/service/s3@v1.105.0/api_client.go:567), which replaces the wrapped `DialContext` at [client.go:145](/home/paulca/go/pkg/mod/github.com/aws/aws-sdk-go-v2@v1.44.0/aws/transport/http/client.go:145).
+
+ **Failure scenario:** With `AWS_DEFAULTS_MODE=standard`, a root worker receives response headers and then waits indefinitely for the body. The header timer has finished, and no body timer is installed. This affects ordinary configurations without an explicit custom HTTP client.
+
+ **Fix:** Preserve progress instrumentation through defaults-mode service-client construction, including credential clients. Alternatively, explicitly refuse unsupported modes before starting work. Add an integration test that constructs the actual service client under a non-legacy mode and verifies a stalled body times out.
+
+ **Fault family:** Root-worker liveness — ordinary configuration must not silently remove the protection against an indefinitely blocked storage call.
+
+ I do **not** accept this as an implicit opt-out. An explicitly supplied custom HTTP client is a reasonable caller-controlled override; selecting AWS defaults mode is not an explicit request to disable body protection.
+
+2. **P2 — Unrelated HTTP/2 traffic can keep a stalled response alive indefinitely.**
+
+ **Evidence:** [progressConn.Read:121](/home/paulca/amadan.net/carlos/platform-audit-aws-timeouts/internal/rootaws/stall.go:121) records every received connection byte. [idleBody.check:257](/home/paulca/amadan.net/carlos/platform-audit-aws-timeouts/internal/rootaws/stall.go:257) treats that timestamp as progress for every response using the connection. HTTP/2 remains enabled by the SDK’s [default transport:217](/home/paulca/go/pkg/mod/github.com/aws/aws-sdk-go-v2@v1.44.0/aws/transport/http/client.go:217).
+
+ **Failure scenario:** An HTTP/2-compatible storage endpoint sends headers for request A, then never sends its remaining body. Request B continues receiving data on the same connection, or the endpoint sends periodic PING frames. Every timer check for A observes recent connection traffic and rearms forever. No additional application request is necessary in the PING case.
+
+ The comment that other streams “can only delay a timeout” understates this: the delay can be unlimited.
+
+ **Fix:** Measure HTTP/2 progress per response stream, retaining connection-level measurement for HTTP/1 chunk decoding. If that cannot be supported in this slice, explicitly restrict the bounded transport to HTTP/1 where compatible. Add a two-stream regression test proving that activity on one stream cannot preserve another stalled stream.
+
+ **Fault family:** Root-worker liveness — unrelated traffic must not satisfy a blocked operation’s progress requirement.
+
+3. **P2 — Redirect-body reads occur before the body timer is installed.**
+
+ **Evidence:** [stall.go:174](/home/paulca/amadan.net/carlos/platform-audit-aws-timeouts/internal/rootaws/stall.go:174) waits for the downstream HTTP call to return before wrapping its response body at line 186. The SDK permits 307/308 redirects at [client.go:325](/home/paulca/go/pkg/mod/github.com/aws/aws-sdk-go-v2@v1.44.0/aws/transport/http/client.go:325). Before following one, Go drains small or unknown-length response bodies using `io.CopyN` at [net/http/client.go:713](/home/paulca/.local/go-dist/src/net/http/client.go:713).
+
+ **Failure scenario:** An endpoint returns `307`, a valid `Location`, and `Content-Length: 100`, then sends no body. `http.Client.Do` blocks draining those bytes. The header timeout has completed, and the middleware has not yet received the response, so neither bound ends the wait. This also affects the newly bounded move probe under legacy defaults and HTTP/1.
+
+ **Fix:** Apply body protection at the response transport boundary, before the HTTP client performs redirect-body reads. Preserve the existing redirect policy. Add a regression test with a stalled 307/308 body and an independent test deadline.
+
+ **Fault family:** Root-worker liveness — every response-body read performed for a storage call must receive the bound, including reads inside the HTTP client.
+
+No P3 findings.
+
+The other requested checks produced these conclusions:
+
+- **Healthy transfers and consumer pauses:** The new connection timestamp fixes the original slow-chunk failure. Reads start their own idle interval, so time spent between consumer reads is excluded. Multipart upload duration and presigning are not capped by these response timers. Streamed responses remain subject to the coverage gaps above.
+- **Timer lifecycle:** Serial reads reuse one timer and stop it after returning. Callback state is mutex-protected; connection timestamps are atomic. I found no additional persistent timer/goroutine leak or wrapper-state race with concurrent `Close` for the standard HTTP bodies. Expiry can still race with arriving data at the timeout boundary.
+- **Configuration:** CA-bundle loading preserves the transport options. `s3compat` retains its endpoint, checksum and middleware behavior. Caller `WithHTTPClient` options intentionally win; ordinary `WithAPIOptions` calls append in the installed SDK. Root shared-profile refusals and credential-file restrictions remain intact.
+- **Connection pooling:** Legacy-mode service clients can share the configured client and pool. Non-legacy modes clone it. Existing pool limits remain unchanged. HTTP/2 sharing matters because of finding 2.
+- **Retries:** `bodyStallError` implements the timeout interfaces recognized by the SDK. Errors during SDK deserialization are retryable. A streamed `GetObject` body fails after the operation returns, so the SDK does not automatically retry that read; `S3Store.Get` propagates its `io.ReadAll` error.
+- **Values:** The three cited existing whole-request limits are 120 seconds. Keeping that conservative value is consistent with them. They do not prove a shorter limit safe. Three attempts can approach twelve minutes plus connection establishment and backoff when both phase limits are consumed, and progress before stalling can extend this.
+- **Lease cleanup:** Both construction-error paths now use the existing ten-second release context, preserve the original error and clear the release handle. `Held.Release` still stops the renewer before remote release. I found no cut-state or ordering regression.
+- **Excluded clients:** `grouprollaws` has separate bounds; the host-fence loop supplies a two-minute pass deadline. The other listed exclusions remain reasonable follow-up scope; the direct move probe was the root-worker gap requiring inclusion here.
+
+The tests cover the original regressions, but do not establish the remaining cases. Loader and release-deadline assertions detect the old behavior; the new fragmented-chunk test targets the round-one P1. Compatibility tests need not fail against the original implementation. Progress tests now allow substantially more scheduling slack, though their wall-clock sleeps can still flake after a sufficiently long scheduling delay. Stall tests use one attempt, so they do not demonstrate retries. Their elapsed-time assertion runs only after return and is not an independent watchdog.
+
+**Census verdicts at the requested tip:**
+
+| Unit or envelope | Verdict | Evidence and basis |
+|---|---|---|
+| `internal/host/movesstore.go:probeStore` | **Approve existing `legacy` / `accepted-legacy` disposition** | Reviewed [probeStore:46](/home/paulca/amadan.net/carlos/platform-audit-aws-timeouts/internal/host/movesstore.go:46) and `probeStoreOptions`, lines 81–99. Same credentials, destinations, operations and bounded body consumption; no additional root read authority. |
+| `internal/rootaws/stall.go:idleBody.Read` | **Approve new `legacy` / `accepted-legacy` disposition** | Reviewed [Read:220](/home/paulca/amadan.net/carlos/platform-audit-aws-timeouts/internal/rootaws/stall.go:220), `check` and `Close`, through line 268. Reads the existing HTTP response body; introduces no filesystem path or executable input. |
+| `internal/rootaws/stall.go:progressConn.Read` | **Approve new `legacy` / `accepted-legacy` disposition** | Reviewed [Read:121](/home/paulca/amadan.net/carlos/platform-audit-aws-timeouts/internal/rootaws/stall.go:121) and its construction at lines 96–108. Reads the connection already dialed for the request and records timing; adds no destination-selection authority. |
+| `internal/rootaws` envelope | **Approve** | Reviewed all of `stall.go`, [config.go:39](/home/paulca/amadan.net/carlos/platform-audit-aws-timeouts/internal/rootaws/config.go:39) through both loaders and their credential restrictions, plus the changed tests and SDK dependencies. No root credential guard or validation is weakened. |
+| `internal/host` envelope | **Approve** | Reviewed the complete changed probe path and [movescut.go:889](/home/paulca/amadan.net/carlos/platform-audit-aws-timeouts/internal/host/movescut.go:889) through `releaseLease`, their dependencies and added tests. Existing operations gain timeout handling; no additional root authority is granted. |
+
+These census approvals concern authority, not functional completeness.
+
+`git diff --check` passed. Targeted tests could not start: Go could not create its work directory in the read-only sandbox. No test or census-test pass is claimed. No files were edited, no subagents were spawned, and no full suites were run.
+
+This is the first round without P1s, so the review stops here. Root-worker liveness has findings in both rounds; stopping rule 2 applies. The implementation should choose explicit refusal of unsupported cases, cut unsupported transport behavior, or enforce the invariant centrally with guard tests. I recommend central enforcement before HTTP-client body consumption. The resulting production-storage changes and census still require the scoped checks specified by rule 1, without reopening the full review.
+
+**READY AFTER FIXES**
\ No newline at end of file