Skip to content

Commit a3d1086

Browse files
committed
fix(codex): support paginated message forks with Codex 0.151.0
1 parent ecb0386 commit a3d1086

17 files changed

Lines changed: 108 additions & 113 deletions

‎docs/plugins/codex-computer-use.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ reconciliation so OpenClaw does not override that selection.
277277
## Remote marketplaces
278278

279279
Remote marketplace support was introduced in Codex 0.146.1 and remains
280-
available in OpenClaw's pinned Codex 0.150.1. OpenClaw passes the opaque remote
280+
available in OpenClaw's pinned Codex 0.151.0. OpenClaw passes the opaque remote
281281
plugin ID returned by Codex to `plugin/read` and `plugin/install`; a
282282
human-readable plugin name is not a valid substitute.
283283

‎docs/plugins/codex-harness-reference.md‎

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ flags, and plugin allow/deny references into this block. Explicit canonical
177177
## App-server transport
178178

179179
For ordinary harness turns, OpenClaw starts the managed Codex binary shipped
180-
with the official plugin (currently `@openai/codex` `0.150.1`):
180+
with the official plugin (currently `@openai/codex` `0.151.0`):
181181

182182
```bash
183183
codex app-server --listen stdio://
@@ -322,7 +322,7 @@ If the normal app-server runtime would be `danger-full-access`, enabling
322322
permission profile instead. Codex-managed network enforcement is sandboxed
323323
networking, so a full-access profile would not protect outbound traffic.
324324

325-
The plugin manages stable Codex app-server `0.150.1`. Explicit custom
325+
The plugin manages stable Codex app-server `0.151.0`. Explicit custom
326326
executables, remote app-servers, and macOS desktop binaries must report a
327327
parseable semantic version of `0.149.0` or newer. Older, malformed, and
328328
unversioned handshakes are rejected. Newer versions log a compatibility warning
@@ -451,7 +451,7 @@ The stable default is fail-closed: active OpenClaw sandboxing disables native
451451
Codex execution surfaces that would otherwise run from the Codex app-server
452452
host. Use `appServer.experimental.sandboxExecServer: true` only when you want
453453
to try Codex's remote environment support with OpenClaw's sandbox backend.
454-
This preview path uses the pinned Codex `0.150.1` app-server.
454+
This preview path uses the pinned Codex `0.151.0` app-server.
455455

456456
```json5
457457
{
@@ -848,21 +848,18 @@ response remains authoritative even if it contains no visible models; HTTP
848848
`401` and `403` return an empty catalog rather than exposing fallback models.
849849

850850
<Note>
851-
The current bundled harness is `@openai/codex` `0.150.1`. A live `model/list`
852-
probe against the official `0.150.1` app-server returned these public picker
853-
rows:
854-
855-
| Model id | Input modalities | Reasoning efforts |
856-
| --------------- | ---------------- | ------------------------------- |
857-
| `gpt-5.5` | text, image | low, medium, high, xhigh |
858-
| `gpt-5.6` | text, image | low, medium, high, xhigh, ultra |
859-
| `gpt-5.6-luna` | text, image | low, medium, high, xhigh, ultra |
860-
| `gpt-5.6-terra` | text, image | low, medium, high, xhigh, ultra |
861-
| `gpt-5.6-sol` | text, image | low, medium, high, xhigh, ultra |
862-
| `gpt-5.4` | text, image | low, medium, high, xhigh |
863-
| `gpt-5.4-mini` | text, image | low, medium, high, xhigh |
864-
| `gpt-5.3-codex` | text, image | low, medium, high, xhigh |
865-
| `gpt-5.2` | text, image | low, medium, high, xhigh |
851+
The current bundled harness is `@openai/codex` `0.151.0`. A live `model/list`
852+
probe against the official `0.151.0` app-server verified this public subset of
853+
picker rows:
854+
855+
| Model id | Input modalities | Reasoning efforts |
856+
| --------------- | ---------------- | ------------------------------------ |
857+
| `gpt-5.4` | text, image | low, medium, high, xhigh |
858+
| `gpt-5.4-mini` | text, image | low, medium, high, xhigh |
859+
| `gpt-5.5` | text, image | low, medium, high, xhigh |
860+
| `gpt-5.6-luna` | text, image | low, medium, high, xhigh, max |
861+
| `gpt-5.6-sol` | text, image | low, medium, high, xhigh, max, ultra |
862+
| `gpt-5.6-terra` | text, image | low, medium, high, xhigh, max, ultra |
866863

867864
Available model IDs, input modalities, and reasoning efforts remain
868865
account-scoped. Run `/codex models` after starting or upgrading the gateway to

‎docs/plugins/codex-harness.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ channel is the communication surface.
9999

100100
- The official `@openclaw/codex` plugin installed. Include `codex` in
101101
`plugins.allow` if your config uses an allowlist.
102-
- Managed Codex app-server `0.150.1`. The plugin ships and manages
103-
`@openai/codex` `0.150.1` by default, so a `codex` command on `PATH` does not
102+
- Managed Codex app-server `0.151.0`. The plugin ships and manages
103+
`@openai/codex` `0.151.0` by default, so a `codex` command on `PATH` does not
104104
affect normal startup. Explicit custom, remote, and macOS desktop-owned
105105
app-servers must report a parseable semantic version of `0.149.0` or newer.
106106
Newer versions continue with a compatibility warning and normal runtime

‎docs/plugins/codex-native-plugins.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ working.
2323
- `plugins.entries.codex.enabled` is `true`.
2424
- `plugins.entries.codex.config.codexPlugins.enabled` is `true`.
2525
- Codex app-server reports `0.149.0` or newer. The official plugin ships
26-
`@openai/codex` `0.150.1`; newer custom, remote, and macOS desktop-owned
26+
`@openai/codex` `0.151.0`; newer custom, remote, and macOS desktop-owned
2727
binaries continue with a compatibility warning and normal runtime validation.
2828
- The target Codex app-server can see the expected marketplace, plugin, and
2929
app inventory.

‎docs/start/setup.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ openclaw health
149149
### Common footguns
150150

151151
- **Wrong port:** Gateway WS defaults to `ws://127.0.0.1:18789`; keep app + CLI on the same port.
152+
- **Wrong developer CLI:** When `PATH` includes `node_modules/.bin`, `codex` can
153+
resolve to the workspace-pinned CLI instead of your standalone installation.
154+
For developer workers, use the intended executable's absolute path for both
155+
`--version` and `exec`, and confirm the worker's startup version. A package
156+
manifest or a version check in another shell does not identify a running worker.
157+
OpenClaw's [managed Codex app-server](/plugins/codex-harness-reference#app-server-transport)
158+
has a separate pinned-version contract; do not change that pin or your model/auth
159+
settings to fix developer CLI selection. If the installed workspace package and
160+
native executable disagree with the lockfile, repair the install with `pnpm install`
161+
rather than editing `node_modules`.
152162
- **Where state lives:**
153163
- Channel/provider state: `~/.openclaw/credentials/`
154164
- Model auth profiles: SQLite auth stores (shared: `~/.openclaw/state/openclaw.sqlite`; agent-local: `~/.openclaw/agents/<agentId>/agent/openclaw-agent.sqlite`)

‎extensions/codex/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"type": "module",
1010
"dependencies": {
11-
"@openai/codex": "0.150.1",
11+
"@openai/codex": "0.151.0",
1212
"semver": "7.8.5",
1313
"smol-toml": "1.8.0",
1414
"typebox": "1.3.16",

‎extensions/codex/src/app-server/client.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@ describe("CodexAppServerClient", () => {
500500

501501
it.each([
502502
["0.149.0", 0],
503-
["0.151.0-alpha.4", 1],
504-
["0.151.0", 1],
503+
["0.152.0-alpha.4", 1],
504+
["0.152.0", 1],
505505
["1.0.0", 1],
506506
])("accepts app-server version %s for normal startup validation", async (version, warnings) => {
507507
const warn = vi.spyOn(embeddedAgentLog, "warn").mockImplementation(() => undefined);

‎extensions/codex/src/app-server/protocol-generated/json/v2/CodexAppServerProtocolDefinitions.json‎

Lines changed: 7 additions & 3 deletions
Large diffs are not rendered by default.

‎extensions/codex/src/app-server/upstream-fork-boundary.test.ts‎

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ async function resolveFromTurns(params: {
3636
userMessageOrdinal: number;
3737
localPrefixTexts: readonly (string | undefined)[];
3838
localIdentities?: readonly (string | undefined)[];
39+
historyMode?: "legacy" | "paginated";
3940
}) {
4041
const identities =
4142
params.localIdentities ??
@@ -62,13 +63,19 @@ async function resolveFromTurns(params: {
6263
)
6364
: { role: "user", content: text ?? "", timestamp: index },
6465
}));
65-
return await resolveEntries(params.turns, entries, `entry-${params.userMessageOrdinal}`);
66+
return await resolveEntries(
67+
params.turns,
68+
entries,
69+
`entry-${params.userMessageOrdinal}`,
70+
params.historyMode,
71+
);
6672
}
6773

6874
async function resolveEntries(
6975
turns: readonly CodexTurn[],
7076
entries: SessionTranscriptMessageEntry[],
7177
entryId: string,
78+
historyMode: "legacy" | "paginated" = "legacy",
7279
) {
7380
transcriptMocks.readVisibleEntries.mockResolvedValue(entries);
7481
const result = await resolveCodexUpstreamForkBoundary({
@@ -79,30 +86,34 @@ async function resolveEntries(
7986
entryId,
8087
threadId: "thread-1",
8188
control: {
82-
readThread: vi.fn(async () => ({ id: "thread-1" })),
89+
readThread: vi.fn(async () => ({ id: "thread-1", historyMode })),
8390
listTurnPage: vi.fn(async () => ({ data: [...turns] })),
8491
} as unknown as Parameters<typeof resolveCodexUpstreamForkBoundary>[0]["control"],
8592
});
8693
return result.ok ? { ok: true as const, boundary: result.boundary } : result;
8794
}
8895

8996
describe("resolveCodexUpstreamForkBoundaryFromTurns", () => {
90-
it("maps the recorded user identity to the upstream turn", async () => {
91-
const result = await resolveFromTurns({
92-
turns: [turn("turn-1", [user("one")]), turn("turn-2", [user("two")])],
93-
userMessageOrdinal: 1,
94-
localPrefixTexts: ["one", "two"],
95-
});
97+
it.each(["legacy", "paginated"] as const)(
98+
"maps the recorded user identity to the upstream turn with %s history",
99+
async (historyMode) => {
100+
const result = await resolveFromTurns({
101+
turns: [turn("turn-1", [user("one")]), turn("turn-2", [user("two")])],
102+
userMessageOrdinal: 1,
103+
localPrefixTexts: ["one", "two"],
104+
historyMode,
105+
});
96106

97-
expect(result).toEqual({
98-
ok: true,
99-
boundary: {
100-
beforeTurnId: "turn-2",
101-
targetTurnId: "turn-2",
102-
retainedMarker: { turnId: "turn-1", userMessageCount: 1 },
103-
},
104-
});
105-
});
107+
expect(result).toEqual({
108+
ok: true,
109+
boundary: {
110+
beforeTurnId: "turn-2",
111+
targetTurnId: "turn-2",
112+
retainedMarker: { turnId: "turn-1", userMessageCount: 1 },
113+
},
114+
});
115+
},
116+
);
106117

107118
it("cuts before the first turn with an empty retained baseline", async () => {
108119
const result = await resolveFromTurns({
@@ -282,23 +293,3 @@ describe("resolveCodexUpstreamForkBoundaryFromTurns", () => {
282293
expect(result).toMatchObject({ ok: false, code: "drift-mismatch" });
283294
});
284295
});
285-
286-
describe("resolveCodexUpstreamForkBoundary", () => {
287-
it("rejects paginated-history threads before reading turns", async () => {
288-
const readThread = vi.fn(async () => ({ id: "thread-1", historyMode: "paginated" }));
289-
const result = await resolveCodexUpstreamForkBoundary({
290-
agentId: "main",
291-
sessionId: "session-1",
292-
sessionKey: "agent:main:upstream",
293-
storePath: "/tmp/does-not-matter",
294-
entryId: "entry-1",
295-
threadId: "thread-1",
296-
control: { readThread } as unknown as Parameters<
297-
typeof resolveCodexUpstreamForkBoundary
298-
>[0]["control"],
299-
});
300-
301-
expect(result).toMatchObject({ ok: false, code: "upstream-unavailable" });
302-
expect(readThread).toHaveBeenCalledWith("thread-1", false);
303-
});
304-
});

‎extensions/codex/src/app-server/upstream-fork-boundary.ts‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ export async function listCodexUpstreamTurns(
181181
const seenCursors = new Set<string>();
182182
let cursor: string | undefined;
183183
for (;;) {
184+
// Codex hydrates full turn items for both history modes; boundary validation
185+
// needs their recorded message identities, not the native storage layout.
184186
const page = await control.listTurnPage({
185187
threadId,
186188
limit: TURN_PAGE_LIMIT,
@@ -211,15 +213,6 @@ export async function resolveCodexUpstreamForkBoundary(params: {
211213
control: CodexSessionCatalogControl;
212214
}): Promise<CodexUpstreamForkBoundaryResult> {
213215
try {
214-
// Paginated-history threads reject itemsView "full" turn reads (thread/items/list
215-
// is required); fork support for them is future work — fail closed with intent.
216-
const thread = await params.control.readThread(params.threadId, false);
217-
if (thread.historyMode === "paginated") {
218-
return failure(
219-
"upstream-unavailable",
220-
"This Codex thread uses paginated history, which cannot be forked from OpenClaw yet.",
221-
);
222-
}
223216
const entries = await readVisibleSessionTranscriptMessageEntries({
224217
agentId: params.agentId,
225218
sessionId: params.sessionId,

0 commit comments

Comments
 (0)