spec: connectors rev 3.1, Astra round 3 folded in (ready with changes)
Astra's last round on e9f1bc7 said READY WITH CHANGES with no Critical. Its ten Important findings are folded in: a durable slot per metered connection released only after the termination proof and the charge, questions through the metered guard, Resume bound to its pause, normalised cost accounting, a total room comparator, future-only wake-ups, OpenCode Go metered without a standing overflow switch, an in-namespace stdio bridge for OpenCode, and a selected-model health probe. Round 3's text is kept beside the spec.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+217
−64
docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md+176 −64docs/superpowers/specs/CODEX-FINDINGS-CONNECTORS-SCHEDULING-R3.md+41 −0
CI failed — run details
diff --git a/docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md b/docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md| index 5b507a5b..5dadb920 100644 |
| --- a/docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md |
| +++ b/docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md |
| @@ -1,6 +1,6 @@ |
| # Equipo connectors and token-aware scheduling |
| -Status: design for Paul's review, 2026-11-12, **revision 3**. Spec only, |
| +Status: design for Paul's review, 2026-11-12, **revision 3.1**. Spec only, |
| nothing built. Drafted by Claude (Opus 5.5) on `connections-slice2-design` |
| from main 1d7b4e4. |
| @@ -20,7 +20,11 @@ from main 1d7b4e4. |
| - scheduling decides admission from the readings taken at admission |
| and claims nothing about what a step will go on to consume. |
| -§15 maps both rounds' findings. |
| +- Astra round 3, the last, on revision 3 (e9f1bc7): **READY WITH |
| + CHANGES**, no Critical. Its ten Important findings are folded into |
| + revision 3.1 (`-R3.md`, §15), with no further round. |
| + |
| +§15 maps all three rounds' findings. |
| This builds on: |
| @@ -70,10 +74,14 @@ Each has a recommendation. Nothing is built until these are answered. |
| below 80%. `urgent` steps start on any connection that is not |
| limited. The thresholds are the margin, because Equipo does not |
| predict a step's consumption. *Recommend: these numbers.* |
| -7. **Subscriptions that can bill overflow** (OpenCode Go into Console |
| - credit, a Mistral plan into pay-as-you-go) count as metered unless |
| - you confirm on the add-connection screen that pay-as-you-go is off. |
| - *Recommend:* turn it off on both, and confirm. |
| +7. **Subscriptions that can bill overflow** count as metered unless you |
| + confirm on the add-connection screen that a **standing setting** |
| + turns overflow off. For a Mistral plan that setting is pay-as-you-go |
| + off. For OpenCode Go, a zero Console balance is a snapshot rather |
| + than a setting, and no overflow switch is documented, so Go counts |
| + as **metered** until you find one in the Console. *Recommend:* turn |
| + Mistral's pay-as-you-go off and confirm it; leave OpenCode Go |
| + metered until a switch is confirmed. |
| 8. **The coordinator stays on Claude and Codex.** The new connectors |
| take Engineering, Review and Ask. *Recommend: yes.* |
| 9. **Order.** *Recommend:* metered connections and the budget, Pi on |
| @@ -130,7 +138,7 @@ docs: |
| |---|---|---| |
| | TensorX | The prepaid balance. Keys are disabled when it falls under $0.05. Keep it at what you are willing to spend. Whether TensorX has automatic top-up, and per-key spend limits, is not documented; check that no top-up is set. | [T3] | |
| | Command Code Provider API | A pay-as-you-go account has only its credit balance, and a plan has dollar caps per 5 hours and per week. Either is a limit, if auto-purchase of credits is off (not documented; check in Studio). | [CC4] | |
| -| OpenCode Go | The Go plan's per-model limits. Overflow goes to Console credit, which is prepaid with a top-up fee, so a zero Console balance is the limit. | [OC2, OC12] | |
| +| OpenCode Go | The Go plan's per-model limits, and then the prepaid Console credit that overflow draws on (top-ups carry a fee). The Console balance is the hard limit. It is a balance, not a setting, so Go stays metered (§0 decision 7). | [OC2, OC12] | |
| | Mistral plan | The plan's monthly usage. Overflow needs pay-as-you-go to be enabled, so pay-as-you-go off is the limit. | [V13] | |
| The confirmation is recorded with the person, the time and the provider. |
| @@ -164,11 +172,17 @@ gateway, which is later (§5). |
| only: `api.tensorx.ai`, `api.commandcode.ai`, `opencode.ai`, |
| `api.mistral.ai`. `egress.ProviderPolicy` and `Policy.Hash` become a |
| table keyed by `(harness, provider)`. There is no other network. |
| -- **Health:** the runner, outside the namespace, calls `GET /v1/models` |
| - with the key, and Paul picks the connection's one model from the list |
| - on the connect card. A second model is a second connection, since |
| - rev 3's model-pair routing is unbuilt. The connection is `healthy` |
| - after that read succeeds. |
| +- **Health (round 3, finding 10):** the runner, outside the namespace, |
| + calls `GET /v1/models` with the key, and Paul picks the connection's |
| + one model from the list on the connect card. A second model is a |
| + second connection, since rev 3's model-pair routing is unbuilt. The |
| + connection is `healthy` only after a **one-token completion** on the |
| + selected model (`POST …/chat/completions`, `max_tokens: 1`, at the |
| + provider's own path in §4) succeeds. That is the selected-model proof |
| + rev 3 §2.5 requires. It runs at connect and on Check again only, as |
| + Claude's token check does, never hourly. It is billable, so it is |
| + recorded as a usage row with role `probe` and charged to the budget |
| + like any other. |
| ### 2.3 The soft budget |
| @@ -176,22 +190,61 @@ gateway, which is later (§5). |
| price table's currency, with both required and pre-filled (§0 |
| decision 4). Day and month are in the person's zone, UTC until one is |
| known. |
| -- **Spend is what the harness reported.** `cost = Σ reported tokens × |
| - the connection's price table`, where the harness reports its own cost |
| - (Pi `usage.cost`, OpenCode `cost`, Vibe `export.json`). The larger of |
| - the two is taken and both are recorded. Spend is charged to the day |
| - and month in which the attempt's usage row was recorded. |
| +- **Spend is what the harness reported (round 3, finding 5).** Each |
| + attempt's usage becomes **normalised billable components**: |
| + `uncached_input`, `cached_input`, `cache_write`, `output` and |
| + `reasoning`. `reasoning` is counted apart from `output` only where |
| + the provider's price-table entry says it bills separately; otherwise |
| + it is treated as included in `output` and not added. Per adapter: |
| + - **Pi:** `message_end.usage` is per request. The attempt's figure is |
| + the sum over its assistant messages, and it is `complete` when |
| + `agent_end` was seen. |
| + - **OpenCode:** whether `session.usage.updated` is cumulative or |
| + incremental is probe OC-P4. If cumulative, the attempt is the last |
| + total less the total at the attempt's start, as `CodexTally` does; |
| + if incremental, the sum. It is `complete` when the session went |
| + idle. |
| + - **Vibe:** one attempt is one run. It is `export.json`'s totals, |
| + `complete` when the file is present and parses. |
| + |
| + Price tables are versioned per connection: `{model, currency, |
| + micros per million for each component, price_version}`. Cost is |
| + int64 micro-units with overflow checks. A model with no price, or a |
| + component the table cannot price, makes the attempt's spend unknown |
| + (above). Where the harness reports its own cost (Pi `usage.cost`, |
| + OpenCode `cost`, Vibe's export), the larger figure is charged and |
| + both are recorded. `wire.Usage` gains `cost_micros`, `currency`, |
| + `price_version` and `cost_reported_micros`. Spend is charged to the |
| + day and month in which the attempt's usage row was recorded. |
| - **The ledger:** `budget_charge` rows in `thin.db`, keyed by the usage |
| row's existing key `(turn, step, attempt, connection, model)`, so a |
| resent row charges once. |
| -- **One step at a time.** A metered connection runs at most one step or |
| - question at once. Admission checks `reported spend < budget` for both |
| - the day and the month. The overshoot is therefore at most what one |
| - step spends, which the provider's limit bounds. |
| -- **Unknown spend pauses.** An attempt on a metered connection that |
| - ends without a complete usage figure marks the connection **"spend |
| - unknown"**. Nothing more is dispatched to it until Paul taps Resume, |
| - after looking at the provider's dashboard. |
| +- **One slot per metered connection (round 3, finding 1).** A metered |
| + connection has one durable `metered_slot` row in `thin.db`. Every |
| + attempt on it claims the slot in the same transaction as its |
| + admission, whatever it is: an Engineering or Review step, a question, |
| + a probe. Admission requires the slot to be free and `reported spend < |
| + budget` for both the day and the month. The slot is released only |
| + after the attempt's **termination proof** and either a committed |
| + charge or `spend_unknown`, in one transaction. Cancellation and |
| + failure take the same path. |
| +- **Restart recovery.** At start-up, before anything is admitted, a |
| + claimed slot is reconciled: |
| + 1. the attempt's namespace is recovered and killed, with the exit |
| + proven, as the existing recovery does; |
| + 2. a usage row already committed is charged; |
| + 3. otherwise the connection becomes `spend_unknown`; |
| + 4. then the slot is released. |
| + |
| + The overshoot is therefore at most what one attempt spends, which the |
| + provider's limit bounds. |
| +- **Unknown spend pauses.** An attempt that ends without a complete, |
| + priced usage figure marks the connection **"spend unknown"**, with a |
| + `pause_revision`. Nothing more is admitted to it until Paul taps |
| + Resume, after looking at the provider's dashboard. **Resume (finding |
| + 3)** carries the `pause_revision` it saw. The runner consumes it |
| + atomically once, and only if that is still the current pause. A stale |
| + or repeated Resume leaves a newer pause in place. |
| - **Budget changes** take effect when the runner applies the durable |
| `budget` frame. Until then the page shows "applies when <runner> |
| confirms". A running step is not stopped by a change. |
| @@ -300,15 +353,25 @@ fall back to Console credit. [OC2] |
| OC-P1 checks that OpenCode works with only `opencode.ai` reachable. |
| If the catalogue lives on `opencode.ai` too, its fetch is a known, |
| stated leak of the model list request, not of data. |
| -- **Driving it:** `opencode serve --standalone --hostname 127.0.0.1 |
| - --port <fixed>` inside the namespace, on the namespace's own |
| - loopback. The SSE `GET /api/event` gives text, tool calls, results |
| - and `permission.asked`, answered at the reply endpoint. Usage comes |
| - from `session.usage.updated`. [OC4] |
| -- **Billing:** a subscription only if Paul confirms that his Console |
| - balance is zero (§0 decision 7). Otherwise it is metered. Headroom is |
| - "not reported" unless probe OC-P3 finds the Go allowance in |
| - OpenCode's events. |
| +- **Driving it (round 3, finding 9):** `opencode serve --standalone |
| + --hostname 127.0.0.1 --port <fixed>` inside the namespace, on the |
| + namespace's own loopback, which the runner cannot reach. The control |
| + path is therefore an **in-namespace stdio bridge**: a small mode of |
| + the certified namespace helper (the binary that is already PID 1). It |
| + connects only to `127.0.0.1:<fixed>` inside the namespace, allows only |
| + the OpenCode paths the adapter uses (create session, prompt, the SSE |
| + event stream, the permission reply, abort), and relays them as framed |
| + JSON over the helper's stdio, which the runner already owns as the |
| + capture. Its mode, port and path list are part of the policy manifest |
| + and its hash, and it exits with the namespace. The SSE `GET |
| + /api/event` gives text, tool calls, results and `permission.asked`, |
| + answered at the reply endpoint. Usage comes from |
| + `session.usage.updated`. [OC4] If probe OC-P2 finds a stdio mode in |
| + OpenCode v2 (`acp`, unconfirmed), the bridge is not built. |
| +- **Billing:** metered (§0 decision 7), unless Paul confirms a standing |
| + Console setting that disables overflow, which is undocumented today. |
| + Headroom is "not reported" unless probe OC-P3 finds the Go allowance |
| + in OpenCode's events. |
| - **Fallback:** if Pi fails its probes, a TensorX connection may use |
| `harness: opencode`. [T5] |
| @@ -345,7 +408,7 @@ Vibe 3.1.2 (PyPI, 2026-11-10) is Apache 2.0. [V1, V2] |
| |---|---|---|---|---|---|---| |
| | Pi → TensorX | No | Yes, after §3 acceptance | Yes | Yes | Not reported | Metered | |
| | Pi → Command Code Provider API | No | Yes, if CC-P1 | Yes | Yes | Not reported | Metered until §0 decision 2 | |
| -| OpenCode → OpenCode Go | No | Yes | Yes | Yes | OC-P3, else not reported | Subscription if the Console balance is zero, else metered | |
| +| OpenCode → OpenCode Go | No | Yes | Yes | Yes | OC-P3, else not reported | Metered, unless a standing overflow-off setting is confirmed | |
| | Vibe → Mistral plan | No | Yes, if V-P2 | Yes, if V-P2 | Yes (`--resume`) | V-P3, else not reported | Subscription if pay-as-you-go is off, else metered | |
| | OpenCode → TensorX | No | only if Pi fails | as Pi | as Pi | as Pi | Metered | |
| @@ -429,24 +492,35 @@ connection), as today. |
| release, no other step is running on it, spend is known, and the |
| reported spend is under both the day and the month budget. |
| -Ask never comes through `Decide`: it stays on its step's exact session |
| -and connection (rev 3 §3). |
| +**Ask (round 3, finding 2)** never comes through `Decide` for its |
| +choice: it stays on its step's exact session and connection (rev 3 §3). |
| +On a metered connection, every question still passes the **metered |
| +guard**: the slot, the day and month budget, and no `spend_unknown`, |
| +all in the same admission transaction as a step. Consent is the |
| +question itself, because Paul asking is his own action. A question the |
| +guard refuses is held with the step's hold copy ("Waiting: TensorX has |
| +reached today's budget"), never moved to another connection. |
| **Thresholds.** A subscription connection **admits** a step at priority |
| `p` when every reported window has `used < t(p)`, where `t(low) = 0.60`, |
| `t(normal) = 0.80`, `t(urgent) = 1.0` (only "not limited"). A |
| -connection with no window reported admits when it is not limited, and |
| -the routing row says "headroom not reported". A release (Run now) |
| -treats the step as `urgent` for thresholds and metered eligibility, and |
| -the bars still apply. |
| +A connection with no window reported admits when it is not limited, and |
| +the routing row says "headroom not reported". A window whose |
| +`resets_at` has passed with no newer reading counts as not reported, |
| +never at its old figure. A release (Run now) gives the step the |
| +**effective priority** `urgent` for thresholds and metered eligibility, |
| +and the bars still apply. |
| **Room, with a fixed precedence (finding 16).** Among subscription |
| connections that admit the step, the one with the most room is the |
| -least by these keys, in order: |
| - |
| -1. the largest `used` among its reported windows (lower is more room); |
| -2. the `used` of its shortest reported window (lower first); |
| -3. connections with any reported window before those with none; |
| +least by these keys, in order (round 3, finding 6): |
| + |
| +1. connections with at least one reported window before those with |
| + none; the rest of the keys apply only between two connections that |
| + both have windows; |
| +2. the largest `used` among its reported windows (lower is more room); |
| +3. the `used` of its first window when its windows are sorted by |
| + `minutes` ascending (missing `minutes` sorts last), then by name; |
| 4. the connection id, bytewise. |
| Among metered connections, the most room is the least by: |
| @@ -454,15 +528,20 @@ Among metered connections, the most room is the least by: |
| 1. the larger of day and month spend as a fraction of its budget; |
| 2. the connection id, bytewise. |
| -A subscription always ranks before a metered connection. |
| +A subscription always ranks before a metered connection. A preference |
| +for a metered connection does not change that: it orders metered |
| +connections first among themselves, in rule 4. |
| **Order of rules.** The first that yields a connection wins. |
| -1. **Kept session (finding 15).** A step that resumes a kept session (a |
| - fix round on its Engineering session) stays on that connection while |
| - it is usable and passes the bars, whatever the threshold. This is |
| - rev 3's binding rule: a session leaves its connection only on a |
| - quota or auth failure. Reason `sticky`. |
| +1. **Kept session (findings 15 and round 3, finding 4).** A step that |
| + resumes a kept session (a fix round on its Engineering session) stays |
| + on that connection, whatever the threshold, while it is usable. When |
| + a **spending bar** blocks it (busy slot, budget, spend unknown), the |
| + step is **held** on that connection, not moved. It switches only as |
| + rev 3 allows: a quota or auth failure (the connection is then not |
| + usable and is in `avoid`), or Paul's explicit per-task "Run on …". |
| + Reason `sticky`. |
| 2. **Preferred.** The role's preferred connection, if it admits the |
| step. Reason `preference`. |
| 3. **Subscription.** The subscription with the most room. Reason |
| @@ -473,14 +552,25 @@ A subscription always ranks before a metered connection. |
| reset comes first), `budget`, `spend_unknown` or `no_connection`. |
| Every attempt, failover included, is admitted through `Decide`, with |
| -the failed connection in `avoid`. |
| +the failed connection in `avoid`. A consumed release becomes a durable |
| +**grant** for `(step, step_revision)`. It covers every attempt of that |
| +step revision, failover attempts included, and ends when the step ends. |
| +A second admission for the same step revision is refused by a unique |
| +key, so a replayed release cannot start another execution. |
| -**Wake-ups.** `wake_at` is the earliest of: |
| +**Wake-ups (round 3, finding 7).** `wake_at` is the earliest time |
| +**strictly after `now`** among: |
| -- every `resets_at` of every capable connection, limited ones included; |
| +- every future `resets_at` of every capable connection, limited ones |
| + included; |
| - the next budget day or month boundary; |
| -- the preference's `until`; |
| -- `by` minus 24 h, the deadline check. |
| +- the preference's `until`, while it is in the future (an expired |
| + preference is cleared and treated as absent); |
| +- `by` minus 24 h, unless the deadline check has already fired for |
| + this step, which is recorded as `deadline_notified`. |
| + |
| +When none exists, `wake_at` is null and only a fact change wakes the |
| +step. |
| The runner persists it with the hold, re-runs `Decide` then, and also |
| on any reading, step end, budget change, preference change or release. |
| @@ -496,10 +586,12 @@ stricter rule wins, and it never uses a metered connection. |
| **Invariants**, each a property test: |
| -- (a) no admission on a subscription with a reported window at or above |
| - `t(p)`, except a kept session; |
| +- (a) no admission on a subscription with a reported, unexpired window |
| + at or above `t(effective priority)`, except a kept session; |
| - (b) no metered admission without `urgent` or a release; |
| -- (c) never two running steps on one metered connection; |
| +- (c) never two attempts (steps, questions or probes) holding one |
| + metered connection's slot, and never a slot released before its |
| + attempt's termination proof and charge; |
| - (d) no metered admission once the reported spend reaches the budget, |
| or while spend is unknown; |
| - (e) a hold only when rules 1 to 4 all fail; |
| @@ -590,7 +682,7 @@ gain `hold`. |
| **Frames, instance to runner:** `budget` (durable, acked when applied), |
| `release` (durable, consumed once), `preference.until` (durable) and |
| -`resume_spend{connection}` (durable). |
| +`resume_spend{connection, pause_revision}` (durable, consumed once). |
| **Routing reasons** gain `sticky`, `metered_urgent`, `metered_release` |
| and `held`. |
| @@ -626,11 +718,11 @@ needs its own Astra round on its branch. |
| | # | Slice | Finish line | Sec | Size | |
| |---|---|---|---|---| |
| -| S1 | Metered connections: `KindAPIKey` sealed paste, the limit and pay-as-you-go confirmations, the egress table keyed by `(harness, provider)`, the budget ledger, one step at a time, spend unknown, the spend line | With a fake harness, the step after the reported spend crosses the budget is held, a second concurrent step is never admitted, a step with no usage pauses the connection, and a resent usage row charges once | **Sec** | 2 | |
| +| S1 | Metered connections: `KindAPIKey` sealed paste, the limit and overflow confirmations, the selected-model probe, the egress table keyed by `(harness, provider)`, normalised components and price tables, the budget ledger, the durable slot and its restart recovery, spend unknown with bound Resume, the metered guard for questions, the spend line | With a fake harness: the attempt after the budget is crossed is held; a concurrent Engineering, Review and question race admits exactly one; a crash between exit and charge ends in `spend_unknown` before anything else is admitted; a stale Resume leaves a newer pause; a resent usage row charges once; an unpriced model gives spend unknown | **Sec** | 2.5 | |
| | S2 | Pi on TensorX: committed pins, isolated config, Equipo's extension, `fakepi`, RPC adapter, rev 3 P1 to P5, the §3 acceptance | A real Review step on TensorX GLM on staging, recorded `other_family`, with the hostile-repository fixture loading nothing | **Sec** | 3 | |
| -| S3 | Scheduler: priority and `by`, `Decide`, holds, wake-ups, release order, Run now with replay refusal, the Needs you rules, `preference.until` | The six invariants pass as property tests; a `low` step holds at 0.61 and starts by itself after the reset; a replayed or stale release starts nothing | | 2.5 | |
| +| S3 | Scheduler: priority and `by`, `Decide`, holds, wake-ups, release order, Run now grants with replay refusal, the Needs you rules, `preference.until` | The six invariants pass as property tests; a `low` step holds at 0.61 and starts by itself after the reset; a replayed or stale release starts nothing; a failover attempt inside a grant is admitted; no wake-up is ever in the past | | 2.5 | |
| | S4 | Usage page (availability, spend, tokens) and the four advice kinds | From fixtures, each kind fires once, ties pick the same card on every run, and Not now silences it for 14 days | | 2 | |
| -| S5 | OpenCode on Go: pins, isolated config, serve adapter, OC-P1 and OC-P3 | A real Engineering step on Go on staging, with its usage row | **Sec** | 2.5 | |
| +| S5 | OpenCode on Go: pins, isolated config, the in-namespace stdio bridge (unless OC-P2 finds a stdio mode), serve adapter, OC-P1, OC-P3 and OC-P4 | A real Engineering step on Go on staging, with its usage row; the bridge refuses a path outside its list | **Sec** | 3 | |
| | S6 | Vibe on the Mistral plan: PyPI pin, V-P2 and V-P3 | A real Vibe Review of a Claude step on staging | **Sec** | 2 | |
| | S7 | Command Code Provider API behind Pi, after CC-P1 | A real Review step through it | **Sec** | 0.5 | |
| @@ -743,3 +835,23 @@ the gateway are now cut or restated. |
| | 25 | Adversarial finish lines | §3 acceptance and §11 finish lines name the budget, replay and hostile-config cases | |
| | R2 Critical | The gateway does not bound request bodies | Gateway cut (§5), requirement recorded | |
| | R2 Important | No namespace transport for the gateway | Gateway cut (§5), requirement recorded | |
| + |
| +**Round 3 (revision 3): READY WITH CHANGES.** All ten Important |
| +findings are folded into 3.1: |
| + |
| +| # | Finding, short | Revision 3.1 | |
| +|---|---|---| |
| +| 1 | No durable lifecycle for the one-step bound | §2.3: a durable slot for every attempt, released after the proof and the charge; restart reconciliation; S1 race and crash cases | |
| +| 2 | Ask bypasses the budget | §7: questions pass the metered guard and are held, never moved | |
| +| 3 | Resume not bound to its pause | §2.3: `pause_revision`, consumed once | |
| +| 4 | Kept session and release lifetime | §7: a spending bar holds a kept session; a release becomes a grant for the step revision | |
| +| 5 | Cost accounting underspecified | §2.3: normalised components, per-adapter aggregation, versioned price tables, unpriced means unknown | |
| +| 6 | Comparator and invariant | §7: known before unknown first, window ordering defined, effective priority, metered preference | |
| +| 7 | Wake-ups in the past | §7: strictly future, expired preferences cleared, `deadline_notified`, expired readings not reported | |
| +| 8 | A zero balance is not a setting | §0 decision 7, §2.1, §4.2: Go stays metered without a standing overflow-off setting | |
| +| 9 | No OpenCode control transport | §4.2: an in-namespace stdio bridge in the certified helper, unless OC-P2 finds a stdio mode | |
| +| 10 | Model list is not a credential proof | §2.2: a one-token completion on the selected model, charged as a `probe` | |
| + |
| +The round 3 statuses it gave "NOT RESOLVED" for round 1 items (#4, |
| +#7, #12, #15 to #17, #20, #21, #25) are these ten findings, and are |
| +answered above. |
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-CONNECTORS-SCHEDULING-R3.md b/docs/superpowers/specs/CODEX-FINDINGS-CONNECTORS-SCHEDULING-R3.md| new file mode 100644 |
| index 00000000..91945643 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-FINDINGS-CONNECTORS-SCHEDULING-R3.md |
| @@ -0,0 +1,41 @@ |
| +VERDICT: READY WITH CHANGES |
| + |
| +| Earlier findings | Status | |
| +|---|---| |
| +| R1 #1–2: hard cap, shell access to keys | STATED | |
| +| R1 #3: request reservations | CUT | |
| +| R1 #4: crash recovery | NOT RESOLVED | |
| +| R1 #5: budget changes | RESOLVED | |
| +| R1 #6: accounting scope and periods | STATED: per connection, usage-row time | |
| +| R1 #7: overflow billing | NOT RESOLVED | |
| +| R1 #8: interactive sign-in | CUT | |
| +| R1 #9–11: allowed-host paths, pins, isolated configuration | RESOLVED | |
| +| R1 #12: Run now | NOT RESOLVED: replay addressed; retry authorization unspecified | |
| +| R1 #13–14: coordinator authority, implementation dependencies | RESOLVED | |
| +| R1 #15–16: binding and deterministic selection | NOT RESOLVED | |
| +| R1 #17: estimates and usage normalization | NOT RESOLVED: estimates cut; monetary accounting still needs normalization | |
| +| R1 #18–19: calibration and subscription reservations | CUT | |
| +| R1 #20–21: invariants and wakeups | NOT RESOLVED | |
| +| R1 #22–24: starvation, housekeeping, advice ordering | RESOLVED | |
| +| R1 #25: adversarial acceptance | NOT RESOLVED: recovery and cross-role admission remain uncovered | |
| +| R2 Critical and Important: gateway bounds and transport | CUT | |
| + |
| +1. **Important — §§2.3, 7, 11: The one-step overshoot bound lacks a durable lifecycle.** Rechecking connection revisions does not establish that concurrent Engineering and Review admissions contend on one slot, or that the slot remains occupied until usage is charged. Restart recovery, cancellation and failure between process exit and charging are unspecified. **Fix:** Atomically claim a durable per-connection slot before launch; release it only after termination proof and a committed charge or `spend_unknown`. Reconcile interrupted admissions before dispatch resumes, with crash and cross-role race acceptance cases. |
| + |
| +2. **Important — §§2.3, 7–8: Ask bypasses the budget gate.** Ask explicitly skips `Decide`, while its inherited path checks connection health; no replacement enforces metered consent, serialization, budget or unknown-spend pauses. Repeated questions could therefore spend after the budget is exhausted. **Fix:** Keep Ask’s exact session/model binding, but pass every question through the same transactional metered admission guard, with explicit consent and hold behavior. |
| + |
| +3. **Important — §§2.3, 10: Resume is not bound to the pause it clears.** `resume_spend{connection}` carries no unknown-spend generation; two separately issued Resume commands could let a delayed command clear a later attempt’s pause. **Fix:** Bind Resume to the observed pause revision and consume it atomically once; stale commands must leave newer unknown spend untouched. |
| + |
| +4. **Important — §§7–8: Binding and release rules conflict at continuation boundaries.** A healthy kept connection that fails a budget or busy bar falls through to another connection, contradicting the stated switching restriction. A consumed Run now also has no defined authorization lifetime for failover attempts. **Fix:** Hold a kept session when a spending bar blocks it unless an expressly permitted switch applies. Consume Run now into durable authorization for the specified step revision, defining which attempts it covers without permitting replay to start another execution. |
| + |
| +5. **Important — §§2.3, 4, 10: Cost accounting remains underspecified.** Cutting estimates does not resolve how Pi’s per-message usage, OpenCode’s updates and Vibe’s export become one complete attempt charge. Cached/reasoning overlap, cumulative versus incremental events, missing prices and monetary fields are undefined; existing `wire.Usage` carries no cost. **Fix:** Specify each adapter’s aggregation and completeness rules, normalized billable components, versioned prices and monetary representation; unpriceable usage must produce unknown spend. |
| + |
| +6. **Important — §7: `Decide` still lacks a total comparison and consistent invariant.** The room comparator evaluates maximum and shortest-window usage before handling connections with no windows, leaving its first two keys undefined. Invariant (a) also rejects a normal step released under urgent thresholds because its only stated exception is a kept session. **Fix:** Rank known versus unknown headroom before accessing window values and define missing-duration/tie handling. Express the invariant using effective priority after Run now, and clarify whether a metered preference overrides “subscription always ranks before metered.” |
| + |
| +7. **Important — §§6–8: Wakeups can select an already-expired time forever.** The minimum includes expired reset times, expired preferences and `by − 24 h` after the deadline check has fired. Re-evaluation can therefore immediately schedule the same past wakeup again. **Fix:** Select only future, unconsumed wakeups, persist deadline notification state, and define how stale window readings are retired when refresh supplies no replacement. |
| + |
| +8. **Important — §§0.7, 2.1, 4.2: Zero Console balance is not pay-as-you-go disabled.** OpenCode becomes a subscription on a balance snapshot, although the spec says later Console credit funds overflow. Replenishing that balance would permit paid requests without metered admission or budgeting. **Fix:** Require a persistent overflow-disabled setting for subscription classification; otherwise retain metered classification and make the confirmation describe the actual control. |
| + |
| +9. **Important — §4.2: OpenCode’s control transport is missing.** Its HTTP server binds inside the isolated network namespace, so the runner cannot reach its SSE and reply endpoints through host loopback. The existing egress bridge only carries outbound CONNECT traffic. **Fix:** Specify a per-attempt control bridge or an in-namespace stdio adapter, including fixed authority, lifecycle and policy attestation. |
| + |
| +10. **Important — §2.2: Model listing replaces the required credential/inference proof.** A successful `GET /v1/models` does not establish that the selected model’s inference route works, contrary to Connections §§2.5–2.7; provider-specific probe routes are also unspecified. **Fix:** Define each provider’s authenticated health probe and selected-model validation, including accounting and admission treatment for any billable validation request. |
| \ No newline at end of file |