carlos / platform Public

fix-wal-test-810

No handoff yet. An agent working here writes one with amadan branch handoff, so that whoever picks the branch up next — a person, or another agent on another machine — can start without reading the whole history.

Recently

Human

<task-notification> <task-id>bsk8t7tdl</task-id> <tool-use-id>toolu_01UC6MCFoFVu8sYgCtaaivgU</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/a99cbe46-f458-4f72-8b8a-294aae9cdf21/tasks/bsk8t7tdl.output</output-file> <status>completed</status> <summary>Background command "Wait for CI on the new tip" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>buc8ntwc1</task-id> <tool-use-id>toolu_01JWoQRBLpa6CoACiChHgV8S</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/a99cbe46-f458-4f72-8b8a-294aae9cdf21/tasks/buc8ntwc1.output</output-file> <status>completed</status> <summary>Background command "Wait for CI on 7b61a0c9" completed (exit code 0)</summary> </task-notification>

Human

<paseo-system version="1" kind="agent-message" source-agent-id="8a3d302a-eac7-407c-b61c-f5ccc66b5544" message-id="6da31648-2208-429f-8f67-489aba94c4ce"> Agent manager 8a3d302: excellent. Merge on green and send the SHA. Also file the side note (a failed monitor snapshot can leak a goroutine and the WAL fd until restart when the replica client isn&apos;t the generation-bound wrapper) as a discussion with the fix idea, so it isn&apos;t lost. </paseo-system>

Human

<task-notification> <task-id>aaac076393ec2af43</task-id> <tool-use-id>toolu_013ioT4Pjg7KmgA8x32Cqe78</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/a99cbe46-f458-4f72-8b8a-294aae9cdf21/tasks/aaac076393ec2af43.output</output-file> <status>completed</status> <summary>Agent "Build held-floor-capability" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Both changes are in as new commits, and the WAL-wait test change is reverted. Tests, mutations and census all pass. Nothing was pushed or amended. **Commits (newest first)** - **7b61a0c9** census: re-propose held-floor-capability for the signed drain answer (seal `837f27a6…` to `fa9aea00…`) - **75ff7187** lease: drop the WAL-wait change, it lands on its own branch. It reverts 802f9264, which I had already committed; `internal/lease/release_snapshot_test.go` now matches its earlier content. - **4976e386** grouproll: declare no fixed boxes explicitly with no_fixed_boxes - **45992c2e** region HA: drain acknowledgements are signed for the ask **(1) Signed acknowledgement answer** (`internal/edge/hadrain.go`) - The asker now puts a fresh nonce in each ask: 16 bytes from `crypto/rand`, as lower-case hex, inside the body the ask's existing signature already covers. - The receiver refuses an ask without a valid 32-hex-digit nonce with a bare 404. - The answer is now `{"seen":&lt;bool&gt;,"sig":"&lt;hex&gt;"}`. `sig` is an HMAC-SHA256 under the mesh key (the same signing key the ask uses) over these parts, each followed by a newline: 1. the domain string `carlos-ha-drain-answer\x00` 2. the receiver 3. the asker 4. the transaction 5. the phase (one part more than the ruling listed) 6. the drain id 7. the nonce 8. the seen value - The asker verifies the answer under either mirrored key, in constant time. It counts anything else as not acknowledged and returns an error, never a seen value. That covers an unsigned body, a missing `seen`, a bad signature, an answer to another ask, a 404, and an HTML page. - There is no compatibility path. Bounds and retries are unchanged. - Spec §24 E12 and E15 and §25.4 step 1 are reworded to say this. Tests: - `TestHADrainAnswerMustBeSignedForTheAsk`: - A correct signed answer is accepted. - On a peer acting as an old binary, a tenant answer of `{"seen":true}` is refused, along with an empty or zeroed `sig`, a body with no `seen`, and HTML. - A replayed earlier answer fails as "not signed for this ask". - `TestHADrainAnswerWireShape` pins the exact answer body by recomputing the MAC by hand. - The forgery test now also refuses a missing, short or upper-case nonce. **(2) `no_fixed_boxes`** - `no_fixed_boxes` must be a JSON boolean. A string, number, null or list is rejected as `config_invalid`. - The floor needs exactly one of a non-empty `fixed_boxes` and `"no_fixed_boxes": true`: - Neither (a missing or empty list, with the flag false or absent) is a floor error, `floor_fixed_boxes`. - Both is a floor error, `floor_fixed_both`. - A box's edges file still counts toward the floor whatever is declared. - `TestFloorFixedBoxesDeclaration` covers all 9 combinations, and the config tests cover the type checks. - Spec §24 E14, §25.9 and §25.11 and the verb design doc are updated. **Tests and mutations** - Full `internal/grouproll` package: ok (270 s). - Targeted internal/edge tests (drain, take, control paths, forward, wake): ok. Targeted internal/host tests (drain, edges file, group-name and other census tests): ok. internal/provision census tests: ok. - `go vet` on the changed packages: ok. `gofmt`: clean. Cross-builds for darwin/arm64, windows/amd64 and linux/arm64: ok. - Mutations, each reverted: - Skipping the answer's MAC check fails `TestHADrainAnswerMustBeSignedForTheAsk`. - Accepting both `fixed_boxes` and `no_fixed_boxes` fails `TestFloorFixedBoxesDeclaration`. - Reading `no_fixed_boxes: false` as "none" fails `TestFloorFixedBoxesDeclaration`. **Census** - `make census-card` showed `Edge.serveHAControl` as a changed unit, and the edge and grouproll envelopes moved. - The first `census-propose` failed because it also wanted a claim for `Edge.AskDrainSeen`. I added one and reran it, and the census tests pass. - `AskDrainSeen` doesn't appear in the card's table, but its claim is in the overlay TSV. - The CLAIMS file `.superpowers/held-floor-capability-claims.tsv` now has three lines: ``` internal/host/edgesfile.go:edgesFileWriteClaims held floor capability (region HA §25.9, agent manager 8a3d302, 2026-11-10): sets the constant ha_handover=1 on the box's own edges file on every pass, whatever its capabilities (this build understands the held-requests headers and the drain acknowledgement); the group roll floor reads it. Not from config or any read; ha_take unchanged; a report other tools read, not a root decision; no read added; F,J1 authority retained. One-off cost: the first pass after the upgrade writes once per box. internal/edge/hadrain.go:Edge.serveHAControl held floor capability (region HA §25.4 step 1, agent manager 8a3d302, 2026-11-10): a drain ask must also carry a nonce of 32 lower-case hex digits (else a bare 404, like any other malformed ask), and the JSON answer gains sig, an HMAC-SHA256 under the same mesh key (signingKey of the mirrored pair) over a distinct domain, this box, the asker, the transaction, the phase, the publication id, the nonce and the seen value. Computed in memory from the already verified ask; no read added, no file, record or store access added; the take path is unchanged. internal/edge/hadrain.go:Edge.AskDrainSeen held floor capability (region HA §25.4 step 1, agent manager 8a3d302, 2026-11-10): the ask gains a nonce, 16 bytes from crypto/rand in lower-case hex, inside the already signed body; the answer must carry sig, an HMAC-SHA256 under either mirrored mesh key over a distinct domain, the peer, this box, the transaction, the phase, the id, that nonce and the seen value, verified in constant time; an unsigned, wrongly signed or other-ask answer is an error (not acknowledged), never seen. Reads only the in-memory mesh keys it already used; no store, file or record read added; a drain only fails more often, never proceeds on less. ``` **Operator-facing strings for copy review** (`internal/grouproll/text.go`; none of these has been reviewed) - `floor_box` (changed in round 0): "Box {box} does not publish ha_handover: 1" - `floor_fixed_missing` (new): "Fixed box {box} is in fixed_boxes but has no edges file" - `floor_fixed_boxes` (new, reworded this round): "The config must list the deployment's fixed boxes in fixed_boxes, or set no_fixed_boxes to true if it has none" - `floor_fixed_both` (new): "The config lists fixed_boxes and also sets no_fixed_boxes to true. Keep only one" The drain-report reasons operators see in the drain summary, all new: - "the %s state could not be acknowledged: %v" - "ha-drain: the edges files have not all been read" - "ha-drain: %s's answer is not signed for this ask" **Config keys, as an operator would read them** - `fixed_boxes`: a list of box references, one for every fixed box in the deployment that can forward requests to a group member, in any region. For example `["adi", "tito-1"]`. Each reference appears once and is the name of the box's edges file without `.json`. If a listed box has no edges file, the tool uses DR-4 and names the box. - `no_fixed_boxes`: `true` or `false`. Set it to `true` only if the deployment has no fixed boxes at all. - Use exactly one of the two: a non-empty `fixed_boxes`, or `"no_fixed_boxes": true`. With neither, or with both, the tool refuses the transaction and changes nothing. - The superseded `region-group-roll.py` refuses a config that contains either key. **Not done** - The runbook still needs your copy-reviewed edits: - `docs/region-ha-runbook.md` lines 62 and 64 (the old `ha_take` and `CARLOS_REGION_HA` sentences). - Its "Add three keys" list, which now needs `fixed_boxes` / `no_fixed_boxes`.</result> <usage><subagent_tokens>304954</subagent_tokens><tool_uses>101</tool_uses><duration_ms>1967339</duration_ms></usage> </task-notification>