design: stateless replicas rev 2 (builder check: edge cases, fleetChannelFor fallback)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/specs/2026-11-01-stateless-replicas-design.md+38 −3
CI passed — run details
Intent
<task-notification> <task-id>bnn1rm61b</task-id> <tool-use-id>toolu_01XA34qLuYzkT4AZPZyuJ4in</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/3bbea1fd-996b-42f3-b651-0add5a8ac1d5/tasks/bnn1rm61b.output</output-file> <status>completed</status> <summary>Background command "Wait for the builder check result" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 41.3 g CO₂e (5,187,580 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-stateless-replicas, 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/specs/2026-11-01-stateless-replicas-design.md b/docs/superpowers/specs/2026-11-01-stateless-replicas-design.md| index 449917bce..0fd86bbef 100644 |
| --- a/docs/superpowers/specs/2026-11-01-stateless-replicas-design.md |
| +++ b/docs/superpowers/specs/2026-11-01-stateless-replicas-design.md |
| @@ -1,6 +1,6 @@ |
| # Stateless replicas: several copies of one app on a fleet |
| -Rev 1, 2026-11-01. Brainstormed with Paul in the session that closed rootfs |
| +Rev 2, 2026-11-01 (rev 1 plus the builder check: §6.3 corrected, §6.6 added). Brainstormed with Paul in the session that closed rootfs |
| apps Plan 6. Discussion: to be filed on amadan carlos/platform; related |
| #366 (rootfs apps), #457 (managed fleets), region HA (spec |
| 2026-10-26-region-ha-without-claims-design.md). |
| @@ -218,8 +218,10 @@ to set aside. |
| ### 6.3 The hub spreads requests and skips a dead copy |
| Today the hub forwards a fleet app's host down one box's tunnel channel |
| -(`fleetChannelFor`, `internal/edge/edge.go`), and a dead box gives 503 with |
| -no failover. For a replicated app the hub: |
| +(`fleetChannelFor`, `internal/edge/edge.go`). An unlabelled route falls back |
| +to another connected fleet box. A labelled route (managed fleets 1b, which a |
| +multi-box fleet uses) is bound to its box, and a dead box gives 503 with no |
| +failover. For a replicated app the hub: |
| - holds the set of copies that are up; |
| - sends each request to one of them, round-robin; |
| - drops a copy from the set within seconds of its tunnel closing or its |
| @@ -260,6 +262,39 @@ with one copy left (the other box lost) switches that copy alone. |
| - `carlos run` and interactive sessions open on one copy: a healthy one the |
| platform picks, or the one named with a flag (author's call). |
| +### 6.6 Edge cases (author's calls after the builder check) |
| + |
| +- **A release whose result is unknown.** Say the coordinator's box dies |
| + while the release command runs. The command may have committed |
| + migrations before its success was recorded. The unknown result counts as |
| + a failure, so the deploy stops and every copy keeps the old build. Running |
| + the deploy again runs the command again. Release commands must therefore |
| + be safe to run twice, as Rails migrations are (schema_migrations). The |
| + docs say so. Nothing asks an operator to step in. |
| +- **What "reads don't fail" promises.** A read is retried on another copy |
| + when the box died before it started answering. A response already |
| + streaming to the client when its box dies is cut, because the hub cannot |
| + restart it elsewhere without buffering every response, which this design |
| + does not do. The drill measures failures among requests the dying box had |
| + not started answering. Those must be zero. A cut mid-stream response is |
| + counted and reported, not failed. |
| +- **Apps with several instance records.** `--copies` is set on the app and |
| + applies to each of its instances. Each instance has its own copies, its |
| + own coordinator lease and its own release run: "once per deploy" means |
| + once per instance per build, as a single instance's release runs today. |
| + Two instances of one app sharing a database is the app's concern, as it |
| + is today. |
| +- **Moving between stateful and stateless releases.** It is refused rather |
| + than converted. While an app has more than one copy, promoting, deploying |
| + or rolling back to a release that does not declare "no local database" |
| + is refused, with a message saying to set `--copies 1` first. An app going |
| + from a local database to stateless keeps its old database file and |
| + replica untouched. They are simply no longer used. |
| +- **Hibernation.** More than one copy requires an always-on release. A |
| + release shipped with `--hibernate` is refused while copies are above 1, |
| + and setting copies above 1 on a hibernating app is refused. Health checks |
| + never wake anything. |
| + |
| ## 7. Constraints |
| - **Copy:** every user-facing string goes through Paul's copy review before |