@parcha/agentrun-harness-codex 0.1.0-beta.68 → 0.1.0-beta.70
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.
- package/CHANGELOG.md +14 -0
- package/dist/adapter.d.ts +7 -0
- package/dist/adapter.js +7 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +1 -0
- package/dist/harness.d.ts +2 -0
- package/dist/harness.js +1 -0
- package/dist/host/machine.d.ts +2 -0
- package/dist/host/machine.js +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## 0.1.0-beta.70 (2026-11-29)
|
|
6
|
+
|
|
7
|
+
- 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 -->
|
|
8
|
+
|
|
9
|
+
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".
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
`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.
|
|
14
|
+
|
|
15
|
+
## 0.1.0-beta.69 (2026-11-28)
|
|
16
|
+
|
|
17
|
+
- 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 -->
|
|
18
|
+
|
|
5
19
|
## 0.1.0-beta.64 (2026-11-26)
|
|
6
20
|
|
|
7
21
|
- 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 -->
|
package/dist/adapter.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ export declare const codexToolName: (name: string) => string;
|
|
|
18
18
|
* three quarters of a token a character: not a quarter, which holds for ASCII alone.
|
|
19
19
|
*/
|
|
20
20
|
export declare const CODEX_TOOL_OUTPUT_TOKENS: number;
|
|
21
|
+
/** How long Codex waits on a silent stream from a model on the host's own machine (an Ollama model the route
|
|
22
|
+
* translates), which says nothing while it loads or reads a long prompt: 30 minutes, as claude-agent's CLI waits
|
|
23
|
+
* (its LOCAL_STREAM_IDLE_MS). Any other route keeps Codex's own five minutes. */
|
|
24
|
+
export declare const LOCAL_STREAM_IDLE_MS: number;
|
|
21
25
|
export interface CodexProvider {
|
|
22
26
|
/** The provider's origin (`https://api.openai.com`): the proxy forwards to its `/v1/responses` only. */
|
|
23
27
|
origin: string;
|
|
@@ -53,6 +57,9 @@ export interface CodexAdapterOptions {
|
|
|
53
57
|
* result is its share of it (the kernel's resultMaxChars). A session's own (SessionSpec.contextWindow) wins. With
|
|
54
58
|
* neither, Codex is told 272 000 and the host's bound alone holds a result. */
|
|
55
59
|
contextWindow?: number;
|
|
60
|
+
/** How long Codex waits on a streamed answer that sends nothing. A host sets LOCAL_STREAM_IDLE_MS for a model on its
|
|
61
|
+
* own machine; absent, Codex's own limit (five minutes), so a hung paid stream holds the run's slot and cap no longer. */
|
|
62
|
+
streamIdleMs?: number;
|
|
56
63
|
/** Where sessions keep their private directories when the host lends none (`io.dir`): one per session key. */
|
|
57
64
|
sessionsDir?: string;
|
|
58
65
|
/** The host's skills, which Codex lists to the model by name and description and the model reads with
|
package/dist/adapter.js
CHANGED
|
@@ -42,6 +42,10 @@ export const codexToolName = (name) => (name.startsWith("mcp__") ? `mcp_${name.s
|
|
|
42
42
|
* three quarters of a token a character: not a quarter, which holds for ASCII alone.
|
|
43
43
|
*/
|
|
44
44
|
export const CODEX_TOOL_OUTPUT_TOKENS = Math.ceil((HOST_RESULT_MAX_CHARS * 3) / 4);
|
|
45
|
+
/** How long Codex waits on a silent stream from a model on the host's own machine (an Ollama model the route
|
|
46
|
+
* translates), which says nothing while it loads or reads a long prompt: 30 minutes, as claude-agent's CLI waits
|
|
47
|
+
* (its LOCAL_STREAM_IDLE_MS). Any other route keeps Codex's own five minutes. */
|
|
48
|
+
export const LOCAL_STREAM_IDLE_MS = 30 * 60_000;
|
|
45
49
|
/** The adapter's event for a harness live event, if it has one: a tool's by the host's name for it (`hostName`). */
|
|
46
50
|
function adapterEvent(event, hostName) {
|
|
47
51
|
const e = event;
|
|
@@ -191,6 +195,7 @@ export function codexAdapter(options) {
|
|
|
191
195
|
// The window the host knows (the session's, from its catalog; else this adapter's). Only with neither is Codex told
|
|
192
196
|
// 272,000, a guess at a large OpenAI model's, and then no tool result is held to it: the host's bound alone.
|
|
193
197
|
contextWindow: window ?? 272_000,
|
|
198
|
+
...(options.streamIdleMs !== undefined ? { streamIdleMs: options.streamIdleMs } : {}),
|
|
194
199
|
...budget,
|
|
195
200
|
...(options.log ? { log: options.log } : {}),
|
|
196
201
|
...(options.standIn ? { test: { command: options.standIn.command, args: options.standIn.args ?? [] } } : {}),
|
|
@@ -216,6 +221,8 @@ export function codexAdapter(options) {
|
|
|
216
221
|
...(options.provider.plan ? { plan: true } : {}),
|
|
217
222
|
...(options.provider.refused ? { credentialRefused: options.provider.refused } : {}),
|
|
218
223
|
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
224
|
+
// The proxy waits on a silent model as long as Codex does on one (a model on the host's own machine).
|
|
225
|
+
...(options.streamIdleMs !== undefined ? { stallMs: options.streamIdleMs } : {}),
|
|
219
226
|
},
|
|
220
227
|
}),
|
|
221
228
|
},
|
package/dist/config.d.ts
CHANGED
|
@@ -43,6 +43,9 @@ export interface CodexConfigOptions {
|
|
|
43
43
|
* else), less any name the policy excludes.
|
|
44
44
|
*/
|
|
45
45
|
commandEnv?: Readonly<Record<string, string>>;
|
|
46
|
+
/** How long Codex waits on a streamed answer that sends nothing (`stream_idle_timeout_ms` on its provider). Absent:
|
|
47
|
+
* Codex's own limit, five minutes. A host sets it for a model on its own machine (LOCAL_STREAM_IDLE_MS). */
|
|
48
|
+
streamIdleMs?: number;
|
|
46
49
|
/** Merged over the generated config, last. */
|
|
47
50
|
extra?: Record<string, TomlValue>;
|
|
48
51
|
}
|
package/dist/config.js
CHANGED
|
@@ -96,6 +96,7 @@ export function codexConfig(options) {
|
|
|
96
96
|
env_key: options.envKey,
|
|
97
97
|
wire_api: 'responses',
|
|
98
98
|
supports_websockets: false,
|
|
99
|
+
...(options.streamIdleMs !== undefined ? { stream_idle_timeout_ms: Math.max(1, Math.floor(options.streamIdleMs)) } : {}),
|
|
99
100
|
},
|
|
100
101
|
},
|
|
101
102
|
...(options.cwd ? { projects: { [options.cwd]: { trust_level: 'untrusted' } } } : {}),
|
package/dist/harness.d.ts
CHANGED
|
@@ -117,6 +117,8 @@ export interface CodexHarnessOptions {
|
|
|
117
117
|
name?: string;
|
|
118
118
|
/** The model's context window (Gateway ids are unknown to Codex). Default 272,000. */
|
|
119
119
|
contextWindow?: number;
|
|
120
|
+
/** How long Codex waits on a streamed answer that sends nothing (CodexConfigOptions.streamIdleMs). Default Codex's own. */
|
|
121
|
+
streamIdleMs?: number;
|
|
120
122
|
/** What the session's model can take of one tool result (its context window): the tool bridge holds every result to
|
|
121
123
|
* it (boundResult's budget), and so does each result code mode hands Codex from the log. Absent: the host's bound
|
|
122
124
|
* alone (HOST_RESULT_MAX_CHARS). */
|
package/dist/harness.js
CHANGED
|
@@ -249,6 +249,7 @@ export function codexHarness(options = {}) {
|
|
|
249
249
|
baseUrl: `${machine.modelUrl}/v1`,
|
|
250
250
|
envKey: KEY_ENV,
|
|
251
251
|
contextWindow: options.contextWindow ?? 272_000,
|
|
252
|
+
...(options.streamIdleMs !== undefined ? { streamIdleMs: options.streamIdleMs } : {}),
|
|
252
253
|
cwd,
|
|
253
254
|
...(spec.env ? { commandEnv: spec.env } : {}),
|
|
254
255
|
extra: {
|
package/dist/host/machine.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export interface LocalMachineOptions {
|
|
|
41
41
|
credentialRefused?: ModelProxyOptions["credentialRefused"];
|
|
42
42
|
log?: ModelProxyOptions["log"];
|
|
43
43
|
fetch?: typeof fetch;
|
|
44
|
+
/** How long the provider may send nothing on a request before the proxy stops it (ModelProxyOptions.stallMs). */
|
|
45
|
+
stallMs?: number;
|
|
44
46
|
};
|
|
45
47
|
/** For tests: the process environment the allowlist reads. Default `process.env`. */
|
|
46
48
|
env?: Readonly<Record<string, string | undefined>>;
|
package/dist/host/machine.js
CHANGED
|
@@ -244,9 +244,11 @@ export function localMachine(options) {
|
|
|
244
244
|
...(price ? { price } : {}),
|
|
245
245
|
...(options.proxy.log ? { log: options.proxy.log } : {}),
|
|
246
246
|
...(options.proxy.fetch ? { fetch: options.proxy.fetch } : {}),
|
|
247
|
+
...(options.proxy.stallMs !== undefined ? { stallMs: options.proxy.stallMs } : {}),
|
|
247
248
|
// The provider stopped the turn's answer on its content filter: no retry of it can pass, so the turn ends at once.
|
|
248
249
|
onFiltered: (message) => ctx.halt?.(new Error(message)),
|
|
249
|
-
// The provider's error answer ends the run (a ChatGPT plan's limit reached)
|
|
250
|
+
// The provider's error answer ends the run (a ChatGPT plan's limit reached), or the proxy stopped a request the
|
|
251
|
+
// provider sent nothing on for its stall bound: no retry or other key can pass it.
|
|
250
252
|
onFinal: (message) => ctx.halt?.(new Error(message)),
|
|
251
253
|
// The provider cut the turn's answer at its output limit: Codex would ask for it again (it retries an incomplete
|
|
252
254
|
// stream), so the harness ends the turn there, its answer cut.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CODEX_TOOL_OUTPUT_TOKENS, codexAdapter } from "./adapter.js";
|
|
1
|
+
export { CODEX_TOOL_OUTPUT_TOKENS, codexAdapter, LOCAL_STREAM_IDLE_MS } from "./adapter.js";
|
|
2
2
|
/** The policy a Codex session's model proxy applies, for a host that serves the same route itself (a faux harness's). */
|
|
3
3
|
export { codexPolicy, planLimitOf, webSearchUsd, withWebSearches } from "./host/policy.js";
|
|
4
4
|
/** The check the adapter runs on the host's skills when it is made: @parcha/agentrun-kernel' own, as the Claude adapter's. */
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CODEX_TOOL_OUTPUT_TOKENS, codexAdapter } from "./adapter.js";
|
|
1
|
+
export { CODEX_TOOL_OUTPUT_TOKENS, codexAdapter, LOCAL_STREAM_IDLE_MS } from "./adapter.js";
|
|
2
2
|
/** The policy a Codex session's model proxy applies, for a host that serves the same route itself (a faux harness's). */
|
|
3
3
|
export { codexPolicy, planLimitOf, webSearchUsd, withWebSearches } from "./host/policy.js";
|
|
4
4
|
/** The check the adapter runs on the host's skills when it is made: @parcha/agentrun-kernel' own, as the Claude adapter's. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-harness-codex",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.70",
|
|
4
4
|
"description": "Codex as an AgentRun harness: a tool-less Codex app-server behind a loopback model proxy, durable in AgentRun's own store, with the host's tools as its only tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentrun",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"test": "node --test --test-concurrency=8 'test/*.test.mjs'"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@parcha/agentrun-kernel": "0.1.0-beta.
|
|
47
|
+
"@parcha/agentrun-kernel": "0.1.0-beta.70"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@openai/codex": "0.164.0"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@openai/codex": "0.164.0",
|
|
59
|
-
"@parcha/agentrun-dsl": "0.1.0-beta.
|
|
59
|
+
"@parcha/agentrun-dsl": "0.1.0-beta.70"
|
|
60
60
|
},
|
|
61
61
|
"repository": {
|
|
62
62
|
"type": "git",
|