Repository navigation
Conversation
❌ 2 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
tholop
force-pushed
the
feat/sdk-typed-helpers
branch
from
October 8, 2026 13:07
c1ff8c7 to
cb10270
Compare
tholop
force-pushed
the
feat/sdk-vm-labels
branch
from
October 8, 2026 13:07
bc9bdb5 to
2514565
Compare
…nd discovery
Add structured error codes (`ErrorCode::VmNotFound`, `ErrorCode::CreateTimeout`,
`ErrorCode::ExecTimeout`) to `ErrorResponse` in `capsem-api` and `capsem-service`,
returning HTTP 504 (`StatusCode::GATEWAY_TIMEOUT`) with `timeout_secs` on guest
command execution timeouts. Migrate `AppError` from a tuple struct to a named-field
struct with `AppError::new(status, error)` across `capsem-service` route handlers and
typed constructors (`AppError::vm_not_found`, `AppError::exec_timeout`,
`AppError::create_timeout`, and `AppError::with_code`).
In `sdk/python`:
- Parse `ErrorResponse` once in `HttpError.__init__` (`response` and `code`) and
dispatch `VmNotFoundError`, `CreateTimeoutError`, and `ExecTimeoutError`
(subclassing `CapsemTimeoutError(TimeoutError, CapsemError)`) from `_ERROR_DISPATCH`
keyed by `models.ErrorCode`, with pickle round-trip support (`HttpError.__reduce__` /
`__setstate__` and `Transport.__getstate__` dropping `_session`).
- Add host gateway URL and bearer token discovery (`discover_gateway`,
`capsem_run_dir`, `Hypervisor.connect`). Note: `capsem_run_dir` is the one
client-side path helper retained as an exception to relying on the server for
path rules because `discover_gateway` resolves `~/.capsem/run/gateway.{port,token}`
on the host before any gateway connection exists; guest file path sanitization
is delegated entirely to the gateway (`POST/GET /vms/{id}/files/*`).
tholop
force-pushed
the
feat/sdk-typed-helpers
branch
from
October 9, 2026 15:49
cb10270 to
1c64f61
Compare
tholop
force-pushed
the
feat/sdk-vm-labels
branch
from
October 9, 2026 15:49
2514565 to
3e94546
Compare
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.
Summary
Lets SDK callers handle timeouts and missing VMs by exception type instead of matching error text, and find the local gateway without copying discovery code. The Inspect AI integration (#338) uses both. Stacked on #336.
Changes
capsem-api,capsem-service, OpenAPI):ErrorCode(vm_not_found,create_timeout,exec_timeout) toErrorResponse(openapi.jsonand generated SDK models) and returns HTTP504(StatusCode::GATEWAY_TIMEOUT) withtimeout_secson guest command execution timeouts (AppError::exec_timeout).AppErrorincrates/capsem-service/src/errors.rsfrom a tuple structAppError(StatusCode, String)toAppError { status: StatusCode, body: ErrorResponse }, mechanically updating the ~182(status, message)route-handler call sites toAppError::new(status, msg)alongsideAppError::vm_not_found,AppError::exec_timeout, andAppError::create_timeout.sdk/python):ErrorResponseonce inHttpError.__init__and raises typedVmNotFoundError,CreateTimeoutError, andExecTimeoutError(the two timeout classes subclassCapsemTimeoutError(TimeoutError, CapsemError)), with pickle round-trip support (HttpError.__reduce__/__setstate__andTransport.__getstate__dropping_session).discover_gateway,capsem_run_dir,Hypervisor.connect) to resolveCAPSEM_GATEWAY_URL/CAPSEM_GATEWAY_TOKENor~/.capsem/run/gateway.{port,token}($CAPSEM_RUN_DIR) on the host before a gateway connection exists.