@parcha/agentrun-harness-codex 0.1.0-beta.125 → 0.1.0-beta.126

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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## 0.1.0-beta.126 (2026-12-03)
6
+
7
+ - A codex session no longer keeps a copy of its history for every turn it took. Each drive left a listener on the session's signal, which lives as long as the session, and the listener held the drive's whole frame: its model proxy with the request it last sent, and the rollout's lines. A run's memory grew with the square of its turns, about 380 MB of heap after 60 short turns, and now grows with its history (100 MB, most of it the test's own store). A codex run now reserves 256 MiB, not 192: Codex's app-server grows with the thread until Codex compacts it, from 37 MB of anon at the first turn to 114 MB with a 2.5 MB request, so a host holds fewer codex runs at once (an 8 GB one 31, not 42). <!-- changes/codex-drive-listeners-run-weight.md -->
8
+
5
9
  ## 0.1.0-beta.110 (2026-12-02)
6
10
 
7
11
  - A run's GenAI trace can now carry its content, opt-in and off by default. With `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true` (or the pinned conventions' `OTEL_INSTRUMENTATION_GENAI_CAPTURE_CONTENT=SPAN_ONLY`, which decides whenever it is set) in the runner's environment, a run's `invoke_agent` span carries its system prompt, the messages its model was given and the model's text (`gen_ai.system_instructions`, `gen_ai.input.messages`, `gen_ai.output.messages`), and each `execute_tool` span the call's arguments and, for a call that succeeded, its result (`gen_ai.tool.call.arguments`, `gen_ai.tool.call.result`). Every string goes through the run's redactor before it is kept, and each attribute is at most 16,384 bytes. On pi, the model's text is each turn's answer as pi keeps it, and a pi-native tool's result is kept as a host tool's is. Codex's host tool ends now carry their result text, as every other adapter's do (its own built-in tools report none). A workflow's run, a backend SDK run and a native job carry no content yet. No run receives the variable; a run in its own process is told by its runner. Off, every span is byte for byte what it was. With it on, the content is stored in the tracing backend, readable by anyone who can read the project's traces there: see "Content capture" in docs/traces.md. <!-- changes/serve-genai-content-capture.md -->
package/dist/facts.js CHANGED
@@ -11,8 +11,9 @@ export const facts = Object.freeze({
11
11
  rerunsStarted: false,
12
12
  // An answer its output limit cut ends the turn: the harness ends it there, before Codex asks for the answer again.
13
13
  recoversCutAnswers: 0,
14
- // One run's memory, measured with the server's (serve's host.ts): Codex's app-server beside the run's process.
15
- runMib: 192,
14
+ // One run's memory, measured with the server's (serve's host.ts): Codex's app-server beside the run's process, which
15
+ // grows with the thread up to where Codex compacts it (serve's harness-table.ts says how it was measured).
16
+ runMib: 256,
16
17
  // OpenAI's reasoning efforts stop at xhigh.
17
18
  thinking: Object.freeze(["low", "medium", "high", "xhigh"]),
18
19
  // Codex's own live search, booked per call.
package/dist/harness.js CHANGED
@@ -213,7 +213,14 @@ export function codexHarness(options = {}) {
213
213
  const resume = thread && isSessionMeta(restored[0]) && isRolloutPath(thread.path, thread.threadId) ? thread : undefined;
214
214
  // Settled before Codex starts (below): a host call the rollout left with no output gets one.
215
215
  let lines = resume ? restored : [];
216
- let rolloutBytes = new TextEncoder().encode(rolloutText(lines));
216
+ // The restored rollout's length in bytes, where the tail starts. Its bytes are made only for the upload (rolloutFile), never
217
+ // kept: the drive's frame lives as long as the drive, and a long run's rollout would be held there a second time.
218
+ let rolloutLength = 0;
219
+ const rolloutFile = () => {
220
+ const bytes = new TextEncoder().encode(rolloutText(lines));
221
+ rolloutLength = bytes.length;
222
+ return bytes;
223
+ };
217
224
  // Codex's key: the attach's model key, which the relay checks (its hash armed the relay; only the attach's processes may use it). Never a credential: the handler adds that.
218
225
  const key = machine.modelKey;
219
226
  // A `never` tool waits for the journal: its call is in the log before its intent (the barrier ran first, below).
@@ -229,6 +236,10 @@ export function codexHarness(options = {}) {
229
236
  let poll;
230
237
  let builtins;
231
238
  const clamps = new Map();
239
+ // What the drive hung on the session's signal, taken off when it ends: that signal outlives every drive, and a listener
240
+ // left on it would keep the drive's whole frame (its model proxy and the request it last sent, the rollout's lines)
241
+ // alive for the rest of the session, one more for each turn.
242
+ const unlisten = [];
232
243
  try {
233
244
  if (resume) {
234
245
  // Validate before the bridge can approve or dispatch another effect. Earlier versions could retain a synthetic
@@ -245,7 +256,6 @@ export function codexHarness(options = {}) {
245
256
  await journal.flush();
246
257
  lines = settled;
247
258
  });
248
- rolloutBytes = new TextEncoder().encode(rolloutText(lines));
249
259
  }
250
260
  // The log wins: the VM's cache dirs are wiped, and CODEX_HOME rebuilt from the log.
251
261
  await machine.files.wipe();
@@ -270,7 +280,7 @@ export function codexHarness(options = {}) {
270
280
  machine.configure?.(config);
271
281
  await machine.files.upload('codex-home', [
272
282
  { path: 'config.toml', bytes: new TextEncoder().encode(toToml(config)) },
273
- ...(resume ? [{ path: resume.path, bytes: rolloutBytes }] : []),
283
+ ...(resume ? [{ path: resume.path, bytes: rolloutFile() }] : []),
274
284
  ]);
275
285
  proc = await machine.spawn({
276
286
  command: codex.command,
@@ -308,8 +318,10 @@ export function codexHarness(options = {}) {
308
318
  const fail = () => reject(ctx.signal.reason ?? new Error('agentrun-harness-codex: the drive stopped'));
309
319
  if (ctx.signal.aborted)
310
320
  fail();
311
- else
321
+ else {
312
322
  ctx.signal.addEventListener('abort', fail, { once: true });
323
+ unlisten.push(() => ctx.signal.removeEventListener('abort', fail));
324
+ }
313
325
  });
314
326
  const lost = new Promise((_, reject) => {
315
327
  const fail = () => reject(new Error("agentrun-harness-codex: the link to the session's sandbox was lost"));
@@ -721,7 +733,7 @@ export function codexHarness(options = {}) {
721
733
  if (resume) {
722
734
  await guard(rpc.request('thread/resume', { threadId: resume.threadId, ...threadParams, excludeTurns: true }));
723
735
  threadId = resume.threadId;
724
- tail = await machine.tail('codex-home', resume.path, { offset: rolloutBytes.length });
736
+ tail = await machine.tail('codex-home', resume.path, { offset: rolloutLength });
725
737
  }
726
738
  else {
727
739
  const started = await guard(rpc.request('thread/start', {
@@ -945,6 +957,8 @@ export function codexHarness(options = {}) {
945
957
  }
946
958
  }
947
959
  finally {
960
+ for (const off of unlisten)
961
+ off();
948
962
  if (poll)
949
963
  clearInterval(poll);
950
964
  for (const t of clamps.values())
@@ -126,10 +126,15 @@ function start(options, from, cwd, ceiling, confine, watch, admit) {
126
126
  }
127
127
  };
128
128
  if (options.signal) {
129
- if (options.signal.aborted)
129
+ const signal = options.signal;
130
+ const onAbort = () => kill("SIGKILL");
131
+ if (signal.aborted)
130
132
  kill("SIGKILL");
131
- else
132
- options.signal.addEventListener("abort", () => kill("SIGKILL"), { once: true });
133
+ else {
134
+ signal.addEventListener("abort", onAbort, { once: true });
135
+ // Off once the child is gone: the signal can outlive it (a session's), and the listener holds the child's frame.
136
+ void exited.then(() => signal.removeEventListener("abort", onAbort));
137
+ }
133
138
  }
134
139
  const reader = createInterface({ input: child.stdout, crlfDelay: Infinity });
135
140
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-harness-codex",
3
- "version": "0.1.0-beta.125",
3
+ "version": "0.1.0-beta.126",
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.125"
47
+ "@parcha/agentrun-kernel": "0.1.0-beta.126"
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.125"
59
+ "@parcha/agentrun-dsl": "0.1.0-beta.126"
60
60
  },
61
61
  "repository": {
62
62
  "type": "git",