| index 021af434..5b507a5b 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,16 +1,26 @@ |
| # Equipo connectors and token-aware scheduling |
| |
| -Status: design for Paul's review, 2026-11-12, **revision 2**. Spec only, |
| +Status: design for Paul's review, 2026-11-12, **revision 3**. Spec only, |
| nothing built. Drafted by Claude (Opus 5.5) on `connections-slice2-design` |
| from main 1d7b4e4. |
| |
| -Revision 1 (732d7d6) drew **NOT READY** from Astra's one round |
| -(`CODEX-FINDINGS-CONNECTORS-SCHEDULING.md`). Per the brief, revision 2 |
| -cuts scope rather than spinning. The central change is that every new |
| -connector reaches its provider only through a **metering gateway on the |
| -runner**. The gateway holds the key, prices and caps every request |
| -before forwarding it, and allows only inference paths. §15 maps each |
| -finding to its fix or cut. |
| +**History.** |
| + |
| +- Revision 1 (732d7d6): Astra round 1 said NOT READY. |
| +- Revision 2 (6591b33) added a metering gateway on the runner. Astra |
| + round 2 also said NOT READY, with a new Critical (the gateway did not |
| + bound request bodies) and an Important (no namespace transport for |
| + it). The full texts are in `CODEX-FINDINGS-CONNECTORS-SCHEDULING.md` |
| + and `-R2.md`. |
| +- Revision 3, on the controller's direction, **cuts the gateway from |
| + v1**: |
| + - hard caps live at the provider; |
| + - Equipo keeps a soft budget from reported usage; |
| + - keys reach the harness as Claude's and Codex's credentials do; |
| + - 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. |
| |
| This builds on: |
| |
| @@ -31,48 +41,45 @@ Each has a recommendation. Nothing is built until these are answered. |
| |
| 1. **"Pi" means Pi as the harness, with TensorX as the paid |
| connection.** Pi has no subscription of its own. *Recommend: yes.* |
| -2. **Command Code arrives as a provider behind Pi, not as its own |
| - harness yet.** You already use Command Code's models through Pi, and |
| - its Provider API (`api.commandcode.ai/provider/v1`) fits the |
| - gateway. Its own CLI has undocumented hosts and stream, so it waits |
| - for a later design. Please check in Command Code Studio whether |
| - Provider API calls draw on your plan's 5-hour and weekly windows or |
| - on pay-as-you-go credits. Until that is known, Equipo treats it as |
| - metered and capped. *Recommend: yes.* |
| -3. **When subscriptions run out, which work may spend metered money?** |
| - *Recommend:* only tasks you marked `urgent`. Only your tap sets |
| - urgent, never the coordinator's. `normal` and `low` work waits for |
| - the reset. A deadline that waiting would miss asks you first, with |
| - "I'd run it on TensorX: at most $0.40". |
| -4. **Default caps for a new metered connection**, pre-filled on the |
| - connect card and required before first use. *Recommend: $1 a day and |
| - $10 a month.* The cap is hard: the gateway refuses any request whose |
| - worst-case price does not fit. |
| -5. **The reserve ladder.** `low` work starts only below 60% of a |
| - subscription window, and `normal` below 80%. Above that, only |
| - `urgent` work and your chat with the coordinator go on. *Recommend: |
| - these numbers*, revisited once Equipo has recorded readings. |
| -6. **Subscriptions that can overflow into paid credit** (OpenCode Go |
| - into Console credit, a Mistral plan into pay-as-you-go). The gateway |
| - stops such a connection at the first sign of paid billing, and treats |
| - it as metered and capped whenever the provider gives no reading. |
| - *Recommend:* also keep pay-as-you-go off (or the balance at zero) on |
| - both accounts. Then the worst case is one refused request, not a |
| - bill. |
| -7. **The coordinator stays on Claude and Codex.** The new connectors |
| - take Engineering, Review and Ask, which is where tokens go. |
| - *Recommend: yes.* |
| -8. **Order, and what is later.** *Recommend:* |
| - 1. the gateway and caps; |
| - 2. Pi on TensorX; |
| - 3. the scheduler; |
| - 4. Usage and advice; |
| - 5. OpenCode Go; |
| - 6. Mistral Vibe; |
| - 7. the Command Code provider. |
| - |
| - Mac runners, the Command Code CLI, coordinator cells and sign-in by |
| - link are later designs. |
| +2. **Command Code comes in as a provider behind Pi, for now.** You |
| + already use its models through Pi, and its Provider API is a plain |
| + API key. Its own CLI has undocumented hosts and output, so it is a |
| + later design. *Recommend: yes.* Please check in Command Code Studio |
| + whether Provider API calls draw on your plan's windows or on credits. |
| + Until then it counts as metered. |
| +3. **The hard cap is the provider's, never Equipo's.** A metered |
| + connection is accepted only after you confirm, on the add-connection |
| + screen, that the key has a provider-side limit (§2.1 shows how for |
| + each provider). For TensorX that limit is the prepaid balance, so |
| + keep it at what you are willing to spend. A shell inside a step |
| + could use the key up to that limit. *Recommend: accept this.* The |
| + alternative, Equipo enforcing a hard cap itself, needs the gateway |
| + that failed two reviews (§5). |
| +4. **Equipo's own budget is soft.** It is a daily and a monthly figure |
| + per metered connection. Equipo stops starting new steps when the |
| + **reported** spend reaches either. A metered connection runs one |
| + step at a time, so it can overshoot by at most one step, and the |
| + screen says so. *Recommend: $1 a day and $10 a month* as the |
| + pre-filled defaults. |
| +5. **When does metered money get spent?** Only on tasks you mark |
| + `urgent` (your tap, never the coordinator's), or a step you release |
| + with "Run it now anyway". `normal` and `low` work waits for a |
| + subscription. *Recommend: yes.* |
| +6. **The reserve thresholds.** A `low` step starts only while every |
| + reported window of a subscription is below 60%, and a `normal` step |
| + 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. |
| +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 |
| + TensorX, the scheduler, Usage and advice, OpenCode Go, Mistral Vibe, |
| + then the Command Code provider. The gateway, Command Code's CLI and |
| + Mac are later (§5). |
| |
| ## 1. Why, and the shape |
| |
| @@ -82,203 +89,163 @@ advice on how to handle tokens", and "can I get connectors for my |
| Mistral, Pi, Opencode and Command Code subscriptions? … Pi I guess would |
| then use… my TensorX? But I don't want to run that down too much." |
| |
| -**Part A** adds three harnesses (Pi, OpenCode, Mistral Vibe) and four |
| -provider accounts behind them: TensorX, the Command Code Provider API, |
| -OpenCode Go and the Mistral plan. Every request goes through the |
| -runner's gateway, which makes spend caps hard and keeps every key out of |
| -the harness's namespace. |
| +**Part A** adds three harnesses (Pi, OpenCode, Mistral Vibe) over four |
| +accounts: TensorX, the Command Code Provider API, OpenCode Go and the |
| +Mistral plan. The provider holds the hard cap, and Equipo keeps a soft |
| +budget. |
| |
| -**Part B** adds `schedule.Decide`, a pure function the runner uses to |
| -run, hold or route each step, and `advice.Compute`, a pure function the |
| -instance uses to turn the same recorded facts into quiet cards. No model |
| -decides anything; models only describe a task. |
| +**Part B** adds `schedule.Decide`, a pure function on the runner that |
| +starts or holds each step from the readings taken at admission, and |
| +`advice.Compute`, a pure function on the instance that turns recorded |
| +facts into quiet cards. No model decides anything. |
| |
| **Reused, not redesigned:** |
| |
| - connections, homes and `connect.Choose`; |
| -- the sealed paste (`sealbox`, `seen_seals` and the delivery state |
| - machine of rev 3 §2.4, built for Claude tokens); |
| -- the egress relay's public-address checks (`internal/runner/egress`); |
| +- the sealed paste, with `sealbox`, `seen_seals` and the delivery state |
| + machine (rev 3 §2.4, built for Claude tokens); |
| +- the token's delivery to the CLI, via a 0600 file outside |
| + model-readable paths and bubblewrap's `--args` pipe; |
| +- the egress relay (`internal/runner/egress`), CONNECT to allowlisted |
| + public hosts on 443; |
| - usage rows (`wire.Usage`, `chat_usage`); |
| -- the step deferral (`stepDeferred` in `thin/engineer.go`); |
| -- the policy and manifest digests (`provider/policy.go`, |
| - `check_policy.go`); |
| -- the committed-digest pinning of srt (`internal/runner/mac`). |
| +- the step deferral (`stepDeferred`); |
| +- the policy and manifest digests; |
| +- srt's committed-digest pinning. |
| |
| # Part A: connectors |
| |
| -## 2. The metering gateway |
| - |
| -Rev 1 relied on harnesses reporting their own usage. Astra's first |
| -Critical finding showed why that is not enough: billing happens before |
| -the event arrives, and a harness can stay silent. So each metered or |
| -overflow-capable connection gets a gateway in the runner process, |
| -outside the namespace. |
| - |
| -**Shape.** |
| - |
| -- The gateway listens on a loopback port bound into the attempt's |
| - namespace, the transport rev 3 §2.5 designed for local endpoints. The |
| - harness's provider config points at `http://127.0.0.1:<port>/v1` with |
| - a placeholder key. |
| -- The gateway forwards over TLS to exactly one upstream origin recorded |
| - on the connection (`https://api.tensorx.ai`, `https://opencode.ai`, |
| - `https://api.mistral.ai`, `https://api.commandcode.ai`). It resolves |
| - that origin to public addresses only, with the relay's checks, refuses |
| - redirects, and injects `Authorization: Bearer <key>`. |
| -- The key lives in the runner's state, never in the connection home, the |
| - namespace, argv or an environment the harness can see. |
| -- These connectors get **no egress relay at all**. The gateway is their |
| - only way out. |
| - |
| -**Allowed requests only.** A per-upstream table of method and path: |
| - |
| -- `POST /v1/chat/completions`; |
| -- `GET /v1/models`; |
| -- for Mistral, the budget read of §4; |
| -- for OpenCode Go, its inference paths. |
| - |
| -Anything else gets a 403 and a diagnostic line naming the method and |
| -path, with no bodies or headers logged. That removes the rev 1 problem |
| -of telemetry sharing an allowed host (`api.mistral.ai/v1/datalake/…`). |
| -Bodies are capped at 4 MiB. |
| - |
| -**Per-request reservation: the hard cap.** Before forwarding, the |
| -gateway: |
| - |
| -1. **Clamps the output.** It sets `max_tokens` (or |
| - `max_completion_tokens`) to `min(requested, model limit, Equipo's |
| - step limit)`. |
| -2. **Bounds the input.** It takes input tokens to be at most the body's |
| - byte length, since a token is never shorter than a byte. That is |
| - conservative and needs no tokenizer. |
| -3. **Prices the worst case.** `worst = in_bytes × in_price + max_tokens |
| - × out_price`, using the connection's price table |
| - (`price_version`). |
| -4. **Commits the reservation.** In one SQLite transaction in |
| - `thin.db`, it checks `charged + Σ open reservations + worst ≤ cap` |
| - for the day and the month, and writes a `gw_request` row |
| - `{id, connection, attempt, worst, state: reserved}`. If the check |
| - fails, the request gets a 429 with `x-equipo-reason: spend_cap`, and |
| - the adapter classifies the attempt as failed with reason `spend_cap`. |
| -5. **Forces usage reporting.** It sets `stream_options.include_usage = |
| - true` for streamed requests, then forwards. |
| - |
| -When the response ends, it reads `usage` (the final SSE chunk or the |
| -body). It charges `min(worst, priced usage)`, or the whole `worst` when |
| -usage is missing or malformed. The row becomes `charged` in one |
| -transaction. |
| - |
| -**What this proves.** A request is never sent unless its worst case |
| -fits. Committed money cannot be taken by another attempt, because every |
| -request reserves its own. The cap holds even when the harness |
| -under-reports or says nothing. It does assume Equipo's price table is |
| -right. A provider price rise is the one remaining gap, and it is closed |
| -by checking `/v1/models` pricing where the provider offers it and by the |
| -prepaid balance itself (TensorX). |
| - |
| -**Crash recovery.** At start, every `gw_request` in `reserved` is |
| -charged its `worst` and marked `charged_unknown`. It may have been |
| -billed, so it is never released as zero. No request is admitted until |
| -that sweep finishes. Request ids are the gateway's own, so a replayed |
| -usage event cannot charge twice. |
| - |
| -**Periods.** A request is charged to the day and month in which it was |
| -reserved, in the person's zone, UTC until one is known. A zone change |
| -takes effect at the next day boundary. A reservation made at 23:59 and |
| -charged at 00:01 stays in the old day. |
| - |
| -**Cap changes.** The instance sends a durable `caps{connection, day, |
| -month, revision}` frame. The new cap is effective on the runner when the |
| -frame is applied, which is the same transaction that acks it. Until the |
| -ack, the page shows "New cap applies when <runner> confirms". Requests |
| -already forwarded finish and are charged; nothing new is admitted over |
| -the new cap. Nothing is grandfathered beyond requests already sent. |
| - |
| -**Budget identity.** Charges belong to `(runner, provider, key |
| -fingerprint)`. The fingerprint is an HMAC of the key under a secret held |
| -only by that runner. Removing and re-adding the same key on the same |
| -runner keeps the day's and month's charges. The same key on two runners |
| -gets two caps, which the runner cannot see. The Usage page warns when a |
| -person has two metered connections to the same provider, and the |
| -provider's prepaid balance remains the outer bound. That limit is |
| -stated, not hidden. |
| - |
| -**Usage rows** come from the gateway, per request and per attempt. |
| -They are authoritative for these connectors. The harness's own usage |
| -events are recorded beside them only as a consistency check. The rows |
| -take the existing `wire.Usage` shape, with `cost_micros` and |
| -`price_version` added. |
| - |
| -**Headroom readings** are taken where the provider's responses carry |
| -them, because the gateway sees bodies and headers: |
| - |
| -- TensorX: `x-ratelimit-remaining-*`, per-minute rate limits, shown as |
| - such and never as spend headroom; |
| -- OpenCode Go: `opencode.allowance` and `opencode.billing_source` in the |
| - body; |
| -- Mistral: the budget read of §4. |
| +## 2. Metered connections |
| + |
| +### 2.1 The provider's limit is the only hard cap |
| + |
| +A connection is **metered** when its key is billed per token, or when it |
| +is a subscription that can bill overflow and Paul has not confirmed that |
| +pay-as-you-go is off. The add-connection screen for a metered connection |
| +has one required confirmation, "This key has a spending limit at |
| +<provider>", with a line and a link saying how, from the provider's |
| +docs: |
| + |
| +| Provider | The provider-side limit | Source | |
| +|---|---|---| |
| +| 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] | |
| +| 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. |
| +Equipo cannot verify it, and the screen says so: |
| + |
| +> "Equipo can't see this limit. It is the only thing that stops spending |
| +> for certain: Equipo's own budget is checked between steps, and a step |
| +> that is running can use this key up to the limit you set at |
| +> <provider>." |
| + |
| +**Why a step can use the key.** These harnesses have no sandbox of |
| +their own for shell commands, unlike Claude Code's nested sandbox, which |
| +keeps its token out of reach (rev 3 §2.4). A command a model runs is in |
| +the same namespace and user as the harness, so it can read the harness's |
| +environment and spend the key. It can spend it only at the provider's |
| +host, because the relay allows nothing else. That is stated, not |
| +mitigated, in v1. Keeping the key out of the namespace altogether is the |
| +gateway, which is later (§5). |
| + |
| +### 2.2 Delivery, as Claude and Codex credentials are delivered |
| + |
| +- **Sign-in is a sealed paste only:** rev 3 §2.4 as built, generalised |
| + from `KindToken` to `KindAPIKey`, with `endpoint` the provider's |
| + origin. The key lands as a 0600 file in the connection's home, |
| + outside every path a model tool is given. |
| +- **Each launch** gets the key as the harness's environment variable |
| + through bubblewrap's `--args` pipe, never in argv, a manifest or a |
| + record. The harness's config names that variable and never holds the |
| + key. |
| +- **Egress** goes through the relay, allowed to the provider's host |
| + 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. |
| + |
| +### 2.3 The soft budget |
| + |
| +- **Figures.** Each metered connection has `budget {day, month}` in the |
| + 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. |
| +- **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. |
| +- **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. |
| +- **The screen** shows, for example, "TensorX: $0.84 today of $1 · |
| + $6.20 this month of $10 · reported by Pi, can go over by one step", |
| + with "Paused until tomorrow", "Paused until 1 Dec" or "Spend unknown: |
| + check TensorX, then Resume". |
| |
| ## 3. What every connector must have |
| |
| -- **Sign-in is a sealed paste only.** The key goes into the rev 3 §2.4 |
| - path as built, generalised from `KindToken` to `KindAPIKey`, with an |
| - `endpoint` bound to the upstream origin. The runner then calls |
| - `GET /v1/models` through the gateway, and Paul picks the |
| - connection's one model from the list on the connect card. A second |
| - model is a second connection, which is enough without rev 3's |
| - model-pair routing, still unbuilt. The connection is `healthy` after |
| - one clamped one-token request. Sign-in by link and device code for |
| - these providers are later designs. |
| -- **Containment (Linux).** The existing bubblewrap namespace, with the |
| - connection home holding no secret, no relay and the gateway port |
| - only, a runtime copy, no inherited environment, and pidfd |
| - termination proofs. The harness's approval layer is set to "allow |
| - inside the namespace", because the namespace is the containment. |
| - Since the namespace holds no credential, a model tool that reads |
| - everything it can reach finds nothing to steal (Critical finding 2). |
| - **Isolated configuration:** each harness is started so that it loads |
| - only Equipo's configuration. That means fixed config and home |
| - directories, project-local configuration, extensions, plugins and |
| - hooks disabled by flag or environment, and the effective-policy check |
| - of `check_policy.go` extended to each harness. A hostile-repository |
| - fixture (a project config, an extension, an `AGENTS.md` asking for a |
| - tool) proves it. |
| -- **Pinning.** The expected digests are **committed per supported |
| - platform**, as srt's tree digest is, not learned at install: |
| +- **Isolated configuration.** Each harness loads only Equipo's |
| + configuration: fixed config and home directories; project-local |
| + configuration, extensions, plugins and hooks disabled by flag or |
| + environment; and `check_policy.go`'s effective-policy check extended |
| + to each harness. A hostile-repository fixture (a project config, an |
| + extension, an `AGENTS.md` asking for a tool) proves it. |
| +- **Containment (Linux).** The existing bubblewrap namespace: the |
| + credential home mounted to the harness, the relay to the provider |
| + host only, a runtime copy, no inherited environment, pidfd |
| + termination. The harness's approval layer is set to "allow inside the |
| + namespace", because the namespace is the containment. Update checks, |
| + telemetry and catalogue fetches are switched off by configuration, |
| + and on a host other than the provider's they are also refused by the |
| + relay. |
| +- **Pinning.** Expected digests are **committed per supported |
| + platform**, as srt's tree digest is: |
| - npm trees (Pi, OpenCode): a committed `package-lock.json` installed |
| - with `npm ci --ignore-scripts`, plus a committed SHA-256 over the |
| - sorted list of every file path, mode and content digest, symlinks |
| - included (a link must resolve inside the tree), and the platform |
| - binary's own SHA-256 where there is one; |
| + with `npm ci --ignore-scripts`, plus a committed SHA-256 over every |
| + file's path, mode and content, symlinks included (each must resolve |
| + inside the tree), and the platform binary's own SHA-256 where there |
| + is one; |
| - the PyPI tree (Vibe): `uv pip install --require-hashes` from a |
| - committed lock, a pinned Python, and the same committed tree |
| - digest. |
| - |
| - The launcher verifies the digest before every launch and refuses on |
| - drift. The install directory is read-only, and update checks are off |
| - by configuration. Even if one were not, the gateway allows no path |
| - that could reach an updater. |
| -- **Mapping to turns and steps.** Each adapter's `Decode` yields |
| - Equipo's existing event kinds: `delta`, `tool_call`, `tool_result`, |
| - `ask`, `usage` (a consistency check only), `done` (`completed`, |
| - `failed` or `interrupted`) and the failure classes. Unknown events |
| - are counted and dropped, with type names only, never content. |
| -- **Families.** Each connection's model has a family. Review's |
| - `other_family` is judged on the model that actually ran, so a Claude |
| - step can be reviewed by GLM on TensorX, or by Mistral on Vibe. |
| -- **Acceptance**, per supported cell (connector × role), before the |
| - cell turns yes, in CI with the fake and once on staging with the |
| - pinned binary: |
| - - the cap holds against a fake upstream that under-reports, omits |
| - usage, or drops the connection mid-stream; |
| - - a runner crash between reserve and charge is recovered; |
| - - a cap lowered mid-attempt stops the next request; |
| + committed lock, a pinned Python, and the same tree digest. |
| + |
| + The digest is verified before every launch, and the install directory |
| + is read-only. |
| +- **Mapping.** Each adapter's `Decode` yields Equipo's existing kinds: |
| + `delta`, `tool_call`, `tool_result`, `ask`, `usage`, `done` |
| + (`completed`, `failed` or `interrupted`) and the failure classes. |
| + Unknown events are counted and dropped, type names only. |
| +- **Families.** Review's `other_family` is judged on the model that ran. |
| +- **Acceptance**, per supported cell, in CI with the fake and once on |
| + staging with the pinned binary: |
| - the hostile-repository fixture loads nothing; |
| - - a model `cat` of every path it can reach finds no key; |
| - - only the allowed paths pass the gateway; |
| + - only the provider host is reachable; |
| + - Review has no write or shell tool; |
| - killing the namespace ends every descendant; |
| - - Review has no write or shell tool. |
| + - the budget stops the next step when the reported spend reaches it; |
| + - a step with no usage figure pauses the connection; |
| + - a resent usage row charges once. |
| + |
| + Unlike Claude's acceptance, there is **no** "a model `cat` finds no |
| + key" check, because §2.1 says it can. The test asserts the opposite |
| + plainly, so the statement stays true. |
| |
| ## 4. The connectors |
| |
| @@ -289,100 +256,86 @@ package is deprecated. It needs Node 22.19 or later and has no install |
| scripts. [P1] |
| |
| - **Provider config:** `PI_CODING_AGENT_DIR` points at the home. [P2] |
| - `models.json` declares one provider, `api: openai-completions`, |
| - `baseUrl` the gateway, with a placeholder key. [P3] TensorX's API is |
| - OpenAI-compatible (`https://api.tensorx.ai/v1`, keys `tx-…`). [T1] |
| - The Command Code Provider API lives at `api.commandcode.ai/provider/v1`, |
| - and its Claude models work only on its Anthropic-style `/messages` |
| - route, which this design does not use. [CC6] That it serves the other |
| - models on `chat/completions` is inferred, not documented. Probe CC-P1 |
| - checks it before S7, and if it fails, S7 is dropped. |
| -- **Switches:** `PI_OFFLINE=1`, `PI_SKIP_VERSION_CHECK=1` and |
| - `PI_TELEMETRY=0`, with `--no-approve` for project trust. [P4] There |
| - is no permission layer. [P5] Gating is Equipo's own extension (`-e`, |
| - hashed in the manifest), and Review runs with `--tools |
| - read,grep,find,ls`. |
| + `models.json` declares the provider as `openai-completions` with |
| + `apiKey: "$TENSORX_API_KEY"`, or Command Code's variable. [P3] |
| + - TensorX is OpenAI-compatible at `https://api.tensorx.ai/v1`. [T1] |
| + - Command Code's Provider API is at `api.commandcode.ai/provider/v1`, |
| + and its Claude models need `/messages`, which is not used. [CC6] |
| + That other models are served on chat completions is inferred. Probe |
| + CC-P1 checks it, and S7 is dropped if it fails. |
| +- **Switches:** `PI_OFFLINE=1`, `PI_SKIP_VERSION_CHECK=1`, |
| + `PI_TELEMETRY=0` and `--no-approve`. [P4] Pi has no permission layer. |
| + [P5] Gating is Equipo's own extension (`-e`, hashed in the manifest), |
| + and Review runs with `--tools read,grep,find,ls`. |
| - **Mapping:** RPC mode. `message_update` is `delta`. |
| `tool_execution_start` and `_end` are `tool_call` and `tool_result`. |
| - `extension_ui_request` is `ask`, and `agent_end` is `done`. |
| - Termination is the namespace kill. [P6, P7] Rev 3's probes P1 to P5 |
| - gate every cell. |
| -- **Headroom:** TensorX has none beyond per-minute rate limits; it is |
| - prepaid, and keys are disabled under a $0.05 balance, failing as |
| - authentication errors. [T2, T3] So an `auth` failure on TensorX reads |
| - "TensorX refused the key: the balance may be empty, or the key was |
| - revoked". For the Command Code Provider API, headroom is not reported |
| - headless; its plan windows appear only in Studio. [CC4] |
| -- **Families and prices:** from the model id (`z-ai/glm-5.3` is `glm`, |
| - `moonshotai/kimi-k3.1-pro` is `kimi`, `deepseek/…` is `deepseek`) and |
| - the provider's price list. [T4, CC7] |
| + `extension_ui_request` is `ask`, `agent_end` is `done`, and |
| + `message_end.usage` gives `usage`, with `cost`. [P6, P7] Rev 3's |
| + probes P1 to P5 gate every cell. |
| +- **Headroom:** none reported. TensorX shows only per-minute rate |
| + limits, and a key whose balance is under $0.05 fails as an |
| + authentication error. [T2, T3] Such a failure reads "TensorX refused |
| + the key: the balance may be empty, or the key was revoked". |
| +- **Families:** from the model id (`z-ai/glm-5.3` is `glm`, |
| + `moonshotai/kimi-k3.1-pro` is `kimi`, `deepseek/…` is `deepseek`). |
| + [T4, CC7] |
| |
| ### 4.2 OpenCode on OpenCode Go |
| |
| OpenCode v2 is `@opencode/cli` 2.2.7. It has a `postinstall` script and |
| platform binaries as optional dependencies, so the platform binary is |
| -pinned by SHA-256. [OC1] Paul's OpenCode subscription is presumably |
| -**OpenCode Go** ($10, Plus $40 a month): a dollar limit per model, with |
| -the 5-hour limit at 20% of the monthly one and the weekly at 50%, |
| -serving GLM, Kimi, Qwen, DeepSeek, MiniMax and MiMo among others. On a |
| -limit it can fall back to Console credit. [OC2] |
| - |
| -- **Provider config:** a custom `openai-compatible` provider with |
| - `baseURL` the gateway, its package pre-installed in the pinned tree |
| - (OpenCode would otherwise download it). [OC3, OC9] The upstream is |
| - `https://opencode.ai/inference/go`, with Go models served on chat |
| - completions only in this design. [OC10] |
| +pinned by SHA-256. [OC1] Paul's subscription is presumably **OpenCode |
| +Go** ($10, Plus $40 a month): a dollar limit per model, with the 5-hour |
| +limit at 20% of the monthly one and the weekly at 50%. On a limit it can |
| +fall back to Console credit. [OC2] |
| + |
| +- **Provider config:** a custom `openai-compatible` provider, its |
| + package pre-installed in the pinned tree, with the key in an |
| + environment variable it names. [OC3, OC9] The upstream is |
| + `https://opencode.ai/inference/go`, chat completions only. [OC10] |
| - **Switches:** `update: "disable"`, with `XDG_CONFIG_HOME` and |
| `OPENCODE_DB` in the home. [OC5, OC6] The permissions list ends in an |
| explicit deny, and Review gets explicit `edit` and `shell` denies. |
| - [OC7] The models.dev catalogue, telemetry and share have no confirmed |
| - v2 switches. With no egress but the gateway they cannot leave, and |
| - probe OC-P1 confirms OpenCode starts and works without them. |
| + [OC7] Catalogue and telemetry switches are unconfirmed in v2. Probe |
| + 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. The SSE `GET /api/event` gives |
| - text deltas, tool calls and results, and `permission.asked`, answered |
| - at the reply endpoint. [OC4] |
| -- **Headroom and overflow:** the gateway reads `opencode.allowance` and |
| - `opencode.billing_source` from each response body. [OC10] When |
| - `billing_source` names Console credit, the connection becomes |
| - `limited` at once, until the next Go reset, and the charged request is |
| - recorded `overage: true`. So overflow costs at most the requests |
| - already in flight, each within its worst case. Probe OC-P3 checks that |
| - the fields are there. If they are not, the connection is metered and |
| - capped. |
| -- **As Pi's fallback for TensorX:** the same gateway connection with |
| - `harness: opencode`, if Pi fails its probes. [T5] |
| + --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. |
| +- **Fallback:** if Pi fails its probes, a TensorX connection may use |
| + `harness: opencode`. [T5] |
| |
| ### 4.3 Mistral Vibe on the Mistral plan |
| |
| -Vibe 3.1.2 (PyPI, 2026-11-10) is Apache 2.0. `vibe` is a Rust binary |
| -driving a Python app server. [V1, V2] |
| - |
| -- **Provider config:** `VIBE_HOME` is the home. [V6] Its `mistral` |
| - provider's `api_base` points at the gateway, whose upstream is |
| - `https://api.mistral.ai`. [V6] The key is the plan key from |
| - chat.mistral.ai/code/extensions, which the docs say "works … with a |
| - paid plan". [V5] Mistral says plan usage is shared across Studio, the |
| - API and Vibe. [V13] Probe V-P1 confirms that a custom `api_base` is |
| - honoured for Mistral's own models. |
| -- **Switches:** `enable_telemetry = false`, `enable_update_checks = |
| - false` and `outside_workdir = "deny"`. [V7, V8, V9] Engineering runs |
| - `--auto-approve` inside the namespace. Review runs `--enabled-tools` |
| - with the read tools only. |
| -- **Driving it:** `-p --output streaming` (completed history entries, |
| - tool calls as `type: "effect"`), with `--output-dir` for |
| - `export.json`. [V12, V16] The full line schema is unconfirmed (probe |
| - V-P2). If it cannot be mapped, the Vibe cells stay No. Steps deny asks |
| - by policy, so no permission relay is needed for Engineering and |
| - Review. |
| -- **Headroom and overflow:** the gateway calls `GET |
| - /v1/billing/budget` (`usage_percentage`, `initial_budget`, |
| - `reset_at`) with the connection's key. That endpoint comes from Vibe's |
| - source and is undocumented. [V15] It is called before a request when |
| - the last reading is older than 5 minutes or at least 90%. At 100%, |
| - the connection is `limited` until `reset_at`, so pay-as-you-go is |
| - never reached through Equipo. If probe V-P3 shows the read does not |
| - work, the connection is metered and capped at Mistral's API prices. |
| +Vibe 3.1.2 (PyPI, 2026-11-10) is Apache 2.0. [V1, V2] |
| + |
| +- **Provider config:** `VIBE_HOME` is the home. [V6] The plan key, from |
| + chat.mistral.ai/code/extensions, "works … with a paid plan". [V5] It |
| + reaches the launch as `MISTRAL_API_KEY`, through the pipe. |
| +- **Switches:** `enable_telemetry = false` (which also stops crash |
| + reports), `enable_update_checks = false` and `outside_workdir = |
| + "deny"`. [V7, V8, V9] Telemetry would otherwise post to |
| + `api.mistral.ai`, the one allowed host, so this switch, checked by the |
| + policy test, is what stops it. |
| +- **Driving it:** Engineering runs `-p --output streaming |
| + --auto-approve`, and Review runs `--enabled-tools` with the read tools |
| + only. `--output-dir` gives `export.json` with usage and cost. [V12, |
| + V16] The line schema is unconfirmed: if probe V-P2 cannot map it, the |
| + cells stay No. |
| +- **Headroom:** the runner, outside the namespace, may read `GET |
| + /v1/billing/budget` (`usage_percentage`, `reset_at`) with the key, |
| + rev 3 §2.7's probe at most every 15 minutes. That endpoint is from |
| + Vibe's source and undocumented. [V15] Probe V-P3 decides whether it is |
| + used. If not, headroom is "not reported". |
| +- **Billing:** a subscription only if Paul confirms pay-as-you-go is |
| + off. Otherwise it is metered. |
| - **Families:** `mistral-large-4-0` and `mistral-medium-latest` are |
| `mistral`, and `zai-glm-5-3` is `glm`. [V6] |
| |
| @@ -390,188 +343,169 @@ driving a Python app server. [V1, V2] |
| |
| | Connection | Coordinator | Engineering | Review | Ask | Headroom | Billing | |
| |---|---|---|---|---|---|---| |
| -| Pi → TensorX | No (later) | Yes, after the §3 acceptance | Yes | Yes | Rate limits only | Metered, hard cap | |
| -| Pi → Command Code Provider API | No | Yes | Yes | Yes | Not reported | Metered, hard cap (until §0 decision 2 shows it is plan) | |
| -| OpenCode → OpenCode Go | No | Yes | Yes | Yes | `allowance` (OC-P3) | Subscription; overflow stops it | |
| -| Vibe → Mistral plan | No | Yes, if V-P2 | Yes, if V-P2 | Yes (`--resume`) | Budget read (V-P3) | Subscription; 100% stops it | |
| -| OpenCode → TensorX | Only if Pi fails | as Pi | as Pi | as Pi | as Pi | as Pi | |
| +| 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 | |
| +| 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 | |
| |
| -Mac cells are all "later". On a Mac, the gateway removes the credential |
| -from the harness, but srt profiles for these harnesses are their own |
| -design. |
| +Mac cells are all "later". |
| |
| ## 5. Later, named so nothing is lost |
| |
| -- the Command Code CLI as a harness, over ACP, with host discovery; |
| -- sign-in by link for Vibe; |
| -- coordinator cells; |
| -- Mac srt profiles; |
| -- token-denominated caps; |
| -- OpenRouter and local endpoints through the same gateway; |
| -- the "cheap and short" rule; |
| -- calibration of headroom in tokens; |
| -- advice about buying or swapping accounts. |
| - |
| -## 6. Spend on the Usage page |
| - |
| -Each gateway connection gets one line, for example "TensorX: $0.84 |
| -today of $1 · $6.20 this month of $10", with a thin meter for each and |
| -"estimated from tokens and TensorX's prices". A request whose usage |
| -never arrived is counted at its worst case and marked "at most". A |
| -capped connection says "Paused until tomorrow" or "Paused until 1 |
| -Dec". A pending cap change says it is pending. Subscriptions show |
| -tokens and the provider's own reading (Go allowance, Mistral budget), |
| -never a dollar figure. Rev 3 §6's sidebar dot also lights at 80% of any |
| -cap. |
| +- **The metering gateway.** Its requirements, from Astra round 2: |
| + - a strict request schema per provider, forcing the priced model, a |
| + single completion and text-only input, rejecting unpriced features, |
| + and bounding every billable component; |
| + - a per-attempt socket bridge into the namespace, with fixed |
| + connection and attempt authority, lifecycle and policy attestation; |
| + - dialing the validated address without resolving again. |
| + |
| + It is the only route to a cap Equipo enforces, and to keeping the key |
| + out of the namespace. |
| +- Command Code's own CLI (over ACP, after host discovery). |
| +- Mac srt profiles. |
| +- Coordinator cells. |
| +- Sign-in by link or device code for these providers. |
| +- Model-pair routing and tiers (rev 3 slice 3). |
| +- Step estimates (tokens, cost, duration), the "too big" outcome, and |
| + calibration. |
| +- The "cheap and short" rule, token-denominated budgets, OpenRouter and |
| + local endpoints. |
| +- Advice about buying or swapping accounts. |
| |
| # Part B: token-aware scheduling and advice |
| |
| -## 7. Facts |
| +## 6. Facts |
| |
| -All facts are recorded before they are used. |
| - |
| -**Connections:** state; the subscription windows as reported (`used` |
| -from 0 to 1, `resets_at`, `checked_at`), possibly several; the |
| -gateway caps and charges; `billing: subscription | metered`. |
| +**Connections:** `state`; `billing` (`subscription | metered`); the |
| +windows as reported (`used` from 0 to 1, `minutes`, `resets_at`, |
| +`checked_at`); and, for metered connections, the budget, the reported |
| +spend, `spend_unknown` and whether a step is running. A reading older |
| +than 15 minutes is refreshed by rev 3 §2.7's probe **before** |
| +`Decide` is called. |
| |
| **Tasks:** |
| |
| -- `priority` is one of `urgent`, `normal` or `low`, and defaults to |
| - `normal`. |
| +- `priority` is `urgent`, `normal` or `low`, default `normal`. |
| - `by` is an optional date. |
| - The coordinator may set `low` or `normal`, and `by`, **only when it |
| - creates the task** (`record_task`, `start_task`), from what Paul said. |
| - Every later change, and every `urgent`, needs Paul's tap. This keeps |
| - merge authority's rule: the model can describe, never loosen. |
| + creates the task**, from what Paul said. Every later change, and |
| + every `urgent`, is Paul's tap. That keeps merge authority's rule: the |
| + model can describe, never loosen. |
| - Values the coordinator set are labelled "set from your message". |
| |
| -**Estimates**, computed by the instance from `chat_usage` and sent on |
| -`dispatch` (`estimate {tokens_p90, cost_p90_micros, duration_p90_s, |
| -basis, rows}`): |
| - |
| -- **Tokens:** a normalised sum of `input` (with cached input counted |
| - once, using the per-provider rule `rowSpend` already applies), |
| - `output` and `reasoning`, over complete, replied attempts. |
| -- **Cost:** from gateway charges on the same key. |
| -- **Duration:** from step start to end. |
| -- **Key:** `(project, specialist, first pass | fix)`, the last 20 rows. |
| - It falls back to the person's same key across projects, then to seeds |
| - (Engineering first pass 300k tokens and 20 min, fix round 150k and |
| - 10 min, Review 100k and 5 min). |
| -- **Quantile:** nearest-rank p90. Fewer than 5 rows uses the seed. |
| - Missing figures are skipped, and the row is counted only if it is |
| - complete. All arithmetic is in int64 with overflow checks. |
| - |
| -The **subscription plausibility** of §8 uses windows, not token |
| -calibration. Calibration was cut (finding 18) and is in §5. |
| - |
| -## 8. `schedule.Decide` |
| +## 7. `schedule.Decide` |
| |
| **Contract.** `Decide(in Input) Decision` is a pure function in |
| `internal/schedule`. Its input is a versioned, immutable struct: |
| |
| -- the step (role, priority, `by`, estimate, current binding, `avoid`, |
| - per-task metered consent, `run_now` release id); |
| -- the person's connections on this runner, each with its capability for |
| - the role, state, windows, billing kind, cap remainder, open margins |
| - and family; |
| +- the step: role, priority, `by`, `kept_session` (the connection whose |
| + session it resumes, or none), `avoid`, and `release` (a Run now id, |
| + or none); |
| +- the person's connections on this runner, with the facts of §6 and |
| + each one's capability for the role and family; |
| - the role's preference and its `until`; |
| - `now`. |
| |
| -Probing a stale reading happens **before** the call, outside the |
| -function. The runner then calls `Decide` and, in the same `thin.db` |
| -transaction that writes the admission, revalidates that the inputs it |
| -read are unchanged (by row revisions). If they changed, it calls again. |
| - |
| The output is `{run | hold, connection, reason, wake_at, needs_person}`. |
| +The runner calls it at admission and writes the admission in one |
| +`thin.db` transaction that rechecks the connections' row revisions it |
| +read. If any changed, it calls `Decide` again. |
| |
| -**Hard bars**, never overridden, Run now included: |
| +**What it claims.** Admission is decided from the readings taken at |
| +admission. It does not predict or reserve a step's future consumption, |
| +and several steps admitted against the same reading may together run a |
| +window out. The reserve thresholds are the margin. A window that runs |
| +out mid-step is rev 3's quota failover (termination proof, then another |
| +connection), as today. |
| |
| -- the connection is usable (rev 3 §2.7 state); |
| +**Bars**, never overridden, Run now included: |
| + |
| +- the connection is usable (rev 3 §2.7); |
| - the Review family rule; |
| - not in `avoid`; |
| -- for a metered connection: the task is `urgent` or has Paul's metered |
| - consent, and the cap remainder is at least the step's `cost_p90`; |
| -- for Ask: the exact session and connection that ran the step (rev 3 |
| - §3), so `Decide` is not called for Ask. |
| - |
| -**Subscription plausibility, by windows.** A step needs a **margin** |
| -of points of a window: Engineering 10, a fix round 5, Review 5. The |
| -priority's **reserve** is `low` 40, `normal` 20, `urgent` 0 (§0 |
| -decision 5). A subscription connection is plausible for the step when, |
| -for **every** reported window: |
| - |
| - used + open_margins + margin ≤ 1 − reserve |
| - |
| -`open_margins` is the sum of the margins of steps admitted on that |
| -connection **since that window's reading was taken**. A newer reading |
| -already includes their consumption, so a margin is dropped when a |
| -reading arrives whose `checked_at` is after the step's start, and is |
| -never double-counted (finding 19). A connection with no window reported |
| -is plausible when it is not limited, and the routing row says |
| -"headroom not reported". This is admission control, not a promise: a |
| -step may still run a window out, and then rev 3's quota failover takes |
| -over (finding 20). "Never start what cannot finish" holds as far as the |
| -provider's figures go, and the copy says so. |
| - |
| -**Order.** The first rule that yields a connection wins. Ties are |
| -broken by connection id. |
| - |
| -1. **Run now** (Paul's release): the usable connection with the most |
| - room, ignoring the reserve and the margin. Hard bars still apply. |
| - Reason `override`. |
| -2. **Sticky:** the current binding, if plausible. A failed attempt's |
| - connection is in `avoid`, so failover goes through here too |
| - (finding 15). Every new attempt, failover included, is admitted |
| - through `Decide`. |
| -3. **Preferred:** the role's preferred connection, if plausible. |
| -4. **Subscription:** the plausible subscription with the lowest maximum |
| - `used + open_margins` across windows. Known figures rank before |
| - "not reported", then by id. |
| -5. **Metered:** the eligible metered connection with the largest cap |
| - remainder. Reason `metered_urgent` or `metered_consent`. |
| -6. **Hold.** Reason `headroom` (naming the connection whose reset comes |
| - first), `cap` or `no_connection`. |
| - |
| -**Wake-ups (finding 21).** `wake_at` is the earliest of: |
| - |
| -- every `resets_at` of every capable connection, limited ones |
| - included; |
| -- the next cap period boundary; |
| +- for a metered connection: the task is `urgent` or the step carries a |
| + 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). |
| + |
| +**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. |
| + |
| +**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; |
| +4. the connection id, bytewise. |
| + |
| +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. |
| + |
| +**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`. |
| +2. **Preferred.** The role's preferred connection, if it admits the |
| + step. Reason `preference`. |
| +3. **Subscription.** The subscription with the most room. Reason |
| + `headroom`. |
| +4. **Metered.** The metered connection with the most room. Reason |
| + `metered_urgent` or `metered_release`. |
| +5. **Hold.** Reason `headroom` (naming the admitting candidate whose |
| + reset comes first), `budget`, `spend_unknown` or `no_connection`. |
| + |
| +Every attempt, failover included, is admitted through `Decide`, with |
| +the failed connection in `avoid`. |
| + |
| +**Wake-ups.** `wake_at` is the earliest of: |
| + |
| +- every `resets_at` of every capable connection, limited ones included; |
| +- the next budget day or month boundary; |
| - the preference's `until`; |
| -- the moment `by` minus `duration_p90` is reached (the deadline |
| - check). |
| - |
| -The runner persists `wake_at` with the hold and re-runs `Decide` then, |
| -and also on any fact change: a reading, a step end, a cap, a preference, |
| -or a release. |
| +- `by` minus 24 h, the deadline check. |
| |
| -**Release order:** `urgent`, then the earliest `by`, then `normal`, |
| -then `low`, oldest first within each. A held step never blocks a |
| -runnable step behind it, or a person's turn. Person turns are never |
| -held for priority. |
| +The runner persists it with the hold, re-runs `Decide` then, and also |
| +on any reading, step end, budget change, preference change or release. |
| |
| -**Too big to ever run (finding 22).** When the step's `cost_p90` exceeds |
| -every metered connection's whole cap, and no subscription could admit |
| -it even at 0% used, the hold has `needs_person: true` and the reason |
| -`too_big`. |
| +**Release order.** `urgent`, then the earliest `by`, then `normal`, then |
| +`low`, then the oldest, then the step id. A held step never blocks a |
| +runnable step or a person's turn. Person turns are never held for |
| +priority. |
| |
| -**Housekeeping (finding 23).** Housekeeping's own ledger, reservations, |
| -`caused_by` and stand-down stay exactly as built. Its turns and retries |
| -are also `low` for the ladder, so the stricter rule wins. Housekeeping |
| -never uses a metered connection. |
| +**Housekeeping.** Its ledger, reservations and 0.8 stand-down stay as |
| +built. Its turns and retries count as `low` for the threshold, so the |
| +stricter rule wins, and it never uses a metered connection. |
| |
| -**Invariants**, each a property test over random inputs: |
| +**Invariants**, each a property test: |
| |
| -- (a) with no Run now, nothing is admitted that breaks the plausibility |
| - inequality on any reported window; |
| -- (b) no metered admission without `urgent` or consent, Run now |
| - included; |
| -- (c) no gateway request beyond the cap, whatever `Decide` said; |
| -- (d) a step is held only when no rule from 1 to 5 yields; |
| -- (e) the same input gives the same decision. |
| +- (a) no admission on a subscription with a reported window at or above |
| + `t(p)`, except a kept session; |
| +- (b) no metered admission without `urgent` or a release; |
| +- (c) never two running steps on one metered connection; |
| +- (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; |
| +- (f) the same input gives the same output. |
| |
| -## 9. Holds, Needs you, and Run now |
| +## 8. Holds, Needs you, and Run now |
| |
| A held step reports `step {state: deferred, hold {reason, connection, |
| wake_at}}`, an optional extension of today's deferred report. The task |
| @@ -579,140 +513,152 @@ says one of: |
| |
| - "Waiting for headroom on Claude, resets Thu 10:00"; |
| - "Waiting for headroom on Claude" (no reset reported); |
| -- "Waiting: TensorX has reached today's cap". |
| +- "Waiting: TensorX has reached today's budget"; |
| +- "Waiting: TensorX spend unknown, check it, then Resume". |
| |
| -Each has the action **Run it now anyway**. |
| +Each has **Run it now anyway**, except `budget` and `spend_unknown`, |
| +which offer **Raise the budget** and **Resume**. |
| |
| **Needs you**, only where Paul's input changes the outcome: |
| |
| -- the deadline check fires; |
| -- `too_big`; |
| -- no reset in sight (no `wake_at` from a reset, or one more than 72 h |
| - away) while a metered connection could run it with consent; |
| +- the deadline check fires (`by` minus 24 h with the step still held); |
| +- no reset in sight (no reset-based `wake_at`, or one more than 72 h |
| + away); |
| - `no_connection` (today's card). |
| |
| -The card asks with a recommendation, composed by the instance, as merge |
| -authority §4.1 does: "I'd wait: Claude resets Thu 10:00, before Friday." |
| -**Wait** / **Run now on Claude**; or "I'd run it on TensorX: at most |
| -$0.40, within today's cap." **Run on TensorX** / **Wait for Claude**. |
| +The card asks with a recommendation, composed by the instance as merge |
| +authority §4.1 does: "I'd wait: Claude resets Thu 10:00, before |
| +Friday." **Wait** / **Run it now**. |
| |
| -**Run now (finding 12).** `POST /api/v1/tasks/{id}/run-now {step, |
| -step_revision}` is accepted from the task's owner only. It writes a |
| -durable `release{id, task, step, step_revision}` frame. The runner |
| -consumes the release **atomically with the admission it causes**. A |
| -release whose step revision is stale, or that was already consumed, is |
| -acked and ignored. Run now never grants metered consent; that is a |
| -separate per-task tap ("Allow TensorX for this task"), recorded with the |
| -person. |
| +**Run now.** `POST /api/v1/tasks/{id}/run-now {step, step_revision}`, |
| +from the task's owner only, writes a durable `release{id, task, step, |
| +step_revision}`. The runner consumes it **atomically with the admission |
| +it causes**. A release with a stale step revision, or one already |
| +consumed, is acked and ignored. A release may use a metered connection |
| +(§0 decision 5), and never passes a bar. |
| |
| -## 10. Advice |
| +## 9. Advice |
| |
| `advice.Compute(facts, now) []Advice` is pure, on the instance. It runs |
| on fact changes and at 08:00 in the person's zone. The copy is fixed |
| -templates with slots, so no model turn computes or phrases it. The |
| -coordinator can read open advice through `status`, and cannot create, |
| -change or dismiss it. Every recommendation is checked for eligibility |
| -with the same capability, runner and family rules as `Decide`. |
| +templates with slots, so no model turn is involved. The coordinator can |
| +read open advice through `status`, and cannot create, change or dismiss |
| +it. Each recommendation is checked with the same capability, runner and |
| +family rules as `Decide`. |
| |
| | Kind (arbitration order) | Fires when | Card | Actions | |
| |---|---|---|---| |
| -| `cap_near` | a gateway connection passes 80% of a cap | "TensorX: $0.84 of today's $1." | **Raise today's cap** / **Leave it** | |
| -| `prefer_switch` | the role's preferred subscription is past `normal`'s reserve with its reset more than 24 h away, another eligible subscription is below 50% on every window, and held or queued steps exist for the role | "Claude is near its limit until Thu. Codex has room. Prefer Codex for Engineering until then?" | **Prefer Codex until Thu** (a preference with `until`) / **Not now** | |
| -| `defer_tasks` | `normal` tasks without `by` are queued on a connection past 60%, while `urgent` or `by` work is held behind its reserve | "3 tasks could wait for Thu so the urgent one fits. Let them wait?" | **Make them low priority** / **Not now** | |
| +| `budget_near` | a metered connection's reported spend passes 80% of a budget | "TensorX: $0.84 of today's $1." | **Raise today's budget** / **Leave it** | |
| +| `prefer_switch` | the role's preferred subscription has a window at or above 0.80 with its reset more than 24 h away, another eligible subscription has every window below 0.50, and steps for the role are held or queued | "Claude is near its limit until Thu. Codex has room. Prefer Codex for Engineering until then?" | **Prefer Codex until Thu** / **Not now** | |
| +| `defer_tasks` | `urgent` or `by` work is held on `headroom` while `normal` tasks without `by` are queued for the same role | "3 tasks could wait for Thu so the urgent one goes first. Let them wait?" | **Make them low priority** / **Not now** | |
| | `held_long` | a `low` task has been held for 7 days | "2 low-priority tasks have waited a week." | **Make them normal** / **Not now** | |
| |
| +**Deterministic choice (finding 24).** Each advice has the key `(person, |
| +kind, subject)`: |
| + |
| +- for `budget_near` and `prefer_switch`, the subject is the connection |
| + id (for `prefer_switch`, the role then the target connection id); |
| +- for `defer_tasks` and `held_long`, it is the sorted task ids. |
| + |
| +When several are eligible, the one shown is the least by: the kind's |
| +arbitration order; then, within a kind, for connection subjects the |
| +connection id bytewise, for roles the fixed order coordinator, |
| +engineering, review, and for task sets the earliest task `created_at`, |
| +then the first task id; then the key string bytewise. |
| + |
| **Rules:** |
| |
| -- Keys are `(person, kind, subject)`. The subject is the connection, the |
| - role or the sorted task ids. |
| -- At most one new card per person per day, and at most one open at a |
| - time. The arbitration order above picks which. |
| +- At most one new card per person per day, and one open at a time. |
| - Not now silences a key for 14 days, and for 60 days after a second |
| Not now. |
| - Advice whose facts stop holding is withdrawn silently. |
| - Quiet hours are 22:00 to 08:00 (housekeeping's `VisibleAt`). |
| - Never Needs you, never a push. |
| -- An action is the ordinary API call, revision-checked, recorded with |
| - `source: advice` and the key. |
| - |
| -The `advice` table only moves forward, like the housekeeping ledger. |
| -Cards show at the top of Usage and as one quiet card in the |
| -conversation. |
| +- An action is the ordinary API call, revision-checked and recorded |
| + with `source: advice` and the key. |
| |
| -## 11. Wire, API and fixtures |
| +The `advice` table only moves forward. Cards show at the top of Usage |
| +and as one quiet card in the conversation. |
| |
| -**Dispatch** gains `priority`, `by`, `estimate` and `metered_consent`. |
| -**Step reports** gain `hold`. |
| +## 10. Wire, API and fixtures |
| |
| -**Frames, instance to runner:** `caps` (durable, acked when applied), |
| -`release` (durable, consumed once), and `preference.until`. |
| +**`Connection`** gains `harness`, `upstream` (origin only), `billing`, |
| +`model`, `limit_confirmed_at`, `payg_off_confirmed_at`, `budget`, |
| +`spend {day, month, currency, unknown}` and `budget_pending`. |
| +**`Dispatch`** gains `priority`, `by` and `release`. **Step reports** |
| +gain `hold`. |
| |
| -**Frames, runner to instance:** |
| +**Frames, instance to runner:** `budget` (durable, acked when applied), |
| +`release` (durable, consumed once), `preference.until` (durable) and |
| +`resume_spend{connection}` (durable). |
| |
| -- `connection` gains `billing`, `upstream` (origin only), `model`, |
| - `spend {day, month, currency, pending_cap}` and `caps`; |
| -- `routing` reasons gain `override`, `metered_urgent`, |
| - `metered_consent` and `held`; |
| -- `wire.Usage` gains `cost_micros`, `price_version` and `at_most`. |
| +**Routing reasons** gain `sticky`, `metered_urgent`, `metered_release` |
| +and `held`. |
| |
| **API:** |
| |
| -- `PUT /api/v1/connections/{id}/caps`; |
| +- `POST /api/v1/connections` gains `kind: api_key`, `sealed`, |
| + `limit_confirmed` and `payg_off_confirmed`; |
| +- `PUT /api/v1/connections/{id}/budget`; |
| +- `POST /api/v1/connections/{id}/resume`; |
| - `PUT /api/v1/tasks/{id}/priority {priority, by, revision}`; |
| - `POST /api/v1/tasks/{id}/run-now`; |
| -- `POST /api/v1/tasks/{id}/metered-consent`; |
| - `GET /api/v1/advice`; |
| - `POST /api/v1/advice/{id}/act`; |
| -- `POST /api/v1/advice/{id}/dismiss`. |
| +- `POST /api/v1/advice/{id}/dismiss`; |
| +- `PUT /api/v1/preferences` gains `until`. |
| |
| `record_task` and `start_task` gain the optional `priority` (`low` or |
| -`normal`) and `by`. The protocol is bumped. As merge authority does, |
| -an older runner is refused rather than downgraded: it cannot hold a |
| -gateway connection or receive metered dispatch. |
| +`normal`) and `by`. The protocol is bumped, and an older runner is |
| +refused metered connections rather than downgraded. |
| |
| -**Fixtures:** `api/connection-gateway.json`, `api/caps.json`, |
| -`api/task-held.json`, `api/advice.json`; `frames/caps.json`, |
| -`frames/release.json`, `frames/dispatch-estimate.json`, |
| -`frames/step-held.json`. The secret-field guard covers every new type, |
| -and `upstream` is an origin with no path or query. |
| +**Fixtures:** `api/connection-metered.json`, `api/budget.json`, |
| +`api/task-held.json`, `api/advice.json`; `frames/budget.json`, |
| +`frames/release.json`, `frames/step-held.json`. The secret-field guard |
| +covers every new type. |
| |
| -## 12. Slices |
| +## 11. Slices |
| |
| Each slice runs headless first, then on staging with the real pinned |
| -binary, then UI. Each connector slice opens with its probes, and a |
| -failed probe turns its cells to No with the reason. **Sec** marks a |
| -slice that needs its own Astra round on its branch before merge. |
| +binary, then UI. Connector slices open with their probes, and a failed |
| +probe turns a cell to No with the reason. **Sec** marks a slice that |
| +needs its own Astra round on its branch. |
| |
| | # | Slice | Finish line | Sec | Size | |
| |---|---|---|---|---| |
| -| S1 | Gateway and caps: `KindAPIKey` sealed paste, the gateway (paths, clamping, worst-case reservation, charge, crash sweep, periods, budget identity), `caps` frame, spend line | Against a fake upstream that lies, goes silent, or dies mid-stream, and across a crash between reserve and charge, total charges never exceed the cap and every request is charged once | **Sec** | 3 | |
| -| S2 | Pi on TensorX: pins committed, 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 under a $0.10 cap, recorded `other_family`, with the hostile-repository fixture loading nothing | **Sec** | 3 | |
| -| S3 | Scheduler: priority and `by` (creation-only for the coordinator), estimates, `Decide` with plausibility by windows, margins, holds, wake-ups, release order, Run now and consent, the Needs you rules | The five invariants pass as property tests, and a `low` task held at 61% starts by itself after the reset, or at once on Run now | | 3 | |
| -| S4 | Usage page (availability, spend, tokens) and the four advice kinds with their rules | Each kind fires once from fixtures, Not now silences it for 14 days, and no day shows two cards | | 2 | |
| -| S5 | OpenCode on Go: pins, isolated config, serve adapter, OC-P1 and OC-P3, the overflow stop | One real Engineering step on Go on staging, plus a recorded `billing_source` of credit turning the connection limited | **Sec** | 2.5 | |
| -| S6 | Vibe on the Mistral plan: PyPI pin, V-P1 to V-P3, the budget read and the 100% stop | A real Vibe Review of a Claude step on staging, with its budget reading on the Usage page | **Sec** | 2.5 | |
| -| S7 | Command Code Provider API behind Pi | One real Review step through the Command Code Provider API under a cap | **Sec** | 0.5 | |
| - |
| -S3 and S4 touch no credential and can run beside S1 and S2. |
| - |
| -## 13. Risks |
| - |
| -- **Headroom is the providers' word.** Plausibility rests on reported |
| - windows. Without a reading, a subscription is not held until it |
| - refuses, and failover handles the rest. |
| -- **Price tables are maintained by hand.** A provider price rise |
| - between table updates is the one way past a cap. The prepaid balance |
| - (TensorX), Paul's pay-as-you-go settings (§0 decision 6) and a |
| - price-table check at connect bound it. |
| -- **The same key on two runners** has two caps (§2, Budget identity). |
| -- **Undocumented surfaces:** Mistral's budget read, OpenCode Go's |
| - `allowance` fields and Vibe's line schema. Each is a probe with a |
| - stated fallback that fails closed (metered and capped, or No). |
| -- **The gateway is a new trust boundary** in the runner. It is S1's own |
| - Astra round, and it is small: one upstream per connection, fixed |
| - paths, no redirects, no logging of bodies. |
| -- **Three more pinned trees to keep current.** Each bump re-runs that |
| - connector's probes and acceptance. |
| +| 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 | |
| +| 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 | |
| +| 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 | |
| +| 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 | |
| + |
| +## 12. Risks |
| + |
| +- **A step can spend up to the provider's limit.** The key sits in the |
| + namespace, and the soft budget is checked only between steps. This is |
| + the trade Paul is asked to accept (§0 decision 3). The gateway (§5) is |
| + the remedy. |
| +- **Reported usage can be wrong or missing.** Wrong usage misleads the |
| + soft budget. Missing usage pauses the connection. |
| +- **The confirmations are Paul's word.** Equipo cannot check a provider |
| + limit or a pay-as-you-go setting. |
| +- **Thresholds are not predictions.** Concurrent steps can run a window |
| + out. Failover is the backstop. |
| +- **Undocumented surfaces:** Command Code's chat-completions route, Go's |
| + allowance in events, Vibe's line schema and its budget read. Each is |
| + a probe whose failure turns a cell to No or headroom to "not |
| + reported". |
| +- **Three more pinned trees** to keep current. Each bump re-runs that |
| + connector's probes. |
| + |
| +## 13. Not claimed |
| + |
| +- Equipo does not enforce a hard spend cap. |
| +- It does not keep metered keys from a step's shell. |
| +- It does not predict a step's consumption. |
| +- It does not read provider headers or bodies. |
| |
| ## 14. Sources |
| |
| @@ -760,43 +706,40 @@ such in the text. |
| - [OC9] https://opencode.ai/docs/providers/ (custom provider package) |
| - [OC10] https://opencode.ai/docs/console/api/inference/ |
| - [OC11] https://opencode.ai/docs/console/models/ |
| +- [OC12] https://opencode.ai/docs/console/billing/ |
| - [T1] https://docs.tensorx.ai/, https://tensorx.ai/ |
| - [T2] https://docs.tensorx.ai/api-reference/rate-limits.md |
| - [T3] https://docs.tensorx.ai/billing.md |
| - [T4] https://tensorx.ai/pricing/ |
| - [T5] https://github.com/anomalyco/models.dev/tree/dev/providers/tensorx |
| |
| -## 15. Astra round 1, folded in |
| +## 15. Astra rounds 1 and 2, folded in |
| |
| -Verdict on revision 1: NOT READY (full text in |
| -`CODEX-FINDINGS-CONNECTORS-SCHEDULING.md`). Each finding and where |
| -revision 2 answers it: |
| +Round 1 (revision 1) and round 2 (revision 2) both said NOT READY. The |
| +dispositions below are for revision 3. Round 2 counted items 2 to 6, 9 |
| +to 13 and 20 to 23 resolved under the gateway. Those that depended on |
| +the gateway are now cut or restated. |
| |
| -| # | Finding, short | Revision 2 | |
| +| # | Finding, short | Revision 3 | |
| |---|---|---| |
| -| 1 | Post-response usage cannot make a hard cap | §2: per-request worst-case reservation in the gateway before forwarding | |
| -| 2 | The harness's namespace exposes its credentials | §2, §3: keys stay in the runner, injected by the gateway; namespaces hold none. Mac cut (§5) | |
| -| 3 | An attempt could spend other attempts' reservations | §2: every request reserves its own worst case; `charged + open ≤ cap` | |
| -| 4 | No crash recovery for the ledger | §2: `gw_request` rows, start-up sweep charges unknowns in full, gateway-owned ids | |
| -| 5 | Lowering a cap is ambiguous | §2: effective on apply-and-ack, pending shown, only requests already sent finish | |
| -| 6 | Budget identity and period boundaries | §2: `(runner, provider, key HMAC)`, kept across re-add; period by reservation time; the two-runner limit is stated | |
| -| 7 | Overflow and mixed billing are post-hoc | §4.2, §4.3: stop on the first credit billing or the 100% budget; no reading means metered and capped. Command Code is metered until Paul confirms (§0 decision 2) | |
| -| 8 | New sign-in flows under-specified | Cut: sealed paste only (§3); link sign-in is later (§5) | |
| -| 9 | Host allowlists cannot block paths | §2: a path allowlist in the gateway, and no relay for these connectors | |
| -| 10 | A learned tree digest is not a pin | §3: committed digests per platform, full tree coverage and links | |
| -| 11 | Repository config can change the harness | §3: isolated configuration and the hostile-repository fixture | |
| -| 12 | Run now could bypass metered consent; release replay | §8 hard bars, §9: consent separate, release bound to the step revision and consumed once | |
| -| 13 | The coordinator could relax priority | §7: creation only, never `urgent` | |
| -| 14 | Depends on rev 3 slice 3, which is unbuilt | §3: one model per connection, prices in the gateway table, no tiers | |
| -| 15 | Stickiness and failover bypass admission | §8: every attempt goes through `Decide`, sticky before preference, Ask outside it | |
| -| 16 | Input contract and ordering incomplete | §8: versioned input, probing outside, revalidation in the admission transaction, id tie-break | |
| -| 17 | Estimates conflate tokens, cost and duration | §7: three estimates, normalised tokens, nearest-rank p90, int64 | |
| -| 18 | Calibration unsound | Cut (§5); plausibility by windows and margins | |
| -| 19 | Reservations against stale readings | §8: margins dropped when a newer reading arrives | |
| -| 20 | Invariants false as stated | §8: invariants restated as admission guarantees, with Run now excepted where it applies | |
| -| 21 | Wake-ups incomplete | §8: every reset, cap boundary, preference `until` and deadline check, persisted | |
| -| 22 | Starvation and impossible steps | §8: `too_big` to Needs you; §10 `held_long` | |
| -| 23 | Composition with housekeeping | §8: the ledger is unchanged, housekeeping is also `low`, never metered | |
| -| 24 | Advice arbitration and eligibility | §10: keys, arbitration order, eligibility checks; account advice cut | |
| -| 25 | Finish lines not adversarial | §3 acceptance per cell; §12 finish lines name the lies, crashes and hostile config | |
| -| Cut | "Cheap and short", token caps, OpenRouter, local, account advice | All in §5 | |
| +| 1 | No hard cap from post-response usage | Not claimed (§13): the provider's limit is the hard cap (§2.1), and Equipo's budget is soft (§2.3) | |
| +| 2 | The key is reachable from the namespace | Stated (§2.1), and the acceptance asserts it (§3); remedy later (§5) | |
| +| 3 to 6 | Reservation, crash, cap change, identity | The gateway ledger is gone. The soft budget is keyed by usage rows, changes apply on ack, and periods follow the row time (§2.3) | |
| +| 7 | Overflow billing | Metered unless Paul confirms pay-as-you-go is off (§2.1, §4.2, §4.3) | |
| +| 8 | Sign-in flows | Sealed paste only | |
| +| 9 | Paths on allowed hosts | Vibe telemetry is off by config, under the policy check; OpenCode's catalogue on its own host is stated (§4) | |
| +| 10, 11 | Pins, isolated config | §3, unchanged from revision 2 (resolved in round 2) | |
| +| 12 | Run now replay | §8: revision-bound, consumed atomically, refused on replay (S3 finish line) | |
| +| 13 | The coordinator relaxing priority | Creation only, never `urgent` (§6) | |
| +| 14 | Unbuilt rev 3 slice 3 | One model per connection; new fields named in §10 and assigned to S1 and S3 | |
| +| 15 | Switching boundaries | §7 rule 1: kept sessions stay, as rev 3 binds them | |
| +| 16 | "Most room" undefined | §7: a fixed key precedence for subscriptions and for metered connections | |
| +| 17 | Estimates | Cut (§5) | |
| +| 18 | Calibration | Cut (§5) | |
| +| 19 | A reading after the step starts | Removed: admission uses only the readings taken at admission, and claims nothing further (§7) | |
| +| 20 | Invariants | §7: restated for the new rules | |
| +| 21 to 23 | Wake-ups, starvation, housekeeping | §7: wake-ups kept; `too_big` cut with the estimates; `held_long` kept; housekeeping unchanged | |
| +| 24 | Equal-kind ordering in advice | §9: subject ordering defined | |
| +| 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 | |