Repository navigation
Conversation
The isolated sessions adapter calls fetch directly for every endpoint except the streaming run, and on an error response it threw a plain Error with the status and body folded into the message. Callers could not read the status code, request id or execd error code, unlike every other adapter in the SDK, including the isolated filesystem adapter of the same session and the streaming run. Report these failures through throwOnOpenApiFetchError, as the generated-client adapters do, so they carry statusCode, requestId, rawBody and the error code and message from the body. An error without a body falls back to "<METHOD> <path> failed (status=N)".
acodercat
requested review from
Pangjiping,
hittyt,
jwx0925 and
ninan-nn
as code owners
October 29, 2026 02:01
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…ApiFetchError Turning a failed response into a SandboxApiException is not specific to the isolated sessions adapter. Keep it in openapiError.ts, beside the function it builds on, as throwOnFailedResponse, so any adapter that calls fetch directly can use it; the adapter only decides when a response failed and what the fallback message says.
ninan-nn
approved these changes
Oct 29, 2026
ninan-nn
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. This reuses the existing SDK error conversion and aligns isolated-session HTTP failures with the structured SandboxApiException behavior used elsewhere. The regression cases cover structured errors, plain-text and empty bodies, and unexpected non-202 success responses for background runs. Static review only; tests were not run locally.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IsolatedSessionsAdaptercallsfetchdirectly for every isolated session endpoint except the streaming run: create, attach, get, delete, list, capabilities, background run, run status and run logs. When one of these returned an error, the adapter threw a plainErrorwith the status and body folded into the message, for exampleGET /v1/isolated/session/x failed: 404 {"code":"SESSION_NOT_FOUND",...}.Callers had no way to read the status code, the request id or the execd error code without parsing that string. Everything else in the SDK throws
SandboxApiExceptionwith these fields, including the isolated filesystem adapter of the same session and the streamingrun(throughparseJsonEventStream), and so do the other language SDKs for the same endpoints.Summary
throwOnFailedResponsetoopenapiError.ts, next tothrowOnOpenApiFetchError, the function the generated-client adapters use. It reads the body of a failedfetchresponse and hands it to that function. The error now carriesstatusCode,requestId,rawBody, and thecodeandmessagefrom execd's JSON error body. Any other adapter that callsfetchdirectly can use it too.jsonRequest,_runBackgroundand_getRunLogs, the three places that threw a plainError.<METHOD> <path> failed (status=N)and the codeUNEXPECTED_RESPONSE._runBackgroundstill rejects any status other than 202.Testing
Not run (explain why)
Unit tests
Integration tests
e2e / manual verification
The four existing error tests (attach, background run, run status, run logs) now check for
SandboxApiExceptionwith the status code, request id, error code and message. Two new tests cover an error response without a body and a 2xx response other than 202 from the background run. All six fail on the current code, which throws a plainError.Mutation checks: reverting
_getRunLogsto a plainError, or making the helper's final throw a plainError, each fails the matching test.pnpm test(400 passed),pnpm run lintandpnpm run typecheckare clean.Breaking Changes
The thrown error is still an
Error(SandboxApiExceptionextends it). Its message is now execd's error message when the body has one, instead of the method, path, status and raw body. Code that pattern-matched the old message text would need to readstatusCodeorerror.codeinstead.Checklist