carlos / platform Public

Ledger · region-ha-dead-holder-backoff

● 39f6687 Region HA dead-holder backoff (P1b-2 follow-up). A forward for a born-HA host that cannot connect to its holder now marks that holder suspect for 10 s (holderSuspectTTL) in the activator's holder cache instead of dropping the entry. While a host is suspect, ForwardTarget answers a refusal (edge.ForwardDecision{Refuse: true}, which replaces the bare ref string) and the edge's frontForwardHA answers it at the front door with the existing unreachable answer, 503, Retry-After: 10, "instance is waking elsewhere; retry shortly", with no lock read, no dial, no note, no local wake and no per-request step (N-HA10 kept). After the window the next request reads lock.json once; if it still names the same box, only the caller that read forwards (one dial), queued callers are refused, and the box is suspect again until that forward's outcome says otherwise. So a dead holder whose lease has not run out costs each box one lock GET and one failed dial per 10 s per host instead of one of each per request. ForwardResult gains Ref (the box forwarded to). A suspect entry is cleared when this box takes the lease, when a forward to any box comes back with an answer (that box becomes the holder), and when an X-Carlos-Holder names a box (or drops on none or this box); an old unreachable forward never overwrites a negative entry or one naming another box. Once the lease expires and OwnerTerminated says the holder is terminated, the first request after the window reads no live holder and P1b-1's takeover serves it here. Legacy hosts, scheduled ticks, regional names and hops are unchanged; no new copy, no new S3 polling. Tests: TestDeadHolderCostsOneReadAndDialPerWindow, TestSuspectWindowEndForwardsOnce, TestSuspectClearedByTakingTheLease, TestSuspectClearedByAHolderHeader, TestSuspectClearedByASuccessfulForward, TestUnreachableKeepsNewerNews, TestSuspectThenExpiredLeaseTakesOver, TestFrontForwardSuspectRefusalRunsNoLocalStep. Census region-ha-dead-holder-backoff proposed (Edge.frontForwardHA body, Service.ForwardTarget sites; activator and edge envelopes re-pinned), awaiting the reviewer. Not reviewed, not released.

Human

<task-notification> <task-id>bo1y5tvpg</task-id> <tool-use-id>toolu_016N8pShoMhSjtS5N9sSiVro</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/bo1y5tvpg.output</output-file> <status>completed</status> <summary>Background command "Wait for the Astra review to finish" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>a2996f62a17f2d23c</task-id> <tool-use-id>toolu_01D9gzeUQDSTZvpLxDZNyy8U</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/a2996f62a17f2d23c.output</output-file> <status>completed</status> <summary>Agent "Cut v0.31.1 and roll dev" 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>v0.31.1 is released and rolled to dev only, and every dev check passed. Flagship was not touched. Dev is ready for the P1b-2 drill, and CONSOLE_HA_REGIONS is still unset. The full detail is in /home/paulca/.cache/release-v0.31.1/roll-log.md. **Cut** - **Tag:** v0.31.1 (tag object 0d558604) on main bfc668c8. I checked main was unmoved and nothing newer than v0.31.0 existed before tagging. - **Main CI at bfc668c8 failed.** The only failure was TestReleaseLeaseLossUnprovenLeavesTheHold (internal/activator), whose settle started 0.2 µs after its deadline. That is the known flake #460. I recorded the ruling: main's tree 8f6099f0 is identical to the merged branch tip 90d2c802, which landed through the merge gate. Every other shard passed. - **Release:** [https://github.com/carlosframework/releases/releases/tag/v0.31.1](https://github.com/carlosframework/releases/releases/tag/v0.31.1), Latest, 10 assets. The public download's signature verified and its checksums match. - **Homebrew tap:** PR #71 merged. - **apt:** v0.31.1-1 is live (latest.txt reads v0.31.1, and the served deb matches the signed one). - **Build:** linux-arm64 sha 7021a2f2; console dc849550 with the full commit stamped. **Dev roll and checks (all passed)** - **Boxes:** sophie (canary), then leo and dennis (stable), are all v0.31.1 current and running 7021a2f2. - One listeners line each; REFUSING, LEASE HELD and ERROR all 0; NRestarts 0. - host.env sha8 unchanged on all three (leo bee523d2), and CARLOS_POOLS unchanged. - I copied the v0.31.1 binary over bootstrap/carlos to clear the status warning. - **box-1:** updated itself to v0.31.1 by 10:56:42Z (read from system status only). - **Console:** now v0.31.1 (dc849550). The restart took about 1.56 s from stop to serving. All 13 drop-ins and box files on sophie have identical sha8, owner and mode before and after. No ha-regions drop-in. - **#434 probe:** 1180 requests, none failed. Requests during the restart were held for at most 1.46 s, and there were no proxy errors. - **Standard checks:** x-carlos-version is v0.31.1, the billing webhook returns 400, and hosts-used is unchanged (36 recorded, floor v0.29.0). wakecheck woke on sophie (0.65 s) and claimtrial on leo (0.54 s). instances list and analytics work. - **Static site without `_headers`:** favicon.svg still has `no-cache`, the same Etag and X-Carlos-Version. The trailing-slash 301/200 is unchanged. - **Static site with `_headers`:** the throwaway app relcheck-headers works. `/assets/a.css` carries both headers, on its 304 too, and `/` keeps `no-cache`. `carlos ship` refused the `X-Frame-Options` file and named line 2. The app is deleted. - **Forwarding dormant:** 0 holder/forward lines in the sophie, leo and dennis edge journals, and no CONSOLE_HA_REGIONS on the console. - **rootfs:** shop (rootfs, on box-1) shows `process=web` and `process=worker` on every log line since box-1's update. I only read its logs. **Odd things** - **The dev console was not on v0.31.0 before the roll.** It was running a66482c9 (5dcddd46) from 08:07Z. A note at the end of the v0.31.0 roll-log explains it: the plans-6c session moved it there for the billing rehearsal. So I made a66482c9 the rollback target instead of c5fadb15. It wasn't needed. - **Old errors on sophie's journal.** It had "drop-in unreadable (zz-carlos-env.conf)" lines from before this release. They have not come back since the update. - **Already there before this release:** Cost Explorer "AccessDenied" errors when the console starts. The bab account also shows a warning that it is over its plan (4407 of 1500 awake hours). Nothing is left running, and the scratch files I created are removed.</result> <usage><subagent_tokens>151992</subagent_tokens><tool_uses>102</tool_uses><duration_ms>1773647</duration_ms></usage> </task-notification>

● 28fc3b9 Region HA dead-holder backoff, round 1 fixes (Astra R1 READY AFTER FIXES, three P2s; census approved at 39f6687d, re-proposed here). P2-1: a per-host connection gate. A positive holder entry with no confirmed connection lets one request dial; concurrent requests wait on that first connection, bounded by holderConnectWait (edge.ForwardDialTimeout plus 500 ms for the hop's set-up); when it connects they forward, when it cannot they get the suspect refusal, and a gate that never reports is abandoned so the next request dials. The connection is signalled from the transport (httptrace GotConn, dialled or reused, TCP and TLS) through the new HAForwarder.NoteConnected, before any answer, so a slow app never holds the gate; a confirmed connection lifts the gate until the entry changes. P2-2: a read that revalidates an expired suspect and fails (error or timeout) renews the window for the same box and refuses its initiator and waiters, unless news arrived while it ran. P2-3: every entry carries a generation, handed out with each forward (ForwardDecision.Gen, ForwardResult.Gen, NoteConnected) and renewed by every put, every first-connection attempt and every answer from the named box; removal invalidates it. An unreachable, connected or unconnected outcome under an older generation is ignored, so a stale failure cannot undo a success, a holder header or this box taking the lease. A read overtaken by news no longer hands out its uncached answer; its callers look again. N-HA10 kept, 50,000 bound kept, no new copy, no new S3 request. Witnesses: TestFirstDialGatesConcurrentRequests (20 concurrent requests, first dial held open: exactly one dial; connects, unreachable, ended without connecting), TestFirstDialWaitIsBounded, TestSuspectWindowEndForwardsOnce (now waiting on the connection), TestSuspectRevalidationFailureRenewsTheWindow (error, timeout, newer news), TestStaleUnreachableIsIgnored (same-ref success, holder header, lease acquisition), TestForwardHAConnectedBeforeTheAnswer (edge: GotConn while the holder's app holds the answer, Gen round-trips, reused connections count). Census re-proposed under the same NAME: Edge.frontForwardHA and Service.ForwardTarget body only, read sites unchanged; activator and edge envelopes re-pinned. Not released.

Human

<task-notification> <task-id>b1a1zbipb</task-id> <tool-use-id>toolu_01HCy9MHHaC94qxPaKA6pvvr</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/b1a1zbipb.output</output-file> <status>completed</status> <summary>Background command "Wait for usage flushes, then read per-box usage" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>byopsca6t</task-id> <tool-use-id>toolu_01YL4ZeDMnJEt9E5b2aHgTXT</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/byopsca6t.output</output-file> <status>completed</status> <summary>Background command "Wait 5 minutes then read per-box usage" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bpif4fpnq</task-id> <tool-use-id>toolu_01GJz6VBUgU9y5JneVHpT3yH</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/bpif4fpnq.output</output-file> <status>completed</status> <summary>Background command "Wait for 200s to resume through sophie after lease expiry" completed (exit code 0)</summary> </task-notification>

● c88f58a Region HA dead-holder backoff, round 2 (final) fixes: the dial bound enforced centrally (Paul's ruling under stopping rule 2, after Astra's re-review of 28fc3b90 found P2-1 and P2-2 not addressed; P2-3 addressed and the census approved). The edge's forward transport, one per holder address, now dials through a forwardDialGate: at most one TCP dial to a holder is in flight. Dials that arrive meanwhile wait for its outcome within their own forwardDialTimeout; a failure answers every waiter at once with its error, and every dial that arrives until the failed dial's forwardDialTimeout has run out, so a box that refuses at once costs no more dials than one that does not answer; a success lets each waiter dial its own connection. The dial in flight is detached from its caller's cancellation, so a visitor hanging up does not fail the others. Each failed forward reports ForwardUnreachable and the cache's generation rule lands one of them. The bound holds whatever the cache believes (cold entry, live entry after a success, idle pool dropped), so round 1's cache-level connection gate, NoteConnected and the GotConn hook are removed as redundant, with their tests. P2-2: a forward that answers while a suspect's revalidation read runs (no entry in the cache) makes the box that answered the holder and invalidates the read, so its failure no longer renews the suspicion; it sets nothing when no read is in flight or when this box taking the lease (a drop) already invalidated it. Guard test TestDeadHolderGuardRealWiring (package edge_test, the real activator Service over an ExecBackend and the lock fixture, through the real edge scene via forwardha_export_test.go): the holder serves one forward; then its listener is closed, its connections cut and annie's idle forward connections dropped while its lease and the cache entry stay live; 20 concurrent requests make exactly one dial (counted at the dial seam) and get 20 x 503 Retry-After: 10, both with the dial refused at once and black-holed; then sequential requests within 10 s make no dial and no lock read. Also TestForwardDialGate, TestSuccessDuringRevalidationWins (success; lease acquisition first), TestSuspectWindowEndReadsOnce (20 failures under one generation land once), TestForwardHANoteCarriesTheGen. N-HA10 kept, 50,000 bound kept, no new copy, no new S3 request. Census re-proposed under the same NAME: Edge.frontForwardHA body only, read sites unchanged; activator and edge envelopes re-pinned. Not released.
Human

<task-notification> <task-id>b8nmzdih2</task-id> <tool-use-id>toolu_01QtUQPttQwrqosLhFKaBsRF</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/b8nmzdih2.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra's final re-review" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>a00dd29cef729b733</task-id> <tool-use-id>toolu_018enc8R51Weg9hgFpEbABsy</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/a00dd29cef729b733.output</output-file> <status>completed</status> <summary>Agent "Build dead-holder backoff follow-up" 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>The last P2-1 fix is in commit `0de2bcd8`, on top of your merge `68c172fc`. The branch was already there, so the fast-forward did nothing. Not pushed. **Diff stat:** 3 files, 120 insertions, 29 deletions. - `internal/edge/forwardha.go`: 38 lines changed - `internal/edge/forwardha_test.go`: 109 lines changed - `internal/provision/testdata/plan14-root-reads-region-ha-dead-holder-backoff.tsv`: 2 lines changed (the edge envelope re-pinned) **Change.** Every TCP dial to a holder address now goes through `forwardDialGate`, so at most one is ever in flight. After a dial connects, the next waiter takes the gate and dials while the rest keep waiting; a burst to a healthy holder dials one at a time. Each caller's own 2 s deadline bounds its whole wait, queueing and dial together: the dial in flight ignores its caller hanging up but keeps the caller's deadline. Connections are not shared across TLS server names. **One fix found during GREEN.** A black-holed dial fails at its deadline, which is also when its standing failure window for later arrivals ends. The released waiters saw the window already over and dialled again: the guard's black-holed case got 2 dials. Now every waiter on a dial that failed returns that dial's error, whenever the failure lands. The window still covers arrivals that come later. **RED** - On the old gate, the new `TestForwardDialGate` subtests failed: - "after a success the next waiter takes the gate": timed out waiting for the second dial, because released waiters dialled concurrently. - "a healthy burst dials one at a time": "10 dials, 9 at once". - In the version before the waiter fix, the black-holed `TestDeadHolderGuardRealWiring` failed: "2 dials and 0 lock reads, want 1 and 0". **GREEN** - `TestForwardDialGate` passes all six subtests with `-race`. The new one holds the second dial after the first connects, checks at most 1 dial at once, then fails it and checks the remaining waiters share the error with no further dial. - The targeted edge set (`TestFrontForward|TestForwardHA|TestForwardDialGate|TestDeadHolderGuardRealWiring|Backhaul`) passes with `-race` in 74 s. - The targeted activator set passes with `-race`. - `TestDeadHolderGuardRealWiring` and `TestForwardDialGate` together pass with `-count=8`. - `TestAgentActivatorForwards` and the provision census tests pass. - gofmt is clean. The darwin, windows and linux arm64 builds pass, as does `go vet` of the edge package on darwin and windows. **Census.** The card showed only the `internal/edge` envelope moving, with no unit changes. I re-ran `make census-propose NAME=region-ha-dead-holder-backoff` with the existing claims file, which re-pinned the edge envelope digest in the overlay. The seal is unchanged at `8f6a1865b0abcea9d4fb68232cc2a25263a106ec87f73bd4b3f2fb388971ebe5`. **Concerns** - If a healthy holder's dials are slow and a big burst queues, a waiter can run out its 2 s while still queued. Its forward then reports unreachable and the holder goes suspect. That is the cost of the serial ruling. With millisecond same-region dials it would take a very large burst. - A waiter that takes the gate late dials with whatever is left of its 2 s. If that short dial times out, the failure is shared and stands like any other.</result> <usage><subagent_tokens>343330</subagent_tokens><tool_uses>9</tool_uses><duration_ms>749383</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>b0ailuky9</task-id> <tool-use-id>toolu_01DE5jysxzKvaJ8yFKsMYC6F</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/b0ailuky9.output</output-file> <status>completed</status> <summary>Background command "Wait for branch CI to finish" completed (exit code 0)</summary> </task-notification>