carlos / platform Public

plans 4c: Astra review brief and ledger

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 13af0b2c459467404e79418be167c59661ca2649 parent 64bbf1e
2 files changed, +58 −0
  • docs/superpowers/notes/plans-4c-ledger.md +14 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-4C-CODE.md +44 −0

CI passed — run details

diff --git a/docs/superpowers/notes/plans-4c-ledger.md b/docs/superpowers/notes/plans-4c-ledger.md
new file mode 100644
index 000000000..e779cd4d4
--- /dev/null
+++ b/docs/superpowers/notes/plans-4c-ledger.md
@@ -0,0 +1,14 @@
+# SDD ledger — plan: docs/superpowers/plans/2026-10-25-plans-4c-box-throttle.md
+Pre-flight: T1 produces plans.Throttle/ThrottleRule/SetAccountThrottle, T2-T4 consume (match); T3 produces planThrottleFor/planMaxRunFor, T4/T5 consume (match); T5 produces SetMaxRunFor, wired in agent.go by T5. No conflicts.
+Task 1: complete (commits a523cb6..67a3a8e, tests: sh -c 'go test ./internal/plans/ -run 'ThrottleActive|RoundTripsThrottle' && go test ./internal/console/ -run 'SetAccountThrottle|PublishCarriesThrottle|PlanLimits|AccountPlan'' → ok github.com/carlosframework/platform/internal/console 6.900s)
+Task 2: Ruling: convergeThrottle treats an expired stored throttle (past Until) as off before applying 'unmeasured keeps the stored value' — a stale last-month throttle never carries into a new month — cost if wrong: none.
+Task 2: complete (commits 67a3a8e..d65f4f6, tests: go test ./internal/console/ -run 'ThrottleDue|ThrottleSet|ThrottleUnchanged|ThrottleWithout|BannerSays|GracePass' → ok github.com/carlosframework/platform/internal/console 3.377s)
+Task 3: Ruling: planThrottleFor answers only for instance routes (sidecar workers and others are never plan-throttled at the edge) — the spec's throttle targets the account's apps; workers have their own run ceiling — cost if wrong: a worker route escapes the slowdown.
+Task 3: complete (commits d65f4f6..6215723, tests: go test ./internal/host/ -run 'PlansPassKeepsThrottle|ExpiredThrottle|PlanMaxRunFor|ThrottleOffWith|PlansPass|PlanIdle|PlanRate' → ok github.com/carlosframework/platform/internal/host 1.334s)
+Task 4: Ruling: the plan throttle has its own limiter (Edge.planLimiter), separate from the #358 limiter, keyed 'plan:<account>' with one fixed client prefix — independent of CARLOS_RATE_LIMIT and of #358's buckets and eviction — cost if wrong: one more limiter's memory.
+Task 4: Ruling: an awake-throttled account's new upgrade gets the 429 with Retry-After 60s; upgrades are tracked (cancellable context) only while a throttle hook is armed, so a box without plans keeps its request untouched.
+Task 4: Ruling: the host closes upgrades on the pass that first sees an awake throttle (planAwakeThrottled, armed in agent.go beside SetPlanThrottleFor) — transitions only; later upgrades are refused at the edge.
+Task 4: complete (commits 6215723..ed72cb3, tests: sh -c 'go test ./internal/edge/ -run 'Throttle' && go test ./internal/host/ -run 'Throttle|PlansPass'' → ok github.com/carlosframework/platform/internal/host 1.670s)
+Task 5: Ruling: the ceiling skips an entry with a command in progress (e.cmd != nil), as the idle predicate does — a run is not cut mid-command — cost if wrong: a long command can hold an awake-throttled instance awake past 15 minutes.
+Task 5: complete (commits ed72cb3..00541bd, tests: go test ./internal/activator/ -run 'MaxRunFor|IdleFor|MaxRun|Sweep' → ok github.com/carlosframework/platform/internal/activator (cached))
+Task 6: complete (commits 00541bd..64bbf1e, tests: sh -c 'GOFLAGS=-buildvcs=false go test ./internal/provision/ -run 'Plan14RootReadCensus$|Plan9B8RecordWriteCensus$'' → ok github.com/carlosframework/platform/internal/provision 7.706s)
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-4C-CODE.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-4C-CODE.md
new file mode 100644
index 000000000..c45089b04
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PLANS-4C-CODE.md
@@ -0,0 +1,44 @@
+# Whole-branch code review brief: Plans 4c (box-side throttle)
+
+You are a senior Go reviewer on the carlos platform, and the census's
+cross-model reviewer for this branch. Review branch `plans-4c-box-throttle`
+(`git diff 7f8767715280765a9b47bd715a96203d3d36fda4..HEAD` is the branch's own change). Read-only: do not
+modify the working tree, index, HEAD or branches. You may run `go test`
+with GOFLAGS=-buildvcs=false, targeted with -run.
+
+Requirements: the spec docs/superpowers/specs/2026-10-20-plans-caps-packs-design.md
+§5.2 ("Awake hours"), §5.7, §6, §7 and table 4.2; the plan
+docs/superpowers/plans/2026-10-25-plans-4c-box-throttle.md, including its
+Global Constraints, Review Focus and Paul's CONFIRMED calls (bandwidth
+throttles at 2x without notice; awake hours at 2x with 72 h notice;
+5 req/s burst 30 per account; independent of CARLOS_RATE_LIMIT); the
+executor's `Ruling:` lines in docs/superpowers/notes/plans-4c-ledger.md.
+Plans 4a and 4b (merged) and the edge rate limiter #358 (merged) are the
+base.
+
+Grade by effect. Check each Review Focus line deliberately, and also:
+- plans off and boxes with CARLOS_PLAN_LIMITS=off change nothing: no
+ throttle, no upgrade tracking side effects, rate limiter unchanged;
+- the console: revision bumps only on change; the publish pass and
+ existing plan rows; a throttle row for an account with no plan row;
+- the edge: the throttle check's placement relative to the response cache,
+ doors, hop-door and tunnel callers, the activator wake path, and the
+ #358 limiter (no double counting, no slot leaks); upgrade tracking and
+ context cancellation (leaks, races between CloseAccountUpgrades and a
+ new upgrade); 429 shape;
+- the activator ceiling: hibernation semantics, probes, seeds, commands,
+ workers, always-on routes, races with a wake;
+- the host: snapshot last-good copy, Until expiry, notification once per
+ transition, CARLOS_PLAN_LIMITS=off;
+- cost: no new per-box polling (the throttle rides the existing limits
+ record and the existing plans pass).
+
+Census: answer the card's review question for every unit and re-pinned
+envelope in docs/superpowers/notes/census-proposal-plans-4c-box-throttle.md,
+including the hand-written decision overlay plans-4c-units (approve or
+escalate per unit; check its seal and fingerprints).
+
+Answer: findings graded Critical / Important / Minor, each with file:line
+and a concrete failure scenario; then the census verdicts; then a verdict:
+accept, accept with fixes, or changes required. Do not review the wording
+(Luna-approved copy in plancaps_copy.go).