Skip to content

Commit e227c0e

Browse files
fix: update codex to 0.164.0 (spacering-net#666)
[What's new](https://github.com/openai/codex/releases/tag/rust-v0.164.0) Updated runtime handling and typed fixtures for Codex 0.164.0, including extensible errors, new thread notifications, and file-backed images. Fixed the history snapshot failure caused by the new `rootTurnId` field. Three recovery tests still fail because child-process stdout is lost in this environment: final-notification delivery, burst delivery, and backlog draining. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 45907ae commit e227c0e

91 files changed

Lines changed: 507 additions & 121 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎package-lock.json‎

Lines changed: 28 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
},
7070
"dependencies": {
7171
"@agentclientprotocol/sdk": "~2.0.0",
72-
"@openai/codex": "^0.160.1",
72+
"@openai/codex": "^0.164.0",
7373
"cross-spawn": "^7.0.6",
7474
"diff": "^9.0.0",
7575
"open": "^11.0.1",

‎src/CodexAppServerClient.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ export class CodexAppServerClient {
359359
threadId: error.threadId,
360360
turn: {
361361
id: error.turnId,
362+
rootTurnId: null,
362363
items: [],
363364
itemsView: "notLoaded",
364365
status: "failed",
@@ -944,6 +945,7 @@ export class CodexAppServerClient {
944945
threadId,
945946
turn: {
946947
id: turnId,
948+
rootTurnId: null,
947949
items: [],
948950
itemsView: "notLoaded",
949951
status: "interrupted",

‎src/CodexEventHandler.ts‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,9 @@ type KeysOfUnion<T> = T extends unknown ? keyof T : never;
152152
type StructuredCodexErrorKind = KeysOfUnion<StructuredCodexErrorInfo>;
153153

154154
/**
155-
* Exhaustive against the generated app-server union: a schema update cannot silently fall through
156-
* to provider_error. The runtime lookup still has a fallback for a newer app-server talking to an
157-
* older codex-acp build.
155+
* Known error codes map to ACP categories; extensible upstream codes fall back to provider_error.
158156
*/
159-
const STRING_CODEX_ERROR_CATEGORIES = {
157+
const STRING_CODEX_ERROR_CATEGORIES: Partial<Record<StringCodexErrorInfo, CodexFailureKind>> = {
160158
contextWindowExceeded: "context_exhausted",
161159
sessionBudgetExceeded: "budget_exhausted",
162160
usageLimitExceeded: "quota_exhausted",
@@ -174,7 +172,7 @@ const STRING_CODEX_ERROR_CATEGORIES = {
174172
other: "provider_error",
175173
} satisfies Record<StringCodexErrorInfo, CodexFailureKind>;
176174

177-
const STRUCTURED_CODEX_ERROR_CATEGORIES = {
175+
const STRUCTURED_CODEX_ERROR_CATEGORIES: Partial<Record<StructuredCodexErrorKind, CodexFailureKind>> = {
178176
httpConnectionFailed: "transport_lost",
179177
responseStreamConnectionFailed: "transport_lost",
180178
responseStreamDisconnected: "transport_lost",
@@ -726,6 +724,9 @@ export class CodexEventHandler {
726724
// The server lists the skills again and publishes the commands. The change itself is no update.
727725
return null;
728726
// ignored events
727+
// Read markers and predictions have no ACP session update counterpart.
728+
case "thread/readState/changed":
729+
case "thread/prediction/updated":
729730
case "thread/deleted":
730731
case "thread/reverted":
731732
case "thread/queue/changed":
@@ -1221,7 +1222,9 @@ export class CodexEventHandler {
12211222
if (this.isAuthenticationRequiredError(error)) return "auth_required";
12221223
if (this.getHttpStatusCode(error) === 429) return "rate_limited";
12231224
if (typeof error === "string") {
1224-
return STRING_CODEX_ERROR_CATEGORIES[error] ?? "provider_error";
1225+
return Object.hasOwn(STRING_CODEX_ERROR_CATEGORIES, error)
1226+
? STRING_CODEX_ERROR_CATEGORIES[error] ?? "provider_error"
1227+
: "provider_error";
12251228
}
12261229
if (error !== null) {
12271230
for (const kind of Object.keys(STRUCTURED_CODEX_ERROR_CATEGORIES) as StructuredCodexErrorKind[]) {

‎src/__tests__/CodexACPAgent/CodexAcpClient.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
14711471
return {
14721472
id,
14731473
items: [],
1474+
rootTurnId: null,
14741475
itemsView: "notLoaded" as const,
14751476
status,
14761477
error: null,
@@ -1858,6 +1859,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
18581859
turn: {
18591860
id: "turn-id",
18601861
items: [],
1862+
rootTurnId: null,
18611863
itemsView: "notLoaded",
18621864
status: "completed",
18631865
error: null,
@@ -3991,6 +3993,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
39913993
serverInfo: null,
39923994
serverCapabilities: null,
39933995
toolsError: null,
3996+
toolListMeta: null,
39943997
tools: {listFiles: {name: "listFiles", inputSchema: {type: "object"}}},
39953998
resources: [{name: "workspace", uri: "file:///workspace"}],
39963999
resourceTemplates: [],
@@ -4004,6 +4007,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
40044007
serverInfo: null,
40054008
serverCapabilities: null,
40064009
toolsError: null,
4010+
toolListMeta: null,
40074011
tools: {},
40084012
resources: [],
40094013
resourceTemplates: [],
@@ -4125,6 +4129,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
41254129
turn: {
41264130
id: "turn-id",
41274131
items: [],
4132+
rootTurnId: null,
41284133
itemsView: "notLoaded",
41294134
status: "inProgress",
41304135
error: null,
@@ -4138,6 +4143,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
41384143
turn: {
41394144
id: "turn-id",
41404145
items: [],
4146+
rootTurnId: null,
41414147
itemsView: "notLoaded",
41424148
status: "completed",
41434149
error: null,
@@ -4159,6 +4165,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
41594165
turn: {
41604166
id: turnId,
41614167
items: [],
4168+
rootTurnId: null,
41624169
itemsView: "notLoaded",
41634170
status: "inProgress",
41644171
error: null,
@@ -4175,6 +4182,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
41754182
turn: {
41764183
id: "review-turn-id",
41774184
items: [],
4185+
rootTurnId: null,
41784186
itemsView: "notLoaded",
41794187
status,
41804188
error: null,

‎src/__tests__/CodexACPAgent/agent-file-change-report.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function createTurn(id: string, status: Turn["status"]): Turn {
2020
return {
2121
id,
2222
items: [],
23+
rootTurnId: null,
2324
itemsView: "notLoaded",
2425
status,
2526
error: null,
@@ -105,6 +106,8 @@ function spawnChild(rootSessionId: string): ServerNotification[] {
105106
startedAtMs: 0,
106107
item: {
107108
type: "subAgentActivity",
109+
model: null,
110+
reasoningEffort: null,
108111
id: "activity-child",
109112
kind: "started",
110113
agentThreadId: CHILD_THREAD_ID,

‎src/__tests__/CodexACPAgent/agent-initiated-turns-v2.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ describe('agent-initiated Codex turns over ACP v2', () => {
156156
client.emit(turnStarted("turn-2"));
157157
await settle();
158158
client.emit({method: "turn/completed", params: {threadId: sessionId, turn: {
159-
id: "turn-2", items: [], itemsView: "notLoaded", status: "interrupted",
159+
id: "turn-2", rootTurnId: null, items: [], itemsView: "notLoaded", status: "interrupted",
160160
error: null, startedAt: null, completedAt: null, durationMs: null,
161161
}}});
162162
await settle();

0 commit comments

Comments
 (0)