@parcha/agentrun-harness-codex 0.0.0-stage → 0.1.0-beta.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +349 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +6 -0
  4. package/README.md +80 -2
  5. package/dist/adapter.d.ts +93 -0
  6. package/dist/adapter.js +375 -0
  7. package/dist/app-server.d.ts +53 -0
  8. package/dist/app-server.js +105 -0
  9. package/dist/binary.d.ts +31 -0
  10. package/dist/binary.js +74 -0
  11. package/dist/catalog.d.ts +35 -0
  12. package/dist/catalog.js +104 -0
  13. package/dist/code-mode.d.ts +171 -0
  14. package/dist/code-mode.js +514 -0
  15. package/dist/config.d.ts +84 -0
  16. package/dist/config.js +214 -0
  17. package/dist/facts.d.ts +2 -0
  18. package/dist/facts.js +40 -0
  19. package/dist/harness.d.ts +210 -0
  20. package/dist/harness.js +1112 -0
  21. package/dist/host/kernel.d.ts +20 -0
  22. package/dist/host/kernel.js +3 -0
  23. package/dist/host/machine.d.ts +81 -0
  24. package/dist/host/machine.js +355 -0
  25. package/dist/host/policy.d.ts +113 -0
  26. package/dist/host/policy.js +683 -0
  27. package/dist/host/process.d.ts +151 -0
  28. package/dist/host/process.js +50 -0
  29. package/dist/host/sandbox.d.ts +36 -0
  30. package/dist/host/sandbox.js +35 -0
  31. package/dist/index.d.ts +13 -0
  32. package/dist/index.js +10 -0
  33. package/dist/rollout.d.ts +96 -0
  34. package/dist/rollout.js +170 -0
  35. package/dist/schema.d.ts +14 -0
  36. package/dist/schema.js +178 -0
  37. package/dist/scripts.d.ts +218 -0
  38. package/dist/scripts.js +409 -0
  39. package/dist/tool-images.d.ts +7 -0
  40. package/dist/tool-images.js +18 -0
  41. package/dist/transcript.d.ts +20 -0
  42. package/dist/transcript.js +73 -0
  43. package/dist/verify.d.ts +62 -0
  44. package/dist/verify.js +155 -0
  45. package/dist/versions.d.ts +43 -0
  46. package/dist/versions.js +72 -0
  47. package/package.json +72 -4
  48. package/vendor/durable-harness/UPSTREAM.json +39 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,349 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ## 0.1.0-beta.82 (2026-12-02)
6
+
7
+ **Breaking:**
8
+
9
+ - The default OpenAI model is gpt-6.1-terra: on OpenAI's key, on OpenRouter's (for pi, codex and opencode), on a ChatGPT plan that lists it, and as the Codex adapter's own default. It was gpt-6.1-sol, and the Codex adapter's was openai/gpt-6-luna. The OpenAI models offered to pick are gpt-6.2-sol, gpt-6.2-astra, gpt-6.1-terra, gpt-6.1-sol and gpt-6-luna, in that order. A host that relied on the OpenAI default names its model to keep it (`AGENT_MODEL=openai/gpt-6.1-sol`, or the revision's `model`). <!-- changes/openai-default-gpt-6-1-terra.md -->
10
+
11
+ ## 0.1.0-beta.81 (2026-12-01)
12
+
13
+ - A code-mode script that `codex-code-mode-host` did not run to its end ends its turn failed instead of completed, and a host that goes quiet on a script no longer holds the turn open without end. Codex answers an `exec` in its own words, with no script status, when the host is off, did not start, answered outside its protocol, or died with the script in it, and it ended the turn completed; and it waited on a host that took the script and went quiet for as long as the host stayed up. The adapter now counts an `exec` (or the `wait` on its cell) as run only when its output's first text starts with one of Codex's script status headers (`SCRIPT_STATUS`), or with Codex's answer to an `exec` the model wrote wrong (`EXEC_MISTAKES`: no script, or a bad first-line pragma, which Codex answers before it asks the host and the model can put right). Any other answer stops the turn and fails it, naming `codex-code-mode-host` and Codex's words, whether or not a nested call of the script ran first. A host that leaves an `exec` or `wait` unanswered for a minute past the yield the script asked for (Codex's default when it names none), with no nested call of it running, fails the turn the same way. Both lists are checked against the pinned binary. <!-- changes/codex-code-mode-host-down.md -->
14
+ - The loopback model proxy can now check who sends the session's key, not only the key (`ModelProxyOptions.peers`, Linux). Before, any process of the same user could read the key from the harness's environment and use the session's model credential. Now every process that holds the client's socket must be one the host named with `ModelProxy.admitProcess`: the exact process, pinned by its pid and start time, never one of its children and never the host itself. A connection with no holder, or one that is gone, is refused. The check only logs by default: each connection it would refuse is logged once as `would_refuse`, with the session, the reason and the holders' pids, never a key. Setting `AGENTRUN_MODEL_PROXY_PEER_CHECK=enforce` refuses them with a 403. The key is still required either way. The Codex and Claude Agent local machines, OpenCode and Goose turn the check on and name the process they spawn. A socket of another user is refused, unless that user is the one the host says the session runs as (`peers.runUid`), which is admitted on the key alone. A host whose `/proc` can't be read: under `enforce` on Linux the proxy refuses to start (`PROC_UNREADABLE`); otherwise it logs once that the check is off and admits on the key alone. <!-- changes/model-proxy-peer-check.md -->
15
+ - `ModelProxy` has a new method, `admitProcess(pid)`. A host that implements `ModelProxy` itself adds it.
16
+ - `AcpProxy`'s result may carry `admit(pid)`. The ACP harness calls it with the agent's pid once the agent is spawned.
17
+ - `@parcha/agentrun-kernel/host` exports `PEER_CHECK_ENV` and `peerModeOf(env)`.
18
+
19
+ ## 0.1.0-beta.80 (2026-12-01)
20
+
21
+ **Breaking:**
22
+
23
+ - The adapter now checks Codex's code-mode host (`codex-code-mode-host`, the binary a code-mode model's `exec` runs in) against a pinned sha256 per target, as it checks Codex's own binary. It looks for the host where Codex does, from the real path of Codex's binary (a link to Codex leads to the folder of the file it links to). In a package's layout (a `codex-package.json` in the folder above `bin/`), that is the package's `codex-resources/` when the host is there, and otherwise the host beside Codex. A host in the other place is checked too. A host that is not the pinned build is refused with `CodexPinMismatch` (pin `code_mode_host_sha256`), and a missing one with `CodexNotInstalled`, before any run starts. A check that passed is kept for the process only while the binary and each host stay the same files, unchanged. `codexPins()` now includes `hostSha256`, and `CODE_MODE_HOST_SHA256` is exported. <!-- changes/codex-code-mode-host-pin.md -->
24
+ A platform the pins list no host for is refused with `CodexPinMismatch` (pin `code_mode_host_sha256`). Pins of a caller's own that leave out `hostSha256` are refused the same way; set `hostSha256: null` to leave the host unchecked, for example for a binary that runs no code-mode model.
25
+
26
+ ## 0.1.0-beta.75 (2026-11-30)
27
+
28
+ - On Codex, a call a person denied is no longer made again. When an `exec` waited for a person's approval, the model was told afterwards that its script "was cut short (the session stopped)". It read the denial as a crash to retry past, and asked the person the same question until they cancelled. The output now says the script stopped at a call that waited for approval. When the call was refused, because the person declined it or because the tool was set to deny while the call waited, the output adds that the refusal is an answer: the model should finish without the call or say what it needed it for. <!-- changes/codex-declined-call-not-retried.md -->
29
+
30
+ ## 0.1.0-beta.70 (2026-11-29)
31
+
32
+ - A run whose model provider takes a request and then sends nothing now ends failed, in words that name the stall, rather than staying working. Before, the session's model proxy waited on the transport. Node's fetch cut such a request after 5 minutes as "terminated", and every harness asked again. pi wrote a "Model request failed: terminated" row each time and retried up to 8 times. Codex retried with no row at all. claude-agent and goose each waited out two silent requests and then parked on a spend-cap refusal ("Waiting for you to raise the cap"), never naming the stall. pi's and Codex's runs showed working until they were cancelled. <!-- changes/model-stall-bound.md -->
33
+
34
+ The proxy now stops a forwarded request that goes `stallMs` with nothing from the provider, before its headers or between two pieces of its answer. The default is `MODEL_STALL_MS`, 240 s. Time spent waiting on a slow client is not counted. A host route that holds back part of what its provider sends tells the proxy so through `heard` on the request's init (`ProviderHeard`), and the bound starts again. serve's translated routes do this for a thinking block they send whole, a text-tools reply they read whole, and an answer asked whole, so a model that thinks for longer than the bound is not stopped. The client is told "the model sent nothing for 240 s, so the request was stopped" (code `model_stalled`). Before the answer began, that comes at the refused status. After, it comes as the stream's last `error` event, its own event even when the stall left the client inside one. A client does not retry on these words. The request is booked once, at an unknown cost. A host with `onFinal` (claude-agent, goose, opencode and codex) ends the turn in those words, and the turn's next answer request is refused until the host opens its next turn. pi ends the turn because it does not retry those words. The run's timeline shows "Model request failed: the model sent nothing for 240 s, so the request was stopped".
35
+
36
+ A model on the host's own machine (an Ollama model) can say nothing for minutes while it loads or reads a long prompt. On such a model, the proxies of pi, Codex and claude-agent wait as long as those CLIs already do: `LOCAL_MODEL_STALL_MS`, 30 minutes. So do the proxies of a local model tier (a subagent's or a learned workflow's), of a workflow's model nodes, and of an SDK ask. For Codex and claude-agent, the adapter's `streamIdleMs` is also the proxy's bound. serve now sends a local model's requests, and pi's own requests to its proxy, without Node's 5-minute cut (a local model's through the environment's proxy as the rest of the process uses it, with this machine's loopback and `no_proxy`'s hosts direct), so the proxy's bound is the one that ends a silent local model on pi and Codex. Before, that cut came first, and pi retried a slow local model's turn as "terminated" every 5 minutes. The Claude CLI's own client still drops a request that sends nothing for 5 minutes and asks again, so claude-agent on a silent local model retries rather than reaching the 30 minutes. goose and opencode keep the proxy's 240 s on a local model.
37
+
38
+ `MODEL_STALL_MS`, `LOCAL_MODEL_STALL_MS`, `MODEL_STALLED`, `stalledWords` and the `ProviderHeard` type are exported from `@parcha/agentrun-kernel/host`. `ModelProxyOptions.stallMs`, pi's `PiAdapterOptions.stallMs`, and the Codex and claude-agent machines' `proxy.stallMs` set the bound.
39
+
40
+ ## 0.1.0-beta.69 (2026-11-28)
41
+
42
+ - Codex on a model on the host's own machine (an Ollama model) waits out a silent stream for 30 minutes, as claude-agent's CLI already does. A slow machine that took more than five minutes to load the model or read a long prompt used to end the turn with "stream disconnected before completion: idle timeout waiting for SSE". The Codex adapter takes `streamIdleMs` (Codex's `stream_idle_timeout_ms` on its provider) and exports `LOCAL_STREAM_IDLE_MS`; serve sets it for an Ollama model, in process and on a runner. Any other route keeps Codex's own five minutes. <!-- changes/codex-local-stream-idle.md -->
43
+
44
+ ## 0.1.0-beta.64 (2026-11-26)
45
+
46
+ - pi's turn budget now outlasts a process that stops in the turn, as Claude's, Codex's, ACP's and OpenCode's do: a pi session opened again takes the turn back from its conversation (its last answer's usage and calls, and each result handed since) before a call claims, so the calls a resume answers split what their answer left instead of each taking its whole bound. A read of the turn that fails runs no call: the call is an error naming why, and the next call reads again. <!-- changes/turn-budget-resume-pi-scripts.md -->
47
+ - A result goes back to the harness only once its length is in the session's journal (`TurnBudget.kept`): a process that stops right after it was handed no longer loses its part of the turn, which a resumed call would claim again. A length the journal could not keep fails the call instead of handing its result.
48
+ - A result settles at the length it was handed: a result of at most 400 characters, whole under any bound, and a refusal's words now hold what they took, so the calls after them split only what is left.
49
+ - A code-mode script's JSON read too large for its bound is handed as a note alone (`[read cut: this result is M characters of JSON, past the N ...]`), since part of a JSON document does not parse: on a 16k-32k window, a script that parses it fails naming the cut instead of on a character in the middle, and the model reads that it should ask for less. A read that is not JSON keeps its start and its note, as before.
50
+ - A failed call's error refused for a window too small to cut it in keeps its first line (as much as fits beside the note in the 400 characters a result always keeps whole), so the model reads what went wrong.
51
+ - A raise that reaches an agentic run's claim while that claim takes a retry of the raise that resumed the run (a raise covering the run's next park, during the retry's commit) waits for the run's next claim too, as one reaching a claim parking the run again does. Before, the claim could take it and park, the run left with nothing to wake it.
52
+ - The run's view shows the cap park a run stands at as its runner reads it: a raise entry clears only the park it names. A raise that names none (checked against the run while it worked) no longer hides a park journaled before it.
53
+
54
+ ## 0.1.0-beta.63 (2026-11-26)
55
+
56
+ - A tool result is held to the model's context window, not only to the fixed 120,000-character bound: a model with a small window (an Ollama model at 65,536 tokens, a 16k one) is never handed a result that fills its context. <!-- changes/tool-result-window-bound.md -->
57
+ - `boundResult(text, budget?)` takes the model's window (`{ contextWindow, baseInputTokens? }`): a result may take at most a quarter of what the window leaves (`RESULT_WINDOW_SHARE`), at three characters a token (`RESULT_CHARS_PER_TOKEN`), and never more than `HOST_RESULT_MAX_CHARS`. Past that it is cut with a note saying it was cut to fit the window and how to read on; a window too small for any cut refuses the result in words, and a result of at most 400 characters (`RESULT_ALWAYS_WHOLE_CHARS`) always stands whole, so bounding a bound changes nothing. With no window the bound is exactly as before. `resultMaxChars(budget)` gives the bound, and `boundTo(text, max)` cuts to a given bound, saying how (`ResultBound`: the characters kept, the whole length, the bound).
58
+ - `SessionSpec.contextWindow` carries the session model's window, and each harness adapter (Claude, Codex, ACP, OpenCode) takes a `contextWindow` option for when the host passes none; Codex and OpenCode are told that window in place of their 272,000 guess. A Codex script cut off by a crash is answered within the same bound (`recoveryMaxChars`), not `EXEC_RECOVERY_MAX_CHARS`.
59
+ - agentrun-serve puts the run's model window from its catalog on every session, and pi now holds every tool result to it too: a host tool's and a pi-native one's (web_fetch, web_search, the browser's), which before reached the model up to pi's own output limits. What a host tool streams while it runs is held to the bound too (`boundedProgress`), since pi writes a call cut off past its restart limit from that text, without its hooks.
60
+ - A turn's results together fit what the window has left (`TurnBudget`, `ResultBudget.turn`): from what the context already holds (the last request's input tokens and its answer's output, else the session's system prompt and tool schemas counted with o200k), less the room kept for the model's answer (`answerReserve`: a quarter of the window, at most `ANSWER_RESERVE_MAX_TOKENS`, 16,384 tokens), each call the model made takes the smaller of its own bound and what is left over the calls still unanswered, so parallel calls split it, and below the least a cut keeps a result is refused in words. The kernel owns the rule; the session's model proxy reports each answer's facts (`ModelProxyOptions.turn`, its calls counted from the stream by `toolCallsIn`) for Claude, Codex, OpenCode and Goose, and pi and Claude Code on a person's login report them from their own hooks (pi's afterResponse, the login's stream booking). `windowBudget(window, system?)` builds the budget with its turn. A call whose result goes to the harness's own tool rather than the model (`ToolBridgeOptions.outsideTurn`: Codex's code-mode script calls) takes the per-result bound alone, outside the turn's split.
61
+ - The bridge records each cut it hands a harness (`bound:<callId>`, `boundKey`), and a replay of the call is cut by that record. Codex compares a nested call's two records on those lengths, never on the note's words; `boundOf` is gone. A session written before the record still agrees where Codex got the host's bound's cut, as before.
62
+ - On Claude, Codex, ACP and OpenCode, a turn's budget outlasts a process that stops in the turn (a park, a crash): each answer's facts and each result's length as it was handed go to the session's journal as they happen (`journalTurn`, `TURN_STREAM`), and a budget that has read no answer yet takes them back before any call claims (`TurnBudget.restore`). The calls a resume answers split what their answer left, and a result handed before the stop keeps its part. Codex's recovered script outputs claim their room in the turn too and are held to that claim (`ResultBudget.maxChars`). pi's turn budget is not journaled yet: a pi session opened again starts a fresh one, and each result there keeps its per-result bound.
63
+
64
+ ## 0.1.0-beta.59 (2026-11-25)
65
+
66
+ - A model the runner's route translates onto a harness's wire (this machine's Ollama models on Anthropic's Messages and OpenAI's Responses) is offered only to a harness whose proxy forwards with the route's `fetch`, and the Messages translation no longer drops what it can't run. Before, any harness on the wire was offered those models, including a module that sends its requests to the network, where nothing answers. <!-- changes/b51-route-hints.md -->
67
+ - `AdapterFacts` gains `forwardsRoute`. claude-agent, Goose, codex and opencode set it, and so does every recipe that builds on Goose's facts. A harness without it is offered none of the route's models, takes none as its default, and its words say to add a key ("No model yet for <harness>: add an OpenRouter or Anthropic key"). A run that names one is refused before it starts.
68
+ - An output schema (`output_config.format` of type `json_schema`) on a Messages request with no tools now reaches Ollama as its `format`. Before, it was dropped and the answer came back unconstrained. Beside tools it is refused with a 400 `invalid_request_error` that says to drop the output schema or use a model route that takes tools with a format, because Ollama holds the whole answer to the format and leaves the model no way to call a tool.
69
+ - The Messages translation answers `POST /v1/messages` and `POST /v1/messages/count_tokens` alone. Any other method or path is a 404 `not_found_error` in Anthropic's error shape, and nothing reaches Ollama.
70
+ - `agentrun harness-check` on a model the route translates (`--model ollama/<tag>`) now reaches it. Its recorder wraps the route's own fetch, so the recipe's agent gets the same route a server's run gets and the check still sees every request. Before, every request went to the route's placeholder origin and `mcp_tool` failed.
71
+
72
+ ## 0.1.0-beta.53 (2026-11-22)
73
+
74
+ - Keep newly connected Codex and Claude Code setups in sync by default, and move a supported complete setup to AgentRun from the existing agent page. Move preserves the agent's identity, history, source capture and unified usage, and checks destination tools, accounts, model, policy and project restoration before switching execution. <!-- changes/source-sync-move.md -->
75
+
76
+ Managed runs retain project checkpoints for later runs. Source and managed changes produce reviewable conflicts;
77
+ uncertain saves require review before another run. Existing connections require an explicit export grant, native
78
+ credentials stay at the source, and unsupported capabilities remain named prerequisites. See
79
+ [source sync](../../docs/source-sync.md) for compatibility and recovery behavior. Automatic notes and learned skills
80
+ remain retired; authored source skills retain their files and modes.
81
+ Owner skill edits after Move produce a new immutable project for future runs while preserving existing runs and
82
+ unchanged companion assets. Git checkpoints exclude ignored dependency trees before applying project limits and
83
+ file checks. An upload refused before project seeding releases its write receipt only after destination and upload
84
+ cleanup have both settled; unknown or dispatched writes continue to block deletion.
85
+ Completed checkpoint reads that refuse staged Git changes, secrets or unsupported files release their write receipt
86
+ only after scratch, cache, tools and provider cleanup settle under the original claim. The rejected save remains
87
+ visible and unpublished. Failed commands, changed files, lost write acknowledgments and uncertain cleanup retain
88
+ their receipts and continue to block deletion.
89
+ Terminal moved runs whose child crashed before checkpointing now require project review instead of silently starting
90
+ from an older saved project. Recovery reads the committed end, or the exact terminal claim when no end could be
91
+ written; it never invents a checkpoint or publishes orphan files. Missing-end reviews use `entry_id: null` and the
92
+ required `attempt_epoch`, so reviewing an earlier failure cannot acknowledge a later one. Active and queued runs
93
+ are not classified as failed merely because their checkpoint is still pending.
94
+ Moved projects on local storage now place attachments before restoring project files, pin their exact input paths,
95
+ and refuse collisions before admission. Claims and follow-ups reuse the placed files; checkpoints exclude those
96
+ attachments while retaining authored files in the same inputs directory.
97
+
98
+ Moved agents can learn checked workflows on the server using their existing learning settings. Replay and eligible
99
+ shadow-audit runs receive isolated copies of the reserved project; their results remain learning evidence, while
100
+ their settled file changes are explicitly discarded rather than published to the saved project. Uncertain writes
101
+ retain recovery receipts, and the existing restrictions on auditing write-capable agents still apply.
102
+ An audit that stops at an approval can still settle its private project under its original held claim, so that
103
+ refused tool call does not falsely block later runs. Parked runs gain no new tool-dispatch permission; superseded
104
+ claims and unresolved writes still refuse settlement. The bounded host-settlement model covers this transition;
105
+ the DSL effect-admission and recovery-driver models are unchanged.
106
+
107
+ Supported HTTP MCP connections retain source tool selections and denials, with explicit destination account binding.
108
+ Resource lists, templates and reads use the same pinned grants, credentials and permission gate; resource-only servers
109
+ are supported on managed AgentRun; native Codex 0.171.0 has a resource-only discovery limitation. Incomplete resource listings fail visibly, and resource bodies that echo connection credentials are
110
+ scrubbed or withheld before filing. Three upstream tool names are now reserved for these generated resource operations:
111
+ `agentrun_list_resources`, `agentrun_list_resource_templates` and `agentrun_read_resource`. A conflicting upstream tool
112
+ must be renamed before its server can connect. Stdio connections and unsupported native capabilities remain prerequisites.
113
+
114
+ Unknown source storage-write outcomes retain receipts and block deletion until independently resolved; restarting
115
+ or acknowledging a run checkpoint does not clear a source write receipt.
116
+
117
+ The Codex adapter preserves native rollout ordinals when recording an approved tool's result before resuming. This
118
+ fixes pinned Codex 0.164.0 rejecting the resumed thread after approval. Existing mixed or invalid ordinal histories
119
+ remain retained and fail before another tool dispatch; they are not silently rewritten or retried. Older wholly
120
+ unnumbered journals retain their format. This serialization fix leaves recovery admission, intent and result ordering
121
+ unchanged, so the recovery models do not change.
122
+
123
+ ## 0.1.0-beta.44 (2026-11-17)
124
+
125
+ - A Codex run under a small spend cap no longer stops as early on a hold that overstated its next request. <!-- changes/codex-cap-hold-billed-after.md -->
126
+
127
+ A request that only adds items to the session's last billed request is now held at that bill plus the bytes of the items it adds, with the local count's margin. The bill is all of that request's `input_tokens`, cached tokens included. Any other difference falls back to the local count, as before: changed instructions, tools, reasoning or model, or an earlier item edited, removed or moved.
128
+
129
+ Once the run has seen its model reason, a request's least output is 1,024 tokens plus twice the most reasoning one answer reported, within its effort's allowance. Before that it is the whole allowance, as before.
130
+
131
+ The request is still sent with all the output the cap fits, and the hold is still its worst case, so the cap is never passed. When the provider cuts an answer at the output the cap limited it to, the turn says so. A final answer cut that way ends the run with "the run's $0.50 cap stopped the model at N tokens before it finished its answer: raise the cap to at least $X to let it finish", where $X is the cap that sends that request whole with the run's wrap-up reserve still kept beside it.
132
+
133
+ An image in a custom tool call's output (Codex code mode's exec) is now counted at its billed tokens, as one in a function call's output already was.
134
+
135
+ ## 0.1.0-beta.39 (2026-11-16)
136
+
137
+ - A Codex or OpenCode request straight to OpenAI is no longer counted by OpenAI before it is sent: it is held at the kernel's local o200k_base count with its margin, as a request through a gateway already is, so it never waits up to 3 seconds on `POST /v1/responses/input_tokens` first. A capped run on such a route may pause a little sooner than it did on OpenAI's exact count; the cap is still never passed.
138
+ - Breaking, for a host of the kernel: `OPENAI_INPUT_COUNTER` is gone. A `ProviderPolicy` that named it as `countInput` drops it and sets `countInputLocally: responsesLocalInputTokens`. Anthropic's count (`countInput` on the claude-agent policy) is unchanged.
139
+ - A server with no model key can run codex and pi on a person's ChatGPT plan. The owner signs in under `/settings/chatgpt` (OpenAI's Sign in with ChatGPT through pi-ai's own flow, finished by the loopback callback or by pasting the address the sign-in tab ended on), and models named `chatgpt/<id>` go to OpenAI's Responses API on the plan's token, billed to the plan with no price here.
140
+ - `GET /settings/chatgpt`, `POST /settings/chatgpt/sign-in`, `POST /settings/chatgpt/sign-in/finish` and `DELETE /settings/chatgpt` (owner session only). A bad or stale pasted address is a 400 in words. Sign-out revokes the session at OpenAI, then removes it.
141
+ - The sign-in is sealed in one row and read per request by the server and every runner, in their own processes or containers. A token renews once across all of them, 5 minutes before it ends: one holder takes a lease on the row (a compare-and-set on its sealed bytes, `SealedKeys.replaceIf`), and the others adopt the pair it writes back, so a refresh token is never used twice. A renewal sent with no answer read holds the lease to its end, since its refresh token may be spent; a fault OpenAI answers gives it back. A sign-out during a renewal stays. A refused renewal marks the sign-in expired, and runs on it fail at once in words. A 401 from OpenAI, in a pi turn or a workflow's model node, renews the token on the next request when the row still holds it.
142
+ - Capabilities say per harness whether it runs on the plan: pi and codex do, Claude Agent and OpenCode still need a key. Models list `source: "chatgpt"`.
143
+ - On the plan, the Codex policy sends no `max_output_tokens` and none of the keys the plan does not take, refuses a system-role message in words, and names its originator. Its turns are booked with `billing: "plan"` and no cost.
144
+ - Kernel: a model proxy's credential may throw `CredentialUnavailable` to refuse a request in the host's words (`code: "credential_unavailable"`), and `credentialRefused` tells the host the credential a provider answered 401 to.
145
+ - A capped run on a model whose tokenizer is o200k_base, reached over Messages without Anthropic's count (pi on GPT-6.1 Sol through OpenRouter, sent through serve's translation), bounds each request's input by a local count with its stated margin, as a Responses request to a gateway already does. Before, its bytes were the bound: after a few long pages the body passed 272,000 bytes, every rate was priced at Sol's long-context tier, and a $1.50 run stopped at $0.10-0.27 because the cap refused to send a step it could pay for. A Claude model, a body with a document, or one that offers the hosted search keeps the provider count or the byte bound.
146
+ When a run's cap is below what its model needs for one more step and an answer, the wrap-up's words now say so with both amounts, and the effort the model's request asked for when it named one ("This run's cap of $0.25 is below what gpt-6.1-sol at medium effort needs for one more step and an answer, about $0.32."), so a run that stopped its tools at its first call shows the cap was the cause. The rule that decides when a run wraps up has not changed.
147
+ Saving an agent with a cap below that figure (POST /agents, an edit of its definition, or a package install with a per-run budget) now saves with a warning on `definition.max_cost_usd` ("This agent's cap of $0.25 is below what gpt-6.1-sol at medium effort needs for one more step and an answer, about $0.32: a run will wrap up at its first tool call."). It is never refused. The figure is priced on the first request the agent's harness sends: the harness's own input before the agent's prompt (Codex about 12,200 tokens, from billing; Claude Agent, OpenCode and pi measured on their pinned builds, each stated beside its pin), the agent's prompt where the model's tokenizer is o200k_base, and the least output at the agent's effort, its thinking included: a pi agent on a Claude model that thinks with a budget is priced with Claude's 1,024-token thinking minimum, as its first request asks for it.
148
+ - Two fixes to how a Codex code-mode `exec` reads on the timeline, and one line in the desktop and phone skills. An exec that ends ok after its call parked on a person's approval and then ran shows its calls' outcomes alone, without "The exec was cut short after these calls (the session stopped)" or a resumed wait's "that cell's script was cut off". The model is still told those words, and an exec that failed still shows them. An exec the run's end closes, because nothing else ended it (the run stopped while its call waited for approval, or a crash whose next claim never resumed Codex's thread), now reads "Using tool: exec interrupted" with no status (`tool_status` null), never failed: a park or a stop failed nothing. A call a crash cut off still reads failed. The skills' "On Codex" paragraph now says Codex's exec has no top-level `return`, so a script's output goes through `text(...)`.
149
+ - Two fixes to how a Codex code-mode `exec` reads after a park or a crash, and one to pi's wording. A Codex exec's end row now sorts after the rows of the calls its script made: a crash leaves the exec open on the run's record, and Codex's recovered answer to it ends it after the resume. An exec whose call parked on a person's approval and then ran reads ok, with the stopped-and-resumed text, as a codemode script that parked reads on pi and claude-agent, never failed. An exec cut off mid-call still reads failed, after its cut call's row. The same holds for an exec that yielded and was finished by the model's pending `wait` on its cell: it reads ok when its parked call was allowed and ran, and failed when that call was refused or the wait was told the script was cut off. A recovered exec's outcome is saved in the session's log before Codex is answered, so a second crash before its end is recorded still ends it as that outcome says. An exec that no answer of Codex's ends (its run stopped while its call waited for approval, or a crash whose next drive never resumed Codex's thread) is closed with the run, "interrupted", after its calls' rows, never left open or shown failed ahead of them. A computer_op refused before it ran is named on the timeline by its op ("Refused: files.write"), never by "computer_op" or by its arguments, on every harness. On pi, a script's call a crash cut off now reads "interrupted: the process running it stopped before it reported an outcome; it may or may not have taken effect", the words claude-agent, opencode and Codex already give it. On Codex, a computer_op answer stays text, because Codex 0.164.0's code mode hands a script one string and never throws on a tool's reply. The desktop and phone kind skills now say how to read it: an op that ran answers JSON to parse, and a refused op answers the gate's words, which open with `Permission denied:` or `The user denied this`, or give the tool's name then `is read-only for this agent, so this call was refused:` or `can't be called:`.
150
+ - On Codex in code mode, a tool call that finished in the same script as a call waiting for approval now keeps its whole result when the run goes on. Before, the script was cut when the run paused, and on the resume the model got each finished call's result cut to its first 2,000 characters, with a note saying the output of those calls was not shown. So it ran a long read again.
151
+ - A finished call's result, or a failed call's error, comes back as the script got it live: up to the same 120,000-character bound every tool result has, with the usual line saying where it was cut past that.
152
+ - The recovered script output as a whole stays within that bound plus 2,000 characters for the words around the results. Past it, every result in it is cut to the same share, each keeping its start and its last line (a long MCP answer's last line says where the whole answer was filed) and saying where it was cut. Every call's outcome is still told, unless the script made so many calls that their lines alone pass the bound: then the output is cut with the same note, and the recovery note says only the calls still in it are shown above.
153
+ - The recovery note says a finished or failed call's outcome is in the output of the script that made it, instead of "not shown here". A call whose outcome is not in that output (one cut mid-way) keeps the old words.
154
+ - `recoverySystemNote` takes the calls whose outcome is already shown as an optional second argument. Without it the note reads as before, so Claude Code, OpenCode and pi are unchanged.
155
+ - Three fixes to codemode's computer calls. A script call a person allowed carries its computer calls on its own result row only, not on its approval and "ran once you allowed it" rows too, so summing a run's rows counts each computer call once. A script rerun after a crash tells a recorded call whose answer has no value (a file write) by its answer's words, as it was answered live, not as `completed: null`. On Codex, a code-mode `exec` has its own rows, and each host tool call its script makes sits under it (`parent_tool_use_id`, the exec's call id), as a codemode script's calls do on pi, claude-agent and opencode; a host lends this through the new optional `SessionIO.ownCalls`. A Codex script that failed reads failed on its exec's row, never `exec: ok`.
156
+
157
+ ## 0.1.0-beta.38 (2026-11-14)
158
+
159
+ - A run's MCP tools are host tools on every harness: each call passes the run's one tool gate before anything is sent, and the runner calls the server with the credential, books the call and records it, as it does any host tool. opencode now runs MCP tools (`features.mcp_client.harnesses` lists it, and an opencode agent granted `mcp:<server>/<tool>` saves and runs). claude-agent offers a granted tool as `mcp__hands__mcp__<server>__<tool>` and codex as `mcp_<server>__<tool>` (Codex refuses a dynamic tool named `mcp__*`); the Timeline, tool settings and approvals still name it `mcp:<server>/<tool>`. A call set to ask on claude-agent, codex or opencode holds the CLI's call while the run waits (no "waits for a person's approval" result row while it is parked); on the person's allow the resumed session gets the call's own result, no `[tool approval]` message. A codex run no longer fails at its start when a granted server can't be reached: the server's error shows at the first call, as on pi. On a code-mode Codex model, a script's tool call held for a person's approval runs once on their allow, under its own call id, and the script's cut-off `exec` reads its result (or, when the `exec` had yielded, the model's `wait` on its cell); before, the resume told the model the call may have run, and the call the model made again asked again, so the allow never reached a call.
160
+
161
+ Who breaks: a run parked on an MCP call at the MCP door before this version does not resume its call: cancel it and start it again. A Codex thread started before this version loses its MCP tools when it resumes (Codex resumes a thread with the dynamic tools it started with): start a new run. Code built on the kernel's MCP door breaks too. Removed: `SessionSpec.mcp`, `SessionMcp`, `McpClient`, `AdapterCapabilities` and `AgentAdapter.capabilities()`, `AdapterFacts.mcp`, `ModelProxyOptions.mcp`, `mcpRoute`, `McpHandler` and `McpRouteOptions` (`@parcha/agentrun-kernel/host`), and `McpCallResult.parked`. Hand a session its MCP tools as host tools in `SessionSpec.tools` instead.
162
+ - A provider-native web search's fee is one constant, `NATIVE_SEARCH_USD` ($0.01, $10 per 1,000), instead of three copies. The price does not change.
163
+ - Kernel: `@parcha/agentrun-kernel/host` exports `NATIVE_SEARCH_USD`. The Claude and Codex proxy policies and the runner's hosted search all read it.
164
+ - `@parcha/agentrun-harness-claude` no longer exports `CLAUDE_WEB_SEARCH_USD`; read `NATIVE_SEARCH_USD` from `@parcha/agentrun-kernel/host`.
165
+ - Every harness (pi, Claude Code, OpenCode and Codex) now offers three host tools over the run's own tools: `tools_search`, `tools_call` and `codemode`. Codex gets the first two and keeps its own code mode. With MCP servers on a Claude Code run, the CLI's own tool search is on.
166
+ - `tools_search {query, limit?}` ranks the run's tools by what they do (BM25 over each tool's description and argument words) and answers each match's name, description and input schema. It lists only tools the run may call: never one set to deny, and never the three tools themselves.
167
+ - `tools_call {name, args}` calls one of the run's tools by name. The call is asked about, recorded and booked as that tool's own call, under `<callId>/call`. An ask parks the run, and once approved the call runs once. A deny refuses it in the gate's words. A call of an unknown name, of `tools_call` itself, of `tools_search` or of `codemode` is refused in words, and nothing runs.
168
+ - `codemode {script}` runs a JavaScript script in a QuickJS sandbox. Its `await tools.<name>(args)` calls are each the run's own call, gated, recorded and booked under `<callId>/s<n>`. The sandbox has the tools and nothing else of the run: no environment, keys, files, network or timers.
169
+ - A call inside a script that needs approval follows Codex's rule. The run parks. Once a person answers, the script runs again: recorded calls answer from their records, the parked call runs once (or is refused), its outcome is the script's answer, and the rest of the script does not run.
170
+ - A call made through `tools_call` or a script answers what a direct call answers: its text and images to the model, and in a script its value (a tool's structured result, else its text). On pi the harness's own tools (an extension's, the browser's) are found and called the same way as the host's.
171
+ - A refused call inside a script ends the script with the refusal's words.
172
+ - After a crash, a call that was cut off is told as possibly done, and it is not run again.
173
+ - A paid call made through `tools_call` or a script books exactly as a direct call does: held before it is sent, under the cap, and settled once. The cap's wrap-up still refuses the model's own next call.
174
+ - The three tools' definitions ride on every model request: about 2,000 bytes, 639 tokens on Sonnet. So the smallest caps the README measures rise. A pi desktop run on Sonnet through a gateway now needs $0.07 for its first request and $0.13 for five steps in `strict` mode, or $0.07 in `expected` mode (it was $0.06, $0.12 and $0.06). Straight to Anthropic, it needs $0.04 for its first request, and five steps still need $0.09 in `strict` mode and $0.06 in `expected` mode.
175
+ - Claude Code: with an MCP server's tools on the run, the CLI runs with `ENABLE_TOOL_SEARCH=true` and its ToolSearch. The run's MCP tools reach the model through `hands` only once ToolSearch finds them, and every other tool of the session loads as before. The session's proxy admits the tool search's beta (`advanced-tool-use-2025-11-20`), ToolSearch and its placeholder. It also admits a `tool_reference` block, inside a tool result only, that names one of the session's own tools. Without MCP tools, all of these stay refused.
176
+ - A server started by `agentrun-serve` (and so by `npx agentrun`) can start a worker thread from a file. The launcher no longer passes Node `--input-type`, which a worker inherits and Node refuses. Before this, a `codemode` script there failed with "--input-type can only be used with string input via --eval, --print, or STDIN", and so did pi's code mode on a desktop or a phone.
177
+ - A capped Codex, OpenCode or pi (on OpenAI's Responses) run's next-step estimate is closer to its real input, so it pauses for a raise later and less often: the input bound counts the text the model reads (a tool's output, a message, a call's arguments) at its own bytes instead of its JSON-escaped ones, some 4 to 6% less on a code-mode body full of fetched pages, which keeps more requests under the 272k-token long-context tier where every rate doubles. On a route straight to OpenAI the input is counted exactly by OpenAI's `POST /v1/responses/input_tokens`, asked with only the credential and account headers and never through a gateway; a count that fails or takes over 3 seconds leaves the byte bound. The cap still never spends past itself: tool definitions and encrypted reasoning keep every byte.
178
+ - A long answer through an OpenAI Responses gateway that writes its JSON with spaces is priced, a request that answered while its runner's claim was lost is booked at its cost when the run resumes, and a run whose spend is unknown never reads as a full cap to its learning.
179
+ - Before, the model proxy read a long answer's usage (its terminal event longer than the 64 KiB it keeps) only when the gateway wrote `"usage":{` with no space. A Python gateway (LiteLLM's `json.dumps`) writes `"usage": {`, so such a request was booked at an unknown cost though the harness counted its tokens: the run's cost read unknown with nothing unmetered. pi on the gateway, Codex and OpenCode read the usage the same way and are all fixed. Kernel: `lastObjectOf(text, key)` reads the last `"<key>": {...}` object of a cut answer, whatever its spacing.
180
+ - Before, a runner that lost a run's claim (its lease lapsed while the box stalled) and took the run again in the same process booked a request that had answered meanwhile as cut, at an unknown cost: the lost claim's write of its cost was refused, so the resumed run read the request unanswered. The run's cost read unknown though the request reported its usage on a priced model. Kernel: `SessionWriter.scope` names a session across claims in one process (serve's `journalSessions` sets the run's id beside the key); a booking whose cost write is refused hands it to the next booking of the same scope, whose `bookCut` waits (at most 10 s) for one still in flight and writes it as it would have been written. A request with no price stays unpriced and counts for the cap at its hold. A process that died hands nothing on: its requests are booked cut, as before. A workflow run's model booking now takes them too: its claim books an earlier claim's requests before the workflow resumes, where before it never did, so a workflow's request that answered under a lost claim stayed counted at its hold.
181
+ - Before, a run cancelled or stopped while its model request was being admitted could still send that request: the proxy forwarded it after its client had left, nothing stopped it, and it was booked only once the provider ended it, after the run had ended, so the run read the request as cut at an unknown cost. The proxy now books such a request at nothing (never left) and never sends it, so a run cancelled before any request reached the model costs $0. A request that reached the model and was cut keeps the cut rule: unpriced, counted for the cap at its hold.
182
+ - Before, a capped run whose shown cost was unknown gave its learning grade a cap of $0 ("Not graded: no room under the cap.") and its look-back a reached cap. The grade's cap and the look-back now read the run's spend as its own cap gates read it: an answer with no price counts at the figure the cap held for it, never $0 and never the whole cap. Only when that figure is unknown too, the grade is not queued and says why: "Not graded: this run's spend is unknown, so its budget can't cover the grade."
183
+
184
+ ## 0.1.0-beta.37 (2026-11-13)
185
+
186
+ - Every harness sees a desktop or a phone through one surface: the tools `computer_observe`, `computer_act`, `computer_screenshot` and `computer_script`, the same answers from a script, an MCP client or a tool call. Breaking: the `desktop_*` and `phone_*` tools are gone, replaced by the `computer_*` tools (a desktop's and a phone's alike, held to the `desktop` or `phone` setting), and the script API's `apps.open(id)` returns nothing; bind the app with `computer.app(id)`.
187
+ - `computer_script` runs JavaScript in an isolate in serve whose only binding is `computer` (no network, no keys, no timers); its types are `spec/computer/computer.d.ts`, generated with the tools' schemas by `scripts/generate-computer-surface.mjs` (`--check` in CI). A model reads them compactly (no comments, one line a declaration); `computer_act`'s schema types its steps with no words, and its description declares them as TypeScript.
188
+ - A script's `computer.shell` and `computer.files` are held to the run's tool settings as the `bash`, `write` and `read` tools are (a deny or a read-only bash policy refuses inside the script; a setting that asks refuses, since a script can't wait for a person), and a refused step throws in the script, so the steps after it never run. Without the ui group a scroll goes as wheel clicks (about 120 pixels each), which every driver takes.
189
+ - pi offers its code mode (`codemode`) beside its tools with a desktop or a phone, `computer` bound in its scripts; the call is held to the computer kind's setting.
190
+ - In Codex's code mode a script's call of a computer tool answers the tool's value as JSON, its images' data in it; any other tool answers its words and a line saying its images were not sent (in code mode an image reaches a script only as text). A call a script repeats after a restart, of a computer tool that completed, gets that same JSON again.
191
+ - agentrun-serve's `computerMcp` serves a run's computer tools to an MCP client, each answer with `structuredContent`.
192
+ - The desktop-computer and phone-computer skills teach the route: observe, act by ref, check, and one script for steps already known.
193
+ - A web search on a GPT-6 model (gpt-6-luna, gpt-6.1-sol, gpt-6.1-terra) is booked at OpenAI's $0.01 a call, as on GPT-5. Before, its search had no known price. A pi run's native web_search on a GPT-6 model under any spend cap was refused before it was sent ("the size of the next model request's input is unknown, so the run's cap cannot be kept"). A Codex run with `webSearch: "live"`, or an uncapped pi run, booked an unknown cost for any response that searched.
194
+ - A web_search setting of deny or ask now applies to a Claude Code or Codex run's own web search at its next search, including a run that started while it was allow. Before, the setting was read only when the run started, so a run that started with native search kept searching after the setting changed.
195
+ - Claude Code: each WebSearch asks the run's gate before it runs, as a host tool's call does. A deny refuses it in the gate's words. An ask parks the run on the person with nothing searched; once they allow it, the model's next search with the same query runs once, with no second card.
196
+ - Codex: its search runs inside the provider's model request, so its proxy reads web_search's setting before each request and offers the provider its search only while the setting is allow. A failed read offers no search.
197
+ - `SessionIO.permission(tool)` (agentrun-kernel) is the host's setting for a harness's own tool at the time of the read. The runner reads it from the store each time. `ProviderPolicy.apply` may return a promise.
198
+ - A runner run whose plane resolves web_search to native now gets the harness's own search (#2458). The runner had built the run's environment without its plane, so Claude Code and Codex runs on a runner never had it on.
199
+ - A web_search that resolves to the model provider's own search works again on the runner for pi (#2458). It used to answer "web_search has no model to search on" every time:
200
+ - A pi run's own web_search on an Anthropic or OpenAI model. That is what `auto` picks for pi, and `native` too. Each search now goes through the run's model proxy with the provider's search tool, and its searches are booked at the provider's price on top of its tokens.
201
+ - A learned workflow's call node whose web_search resolves native, on any harness.
202
+
203
+ Each run's search uses that run's own model route, never one shared by the whole process. Hand-written workflow agents were not affected: their web_search never resolves native. Both harness packages now export their `withWebSearches` price wrapper, and the Codex one its `webSearchUsd`. A claude-agent or codex run's own search is not switched on by this change.
204
+
205
+ A capped run holds a hosted search's fees with its tokens before the request is sent, at the most searches the request allows, so the fees can't pass the cap. The kernel's model proxy takes a policy's `feeMaxUsd(body)` and holds it as the request's `feeUsd`; a fee it can't bound leaves the request unmeasured. The proxy also hands `usageOf` the sent body as a second argument, so a pi request on OpenAI's Responses that offered no search reads 0 searches from its body, even when its answer names a search call.
206
+
207
+ ## 0.1.0-beta.36 (2026-11-13)
208
+
209
+ - Model defaults move to the current models. The OpenAI default (and OpenRouter's, for pi, codex and opencode) is now gpt-6.1-sol, where OpenRouter's was gpt-6-sol. The Claude Agent adapter's default is now claude-sonnet-5-5 (was claude-sonnet-4-5) and the Codex adapter's is openai/gpt-6-luna (was openai/gpt-5.4-mini). A host that relied on a default names its model; the READMEs' examples name the current ones.
210
+ - The two harness adapters list `@parcha/agentrun-dsl` as a dev dependency, since only their tests import it, and serve's package keywords drop the retired `pi-durable`.
211
+
212
+ ## 0.1.0-beta.35 (2026-11-11)
213
+
214
+ - A capped run that reads screenshots is no longer refused at its cap after the first one. A model request's input bound counted an image's base64 as one token per byte, and then the image's billed maximum on top. A 1280x720 screenshot (about a megabyte of base64) read as some 1.3 million input tokens, so a Sonnet step under a $1.50 cap "needed at least $4.83" when Claude bills it a few cents.
215
+
216
+ Each image, in every turn, now counts at what the routed model's provider can bill it as, in place of its data's bytes, whatever API carries it. The size comes from the image's own header (PNG, JPEG, GIF or WebP):
217
+ - Anthropic: its 28-pixel patches or its area at 750 pixels a token, whichever is more, at most 4,784.
218
+ - OpenAI: its 512-pixel tiles after resizing (85 + 170 each; 85 at detail low), or for a patch-billed mini or nano model its 32-pixel patches at that model's multiplier when more, at most 73,800.
219
+ - Google: 258 per 768-pixel tile, at least 1,120.
220
+ - Any other provider: the most of the three.
221
+ An image whose size can't be read counts at its provider's per-image maximum, never at its bytes. An image-shaped object outside where the API reads images (a tool call's arguments) is counted at its bytes, as text.
222
+
223
+ `InputShape.images` (the kernel host's `providerInputOverhead`) is now a list of images, each with the bytes its data takes and its size when known; `InputShape.model` names the routed model; the figure can be below 0, and so can a policy's `serverInputOverhead`, never past the body's bytes. Upgrading: pass `images: [{ bytes, width?, height? }]`, built with `imageInputOf`, `messagesImagesIn` or `responsesImagesIn`, and the model, in place of a count.
224
+
225
+ ## 0.1.0-beta.34 (2026-11-11)
226
+
227
+ - The server checks a harness's pinned binary (claude-agent's CLI, Codex, OpenCode: its sha256, then the version it reports) without holding its event loop, so requests, timers and store answers go on while a binary of hundreds of MiB is hashed and run. Before, the first check in a process held every request for one to several seconds (GET /v2/capabilities, a server's start, an adapter made for a run). The binary is now hashed off the loop a chunk at a time and run as a child the loop does not wait on. A pass is kept for the adapter's own check, which then reads nothing, and two checks of one binary at once read it once. New: `checkedOnceAsync` and `sha256OfFileAsync` (kernel host), `verifyClaudeAgentCliAsync` (claude-agent), and `verifyCodexAsync` and `verifyCodexBinaryAsync` (Codex). Who breaks: a program that calls the kernel's `checkedOnce` with its own check. A check is now a `BinaryCheck`, a generator that yields each probe (`{ kind: "sha256", path }` or `{ kind: "run", path, args, env, timeoutMs }`) and is given back its answer, so one check runs either way.
228
+ - A codex, opencode or claude-agent run that reads one of its skills' files (`read_skill_file`) now shows the call and its result on the run's Timeline, as pi's tool calls are shown. On the runner, the adapter's own skill reader ran outside the run's record, so the Timeline had no row for it. The read now goes through the host's tool path (the record, the rule before a side effect, the host's hooks on its result); a new `SessionIO.hostTool` hands an adapter's own tool to the host, and the kernel's `hostedTool(io, tool)` applies it.
229
+ - Upgrading: nothing to change.
230
+
231
+ ## 0.1.0-beta.32 (2026-11-10)
232
+
233
+ - The code copied from the upstream durable harness is now AgentRun's own: the port froze, and the pristine upstream copies, the named patches, the import tables, `scripts/port-durable-harness.mjs` and `npm run verify:port` are gone. `vendor/durable-harness/UPSTREAM.json` still records where each copy came from, and each copy keeps its header and NOTICE its attribution. With it go the kernel's paths that never run:
234
+ - `AgentAdapter.version` and `AdapterCapabilities.fork` (no adapter forks; a node that asks for `context: "fork"` is refused as before).
235
+ - `DriveContext.config`, and `requires`/`needs` on a host tool and an effect's options; `kernel/types.ts` is no longer pinned to upstream's types.
236
+ - The Codex harness's `codex.spend` ledger and its dollar caps (`sandbox({ budget })`, `GatewayLedger`, the gateway handler's `budget`, `ledger` and `onCap`), which never fired, and its table of removed options.
237
+ - `Box`, `BoxSpec`, `BoxedChild`, `Isolation` and `boxSlot` (`@parcha/agentrun-kernel/host`), which nothing implemented or used.
238
+ - The model proxy's parts only tests used (`inputTokensMaxOf`, `matchRoute`, `parseStrict`, `reportedCostOf`) move to `@parcha/agentrun-kernel/testing`; `providerIdsOf` and `MCP_ROUTE_VERSIONS` leave the host API.
239
+ - The box egress proxy (`startEgressProxy`, `parseAllow`, the address table) moves into agentrun-serve, its one user.
240
+
241
+ Fixed: a run on Claude Code or Codex now closes its harness session when its process lets the run go, as the adapter's `close()` contract asks; before, serve never called it. On today's adapters an idle session's `close()` stops no process of its own (each drive already ends its CLI or app-server when its turn ends), so this keeps the contract for an adapter whose session holds one. For it, pi-durable-disk's `DoorHook` has a required `close()`: the door's stop calls it once, busy or idle (on a drain after the abort, on a fence alongside the kill, within the abort's bound). A hook with nothing of its own to stop resolves at once. `DoorHook` also has a required `harness` id: a `close()` that throws, rejects or overruns its bound is logged with it ("door close failed" / "door close timed out") through `serveRun`'s new optional `log`, which the run CLI passes its log line to. A harness session that lands after the door's close (a stop while it was still opening) is closed too, once.
242
+ - Each adapter states what its harness is, and serve reads that instead of the harness's name. `@parcha/agentrun-harness-claude/facts` and `@parcha/agentrun-harness-codex/facts` export `facts` (the kernel's `AdapterFacts`): the API its proxy speaks (`wire`), whether it takes a message mid-turn, the memory one run reserves, its thinking levels, its own web search (`native` or `live`), whether its model is its own, how it names a model, its install line and pins, the schemas its MCP client drops, whether it binds the session's MCP servers, an MCP tool alias, and its proxy policy. Serve keeps one table from a harness id to its entry and one `providerFor(wire, env, model)`: opencode and codex take one route because both speak the Responses API, and the gateway base rule is written once, so pi's runs take it too. Nothing else changes for a run, a capability or a refusal's words.
243
+ Upgrading: an AGENT_MODEL_BASE_URL that is plain http to a non-loopback host, names a user, or has a query, fragment or dot segment is now refused on pi, as on Codex and OpenCode (a backslash or whitespace too); the refusal names the setting, and the gateway's key is never sent there. `startServe`'s `fauxHarness` option is gone; a test passes `harnessTable`, a module of harness table entries (`entries(builtins)`), in its place. `AGENTRUN_SERVE_FAUX_HARNESS` is no longer read; `AGENTRUN_HARNESS_TABLE` is set from `harnessTable` alone and dropped from the server's own environment.
244
+ - Agents on codex call a saved MCP server's tools: grant `mcp:<server>/<tool>` in `definition.tools`, as on pi and claude-agent, and `features.mcp_client.harnesses` now lists codex. The harness writes each granted server in Codex's `mcp_servers` itself, at the session's model proxy (`/mcp/<server>`, behind the session key), with only the granted tools enabled and approve mode, so Codex never holds the credential. The proxy records each call in the session before it sends it, by Codex's own call id, so a call a crash cut off is answered interrupted and never sent again. A server that does not start fails the turn (`required`). The Codex proxy policy admits the granted tools in the `mcp__<server>` namespace Codex 0.164 sends them in, and the timeline reads `<server> · <tool>`. The kernel's model proxy mounts `/mcp/<server>` itself, once for every harness with an MCP client of its own, from the session's MCP and the client fact its adapter declares (`capabilities().mcpClient`, the `_meta` key of a call's id: `claudecode/toolUseId` on Claude Code, `callId` on Codex); `ModelProxyOptions.mcp` takes `{ session, client }` in place of a handler.
245
+ - Codex installs itself on first use, as Claude Code does, through one table of the harnesses that install on first use (`src/harness-install.ts`). The first run on codex, or the first agent saved on it, installs the version AgentRun pins (`@openai/codex@0.164.0`, with this platform's binary package) from npm into `<data>/harnesses/codex`; Claude Code's install moves to `<data>/harnesses/claude-agent`: an install an earlier build left at the top of `<data>/harnesses` (its package.json, lock and node_modules, read-only) is removed before the first install, with one log line, and Claude Code installs again; a `harnesses` directory that holds anything else is left as it is. Each is pinned by a lock the server ships (`harnesses/codex/`, every package by sha512) and installs the same way: `npm ci --ignore-scripts --include=optional` into a fresh directory, checked there (for Codex, that its platform package and binary landed, whatever the person's npm config omits), renamed into place and made read-only; a server that stops mid-install stops its npm. A codex run waits for the install and shows `Installing Codex (first use)…` while it does; until it is installed, `GET /v2/capabilities` lists codex with `installs: "on_first_use"`. Codex runs only the binary in that tree, never a copy beside the server; when npm fails, the run's error names the command that installs it by hand. Codex's npx hint (`-p @openai/codex@0.164.0`) is gone. The server image no longer carries a Codex CLI: its build removes `@openai/codex`, its platform packages and its bin link, and `docker/image-check.sh` refuses an image that holds any of them. The hint that restarts AgentRun with OpenCode keeps how it was started: npx's `-y`, `--port` and `--no-open`. `node scripts/harness-locks.mjs` (formerly `claude-lock.mjs`) makes both locks again. `@parcha/agentrun-harness-codex` takes the binary a host installed (`binary: { path, packageVersion }`, checked against the pins) and exports `codexTarget()`.
246
+ Upgrading: Codex installs itself on first use, and the server image no longer carries a Codex CLI. Claude Code installs again on its first run, under `<data>/harnesses/claude-agent`; an earlier install at the top of `<data>/harnesses` is removed.
247
+ - The last data serve kept by a harness's name moves to the adapters' facts: a CLI's own tools and the table tool each one is (`AdapterFacts.nativeTools`, stated by claude-agent and codex), the harnesses each model key runs (from their wires' vendors; OpenRouter's key runs every one) and OpenRouter's default model for each wire's vendor. Nothing changes for a run, a capability or a refusal's words.
248
+ - A run near its spend cap is told once to finish: when what is left is under three times its typical request (the median of the run's own model's priced requests after the first), the model's next request carries "About $X left of this run's budget: finish now with your answer.", and the Timeline shows it as the server's row. On pi it goes into that request's context; on claude-agent, codex and opencode the model proxy adds it to the request's body after everything the CLI sent, so the cached prefix is unchanged. No message is queued, so nothing runs after the model's answer. Once per cap, across restarts; a raise re-arms it.
249
+ - With the built-ins off, a code-mode model (luna, sol) is no longer offered Codex's own `apply_patch`. Code mode listed it as a nested tool of `exec` with no environment to run it, so every call failed with "No usable execution environment is available". The harness now hands Codex its own bundled model catalog with `apply_patch_tool_type` set to null (`model_catalog_json`). `model_catalog_json` is now reserved: an app's `config` may not set it. With `builtins: true`, `apply_patch` stays. If the binary gives no catalog, the session runs on Codex's own and says so: the sandbox note the model gets with its first message reads "Codex's own apply_patch stays listed: …" with the reason.
250
+
251
+ A host tool's images now reach a Codex model as images. The tool's answer to Codex carries each one as an `inputImage` item (a data: URL) after its text, where before only the text went.
252
+ - On Codex, a call that returned images and completed just before the session stopped, before Codex recorded its answer, is now repaired as its text plus a line saying how many images it returned, which are not shown again. Before, the model got the images' base64 as JSON text.
253
+ - A host tool's images on Codex are checked before the model is sent them, by the rule claude-agent holds them to: a type written image/<subtype> with no parameters, and base64. One that can't be sent is the call's error, naming the tool and the image, not a request refused later. In code mode, a script's nested tool call sends no image: Codex hands a script an image as its data: URL inside the result's text, so a script that printed it sent the model the base64 as words. The script now gets the tool's text and a line saying how many images were not sent. When Codex's bundled catalog can't be read, the run's note names the binary by its file name only, with no host path and none of the session's own directories.
254
+ A tool call whose answer to Codex fails to build no longer leaves its images held for the rest of the session.
255
+ - Every deny the model reads now says plainly that the call never left: "It was not run: nothing was sent and nothing was charged." It covers a tool set to deny, an ask refused because no one can approve, the owner's deny of a parked call, and a person's declining message. After a deny, a model no longer tells the person it can't confirm whether a charge was made.
256
+
257
+ An approved call that ran before a crash keeps its saved result when its tool is set to deny before the run reopens: the model gets that result, never "nothing was charged", and it is booked once. A call cut after it started but before its outcome is denied with no claim either way ("It had started before the deny, and whether it took effect is not known.").
258
+
259
+ The same holds for a replay-safe host tool on claude-agent and codex (web_fetch, web_search) that the kernel runs again after a crash cut its first attempt: if it is now denied, or refused for want of an approver, the words say it had started and whether it took effect is not known, never that nothing was charged. If it now asks and PARKS, the request keeps that it is a replay in the run's store (`replayed` on the approval request), so the owner's Deny or a declining message says the same, after a restart too. Host tools now hear the kernel's attempt (`HostTool.call`'s `attempt`). On pi, which reruns a cut replay-safe call with the same call id and no sign of a rerun, the gate keeps its own mark of each replay-safe call it let through that can bill (web_fetch, web_search: an `agentrun.gate_passed` entry, written before the tool runs), and reads its marks before the run resumes, on an agentic run and a workflow's model node alike, so a rerun of one is treated the same way.
260
+ - On codex and claude-agent, a tool call (a remote MCP server's included) has its Timeline row while it runs, from the moment the session records its intent, and a call a crash cut off gets its result row at the next open from the session's record of it: "interrupted ... it may or may not have taken effect" for one that is not safe to repeat. Before, a running call had no row, and a cut call never got one.
261
+ - On codex, a code-mode script's call the host parked for a person's approval (an MCP tool's or a host tool's) is never told to the model as completed: the cut script's output says it "was waiting for a person's approval and did not run". The host marks such an answer `parked` (`HostTool` and `McpCallResult`), which the MCP door never sends the harness's client.
262
+ - A learned workflow's model nodes, its `llm` call nodes and a call node's native search, on claude-agent, codex and opencode, are requests on the run's one route: the session's own model proxy, under a side key the proxy mints for the host (`ModelProxy.sideKey`, `AdapterSession.port`). They get the harness's own body rules, provider, key, price and booking, labelled `learned_workflow` on the session's records (`runner.request.host`), under the run's one cap, as a side call: the spend cap's wrap-up never counts it toward a typical request, and it never takes the wrap-up's note. They reach an operator's gateway at ANTHROPIC_BASE_URL or AGENT_MODEL_BASE_URL as the harness's requests do, and never go around it, so a run there is offered its learned workflows (the learning pin's `workflows_off` is gone). A side request is never the turn's answer request: a content-filter stop on it does not halt the turn.
263
+ Upgrading: Finish or cancel capped runs that used learned workflows before upgrading: their earlier learned-workflow spend is not counted against the cap after it. A pin written before this keeps the workflows it left out, and its `workflows_off` is no longer read.
264
+
265
+ ## 0.1.0-beta.30 (2026-11-05)
266
+
267
+ - On codex, a content-filter stop whose final Responses event is longer than the model proxy keeps of it now ends the turn
268
+ through a gateway that sends each event as its data alone (LiteLLM sends no `event:` lines). Before, only a stream that
269
+ named its events was read, and Codex asked for the refused answer again until its turn limit. The policy reads the
270
+ event's type from its data, whatever the JSON's spacing.
271
+ - A Codex run stopped just after its message was sent to Codex no longer loses the message. Codex answers `turn/start` before it writes the message to its rollout: on the real app-server, killed at the answer or 20 ms after it, the rollout held no user message; 100 ms after, it did. A stop in that window kills Codex with the message sent and never recorded, and the next Codex, resumed from the session's rollout, never has it. The stop's settle now reads Codex's rollout as the session keeps it, the rollout the next Codex is resumed from, and carries a placed message it lacks into the next one, as claude-agent's settle reads its CLI's transcript. The `turn/start` send mark is gone (the kernel's `markSent` and `sentMarks` with it); a stopped drive still starts no turn.
272
+ - A run whose model provider stops the answer on its content filter now ends `failed` with `error.code` `moderated` and
273
+ says so in plain words: "The model provider stopped this answer (its content filter). Rephrase the request, or try
274
+ another model." Before, it ended `run_failed` with the provider's jargon ("Response incomplete: content_filter"). The
275
+ Timeline's error row keeps the harness's words for the stop (pi-ai's on pi, the kernel's on claude-agent and codex). On pi the run reads pi-ai's words for the stop on each API. On
276
+ claude-agent and codex the session's model proxy reads the provider's stop (Anthropic's `refusal`, an OpenAI answer
277
+ `incomplete` for `content_filter`) and the harness ends the turn at once: the CLI no longer asks for the refused answer
278
+ again, turn after turn. Only the turn's own answer request ends it: a side call the CLI makes beside the turn (one
279
+ without the session's tools) that the provider stops is logged and left to the CLI. The refused request is booked at
280
+ the usage its end reports. The kernel exports `CONTENT_FILTERED`, the text such a turn ends with; a provider policy may
281
+ say a stop through `filtered` and a side call through `answers`, and the model proxy tells its machine through
282
+ `onFiltered`.
283
+ - A request you stop under a cap counts the reasoning it never streamed. A model whose reasoning streams only as a summary (the Responses API's reasoning, Claude 4-class thinking) is billed for far more than the summary's bytes. A stop after about 10,000 hidden reasoning tokens on a gpt-5-class model with a 20 KB context cost about $0.106 and counted $0.038, so deliberate stops could pass a cap. A stopped request that reasons now also counts the part of its reasoning budget that did not stream: input + streamed + 1,024 + max(0, reasoning budget - reasoning streamed), never more than its hold. Real usage still replaces the figure when it comes.
284
+ - **On pi:** a reasoning model's stopped request counts its thinking level's budget (on Anthropic's API, the `budget_tokens` it was sent with, for a model whose thinking takes one). A Claude model that thinks adaptively (every current one on Anthropic's API) is sent no budget, and its thinking is bounded only by its output limit, so it counts that limit less 1,024 tokens: in practice its hold. A stop after a 300-byte thinking summary on Sonnet 5.5 with a 20 KB context under a $1 cap counted $0.142 at medium and $0.224 at high, against about $0.45 for 40,000 adaptive thinking tokens. The request's output limit is now the one actually sent: the cap had taken a thinking budget out of it that pi-ai never sends (8,192 tokens at medium), so the request was held at more than it was sent with. With no level, on an API whose model reasons at its own default, it counts its whole output limit. With thinking off on Anthropic's API, on a model whose thinking can be off, nothing more.
285
+ - **Adaptive thinking counts up to the hold.** On every current Claude model, on pi and on `claude-agent`, the provider is given no thinking budget, so a stopped request counts up to the hold the cap took for it. Under a cap with little left beside that hold, the request after the stop can be refused.
286
+ - **On `codex`:** the effort's budget (minimal 1,024, low 2,048, medium 8,192, high 16,384), none at effort `none`, and the output limit when the body names no effort.
287
+ - **On `opencode`:** the same as `codex` (the same Responses API): what a stop counts as streamed is the content its deltas carried, not the wire, plus the unstreamed part of its effort's budget. On the walk through OpenCode's proxy (a request at $100 a million output tokens under a $0.50 cap, stopped after 1,146 characters of answer text after the stream's echo of the request) the stop booked 106,831 bytes, its whole $0.50 hold, and refused "Go on."; it now counts $0.217, and "Go on." goes.
288
+ - **On `claude-agent`:** the thinking budget, or `max_tokens` when thinking is adaptive, for every request that thinks; none with thinking off. Thinking that streamed is subtracted, so a stop after a budget's worth of visible thinking counts nothing on top.
289
+ - **Kernel:** a provider policy may read a request's hidden reasoning from its body (`reasoningHidden`). It may also read the reasoning in each streamed event (`reasoningBytesOf`). The model proxy books a stopped response with both (`stoppedHiddenTokens`, `stoppedReasoningBytes`), and the runner counts all it sent plus the part of the budget its reasoning did not cover.
290
+ - **What streamed is the content, not the wire.** On `claude-agent` and `codex` a stop counted the response's bytes as sent, the provider's framing included: about 11.7 bytes a character of text on the Responses API and 24 on the Messages API. A codex request at $100 a million output under a $0.50 cap, stopped after 1,146 characters, booked its whole hold and refused "Go on.". It now counts each text, reasoning and tool-argument delta's UTF-8 bytes, as pi counts its streamed blocks: $0.217, and the next request goes. A provider policy reads them (`contentBytesOf`).
291
+ - **A stop before the provider's first header** on `claude-agent` and `codex` now counts as a stop with nothing streamed (its input and 1,024 tokens, as on pi), not its whole hold. A response the provider answered with an error status still counts at its hold.
292
+ - A message the person stopped the instant it was sent is no longer lost on claude-agent, and the same window is closed on Codex and OpenCode. Asked "Reply with exactly this code and nothing else: CARRY-CLAUDE-7", stopped within its first second, then told "Go on.", a claude-agent run answered "There's nothing earlier in this conversation for me to continue from": Claude takes a message within its first second, so the stop landed after the harness placed it and before the CLI was handed it, and nothing carried it. Now a stop's settle carries a placed message its CLI never took into the next one, as it carries one stopped before it was placed. On claude-agent that is a message the CLI's own transcript, as the session keeps it, does not hold: that transcript is the history a resumed CLI is given, so a carried message is never sent twice. On Codex it is a message Codex's own rollout, as the session keeps it, does not hold. OpenCode marks a message just before it sends it (`prompt_async`), and a marked message is never carried: a crash between the mark and the send loses it rather than sending it twice. After a stop, no new turn is started.
293
+ - **A recovered message is not carried again.** After a crash between a message's placement and its CLI's record, the recovery message carries its words. It now records which messages it carries, before it goes (a kernel effect by its id on claude-agent, its `PROMPT_STREAM` record on OpenCode). Once the CLI holds the recovery message, a stop's settle and a later recovery both count those messages sent, so nothing is sent twice, even after a second crash. Codex's recovery already did this through its client id.
294
+ - **A follow-up's own prompt** (the host's, named to the settle) is withdrawn and never carried into the person's next message, as the follow-up says: a host prompt that never ran is not sent. A person's message waiting beside it is left as it is.
295
+
296
+ ## 0.1.0-beta.29 (2026-11-04)
297
+
298
+ - **The Codex adapter takes the host's skills, and its sessions no longer see Codex's bundled ones**
299
+ - `codexAdapter({ skills: [{ name, files }] })`: Codex lists each skill to the model by its name and description, and the model reads its `SKILL.md` and its other files with `read_skill_file`, the shared read-only host tool (Codex has no shell here). The skills are written into each session's `CODEX_HOME` at the start of every drive, where Codex lists a user's skills in a turn with its built-ins off; it lists none from a working directory's `.agents/skills` there. A host tool named `read_skill_file` is refused when the adapter has skills.
300
+ - Codex's bundled skills (imagegen, openai-docs, skill-creator, skill-installer) are off in every Codex session, with skills or without (`[skills.bundled] enabled = false`). Before, Codex installed them at every start and listed them to the model, so a session was shown skills its host never gave it.
301
+ - The skills are checked when the adapter is made, and a bad one throws before the binary is looked for. The check, `skillProblems`, and the skill's shape, `HostSkill`, are now in `@parcha/agentrun-kernel` beside `readSkillFileTool`. The Claude adapter's `skillProblems` and `ClaudeAgentSkill` are that check and shape, re-exported, so nothing changes for its users; the Codex adapter exports the same `skillProblems`.
302
+ - The local Codex machine takes a seed of files for one of its private directories (`seed: { dir, files }`, each file's text by its relative path), written at acquire and again after every wipe. A path that is absolute, empty, climbs or starts with a dot, or a directory not the machine's own, is refused when the machine is made.
303
+ - The Codex adapter says what Codex 0.164.0 does to a tool's schema, so no difference is silent. Codex sanitizes the schema its model is given: it strips bounds, patterns, formats, titles, defaults and a few annotations, and it drops or retypes a few shapes (a tuple `items`, `prefixItems`, `patternProperties`, `if`/`then`/`else`, `not`, a non-scalar or untyped non-string `enum`/`const`, `contains`, `dependentRequired`, `propertyNames`, a boolean `items`, constraints inside `allOf`). Checking a session now refuses each of those shapes by tool, JSON pointer and keyword, before anything is paid. For the stripped keywords, the tool's description lists them in plain words under one fixed heading, sorted by pointer, so the model still reads them; the host and the DSL keep checking against the original schema. The measurement is recorded for the public schema corpus and replayed offline.
304
+ - A Codex session can turn on Codex's own web search, live: `codexAdapter({ webSearch: "live" })` sets `web_search = "live"` in Codex's config, and the session's model proxy admits exactly the hosted `web_search` tool the pinned binary then sends (and a `tool_choice` naming it) and refuses any other web search tool; every other hosted tool is dropped or refused as before. Each search a response ran (its `tool_usage.web_search.num_requests`) is added to the response's price at OpenAI's $10 per 1,000 calls, so it counts in the session's cost and the host's budget; a model with no known search price, or a response that does not say how many searches it ran, is booked at an unknown cost. A request that offers web search has no input bound (a search's content is billed as input), so a cap that holds each request's worst case treats its input as unknown. Off by default, and off is unchanged. `CodexWebSearch` is the option's type.
305
+ - The harness packages are published from this release under their final names: `@parcha/agentrun-adapters` is `@parcha/agentrun-kernel`, `@parcha/agentrun-claude-agent` is `@parcha/agentrun-harness-claude`, `@parcha/agentrun-codex` is `@parcha/agentrun-harness-codex`. Their subpaths, directories, harness ids and `AGENTRUN_*` environment variables do not change.
306
+ - Messages these packages raise start with `agentrun-kernel:`, `agentrun-harness-claude:`, `agentrun-harness-codex:`.
307
+ - New package `@parcha/agentrun-harness-codex`, held (not on npm yet): Codex as an AgentRun harness. `codexAdapter(options)` is an `AgentAdapter`, so `createHarnessRunner(codexAdapter(...), { store, tools })` runs a DSL `agent` node on Codex 0.164.0's app-server.
308
+ - Codex's built-in tools are off. A classic model is offered exactly the host's tools and `submit`; a code-mode model is offered code mode's `exec` and `wait`, which reach the host's tools by their own names. A test runs the pinned binary against a scripted model that calls every built-in and checks that nothing runs, writes or spawns.
309
+ - Codex's model traffic goes through a per-session proxy on the loopback interface that holds the provider key, forwards only `POST /v1/responses`, fixes the model, stores nothing at the provider, drops Codex's own web search and every tool that is not the session's (refusing any other provider-hosted tool), and asks the runner before every paid request.
310
+ - The adapter checks the Codex binary it will run against the pins when it is made: the platform package's version, the binary's sha256 and the version it reports. A mismatch or a missing binary is a typed error. A relative `CODEX_BIN` is resolved from the host's working directory, and that absolute path is the one checked and run.
311
+ - Codex runs in the session's own directories with an empty working directory and an allowlisted environment.
312
+ - Sessions are durable in the store the host lends: a session a process died inside resumes from its records, and a `never` tool's cut-off call is reported, never repeated, and a call delivered twice runs its tool once.
313
+ - A spend cap below one request's worst case at its model's output ceiling no longer refuses the run before it starts. Each request is limited to the output tokens what is left of the cap can buy, thinking included, and held at that, so the cap stays exact. A request is refused only when what is left cannot buy its least: 1,024 tokens for its answer, plus its thinking's least when it thinks. A $0.50 cap on Claude Sonnet now runs; before, any cap under about $1.30 could never send a request.
314
+ - A refusal says, in plain words, what the run spent of its cap, what its next request needs and the cap that would run it ("Not sent: ... Raise the cap to at least $0.48 to run it."), on the run's error and its timeline row, after the code `spend_cap_reached (out of budget): `, which pi-ai's retry takes as final. A request the cap refused counts as no model request in the run's usage, on every harness; a run whose only request was refused says "no model request sent". A reply the limit cut short says so on the run's timeline.
315
+ - The model proxy asks the host with a request's own output limit and its least (`outputTokensAsked`, `outputTokensLeast`), and writes the admitted limit (the ticket's `outputTokensMax`) into its body through a policy's new `limitOutput`; it never sends a request unlimited that was admitted with a limit, nor a body longer than the one its input was measured on. The runner's `beforeRequest` may answer `outputTokensMax` beside `holdUsd`, and holds each request in flight at the limit it was admitted with; a limit that is no whole number of tokens above 0 refuses the request, never sends it unlimited.
316
+ - A turn that a halt ended with a reason now ends `failed`, naming it, never `interrupted` with the reason dropped: a harness's spend cap, its transcript mirror, a refused spawn. Only the session's own stop (its interrupt or its close, told apart by identity with the kernel's `SessionHalt`) and its host's stop end a turn `interrupted`. `abortedOutcome` decides it, and both adapters use it. This changes how spend-cap and mirror halts end a turn: a host that read `interrupted` for them now reads `failed` with the reason.
317
+ - A model that runs its tools in code mode, such as gpt-6-sol, now runs on the Codex adapter; it was refused before any request. The adapter no longer reads the binary's model catalog or refuses a code-mode model when a session is checked, and the proxy passes Codex's `exec` and `wait` (and drops the sub-agent and user-input tools listed beside them, and refuses a code-mode request that allows parallel tool calls). A host tool the script calls arrives as a nested call under an id of Codex's own, which no line of the session's log carries, so a `never` tool called that way was declined for good; it now runs once, as soon as the `exec` it runs under is in the log.
318
+ - After a crash, a host tool's call that was cut off is told to Codex by the replay policy the run's log recorded when it started, as the recovery note of the same turn tells it. Before, the output Codex got for a `safe` call said it may have taken effect, while the note said it was safe to repeat: the drive that opens after a crash marks a safe call for a retry, which the output's own rule did not count as interrupted.
319
+ - A Codex session no longer tells the model its files are read-only. Codex sent a `<permissions instructions>` developer message ("`sandbox_mode` is `read-only`: The sandbox only permits reading files") about its own sandbox, which binds only its built-in tools, and those are off. The host's tools write. A model that believed the message refused to write at all and ended its turn with no tool call. The adapter now sets `include_permissions_instructions = false`. Codex's sandbox itself stays read-only.
320
+ - A model Codex's catalog marks multi-agent V2 (luna, sol) is no longer told it can spawn sub-agents. `multi_agent = false` turns off only V1, so Codex still built V2's collaboration tools, which the model proxy dropped, and sent `<multi_agent_role>` and `<multi_agent_mode>` messages describing them. The config now sets `[agents] enabled = false`, which turns off both versions.
321
+ - `CODEX_INSTALL` is exported: the pinned install line (`npm install --save-exact @openai/codex@<version>`) that `CodexNotInstalled` names, so a host can print it without copying its format.
322
+ - Codex dies with the process that started it. The session machine starts Codex with a watch on its parent (the host's `parentWatched`, inside the host's confinement), so a host that is SIGKILLed and runs no close leaves no Codex behind, on a box with or without `setpriv`. A confinement prefix must exec Codex in place, as `setpriv` does: a wrapper that forks and stays as the parent defeats the watch.
323
+ - A call that Codex's rollout holds with no output now gets one from the log whenever a thread resumes, before any turn is sent, and not only under a recovery note. A turn that ended without answering a call (one interrupted mid-call, or settled instead of resumed) left it unanswered, and the next turn's history, with a call left open, was refused by the provider. A cut-off code-mode `exec` is answered first, as a custom tool output built from its nested calls. Every other call gets the generic output, of the kind the call asks for: a custom tool call such as Codex's own `apply_patch` gets a custom tool call output, and a host tool that happens to be named `exec` is answered as the function call it is. A `never` call the ended turn completed is answered as recorded only when a recovery note resumes that turn; a new turn that calls it again runs it. A `wait` of code mode that was waiting on a cell when the session stopped is told so, and that the cell's script was cut off, not that it never started.
324
+ - `codexAdapter` refuses a `webSearch` other than `"live"` with a `TypeError` that names the package as its other errors do, `agentrun-harness-codex: webSearch is "live" or absent`; it began `agentrun-codex:`, the package's name before the rename.
325
+ - Checking a harness's binary against its pins no longer reads the whole binary into memory, and runs once per binary in a process. `verifyCodexBinary` (the codex binary, 294 MiB) and `verifyClaudeAgentCli` (claude-agent's CLI, 231 MiB) each read the file whole to hash it, and agentrun-serve checked each again for every model it resolved: twice per harness in its start's probe, then once per save and once per run check, and a run's own process once more when it made its adapter. One start probe peaked at 395 MiB of memory, 675 MiB with a default model, past a 512 MiB container's limit. The hash now reads 1 MiB at a time, and a check that passed is kept for the process while the binary stays the same file (its path, device, inode, size, and modification and change times, with the pins); touched or replaced, it is checked again, and a failed check is never kept. The kernel's `@parcha/agentrun-kernel/host` exports both parts, `sha256OfFile` and `checkedOnce`.
326
+ - A claude-agent or codex run works in the run's workspace, the directory its file tools write to. Before, the CLI's working directory was an empty one beside it (`runs/<id>/harness/work`): Claude told its model that path, so a file written at its absolute path was refused as "outside the workspace", and the answer quoted the server's data directory. In QA this happened in 3 of 4 Claude runs that wrote a file.
327
+ - `SessionIO.cwd`: a host may name the session's working directory, its workspace. The Claude and Codex adapters run their CLI there, and keep their own state in the session's private directory as before. git stops at the workspace's parent. serve passes the run's `work/`.
328
+ - A file tool's refusal, an error such as ENOENT, and a write's or edit's result on claude-agent and codex name paths in the workspace relative to it (`notes/a.md`, `../escape.md: outside the workspace`), never by the server's data directory. A read's result is the file's own text and is not changed.
329
+ - A host tool's result reaches the model whole on claude-agent and codex. The Claude Agent CLI saved an MCP tool's result past 50,000 characters (a long `web_fetch` page, a `monid` answer, a 50 KB `read`) to a file under its own config directory and told the model to read it, which the run's confinement refuses, so the model could not read the page; Codex kept only the two ends of a result past its truncation policy (10,000 tokens for the models its catalog holds, about 12,000 characters for another). `@parcha/agentrun-kernel` states the bound once, `HOST_RESULT_MAX_CHARS` (120,000 characters, over every host tool's largest result); the Claude Agent adapter lists each host tool with it as `anthropic/maxResultSizeChars` and sets `MAX_MCP_OUTPUT_TOKENS` to it, and the Codex adapter sets `tool_output_token_limit` to it as Codex counts it (four bytes of UTF-8 a token: 90,000).
330
+ `web_fetch` (and `fetch_page`) reads a page a part at a time: `offset` and `max_chars` (20,000 by default, at least 200, at most 50,000; a smaller one or an offset below 0 is refused before anything is fetched, saying so; a workflow's call node reads 50,000 by default) name the part, the Page gives `chars`, its length, and a part that is not the whole page has `truncated` while more follows, `next_offset` where it begins and `original_chars` where the whole length is known; an agent reads a line after the JSON saying which characters these are and the offset that reads on. A page whose HTML pi-browser cut at 1,000,000 characters before reading it gives `html_chars`, its whole length, on every part and no `original_chars`, and the line after its last part says `The page was cut at 1,000,000 characters of HTML before reading; the rest wasn't read.`; `converted: "text"` says its text is plain text, its conversion to markdown having run out of time. The text was cut at 60,000 characters with no way to read the rest. A page's links come with the part at offset 0, at most 200 in 20,000 characters, and a URL longer than 4,096 characters is refused before anything is sent.
331
+ `web_search` leaves out its least relevant results when its answer would pass 100,000 characters, and `omitted` counts them.
332
+ - A host tool's result reaches a harness at most `HOST_RESULT_MAX_CHARS` (120,000) characters long. The kernel's tool bridge, which every host tool's result passes on its way to Claude Agent or Codex, keeps a longer one's start, cut where a character ends, ends it with a line saying where it was cut (`[cut at N of M characters]`), and flags the call's `tool_end` `truncated: true`; the call's record keeps the whole result. On a Codex resume, a call the rollout left unanswered is answered from that record with the same cut. A skill file read with `read_skill_file`, a delegate's answer and a rejection listing every schema error reached the harness whole, however long (a 1 MiB skill file, a 6 MB answer).
333
+ - The model proxy now tells the host, before a paid request is sent, the most input tokens it can be billed for. A spend cap could only count a request's cost once it was billed, so a single request whose input alone was over what was left of the cap was still sent and paid. `beforeRequest` now carries `inputTokensMax`: the UTF-8 bytes of the body exactly as it is sent, plus the input the provider adds that the body does not carry. A byte-level BPE token covers at least one byte, so this never undercounts the body, however dense its text. Each `inFlight` entry carries its own `inputTokensMax` until that request answers, so a cap can hold every open request at its own bound. When the provider's addition cannot be read, `inputTokensMax` is undefined, never 0, and a cap treats that input as unknown.
334
+ - What a provider adds is in one place, `providerInputOverhead(api, shape)` from `@parcha/agentrun-kernel/host`. `api` is pi's API kind, and `shape` is whether the request has tools, its tool_choice and its image count. Each figure is the largest the provider documents for any current model:
335
+ - `anthropic-messages`: the tool-use system prompt the Messages API adds to a body with tools, 675 tokens for tool_choice auto or none and 804 for any or tool, plus 4,784 tokens for each image, its high-resolution tier's maximum.
336
+ - `openai-responses`, and the Azure and Codex Responses kinds: no prompt of their own, and 73,800 tokens for each image. That is 30,000 patches, the most an image may have, times 2.46, the largest model multiplier.
337
+ - `openai-completions`, which OpenAI-compatible gateways speak too: nothing for its per-message formatting, since the body's bytes already bound it; 804 tokens when the request has tools, whatever its tool_choice, the largest Anthropic tool-use prompt, since a gateway may route to an Anthropic model; and 73,800 tokens for each image.
338
+ - Every other API kind, among them pi's `mistral-conversations`, `bedrock-converse-stream`, `google-generative-ai`, `google-vertex` and `pi-messages`, and a faux `faux:<id>`: nothing for text, an assumed 2,048 tokens when the request has tools, and 73,800 tokens for each image. The tool allowance for these kinds is assumed, not documented; it is documented only for `anthropic-messages`, the OpenAI Responses kinds and `openai-completions`. `providerInputOverhead` never returns undefined: only a body that cannot be measured is unmeasured.
339
+ - Images are billed by their area, not their bytes, so a small compressed image of large dimensions is counted at its maximum. A Codex body with a file input (a PDF, billed by its pages) is left unmeasured.
340
+ - A provider policy says what its provider adds with `serverInputOverhead(body)`. The Claude and Codex policies read their body's shape and use the figures above.
341
+ - The faux adapter in `@parcha/agentrun-kernel/testing` measures its prompt's UTF-8 bytes for each request, as a real adapter's proxy measures its body.
342
+ - `inputTokensMaxOf(policy, body, sent)` is exported from `@parcha/agentrun-kernel/host`.
343
+ - The proxy serializes the body once before admission and sends exactly what it measured. A body that cannot be serialized is refused before the runner is asked, so it is never booked.
344
+ - A Claude or Codex turn stopped while the session was still recording the person's message stays stopped. Before, the stop found no turn running, so the session read idle, and the stopped message stayed pending and was sent with the next message. Now a turn that ends on its session's stop leaves the session reading `open_turn` while that message is pending, so serve's stop settles it, and it is never sent.
345
+ - A Claude or Codex turn the person stopped stays stopped when the run's process is replaced. Before, the next process found the stopped turn still open in the session and resumed it: it ran its tools and paid for its model requests again, and its answer came before the person's follow-up. Now serve's open reads the run's stop record and settles that turn, ended `interrupted`, with nothing sent, and the follow-up is a turn of its own. A turn a crash or a drain cut is resumed as before.
346
+ - A stop that lands before the harness took the person's message withdraws that message too, so it is never sent later: not with the follow-up in the same process, and not by a process that replaces it.
347
+ - `AdapterSession` has `settleOpenTurn()`: it records the open turn as ended, interrupted, withdraws the input the turn never placed, and sends nothing. The Claude Agent, Codex and faux adapters implement it. A harness that runs as a child process does both with `settleTurn(drive)` from `@parcha/agentrun-kernel/process`. An adapter written outside this repository without it keeps the old behaviour: its stopped turn is resumed.
348
+ - After `interrupt()`, the Claude Agent and Codex sessions read `open_turn` while the stopped turn is still open in their records. serve's stop settles it there; a runner's pause leaves it for the next process to resume.
349
+ - When the earlier process died before it wrote the stopped turn's end, the next one writes it, `interrupted`, before the follow-up's turn starts.