carlos / platform Public

Fleet alerts Plan 2 plan: R3 findings; skip infra probes (R3 #3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev ac902423cad610f5ba9dbab4f74e555d8ea1643f parent 267feff
2 files changed, +56 −2
  • docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md +9 −2
  • docs/superpowers/reviews/CODEX-FINDINGS-fleet-alerts-2-plan-R3.md +47 −0

CI passed — run details

Intent

Human

<task-notification> <task-id>b1w8d7fkv</task-id> <tool-use-id>toolu_01JR4TjBtRfo9n1yFE6A5RZH</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1f8653ea-6b78-4712-b1ac-1eb863a870a6/tasks/b1w8d7fkv.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra plan review R3" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 17.6 g CO₂e (2,158,656 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on fleet-alerts-2-traffic, 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/docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md b/docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md
index 39d462ccf..ede09a118 100644
--- a/docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md
+++ b/docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md
@@ -46,7 +46,7 @@ The usage edge day is a bucket object read by `/fleet/protection`. Reading it fo
- **Top lists:** 10 entries a window on the box, 20 in an hourly rollup.
- **Counting (Paul's ruling, 2026-11-01): every answer is counted once, on the box the visitor connected to, by its final status.**
- **The ingress counter.** One wrapper, installed first in `Edge.ServeHTTP` and in the :80 handler, records the final status of every answer.
- - **Skipped requests.** It skips a request that arrived over a verified hop (`acceptHop`), over a fleet tunnel (`fromTunnel`), or from a door caller (`doorCallerFrom`, `hopDoorFrom`). The edge those came from counts them, or they are the platform's own calls. It also skips the status host, the tunnel hostname and the store door, which are not visitor traffic.
+ - **Skipped requests.** It skips a request that arrived over a verified hop (`acceptHop`), over a fleet tunnel (`fromTunnel`), or from a door caller (`doorCallerFrom`, `hopDoorFrom`). The edge those came from counts them, or they are the platform's own calls. It also skips the status host, the tunnel hostname, the store door, the steering probe (`steeringProbe`, `edge.go:1845`) and the load balancer's health answer (`lbHealthAnswer`, :80, `edge.go:2930`). None of these is visitor traffic (R3 #3).
- **Classes, per window:**
- Refused: the status is 429 (every rate and plan refusal answers 429 through `writeRateLimited`, and so does a backhaul fair-share refusal), or the status is 404 and the response carries `X-Carlos-Ref` (the guard's block page, `guard.go:150-155`, which the hop does not scrub).
- Unknown host: the request reached `unknownHost`, which marks the ingress note. It counts only in `UnknownHost`.
@@ -222,7 +222,7 @@ The usage edge day is a bucket object read by `/fleet/protection`. Reading it fo
- Each fully skipped 5-minute slot closes as a zero window.
- Windows that start before `ceil5(counter start)` are discarded.
- **`windows(now)`** returns the closed windows whose starts are among the 3 before `floor5(now)`, oldest first. An idle box reports zero windows, not nothing.
-- **The ingress wrapper.** The first statement of `ServeHTTP` wraps `w` in a status-capturing writer and puts a fresh `ingressNote` on the context. Its defer calls `answer` unless `note.skip`, or `unknown` instead when `note.unknown` is set. `noteIngressSkip` is called where the request is known to be a verified hop (right after `acceptHop` reports `hopped`), a tunnel delivery, a door caller, the status host, the tunnel hostname or the store door. The :80 handler gets the same wrapper.
+- **The ingress wrapper.** The first statement of `ServeHTTP` wraps `w` in a status-capturing writer and puts a fresh `ingressNote` on the context. Its defer calls `answer` unless `note.skip`, or `unknown` instead when `note.unknown` is set. `noteIngressSkip` is called where the request is known to be a verified hop (right after `acceptHop` reports `hopped`), a tunnel delivery, a door caller, the status host, the tunnel hostname, the store door, the steering probe or the health answer. The :80 handler gets the same wrapper.
- A hijacked or upgraded connection counts the status it wrote: 101 counts as `S2xx`.
- Nothing else in the request path changes. The existing observer defer keeps doing what it does today, plus `served`.
- **`unknownHost`** calls `noteIngressUnknown` with the stripped host. A door caller's request is already skipped, so only outsiders count. The host is lower-cased and cut to 253 bytes, `strings.ToValidUTF8(…, "?")` is applied, and control characters become `?`.
@@ -249,6 +249,7 @@ The usage edge day is a bucket object read by `/fleet/protection`. Reading it fo
- `TestEdgeTrafficIngressForwardHA`: a delivered forward and `answerHolderUnreachable`, each counted once, at the forwarding edge.
- `TestEdgeTrafficIngressFarAsset`: a far-asset answer filled from the home, an unacknowledged home answer, and a fallback forward. Each is counted once, at the far edge.
- `TestEdgeTrafficTunnelAndDoorSkipped`
+ - `TestEdgeTrafficInfraProbesSkipped` (R3 #3): a steering probe on :443 and a load-balancer health check on :80, both healthy and failed, add nothing to any counter.
- `TestEdgeTrafficUnknownHostOutsiderOnly`: an outsider's unknown host counts in `UnknownHost` and in no class. A door caller's out-of-scope request does not count.
- `TestEdgeTrafficGuardMatchesUsageMeter`: in block mode, one blocked probe and one watched path. Traffic `Blocked`/`Watched` equal the meter's `GuardDelta` Block/Watch.
- `TestEdgeTrafficRateEnforcedVsObserved`: enforcing counts `RateShed` or `RateCeiling`. Observe mode counts only `RateObserved`, and the request is served.
@@ -570,3 +571,9 @@ Stopping rule 2 fired on two families (discussion 497), and Paul chose both cuts
4. **P1, the cursor advances before commit.** Removed with the cursor. Each pass re-judges the last hour, and `TestTrafficSignalsCommitFailureRetried` pins that.
5. **P2, baselines accept partial hours.** Accepted. A baseline hour needs `windows == 12` and `box_windows == boxes*12` (`TestAbuseBaselineSkipsPartialHours`).
+## R3 dispositions (Astra, `CODEX-FINDINGS-fleet-alerts-2-plan-R3.md`, the last round)
+
+1. **P1, a failed commit loses the only crossing at the edge of the hour,** and
+2. **P1, late healthy rows erase a crossing already seen.** They share one cause: crossings are rebuilt from a changeable, time-bounded query rather than kept. Round 3 had P1s, so they go to Paul (stopping rules 1 and 2). The options are on discussion 497. Task 5 waits for his choice. Tasks 1-4 and 6-7 don't depend on it.
+3. **P2, infrastructure probes counted as visitors.** Accepted. The ingress skip list now names the steering probe and the load balancer's health answer (`TestEdgeTrafficInfraProbesSkipped`).
+
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-fleet-alerts-2-plan-R3.md b/docs/superpowers/reviews/CODEX-FINDINGS-fleet-alerts-2-plan-R3.md
new file mode 100644
index 000000000..b60adfd55
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-fleet-alerts-2-plan-R3.md
@@ -0,0 +1,47 @@
+- **R2 #1, P1 — Resolved:** removing completeness-based clearing removes the restarted-box failure.
+- **R2 #2, P1 — Resolved:** ingress ownership and status-based refusal classification address the listed lost and duplicate answers.
+- **R2 #3, P1 — Resolved:** rejected timestamps no longer control a watermark.
+- **R2 #4, P1 — Partly resolved:** replay works while the crossing remains inside the lookback; a failed commit at its boundary still loses it. Carried forward as finding 1.
+- **R2 #5, P2 — Resolved:** baseline eligibility now uses both parts of the partial-hour predicate.
+
+Reviewed commit `267feffa0c8cacf6870f2eae3080ae2f9e9e099d`, branch `fleet-alerts-2-traffic`, round **3 of 3**. References below were verified against that checkout. No files were edited, subagents spawned, or test suites run. Two in-memory arithmetic checks reproduced the timelines below.
+
+1. **P1 — Task 5: a failed incident commit can still lose the only crossing.**
+
+ **Problem and evidence:** [Plan:366](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md:366) bounds replay to interval ends within the last hour. Evaluation precedes `CommitAlertStep`, and the heartbeat-pass counter advances even when that commit subsequently fails ([alertengine_pass.go:188](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/internal/console/alertengine_pass.go:188), [alertengine_pass.go:210](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/internal/console/alertengine_pass.go:210)). Nothing retains an evaluated crossing for retry.
+
+ **Failure scenario:** At 10:00, the console first ingests a delayed heartbeat containing:
+ - 09:00: 500 answered requests, six 5xx.
+ - 09:05 and 09:10: 49,500 healthy answers each.
+
+ These timestamps pass the two-hour ingestion bound at [plan:316](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md:316). Only the interval ending with the 09:00 window crosses. If its incident commit fails, the next heartbeat evaluation at 10:05 starts with 09:05. No remaining interval crosses, so the incident is never recorded. Removing the cursor narrowed R2 #4 without eliminating it.
+
+ **Concrete fix:** Retain pending crossing identity and timestamp until the incident transition commits. Commit consumption with the incident and outbox changes; retry pending crossings independently of the moving lookback. Extend `TestTrafficSignalsCommitFailureRetried` with this boundary case and a console restart.
+
+ **Fault family:** A qualifying observation must survive failure between evaluation and incident commit. This carries forward R2 #4.
+
+2. **P1 — Task 5: late healthy rows can close an incident after five minutes.**
+
+ **Problem and evidence:** The plan re-evaluates historical intervals from all currently stored rows and covers the rule without a signal when none crosses ([plan:376](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md:376)). `withGone` then generates Gone for the open member ([alertsignals.go:283](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/internal/console/alertsignals.go:283)). A non-flapping incident closes immediately; the engine supplies no one-hour hold for Gone ([alertengine.go:195](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/internal/console/alertengine.go:195), [alertengine.go:213](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/internal/console/alertengine.go:213)).
+
+ **Failure scenario:** At 10:10, box A’s 10:00 window supplies 500 answered requests and six 5xx. Box B’s corresponding window has not arrived. The rule crosses at 1.2% and opens an incident. At 10:15, B contributes 49,500 healthy answers for that same window. Every previously crossing interval now has a 0.012% error rate. With no other crossings, the pass produces Gone and closes the incident after five minutes. It can close before sending its first notification.
+
+ This violates the promised minimum lifetime at [plan:90](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md:90). Recomputed historical ratios are not a record of crossings already observed.
+
+ **Concrete fix:** Retain committed crossing timestamps and derive expiry from the latest recorded crossing. Later rows must not erase a crossing that already opened or extended an incident. Deduplicate repeated evaluation of the same crossing. Add the two-box late-denominator timeline to `TestTrafficSignalsSelfClosing`.
+
+ **Fault family:** An observed event must retain its promised lifetime independently of later changes to its source measurements.
+
+3. **P2 — Task 2: infrastructure health checks enter visitor traffic totals.**
+
+ **Problem and evidence:** The exhaustive skip list at [plan:49](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/docs/superpowers/plans/2026-11-01-fleet-alerts-2-traffic.md:49) omits steering probes and load-balancer health checks. Both return inside the proposed outer wrappers: HTTPS steering at [edge.go:1845](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/internal/edge/edge.go:1845), and HTTP health checks at [edge.go:2930](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-alerts-2-traffic/internal/edge/edge.go:2930).
+
+ **Failure scenario:** An idle deployment accumulates successful “visitor” requests from its infrastructure probes. Those answers inflate the chart and dilute the fleet 5xx percentage. The steering probe is a separate reserved answer, not the status route already excluded.
+
+ **Concrete fix:** Mark ingress skipped whenever `steeringProbe` or `lbHealthAnswer` handles the request. Test both listeners, including failed health answers, and assert that these checks contribute no traffic counters.
+
+ **Fault family:** Visitor accounting must exclude infrastructure-generated requests.
+
+The two P1s share one cause: crossings are reconstructed from a mutable, time-bounded query instead of retained through their commit and expiry. Refusing late or partial inputs alone does not fix both. Cutting the two traffic alert rules would remove both blockers while retaining the counters and page; retaining them requires one durable crossing lifecycle with the guard tests above. The three-round review budget is exhausted.
+
+**NOT READY:** P1 findings 1 and 2 block implementation as written.
\ No newline at end of file