File tree Expand file tree Collapse file tree
Sources/OpenClaw/NodeMode Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,6 +158,8 @@ final class CodexAppServerThreadClient: @unchecked Sendable {
158158 requestParamsData : requestParamsData ,
159159 maxLineBytes : max ( 1 , maxLineBytes ) ,
160160 continuation : continuation )
161+ // Callers pass the operation's remaining wall-clock deadline.
162+ // Queue wait therefore counts, matching the former one-shot session.
161163 request . timer = self . makeRequestTimer (
162164 token : token ,
163165 timeoutSeconds : timeoutSeconds )
Original file line number Diff line number Diff line change @@ -1268,6 +1268,44 @@ extension MacNodeCodexThreadCatalogTests {
12681268 await client . shutdown ( )
12691269 }
12701270
1271+ @ Test func `queued request consumes its wall-clock deadline` ( ) async throws {
1272+ let fake = try makeFakeCodex ( #"""
1273+ #!/bin/sh
1274+ IFS= read -r initialize || exit 2
1275+ id=$(printf '%s\n' "$initialize" | /usr/bin/sed -E 's/.*"id":([0-9]+).*/\1/')
1276+ printf '{"id":%s,"result":{}}\n' "$id"
1277+ IFS= read -r initialized || exit 3
1278+ IFS= read -r request || exit 4
1279+ touch "${0}.request-started"
1280+ sleep 5
1281+ """# )
1282+ defer { try? FileManager . default . removeItem ( at : fake . directory ) }
1283+ let client = CodexAppServerThreadClient ( idleTimeoutSeconds : 10 )
1284+
1285+ let first = Task {
1286+ try await self . requestEmptyList (
1287+ client : client ,
1288+ executable : fake . executable ,
1289+ timeoutSeconds : 0.5 )
1290+ }
1291+ #expect ( await self . waitForFile (
1292+ URL ( fileURLWithPath : fake . executable . path + " .request-started " ) ) )
1293+ let second = Task {
1294+ try await self . requestEmptyList (
1295+ client : client ,
1296+ executable : fake . executable ,
1297+ timeoutSeconds : 0.05 )
1298+ }
1299+
1300+ await #expect ( throws : MacNodeCodexThreadCatalog . CatalogError . timedOut ) {
1301+ try await second . value
1302+ }
1303+ await #expect ( throws : MacNodeCodexThreadCatalog . CatalogError . timedOut ) {
1304+ try await first . value
1305+ }
1306+ await client . shutdown ( )
1307+ }
1308+
12711309 @ Test func `cancellation restarts the client without dropping the next request` ( ) async throws {
12721310 let fake = try makeFakeCodex ( #"""
12731311 #!/bin/sh
You can’t perform that action at this time.
0 commit comments