carlos / platform Public

moves: run's POSTs leave once; the classifier gets the raw body

Branch review round 4 (Paul: fix both, merge, no round 5):
- the run wire hands the transport a POST it cannot rewind (GetBody
  nil), so an HTTP/2 REFUSED_STREAM retry cannot resend it past the
  dispatch gate;
- a 2xx status body reaches offlinerun.ClassifyStatus as it came,
  whatever roundTrip's decoder made of it.
Mutation-checked. doors.go joins the moves copy scan; census re-pinned
with mover.roundTrip's claim at its existing disposition.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev d4ba2da191de03e8a7c74742bf2010286c0dc250 parent 9020a84
7 files changed, +77 −7
  • approved_moves_copy_test.go +1 −0
  • docs/superpowers/notes/census-proposal-omr-run.md +9 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-omr-run.tsv +6 −4
  • move.go +8 −0
  • move_offline_run.go +7 −1
  • move_offline_run_test.go +45 −0

CI failed — run details

Intent

Human

<task-notification> <task-id>b60m99i71</task-id> <tool-use-id>toolu_01CUom8saB7CVFaFUKhf2bt4</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/b60m99i71.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra round 4" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 51.3 g CO₂e (6,393,629 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on offline-move-run, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/approved_moves_copy_test.go b/approved_moves_copy_test.go
index 4e7ab1e93..8af76bfe3 100644
--- a/approved_moves_copy_test.go
+++ b/approved_moves_copy_test.go
@@ -1395,6 +1395,7 @@ var movesScanFiles = []string{
"move_offline_run.go",
"internal/moves/offlinerun/decide.go",
"internal/moves/offlinerun/run.go",
+ "internal/moves/offlinerun/doors.go",
// Region HA stage B: relocation files that import internal/moves (the
// shared build, the probe attempts, the landing and wake owners).
"internal/host/relocationattempts.go",
diff --git a/docs/superpowers/notes/census-proposal-omr-run.md b/docs/superpowers/notes/census-proposal-omr-run.md
index de55e7ed0..a92eb3cd0 100644
--- a/docs/superpowers/notes/census-proposal-omr-run.md
+++ b/docs/superpowers/notes/census-proposal-omr-run.md
@@ -2,14 +2,22 @@
Ruling `census-ruling-omr-run`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `move.go` `mover.roundTrip` | body | unchanged (1) | sendOnce (set only by carlos move offline run): a POST gets GetBody nil so the HTTP transport cannot resend it by itself. Request building only; it reads nothing new and the response handling is unchanged. |
+
Envelopes re-pinned: `.`, `internal/moves/offlinerun`.
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.
+Recorded dispositions, which each change must still satisfy:
+
+- `move.go` `mover.roundTrip`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-moves-offline;basis=the carlos CLI on a person's machine, as that person (no box unit): main's body with the offline status view's waiting sentence read from the reply (WireWaiting); read site unchanged, offset moved
+
New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
- new `move_offline_run.go:mover.offlineRun`: reads +file:OpenFile; written legacy, accepted-legacy, frozen
-Seal: `da718fcd010b3c1db861196e0bbb9121723a9857ad16c2a15a329983688b8981` → `790d5983e970470bd3e7adf9047edb5bd034492289ed1503e3e4d9e7f083d6a8`.
+Seal: `da718fcd010b3c1db861196e0bbb9121723a9857ad16c2a15a329983688b8981` → `4da35a3f5a827963bcd5e531fc790124dbcabc815d41f60a4d6b625a16b43a4f`.
Overlay: `internal/provision/testdata/plan14-root-reads-omr-run.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 2b25a0957..fc8f32398 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -223,4 +223,4 @@ plan14-root-reads-platform-mail-submission.tsv edd68225d4f61e5953ecaa710fe07e8c0
plan14-root-reads-drain-quiesce-1062.tsv 66404a2fb26ea541e99d9c3d3bd87cb3f2a346eda95cdb7d7838cab2fcd844f5
plan14-root-reads-flat-plans.tsv 66404a2fb26ea541e99d9c3d3bd87cb3f2a346eda95cdb7d7838cab2fcd844f5
plan14-root-reads-sr-followups.tsv da718fcd010b3c1db861196e0bbb9121723a9857ad16c2a15a329983688b8981
-plan14-root-reads-omr-run.tsv 790d5983e970470bd3e7adf9047edb5bd034492289ed1503e3e4d9e7f083d6a8
+plan14-root-reads-omr-run.tsv 4da35a3f5a827963bcd5e531fc790124dbcabc815d41f60a4d6b625a16b43a4f
diff --git a/internal/provision/testdata/plan14-root-reads-omr-run.tsv b/internal/provision/testdata/plan14-root-reads-omr-run.tsv
index da8dc551f..57ada51cb 100644
--- a/internal/provision/testdata/plan14-root-reads-omr-run.tsv
+++ b/internal/provision/testdata/plan14-root-reads-omr-run.tsv
@@ -1,7 +1,9 @@
# Census overlay omr-run, written by census-propose (#369). census-ruling-omr-run, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-omr-run.md.
-# 0 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
-@legacy ef5fb39696f4b1e2dfb49ca386aa3d038795e07a23277efbbf9521a076fa4737 move_offline_run.go mover.offlineRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-omr-run;basis=new: carlos move offline run (offline move run plan, Task 5). Opens the operator's own --log path to append the run's output (os.OpenFile, O_APPEND|O_CREATE|O_WRONLY, 0600); reads nothing from it. The verb refuses root (moveMain, L25) before it gets here, so this is never a root read. file:OpenFile@224 38b645c74e045273198c1e13322b8b8bd9ac1cb8571ef8c2b5c531061e64fa9a
-move_offline_run.go mover.offlineRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-omr-run;basis=new: carlos move offline run (offline move run plan, Task 5). Opens the operator's own --log path to append the run's output (os.OpenFile, O_APPEND|O_CREATE|O_WRONLY, 0600); reads nothing from it. The verb refuses root (moveMain, L25) before it gets here, so this is never a root read. file:OpenFile@224 38b645c74e045273198c1e13322b8b8bd9ac1cb8571ef8c2b5c531061e64fa9a
-@coverage . 8625e8d39e42f4f13f07a98bd92ce27836bf365e8830071500008ed33012af2b
+@legacy ff402ca905920c90eaaf78a51868845f68cbe849cef612aceb3186cb68e464da move.go mover.roundTrip legacy accepted-legacy accepted-legacy;rev3=census-ruling-moves-offline;basis=the carlos CLI on a person's machine, as that person (no box unit): main's body with the offline status view's waiting sentence read from the reply (WireWaiting); read site unchanged, offset moved;rev3=census-ruling-omr-run;basis=sendOnce (set only by carlos move offline run): a POST gets GetBody nil so the HTTP transport cannot resend it by itself. Request building only; it reads nothing new and the response handling is unchanged. file:ReadAll@949 fa2ed514e75ae6f6e20fd9aa5f3ed82f6e93707556cf21d6b9cc6670ee318b7b
+@legacy 893d9ac1948eab2d0de769c306fde8fad28e6cda0877e9357c0080b32fcf103b move_offline_run.go mover.offlineRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-omr-run;basis=new: carlos move offline run (offline move run plan, Task 5). Opens the operator's own --log path to append the run's output (os.OpenFile, O_APPEND|O_CREATE|O_WRONLY, 0600); reads nothing from it. The verb refuses root (moveMain, L25) before it gets here, so this is never a root read. file:OpenFile@224 f0dabab059a93e46bc5f63862c04b744fa67d57c9b4f325beef418e13373cd73
+move.go mover.roundTrip legacy accepted-legacy accepted-legacy;rev3=census-ruling-moves-offline;basis=the carlos CLI on a person's machine, as that person (no box unit): main's body with the offline status view's waiting sentence read from the reply (WireWaiting); read site unchanged, offset moved;rev3=census-ruling-omr-run;basis=sendOnce (set only by carlos move offline run): a POST gets GetBody nil so the HTTP transport cannot resend it by itself. Request building only; it reads nothing new and the response handling is unchanged. file:ReadAll@949 fa2ed514e75ae6f6e20fd9aa5f3ed82f6e93707556cf21d6b9cc6670ee318b7b
+move_offline_run.go mover.offlineRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-omr-run;basis=new: carlos move offline run (offline move run plan, Task 5). Opens the operator's own --log path to append the run's output (os.OpenFile, O_APPEND|O_CREATE|O_WRONLY, 0600); reads nothing from it. The verb refuses root (moveMain, L25) before it gets here, so this is never a root read. file:OpenFile@224 f0dabab059a93e46bc5f63862c04b744fa67d57c9b4f325beef418e13373cd73
+@coverage . 06318726d63765d43fd11d5032b8011e6782a3381856f61ce577a7a007d23022
@coverage internal/moves/offlinerun c0bdedec8828e4f7fbc68e96c678159d60e571c3a94d18b3c03e37ef8730ae96
diff --git a/move.go b/move.go
index 7e373f53c..a7387a878 100644
--- a/move.go
+++ b/move.go
@@ -464,6 +464,11 @@ type mover struct {
// limited: a 429 was answered, so the command waits 10 seconds between
// calls now and has said so (once).
limited bool
+ // sendOnce: run's requests leave at most once per call. The POST body
+ // cannot be rewound (no GetBody), so the transport never resends it on
+ // its own (an HTTP/2 REFUSED_STREAM retry, a 307/308): every POST run
+ // makes passes offlinerun's dispatch gate (branch review round 4).
+ sendOnce bool
}
func (m *mover) withDetail() string {
@@ -513,6 +518,9 @@ func (m *mover) roundTrip(ctx context.Context, method, path string, in any) move
if m.sess.c.token != "" {
req.Header.Set("Authorization", "Bearer "+m.sess.c.token)
}
+ if m.sendOnce && method != http.MethodGet {
+ req.GetBody = nil
+ }
res, err := m.sess.c.httpc.Do(req)
if err != nil {
return moveReply{failed: true, stopped: ctx.Err() != nil}
diff --git a/move_offline_run.go b/move_offline_run.go
index bb3e7ada5..170ad8429 100644
--- a/move_offline_run.go
+++ b/move_offline_run.go
@@ -162,6 +162,7 @@ func (m *mover) offlineRun(ctx context.Context, a moveArgs, d moveDeps) int {
ints := offlinerun.NewInterrupts()
w := &offlineRun{m: m, said: map[string]bool{}}
+ m.sendOnce = true
wire := &runWire{m: m}
start := now()
watch := &runWatcher{w: w, wire: wire, now: now, policy: policy,
@@ -260,10 +261,15 @@ func (w *runWire) Do(ctx context.Context, method, tail string, body any) offline
}
x := offlinerun.Exchange{Status: r.status}
switch {
+ case r.status/100 == 2 && r.body != nil:
+ // A 2xx body that read is handed on as it came, whatever
+ // roundTrip's own decoder made of it: offlinerun.ClassifyStatus
+ // alone judges it (branch review round 4).
+ x.Body = r.body
case !r.failed:
x.Body = r.body
case r.unread:
- // A 2xx whose body is not JSON: no body to hand on.
+ // No body to hand on.
case r.status != 0:
x.Cut = true // the answer came; its body did not read
}
diff --git a/move_offline_run_test.go b/move_offline_run_test.go
index 53293b284..93a5505ea 100644
--- a/move_offline_run_test.go
+++ b/move_offline_run_test.go
@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"errors"
+ "fmt"
"go/ast"
"go/parser"
"go/token"
@@ -1583,3 +1584,47 @@ func TestMoveOfflineRunCtrlCPromisesOnlyWhatItCanDo(t *testing.T) {
}
})
}
+
+// run's POSTs leave at most once per call: the transport is handed a body it
+// cannot rewind, so it never resends one by itself (an HTTP/2 REFUSED_STREAM
+// retry). Status reads are untouched (branch review round 4, finding 1).
+func TestRunPostsCannotBeReplayedByTheTransport(t *testing.T) {
+ var seen []string
+ rt := runRoundTrip(func(r *http.Request) (*http.Response, error) {
+ seen = append(seen, fmt.Sprintf("%s rewindable=%v", r.Method, r.GetBody != nil))
+ return &http.Response{StatusCode: http.StatusAccepted, Body: io.NopCloser(strings.NewReader(`{"host":"h","state":"none"}`)), Header: http.Header{}}, nil
+ })
+ c := newConsoleClient("https://console.example", "tok")
+ c.httpc = &http.Client{Transport: rt}
+ m := &mover{sess: &apiSession{c: c, console: c.base}, out: io.Discard, host: "h", path: "/p"}
+ m.sendOnce = true
+ w := &runWire{m: m}
+ w.Do(context.Background(), http.MethodPost, "/seal", map[string]any{"id": "mv-1"})
+ w.Do(context.Background(), http.MethodGet, "", nil)
+ m.sendOnce = false
+ m.roundTrip(context.Background(), http.MethodPost, "/p/seal", map[string]any{})
+ want := []string{"POST rewindable=false", "GET rewindable=false", "POST rewindable=true"}
+ if fmt.Sprint(seen) != fmt.Sprint(want) {
+ t.Fatalf("requests %v, want %v", seen, want)
+ }
+}
+
+// A 2xx body reaches the one classifier as it came, even when roundTrip's own
+// decoder refused it (branch review round 4, finding 2).
+func TestRunWireHandsOnTheRawStatusBody(t *testing.T) {
+ const body = `{"state":"offline-landed","id":"mv-bound","next":"open","detail":7}`
+ rt := runRoundTrip(func(r *http.Request) (*http.Response, error) {
+ return &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(strings.NewReader(body)), Header: http.Header{}}, nil
+ })
+ c := newConsoleClient("https://console.example", "tok")
+ c.httpc = &http.Client{Transport: rt}
+ w := &runWire{m: &mover{sess: &apiSession{c: c, console: c.base}, out: io.Discard, host: "h", path: "/p"}}
+ x := w.Do(context.Background(), http.MethodGet, "", nil)
+ if string(x.Body) != body || x.Cut {
+ t.Fatalf("exchange body %q cut=%v, want the raw body", x.Body, x.Cut)
+ }
+}
+
+type runRoundTrip func(*http.Request) (*http.Response, error)
+
+func (f runRoundTrip) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) }