| 1 | # S2 progress: Pi on TensorX |
| 2 | |
| 3 | Branch `connections-s2-pi` from main 87b66610 (S1 merged). Spec: |
| 4 | `docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md` |
| 5 | revision 3.1 (on `connections-slice2-design`), §11 row S2: §3 (isolated |
| 6 | configuration, containment, pinning, mapping, families, the acceptance |
| 7 | list), §4.1 (Pi, the TensorX part; the Command Code provider is S7), |
| 8 | §4.4 (Pi to TensorX: Engineering, Review and Ask; never the |
| 9 | coordinator), §2.1 to §2.3 (S1's guard, which Pi plugs into) and §7 |
| 10 | (Ask stays on its step's session and connection; a kept session stays |
| 11 | put). Connections rev 3 §1.4, §5 and §8 slice 2's probes P1 to P5. |
| 12 | |
| 13 | No real key, no sign-in, no real provider. The real pinned Pi ran only |
| 14 | against a fake OpenAI-compatible TensorX on 127.0.0.1 (TLS under a test |
| 15 | authority), through the real relay, in the real bubblewrap namespace. |
| 16 | |
| 17 | ## Early checks (the brief's stop conditions) |
| 18 | |
| 19 | - (a) The relay. Pi 1.5.2 on Node 22.23.4 sends its provider calls |
| 20 | through `HTTPS_PROXY` as `CONNECT api.tensorx.ai:443` with no extra |
| 21 | switch (Pi sets its own proxy agent; `NODE_USE_ENV_PROXY` is not |
| 22 | needed). It found one real fault: undici sends `Host: api.tensorx.ai` |
| 23 | without the port, and the relay required `api.tensorx.ai:443`, so every |
| 24 | real TensorX call would have been refused (403). The relay now accepts |
| 25 | the bare host when the port is 443 (the same authority, RFC 9110's |
| 26 | default port); another host or port is still refused |
| 27 | (`TestEgressAcceptsNodeConnect`, `TestEgressRejectsSmuggling`). |
| 28 | - (b) Isolated configuration. Pi's argv turns off every project and |
| 29 | context source: `--no-approve --offline --no-context-files |
| 30 | --no-extensions -e builtin:mcp -e /config/pi/equipo.ts --no-skills |
| 31 | --no-prompt-templates --no-themes --session-dir`, with |
| 32 | `PI_OFFLINE=1 PI_SKIP_VERSION_CHECK=1 PI_TELEMETRY=0`, and settings.json |
| 33 | says `defaultProjectTrust: never`. A hostile repository (.pi settings |
| 34 | with sessionDir, defaultTools and extensions; a .pi extension that |
| 35 | writes a marker and registers a tool; .pi/mcp.json starting a server; |
| 36 | SYSTEM.md, APPEND_SYSTEM.md, skills in .pi and .agents, prompts; |
| 37 | AGENTS.md and CLAUDE.md asking for a tool) loads nothing: |
| 38 | `TestPiAcceptanceHostileRepository`. |
| 39 | - (c) RPC. One session holds a hundred turns, and a kept session resumes |
| 40 | in a new process with its history (`TestPiP1SessionAcrossTurns`). |
| 41 | `abort` with a pending extension dialog does not settle until the |
| 42 | dialog is answered, so `Interrupt` cancels pending dialogs first; ending |
| 43 | everything is the namespace kill, proven (`TestPiP5DescendantTermination`: |
| 44 | an abort leaves a shell's background loop running, the kill ends it). |
| 45 | |
| 46 | ## Done |
| 47 | |
| 48 | 1. Pinning (1bdc4288, c396d426). `internal/runner/provider/pi`: the |
| 49 | committed `npm/package.json` and `package-lock.json` (Pi 1.5.2 by its |
| 50 | integrity, every package by integrity; no install script runs: |
| 51 | `npm ci --ignore-scripts`); Node v22.23.4 (the Mac's srt Node) from the |
| 52 | official Linux archives, pinned by archive and program digests for |
| 53 | amd64 and arm64; the tree digest committed per platform |
| 54 | (`provider.TreeSHA256`: every entry's path, mode and content, links by |
| 55 | target, each link relative and inside the tree, anything writable |
| 56 | refused). The install is sealed read-only (directories 0555, files |
| 57 | 0555 or 0444) so modes do not depend on the umask. npm 10.9.9 (the |
| 58 | pinned Node's) and npm 11 make the same tree; it has no |
| 59 | platform-specific package, so amd64 and arm64 share one digest. Node |
| 60 | and the tree are checked when the policy is built and again at every |
| 61 | launch's attestation; `pi.Verify(root)` checks an install root. |
| 62 | 2. Getting it there (c396d426). `equipo-runner install-pi <root>` on a |
| 63 | Linux runner: Node's archive checked before it is unpacked (the Mac |
| 64 | installer's `mac.Fetch`), `npm ci --ignore-scripts` from the committed |
| 65 | lockfile, sealed, verified, removed if it does not verify; it prints |
| 66 | `EQUIPO_PI_ROOT=...` for the runner's environment. `install` records |
| 67 | `EQUIPO_PI_ROOT` when set; `install` and `verify-installed` run |
| 68 | `pi.Verify` then. CI's box installs the same (`scripts/ci-box.py` |
| 69 | `install_pi`, Python computing exactly `provider.TreeSHA256`; pins in |
| 70 | `scripts/ci-box.json` "pi", held to the code by |
| 71 | `TestBoxPiMatchesTheCode`), mounts it at `/opt/equipo-pi` and sets |
| 72 | `EQUIPO_PI_ROOT`; testci fingerprints it, so a pin change reruns the |
| 73 | real-Pi tests. |
| 74 | 3. The Pi policy kind (1bdc4288), `check_policy.go`'s effective-policy |
| 75 | check extended to Pi: `BuildPiPolicy` / `IsPi` / attestation. The |
| 76 | exact argv above; the environment above plus `EQUIPO_PI_TOOLS` and, |
| 77 | for a read-only role, `EQUIPO_PI_CONFINE=/workspace`; mounts `/opt/node` |
| 78 | (file), `/opt/pi/node_modules` (the tree; Node resolves packages only |
| 79 | under a `node_modules` path), `/opt/equipo-tool-proxy`, |
| 80 | `/config/pi/equipo.ts`; Pi's config directory in the attempt's own |
| 81 | runtime home (`PI_CODING_AGENT_DIR=/home/runner/agent`: Pi writes its |
| 82 | credential store and a settings lock there, so it cannot be read-only) |
| 83 | holding `models.json`, `settings.json` and `mcp.json` the runner wrote, |
| 84 | hashed into the manifest and read back at attestation. models.json is |
| 85 | accepted only as one provider, `openai-completions`, an https base URL, |
| 86 | the selected model and `apiKey: "$TENSORX_API_KEY"` (never a literal or |
| 87 | a `!command`). Tools: names only; a read-only role (Review, a question) |
| 88 | gets no `bash`, `edit` or `write`; MCP tools only `mcp__equipo__<name>`. |
| 89 | 4. Containment (1bdc4288): the existing namespace; the tree mounted |
| 90 | read-only whole; Pi's variables allowed only for a Pi policy; the key |
| 91 | (`.oauth-token` in the connection's home, S1's delivery) reaches the |
| 92 | namespace as `TENSORX_API_KEY` through bubblewrap's `--args` pipe, in |
| 93 | no argv, policy or manifest; egress by S1's table `(pi, tensorx)` to |
| 94 | `api.tensorx.ai` only (the policy names its harness). |
| 95 | 5. Equipo's extension (`pi/equipo.ts`, embedded, its digest a pinned file |
| 96 | in the manifest): the role's tools run; for a read-only role its read |
| 97 | tools only inside `/workspace` (after resolving links, so a link the |
| 98 | repository plants does not lead out); anything else is asked of |
| 99 | Equipo as an `extension_ui_request` and runs only on a yes. In a step |
| 100 | nobody can answer, so Equipo refuses (and the tail says so). |
| 101 | 6. The adapter (1bdc4288): an RPC client (LF framing, id-correlated |
| 102 | responses), `Decoder` (text deltas to `delta`; `tool_execution_start` |
| 103 | and `_end` to `tool_call` and `tool_result`; the extension's dialog to |
| 104 | `ask`; each assistant `message_end` to `usage`; `agent_end` that will |
| 105 | not retry to `done` with `completed`, `interrupted` or `failed` and the |
| 106 | class: 401/403 `auth`, 429 after Pi's own retries `quota`, else |
| 107 | `provider`; unknown events counted by type name and dropped, logged by |
| 108 | name and count), `Tally` (the sum over assistant messages, complete on |
| 109 | that `agent_end`; Pi's own cost as the reported cost when Pi priced it) |
| 110 | and `Launcher`, a `provider.Launcher` over a `ProcessHost`. `fakepi` |
| 111 | reproduces the recorded protocol (recordings in `pi/testdata`) and |
| 112 | plays the extension's gate. |
| 113 | 7. Steps (7ba4c538): `connect.Choose` takes the harness's capability (the |
| 114 | matrix gains `pi` for Engineering and Review, not the coordinator) and |
| 115 | an explicit leave to spend; metered connections are candidates only |
| 116 | with it, and then only when no subscription can run the role. |
| 117 | `Conns.ChooseFor` passes it; `Choose` (the coordinator's) never |
| 118 | spends. Engineering and Review on a metered connection run `runPi` |
| 119 | through `Meter.Run`: admission with the slot claimed, the namespace |
| 120 | recorded in the step and the slot before it starts, usage priced and |
| 121 | charged once, the slot released after the termination proof; held, |
| 122 | the step waits deferred; a refused key marks the connection refused. |
| 123 | Review's family and label come from the model that ran. A step's Pi |
| 124 | session is kept for questions; an Engineering fix round on Pi resumes |
| 125 | its kept session on the same connection. |
| 126 | 8. Ask (7ba4c538): `askPi` is S1's `MeteredAsk`: a question about a step |
| 127 | whose kept session is on the metered connection runs there, through |
| 128 | the guard, resuming that session read-only on the exact commit. |
| 129 | 9. The browser test the controller added (c0822242): |
| 130 | `TestBrowserConnectionsMeteredLimitRequired`. |
| 131 | 10. No wire change: S2 rides S1's protocol 12. No migration. |
| 132 | |
| 133 | ## Tests |
| 134 | |
| 135 | - `internal/runner/provider`: `TestPiPolicyIsolatedConfiguration`, |
| 136 | `TestPiPolicyRefusals`, `TestPiPolicyAttestation`, |
| 137 | `TestPiLaunchSecretEnv`. |
| 138 | - `internal/runner/provider/pi`: `TestLockfilePinsPi`, `TestTreeDigest`, |
| 139 | `TestTreePinsByPlatform`, `TestPinnedInstallVerifies`; |
| 140 | `TestDecodeRecordedRuns`, `TestDecodeEndings`, `TestDecodeUnknownEvents`, |
| 141 | `TestTallyUsage`, `TestFamilyFromModel`; fakepi in the namespace |
| 142 | `TestPiFakeReviewInNamespace`; the real pinned Pi: |
| 143 | `TestPiP1SessionAcrossTurns`, `TestPiP2RelayForABlockedTool`, |
| 144 | `TestPiP3MCPPinning`, `TestPiP4AStepCanReadTheKey` (rev 3's |
| 145 | credential-read probe, replaced as spec rev 3.1 says: it asserts that a |
| 146 | step CAN read the key from the namespace's environment, and that the key |
| 147 | is in no argv), `TestPiP5DescendantTermination`, |
| 148 | `TestPiAcceptanceHostileRepository`. |
| 149 | - `internal/runner/thin` (real containment): `TestPiReviewStep`, |
| 150 | `TestPiReviewWithoutLeaveToSpend`, `TestPiBudgetHoldsTheNextStep`, |
| 151 | `TestPiNoUsagePausesTheConnection`, `TestPiKeyRefused`, |
| 152 | `TestPiAskKeptSession`, `TestPiEngineeringRun`, |
| 153 | `TestPiEngineeringHeldIsDeferred`, `TestPiReviewFamilyFromTheModelThatRan`, |
| 154 | `TestPiStepRefusesAsks`, and the finish line `TestPiReviewStepRealPi`. |
| 155 | - `internal/runner/connect`: `TestChooseMetered`. |
| 156 | - `internal/runner/egress`: `TestEgressAcceptsNodeConnect`. |
| 157 | - `internal/testci`: `TestBoxPiMatchesTheCode`. |
| 158 | - `cmd/equipo-runner`: `TestReleaseRunnerHasNoFakeWorker` (also: no egress |
| 159 | route, no leave to spend in a release build). |
| 160 | - `internal/headless` (`-tags browser`): `TestBrowserConnectionsMeteredLimitRequired`. |
| 161 | |
| 162 | The §3 acceptance list for the Pi cells, in CI: the hostile repository |
| 163 | loads nothing (`TestPiAcceptanceHostileRepository`); only the provider |
| 164 | host is reachable (same test: another host 403 at the relay, no other |
| 165 | network); Review has no write or shell tool (`TestPiP3MCPPinning`, |
| 166 | `TestPiAcceptanceHostileRepository`, and the policy refusals); killing |
| 167 | the namespace ends every descendant (`TestPiP5DescendantTermination`); |
| 168 | the budget stops the next step (`TestPiBudgetHoldsTheNextStep`); a step |
| 169 | with no usage figure pauses the connection |
| 170 | (`TestPiNoUsagePausesTheConnection`); a resent usage row charges once |
| 171 | (`TestPiReviewStep`). The finish line: `TestPiReviewStepRealPi`, a Review |
| 172 | of a Claude change with the real pinned Pi on the fake TensorX, recorded |
| 173 | `other_family`, family `glm`, charged once, then a question that resumes |
| 174 | its session. |
| 175 | |
| 176 | Local runs were targeted (`-run`), with `-tags testbuild` where the |
| 177 | seams are needed, the real-Pi tests against a local pinned install |
| 178 | (`EQUIPO_PI_ROOT`); plus gofmt, go vet (linux and the darwin runner |
| 179 | build), `rastrillo budget size` and the dead-reference scan. |
| 180 | |
| 181 | ## Mutations, each observed failing |
| 182 | |
| 183 | - policy P1: a read-only role allowed bash, edit or write -> TestPiPolicyRefusals (review with bash/edit/write, ask with bash: accepted) |
| 184 | - policy P2: models.json's apiKey not required to be the variable -> TestPiPolicyRefusals (the key in models.json, a command for the key: accepted) |
| 185 | - policy P3: attestation did not re-read the config files -> TestPiPolicyAttestation (models.json, mcp.json changed after the policy: attested) |
| 186 | - policy P4: attestation ignored the tree digest -> TestPiPolicyAttestation (tree: attested) |
| 187 | - policy P5: --no-context-files left out of argv -> TestPiPolicyIsolatedConfiguration (argv) |
| 188 | - policy P6: Node's digest not checked -> TestPiPolicyRefusals (another node: accepted) |
| 189 | - policy P9: a Pi launch without a tool socket attested -> TestPiPolicyAttestation (tool socket missing) |
| 190 | - policy P10: the selection's provider not checked -> TestPiPolicyAttestation (provider) |
| 191 | - tree P7: a link leaving the tree accepted -> TestTreeDigest (link out of the tree) |
| 192 | - tree P8: a writable directory accepted -> TestTreeDigest (writable directory) |
| 193 | - egress E1: the release check not refusing the egress route -> TestReleaseRunnerHasNoFakeWorker (accepted the egress route) |
| 194 | - egress E2: the egress route built into every build -> TestReleaseRunnerHasNoFakeWorker (the release runner contains the route) |
| 195 | - real Pi R1: --no-context-files left out -> TestPiAcceptanceHostileRepository (the repository's AGENTS.md reached the model's system prompt) |
| 196 | - real Pi R3: --approve instead of --no-approve -> TestPiAcceptanceHostileRepository (the repository's EVIL-MCP loaded) |
| 197 | - real Pi R4: the extension's confinement off -> TestPiP2RelayForABlockedTool (/etc/hostname read without an ask) |
| 198 | - real Pi R5: Equipo's MCP server at codemode exposure -> TestPiP3MCPPinning, TestPiAcceptanceHostileRepository (the pinned tool not declared) |
| 199 | - relay R6: Node's CONNECT Host without the port refused (the relay as it was) -> TestEgressAcceptsNodeConnect, TestPiP3MCPPinning (every real-Pi request: 403 at the relay) |
| 200 | - relay R7: any Host header carried -> TestEgressRejectsSmuggling, TestEgressAcceptsNodeConnect |
| 201 | - choose C1: a metered connection a candidate without leave to spend -> TestChooseMetered (no leave: never chosen; chose tensorx-a) |
| 202 | - choose C2: metered ranked with the subscriptions -> TestChooseMetered (a subscription first even with less room; chose tensorx-a). First run MISSED: the order alone kept Claude first; the case with more reported room on the metered one was added, then caught |
| 203 | - choose C3: Pi in the coordinator row -> TestChooseMetered (never the coordinator; the matrix row) |
| 204 | - thin T1: a metered binding sent down the Claude path (no runPi) -> TestPiReviewStep and five more (policy_rejected) |
| 205 | - thin T2: leave to spend always granted -> TestPiReviewWithoutLeaveToSpend (Review ran on TensorX) |
| 206 | - thin T3: Review's family from the configured model, not the one that ran -> TestPiReviewFamilyFromTheModelThatRan (another model: same_account) |
| 207 | - thin T4: the extension's question allowed in a step -> TestPiStepRefusesAsks. First run MISSED: the tail's "Refused" line is written before the answer; the test now checks the call's outcome, then caught |
| 208 | - thin T5: a refused key not recorded -> TestPiKeyRefused (the connection not refused) |
| 209 | - thin T6: an Engineering step the guard holds not deferred -> TestPiEngineeringHeldIsDeferred. First run MISSED (no test reached Engineering's held branch); the test was added, then caught |
| 210 | - thin T7: a Review the guard holds not deferred -> TestPiBudgetHoldsTheNextStep, TestPiNoUsagePausesTheConnection (failed metered_held) |
| 211 | - release E3: the leave-to-spend seam built into every build -> TestReleaseRunnerHasNoFakeWorker (the release runner contains it) |
| 212 | - install V0 (a real bug, found by running install-pi twice by hand): pi.Verify took its pins from Install{}.Pinned(), which reports not ok for an empty install, so every install was refused; fixed to read the platform's pins; TestPinnedInstallVerifies covers it |
| 213 | - install V1: the tree digest not compared -> TestPinnedInstallVerifies (another tree verified) |
| 214 | - install V2: Node's digest not compared -> TestPinnedInstallVerifies (another Node verified). First run MISSED (the test had no right tree beside a wrong Node); the case was added, then caught |
| 215 | - page B1: the confirmation not required in the form -> TestBrowserConnectionsMeteredLimitRequired (1280 and 390: not required and unticked) |
| 216 | - instance B2: the server not checking the confirmation -> TestBrowserConnectionsMeteredLimitRequired (the stripped form went through: no refusal) |
| 217 | - decode D1: a retry Pi will make taken as the end -> TestDecodeEndings (rate-limited: four ends) |
| 218 | - decode D2: a 401 not classed as a refused key -> TestDecodeEndings (key-refused: provider) |
| 219 | - decode D3: usage complete before agent_end -> TestTallyUsage (complete before the end) |
| 220 | - decode D4: unknown events not counted -> TestDecodeUnknownEvents |
| 221 | - decode D5: system and user messages' usage counted -> TestDecodeRecordedRuns, TestTallyUsage |
| 222 | - decode D6: Pi's unpriced zero cost recorded as a reported cost -> TestTallyUsage |
| 223 | |
| 224 | ## Security round (Astra, read-only, on ca3e7bb0) |
| 225 | |
| 226 | Verdict NOT READY, nine findings, all mechanical; each fixed with a test |
| 227 | written first and a mutation observed. Nothing was found against the |
| 228 | relay's Host change, the gitleaks entry or the leave-to-spend seam. |
| 229 | |
| 230 | 1. The Pi tree hashed by path, then mounted by a fresh open |
| 231 | (`containment/mounts.go`): the containment now hashes the tree again |
| 232 | through the very descriptor it mounts and refuses a mismatch; an |
| 233 | install root anyone else could write (other-writable without the |
| 234 | sticky bit, or group-writable for a group that is not this user's own), |
| 235 | an entry another user owns, and a file with a second name (a hard link |
| 236 | another path could write through) are refused at the policy, the |
| 237 | attestation and `pi.Verify`. `TestNamespacePiTreeSwapAfterAttestation` |
| 238 | swaps a file and the whole directory after the attestation. |
| 239 | 2. A Pi that stops reading its stdin held the runner (`pi/rpc.go`): writes |
| 240 | take their own lock, never held by a waiting caller, and give up with |
| 241 | their context; Interrupt is bounded by its context, cancelling pending |
| 242 | dialogs first; a cancelled step asks Pi to stop aside while the |
| 243 | namespace is killed regardless. `TestClientWritesAreCancellable`, |
| 244 | `TestLauncherInterruptIsBounded`. |
| 245 | 3. Missing usage counted as zero (`pi/decode.go`): a message without |
| 246 | usage, without input or output, with a negative figure, a run with no |
| 247 | message at all, and a sum that overflows (checked addition) leave the |
| 248 | attempt's figures null, so the spend is unknown however the run ends. |
| 249 | `TestTallyUnknownUsage`, `TestPiEndWithoutUsagePausesTheConnection`. |
| 250 | 4. Configuration accepted by secret-shaped names only (`check_policy.go`): |
| 251 | the policy rebuilds models.json, settings.json and mcp.json from the |
| 252 | provider and model and accepts exactly those (no other MCP server, |
| 253 | command, argument or exposure, no other setting, no other field, the |
| 254 | provider table's base URL), and pins the extension's digest; the |
| 255 | extension moved into the provider package. New cases in |
| 256 | `TestPiPolicyRefusals`, `TestPiBaseURLsAreTheProviders`. |
| 257 | 5. The key in logs and reports (`thin/pistep.go`): the runner reads the |
| 258 | launch's key once and redacts it (as itself and as JSON text) from every |
| 259 | delta, as a stream so a key split across deltas is caught, the step |
| 260 | log, the tail, activity subjects, provider errors, unknown event names |
| 261 | and the arguments Pi gives Equipo's tools. `TestPiRedactsTheKey`, |
| 262 | `TestRedactorStream`. |
| 263 | 6. Unbounded text and queues (`thin/pistep.go`, `pi/rpc.go`): the client |
| 264 | keeps at most 16 MiB of records (Pi waits for the rest), a record over |
| 265 | 8 MiB ends the stream, events carry no tool arguments over 64 KiB, |
| 266 | the events channel holds 64, and a reply over 1 MiB ends the run with |
| 267 | its usage incomplete (spend unknown). `TestClientQueueIsBounded`, |
| 268 | `TestDecodeClipsToolArguments`, `TestPiOversizedReply`. |
| 269 | 7. A kept Pi session moved to a recovered subscription |
| 270 | (`connect/choose.go`): with leave to spend, a usable kept metered |
| 271 | connection is chosen first, before subscription precedence; the guard |
| 272 | then holds the round there (busy, budget), it does not move; an |
| 273 | Engineering fix round now finds a kept Pi transcript. |
| 274 | `TestPiKeptSessionStaysPut`, new `TestChooseMetered` cases. |
| 275 | 8. Lexical link containment (`provider/tree.go`): links are followed |
| 276 | link by link under the root, refusing escapes, dangling links, absolute |
| 277 | targets and chains over 40 (cycles); the CI installer does the same. |
| 278 | New `TestTreeDigest` cases. |
| 279 | 9. The leave-to-spend release check untested on its own |
| 280 | (`release_guard_test.go`): `TestReleaseCheckRefusesEachMarker` hands |
| 281 | the script one marker at a time. |
| 282 | |
| 283 | Decisions within the findings: group write on an install root is allowed |
| 284 | only for this user's own group (Debian's user private groups make |
| 285 | `~/.cache` group-writable); a kept metered session without leave to spend |
| 286 | is not kept (no leave, no metered run: decision 5), which no release build |
| 287 | meets before S3; a Review whose verdict was already recorded through |
| 288 | Equipo's tool keeps it when its reply is then cut for length. |
| 289 | |
| 290 | Mutations observed: |
| 291 | |
| 292 | - S8a: link containment lexical again (the old prefix check) -> TestTreeDigest (a chain out of the tree, a dangling link, a cycle: accepted) |
| 293 | - S8b: a link to nothing accepted -> TestTreeDigest (a dangling link) |
| 294 | - S8c: the hop limit removed -> TestTreeDigest (a cycle: the walk never ends; the run fails at its 20s timeout). Raising the limit to 100000 instead was MISSED: the cycle is still refused, only later, so that change is not observable |
| 295 | - S1a: a file with a second name accepted -> TestTreeDigest (a second name for a file) |
| 296 | - S1b: the mount not hashing the tree through its retained descriptor -> TestNamespacePiTreeSwapAfterAttestation (file, directory: a tree changed after its attestation was mounted) |
| 297 | - S1c: an install root others can write accepted -> TestPiPolicyRefusals (an install root others can write) |
| 298 | - S9: the release script not refusing the leave-to-spend marker -> TestReleaseCheckRefusesEachMarker (a binary with only that marker was accepted). Before the fix, TestReleaseRunnerHasNoFakeWorker alone passed with this change, as the finding says |
| 299 | - S3a: a run with no assistant message counted as zero -> TestTallyUnknownUsage (no message at all) |
| 300 | - S3b: a message without countable usage counted as zero -> TestTallyUnknownUsage (without usage, negative, not an object, without input, one good and one without) |
| 301 | - S3c: unchecked sums -> TestTallyUnknownUsage (a sum that overflows) |
| 302 | - S3d: missing input or output read as zero -> TestTallyUnknownUsage (usage without input, without output) |
| 303 | - S3e: as S3a, through a whole step on fakepi -> TestPiEndWithoutUsagePausesTheConnection (charged zero, spend not unknown) |
| 304 | - S4a: the configuration checked by secret-shaped names only (as it was) -> TestPiPolicyRefusals (an MCP server running a shell, a second MCP server, a field in a model, a command for the key, a token in settings: accepted) |
| 305 | - S4b: the extension's digest not pinned -> TestPiPolicyRefusals (another extension) |
| 306 | - S4c: a base URL that is not the provider table's -> TestPiBaseURLsAreTheProviders |
| 307 | - S2a: a write that waits for Pi however long (as it was) -> TestClientWritesAreCancellable, TestLauncherInterruptIsBounded (both hang to the 30s test timeout) |
| 308 | - S2b: the interrupt's dialog cancellation ignoring its context -> TestLauncherInterruptIsBounded (hangs to the timeout). First run MISSED: the test's Pi had no pending question, so no cancellation was sent; the stuck Pi now asks one first, then caught |
| 309 | - S6a: the reply text not capped -> TestPiOversizedReply (no cut, spend not unknown) |
| 310 | - S6b: the client's byte budget off -> TestClientQueueIsBounded (2020 bytes queued in 20 records against 300) |
| 311 | - S6c: tool arguments not clipped in events -> TestDecodeClipsToolArguments (a 200047-byte payload) |
| 312 | - S6d: no record size limit -> TestClientQueueIsBounded (the oversized record is taken and the test hangs to its timeout) |
| 313 | - S5a: Equipo's tools given Pi's arguments unredacted -> TestPiRedactsTheKey (the report holds the key: the verdict's headline and summary) |
| 314 | - S5b: deltas redacted one by one, not as a stream -> TestPiRedactsTheKey (the key split across two deltas reached the report's tail) |
| 315 | - S5c: the step log written unredacted -> TestPiRedactsTheKey (the step log holds the key) |
| 316 | - S5d: the stream holding nothing back -> TestRedactorStream (pieces of 1: the key passed) |
| 317 | - S7a: a kept metered session not resolved first (as it was) -> TestChooseMetered (kept on metered, a subscription usable: chose c1), TestPiKeptSessionStaysPut (the round moved to claude-a) |
| 318 | - S7b: a kept metered connection kept even when it cannot run (refused) -> TestChooseMetered (kept on metered, refused) |
| 319 | - S7c: a fix round not finding a kept Pi transcript -> TestPiKeptSessionStaysPut (the kept Pi session was not found) |
| 320 | |
| 321 | ## Decisions where the spec was open |
| 322 | |
| 323 | - Leave to spend (controller, 2026-11-12, option A): `connect.Choose` |
| 324 | takes it explicitly; it is false for every step in a release build until |
| 325 | S3 sets it from `urgent` and Run now, so nothing selects TensorX in |
| 326 | production yet. The CI tests set it through a seam that exists only in a |
| 327 | test build (`spend_testbuild.go`), as are the egress route to a loopback |
| 328 | provider and the test CA; `scripts/no-fake-worker.sh` refuses a release |
| 329 | binary that contains any of them. No runner switch was built. |
| 330 | - A metered connection is chosen only when no subscription connection can |
| 331 | run the role (§7 rules 3 and 4), even with leave. |
| 332 | - Pi's config directory is in the attempt's runtime home, not a read-only |
| 333 | mount: Pi writes there. The files are the runner's, hashed and read back |
| 334 | before launch; a model could change them only inside its own attempt, |
| 335 | after Pi read them. |
| 336 | - The tree digest covers modes as the seal sets them; the seal is part of |
| 337 | the install. |
| 338 | - Review's tools: `read, grep, find, ls` and its Equipo tools; questions |
| 339 | the same with `git_log`, `git_diff`, `git_show`; Engineering also |
| 340 | `bash, edit, write`. Equipo's MCP server at `direct` exposure, |
| 341 | `autoEnableCodemode: false`; the role names every MCP tool exactly. |
| 342 | - The repository's AGENTS.md is not loaded as context (`--no-context-files`): |
| 343 | the hostile fixture is exactly an AGENTS.md asking for a tool. The model |
| 344 | can still read it with `read`, as file contents. |
| 345 | - The reported cost is Pi's `usage.cost.total` only when Pi priced it |
| 346 | (`totalFromProvider`, or a non-zero figure): models.json carries no |
| 347 | prices, so a TensorX-reported cost is the only one Pi can give. With |
| 348 | none, the priced figure alone is charged. |
| 349 | - Usage is complete at the `agent_end` that will not retry; Pi's own |
| 350 | retries (three, on 429 and connection errors) belong to the attempt. |
| 351 | - A 429 after Pi's retries marks the connection limited with no reset |
| 352 | (TensorX reports only per-minute limits, §4.1). |
| 353 | - Equipo picks the Pi session id (`--session-id`), so a kept session is |
| 354 | found by it; the transcript is copied out to the step's keep directory. |
| 355 | - The family is the vendor of the model id (`z-ai` is glm, `moonshotai` |
| 356 | kimi, `qwen`, `deepseek`, `minimax`), from the model Pi says answered. |
| 357 | - Pi is not in the release manifest (whose schema lists single programs); |
| 358 | a runner gets it with `install-pi` and `EQUIPO_PI_ROOT`, and without it |
| 359 | runs no metered step (`account_unavailable`). |
| 360 | |
| 361 | ## New copy keys |
| 362 | |
| 363 | None. A refused key reads with S1's `chat.connections.reason.key_refused` |
| 364 | and the connection's sign-in-again state; the step tail lines are the |
| 365 | runner's log tail, not app copy. |
| 366 | |
| 367 | ## Staging witness (later, after S3) |
| 368 | |
| 369 | The spec's finish line, a real Review on TensorX GLM on staging, needs a |
| 370 | step with leave to spend, which only S3 gives (an `urgent` task, or Run |
| 371 | now). It waits for S3. Then: |
| 372 | |
| 373 | 1. On the staging runner: `equipo-runner install-pi |
| 374 | /home/<runner>/.local/share/equipo-runner/pi`, add the printed |
| 375 | `EQUIPO_PI_ROOT` to the service environment, `equipo-runner |
| 376 | verify-installed`, restart the unit. |
| 377 | 2. Paul adds TensorX in Settings, Connections, Add a connection: confirms |
| 378 | the spending limit (a small prepaid balance, no automatic top-up), keeps |
| 379 | the $1 and $10 budget, pastes the key, picks `z-ai/glm-5.3`; the |
| 380 | one-token probe makes it Ready and appears on the spend line. |
| 381 | 3. A small task on a test repository whose Engineering runs on Claude, |
| 382 | marked `urgent` (S3), or its Review released with Run now; with |
| 383 | Claude's other accounts limited or absent, Review runs on TensorX. |
| 384 | 4. Witness: the Review step's family `glm` and label `other_family`; its |
| 385 | usage row with `cost_micros` and the spend line moved by the same |
| 386 | amount; TensorX's dashboard shows the calls; the runner log shows no |
| 387 | egress denial and no `pi unknown events` line (or names them). |
| 388 | 5. Ask the Review a question: it answers from its session, on TensorX, |
| 389 | charged. |
| 390 | 6. Check again on the connection and sign out at the end. |
| 391 | |
| 392 | ## Open |
| 393 | |
| 394 | - The staging witness waits for S3 (above). |
| 395 | - No full headless scenario (instance, runner process, forge) runs a Pi |
| 396 | step; the finish line runs the real Review step in thin with real |
| 397 | containment. |
| 398 | - Mac runners: Pi stays parked (rev 3 §5), no srt profile for it. |
| 399 | - Equipo answers the extension's questions with a refusal only; relaying |
| 400 | one to the person is not built (no role needs it). |
| 401 | |