carlos / platform Public

group verb: retry reads whose request got no response

The G5 release-1 dev roll refused at the post-prepare group describe in
14 ms with no call in CloudTrail: a reused keep-alive connection reset
before any answer, and one attempt per call. readCall now retries a read
on the SDK's RequestSendError (not a timeout) with the throttle budget.
Writes and sessions stay single-attempt. Spec V18; census envelope.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude pushed by paul@keymail.dev fd7378aeb365dfee7b24bdff59fa0abe2d8bb535 parent c60889d
6 files changed, +99 −7
  • docs/superpowers/notes/census-proposal-group-read-transport-retry.md +11 −0
  • docs/superpowers/specs/2026-11-09-group-roll-verb-design.md +1 −0
  • internal/grouprollaws/group.go +23 −7
  • internal/grouprollaws/throttle_test.go +60 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv +3 −0

CI failed — run details

diff --git a/docs/superpowers/notes/census-proposal-group-read-transport-retry.md b/docs/superpowers/notes/census-proposal-group-read-transport-retry.md
new file mode 100644
index 000000000..e0246f0bd
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-group-read-transport-retry.md
@@ -0,0 +1,11 @@
+# Census approval: group-read-transport-retry
+
+Ruling `census-ruling-group-read-transport-retry`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+Envelopes re-pinned: `internal/grouprollaws`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+Seal: `9c74b9876a13a3a3802860fe44406898c8bcbfd3bd22e8172a59a02674c3b4af` → `9c74b9876a13a3a3802860fe44406898c8bcbfd3bd22e8172a59a02674c3b4af`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
index 6e80d8697..e707b8636 100644
--- a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
+++ b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
@@ -378,6 +378,7 @@ build to it.
| V15 | A box verb that exits non-zero is `remote` ("returned no complete result"), whatever it printed | The verb's last printable line is carried as `remote_said` ("The command on the member failed: <detail>"), non-printables made spaces, at most 512 characters; with nothing printable it stays `remote`. drain keeps its own report parsing | Dev W slot 2026-11-10: prepare's "pointer artifact does not match requested digest" reached the operator as "no complete result" |
| V16 | `plan` reports a missing provider observation as `record` (FileNotFoundError reached check()) | `plan` says `observation`, as preflight does | REPORT follow-up 3; flagship step 4 2026-11-11 |
| V17 | Every provider call is made once (`--cli-read-timeout`, retries 1) | Reads (the describes, caller identity, HeadBucket, S3 GET and list) are retried while AWS throttles them: four calls at most, about 1, 2 and 4 s apart, jittered; any other failure and the last throttle fail closed as before. Writes and box sessions are never retried. Bare `carlos system group`, its -h and an unknown verb print the group's help | Step-3 dev W4 2026-11-10: the group describe refused under ASG throttling (8a3d302) |
+| V18 | A request that gets no response is one failed call | A read whose request got no response at all (the SDK's RequestSendError: a reset or EOF on a reused connection, no call in CloudTrail) is retried as a throttle is (V17's budget); a timeout is not, and stays one bound. Writes and sessions are never retried | G5 release 1, dev, 2026-11-11: the post-prepare group describe failed in 14 ms with no CloudTrail call; resume closed it (8a3d302) |
Not deviations, recorded so nobody "fixes" them in the port: the drain-rerun
backoff and the TakeHost `wake_timeout` follow-ups from the held build stay
diff --git a/internal/grouprollaws/group.go b/internal/grouprollaws/group.go
index 159425c02..3d189f893 100644
--- a/internal/grouprollaws/group.go
+++ b/internal/grouprollaws/group.go
@@ -29,6 +29,7 @@ import (
ssmtypes "github.com/aws/aws-sdk-go-v2/service/ssm/types"
"github.com/aws/aws-sdk-go-v2/service/sts"
"github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
"github.com/carlosframework/platform/internal/grouproll"
)
@@ -178,12 +179,12 @@ func call[T any](parent context.Context, fn func(context.Context) (T, error)) (T
return zero, grouproll.Uncertain{Key: "api"}
}
-// readCall is call for a read, retried while AWS throttles it: up to
-// throttleAttempts calls, each under call's own bound, with a jittered
-// backoff of about 1, 2 and 4 seconds between them (capped by the caller's
-// context). Only a throttling answer is retried; any other failure, and a
-// throttle on the last attempt, is call's answer as before, so the verb
-// still fails closed. Writes and box sessions never come through here: a
+// readCall is call for a read, retried while AWS throttles it or while
+// the request gets no answer at all: up to throttleAttempts calls, each
+// under call's own bound, with a jittered backoff of about 1, 2 and 4
+// seconds between them (capped by the caller's context). Any other
+// failure, and either kind on the last attempt, is call's answer as
+// before, so the verb still fails closed. Writes and box sessions never come through here: a
// write's outcome after a failure is unknown, and retrying it is the
// engine's decision, not the adapter's.
func readCall[T any](parent context.Context, fn func(context.Context) (T, error)) (T, error) {
@@ -194,7 +195,7 @@ func readCall[T any](parent context.Context, fn func(context.Context) (T, error)
raw = e
return o, e
})
- if err == nil || attempt >= throttleAttempts || parent.Err() != nil || !throttled(raw) {
+ if err == nil || attempt >= throttleAttempts || parent.Err() != nil || !(throttled(raw) || unanswered(raw)) {
return out, err
}
if werr := throttleWait(parent, attempt); werr != nil {
@@ -214,6 +215,21 @@ func throttled(err error) bool {
return err != nil && retry.IsErrorThrottles(retry.DefaultThrottles).IsErrorThrottle(err) == aws.TrueTernary
}
+// unanswered is a read that got no response: the SDK's RequestSendError,
+// the request could not be sent or its connection failed before an
+// answer (a reused keep-alive connection the far end had closed: reset or
+// EOF in milliseconds, with no call in CloudTrail; G5 release 1, dev,
+// 2026-11-11). A timeout is not retried here: it stays one call's bound,
+// as before, so a silent endpoint never costs four.
+func unanswered(err error) bool {
+ var send *smithyhttp.RequestSendError
+ if !errors.As(err, &send) {
+ return false
+ }
+ var netErr net.Error
+ return !errors.Is(err, context.DeadlineExceeded) && !(errors.As(err, &netErr) && netErr.Timeout())
+}
+
// throttleWait sleeps before retry number attempt (1-based): 2^(attempt-1)
// seconds, jittered to between half and all of it. A test replaces it.
var throttleWait = func(ctx context.Context, attempt int) error {
diff --git a/internal/grouprollaws/throttle_test.go b/internal/grouprollaws/throttle_test.go
index b2029f056..a9b973e61 100644
--- a/internal/grouprollaws/throttle_test.go
+++ b/internal/grouprollaws/throttle_test.go
@@ -2,8 +2,10 @@ package grouprollaws
import (
"context"
+ "net/http"
"reflect"
"strings"
+ "syscall"
"testing"
)
@@ -96,3 +98,61 @@ func TestThrottleWaitBounds(t *testing.T) {
t.Fatalf("cancelled wait = %v", err)
}
}
+
+// dropFirst fails the first n requests as a reused connection the far end
+// had closed does (reset, no response), then hands them to next.
+type dropFirst struct {
+ n int
+ next *recorder
+ sent int
+}
+
+func (d *dropFirst) Do(req *http.Request) (*http.Response, error) {
+ d.sent++
+ if d.sent <= d.n {
+ return nil, syscall.ECONNRESET
+ }
+ return d.next.Do(req)
+}
+
+// A read whose request got no response (the G5 release-1 dev describe:
+// 14 ms, no call in CloudTrail) is retried like a throttle; four in a row
+// fail closed with the api answer; a write is never retried.
+func TestReadsRetryUnanswered(t *testing.T) {
+ ok := groupXML(2, 2, 3, [][2]string{{testIID, "InService"}})
+ waits := stubThrottleWait(t)
+ d := &dropFirst{n: 1, next: newRecorder().on("DescribeAutoScalingGroups", ok)}
+ if _, err := testAdapterWith(t, d).Describe(ctx); err != nil {
+ t.Fatalf("reset once, then answered: %v", err)
+ }
+ if d.sent != 2 || len(*waits) != 1 {
+ t.Fatalf("sent %d, waits %v", d.sent, *waits)
+ }
+
+ waits = stubThrottleWait(t)
+ d = &dropFirst{n: 99, next: newRecorder()}
+ _, err := testAdapterWith(t, d).Describe(ctx)
+ if u := uncertainKey(t, err); u.Key != "api" || u.Timeout {
+ t.Fatalf("reset throughout: %+v", u)
+ }
+ if d.sent != throttleAttempts || len(*waits) != throttleAttempts-1 {
+ t.Fatalf("sent %d, waits %v", d.sent, *waits)
+ }
+
+ waits = stubThrottleWait(t)
+ d = &dropFirst{n: 1, next: newRecorder().on("UpdateAutoScalingGroup", "<UpdateAutoScalingGroupResponse/>")}
+ if _, err := testAdapterWith(t, d).SetMinimum(ctx, 1); err == nil || d.sent != 1 || len(*waits) != 0 {
+ t.Fatalf("unanswered write: %v, sent %d, waits %v", err, d.sent, *waits)
+ }
+}
+
+// A timeout is not "unanswered": it stays one call's bound (onStall's
+// headers then a body that never comes is the read timeout).
+func TestReadTimeoutNotRetried(t *testing.T) {
+ waits := stubThrottleWait(t)
+ rec := newRecorder().onStall("DescribeAutoScalingGroups")
+ _, err := testAdapter(t, rec).Describe(ctx)
+ if u := uncertainKey(t, err); !u.Timeout || len(rec.requests()) != 1 || len(*waits) != 0 {
+ t.Fatalf("stall: %+v, %d requests, waits %v", u, len(rec.requests()), *waits)
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 5bd6fdb67..32c681bec 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -167,3 +167,4 @@ plan14-root-reads-group-bucket-region.tsv 733204d61bea49fe418d8ff0f1bfa20d77bdff
plan14-root-reads-w6-ingress-drain.tsv 43260792034a1a20791d14c4e4476e762b40d7bcca64257ef2e9899da6af5df0
plan14-root-reads-group-capacity-damping.tsv 0c649af234a7b89a75479e59e705307e3293a59439b7b251dd4558bd46ef2100
plan14-root-reads-group-verb-followups.tsv 9c74b9876a13a3a3802860fe44406898c8bcbfd3bd22e8172a59a02674c3b4af
+plan14-root-reads-group-read-transport-retry.tsv 9c74b9876a13a3a3802860fe44406898c8bcbfd3bd22e8172a59a02674c3b4af
diff --git a/internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv b/internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv
new file mode 100644
index 000000000..72f40daf5
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-group-read-transport-retry.tsv
@@ -0,0 +1,3 @@
+# Census overlay group-read-transport-retry, written by census-propose (#369). census-ruling-group-read-transport-retry, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-group-read-transport-retry.md.
+# 0 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+@coverage internal/grouprollaws e1d3998565bb65d84af89082ef73ea839767b9a617294a463644ce0e7cedcfb4