Skip to content

Commit 20fe3f4

Browse files
authored
fix: paired Mac Codex sessions finish loading (#104299)
* fix(codex): allow cold Mac session catalogs * chore: keep release notes in PR body
1 parent 5f709cf commit 20fe3f4

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

apps/macos/Sources/OpenClaw/NodeMode/MacNodeCodexThreadCatalog.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ enum MacNodeCodexThreadCatalog {
131131
static let defaultUserMacOSBetaAppExecutable = FileManager.default.homeDirectoryForCurrentUser
132132
.appendingPathComponent("Applications/Codex Beta.app/Contents/Resources/codex")
133133
.path
134+
static let defaultTimeoutSeconds: Double = 24
134135
private static let maxSessionIdLength = 256
135136
private static let maxSessionNameLength = 500
136137
private static let maxCwdLength = 4096
@@ -208,7 +209,7 @@ enum MacNodeCodexThreadCatalog {
208209
arguments: [String]? = nil,
209210
cwd: URL? = nil,
210211
clearEnv: [String] = [],
211-
timeoutSeconds: Double = 12,
212+
timeoutSeconds: Double = MacNodeCodexThreadCatalog.defaultTimeoutSeconds,
212213
maxLineBytes: Int = 5 * 1024 * 1024) async throws -> String
213214
{
214215
let params = try self.decodeParams(paramsJSON)
@@ -226,7 +227,7 @@ enum MacNodeCodexThreadCatalog {
226227
private static func list(
227228
params: ListParams,
228229
invocation: ResolvedInvocation,
229-
timeoutSeconds: Double = 12,
230+
timeoutSeconds: Double = MacNodeCodexThreadCatalog.defaultTimeoutSeconds,
230231
maxLineBytes: Int = 5 * 1024 * 1024) async throws -> String
231232
{
232233
guard params.searchTerm != nil else {

apps/macos/Tests/OpenClawIPCTests/MacNodeCodexThreadCatalogTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,10 @@ struct MacNodeCodexThreadCatalogTests {
940940
#expect((decoded["sessions"] as? [Any])?.count == 50)
941941
}
942942

943+
@Test func `default deadline allows cold large catalog scans`() {
944+
#expect(MacNodeCodexThreadCatalog.defaultTimeoutSeconds == 24)
945+
}
946+
943947
@Test func `rejects unknown and out of range params before launch`() async {
944948
let cases = [
945949
(#"{"extra":true}"#, "unknown Codex session catalog parameter: extra"),

extensions/codex/src/session-catalog.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ describe("Codex supervision catalog", () => {
752752
nodeId: "devbox",
753753
command: CODEX_APP_SERVER_THREADS_LIST_COMMAND,
754754
params: expect.not.objectContaining({ archived: expect.anything() }),
755+
timeoutMs: 28_000,
755756
}),
756757
);
757758
expect(JSON.stringify(result)).not.toContain("private");

extensions/codex/src/session-catalog.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ export const CODEX_SESSION_ARCHIVE_METHOD = "codex.sessions.archive";
7474
const CODEX_APP_SERVER_THREADS_CAPABILITY = "codex-app-server-threads";
7575
const DEFAULT_PAGE_LIMIT = 50;
7676
export const CODEX_SESSION_CATALOG_MAX_PAGE_LIMIT = 100;
77-
const NODE_INVOKE_TIMEOUT_MS = 20_000;
77+
// A node may need a cold Codex state scan before returning a large catalog page.
78+
// Keep this above the Mac node's native 24-second deadline so its result wins,
79+
// while remaining below the shared CLI client's 30-second outer deadline.
80+
const NODE_INVOKE_TIMEOUT_MS = 28_000;
7881
const MAX_SEARCH_LENGTH = 500;
7982
const MAX_CURSOR_LENGTH = 4096;
8083
const MAX_CURSOR_COUNT = 100;

0 commit comments

Comments
 (0)