refactor(sdks): refactor run in session#641
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3c3ec9ef6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
sdks/sandbox/python/src/opensandbox/adapters/command_adapter.py
Outdated
Show resolved
Hide resolved
Align Go SDK with PR alibaba#641's cross-SDK convention: public timeout parameters use language-native duration types instead of leaking raw millisecond wire-format values. Custom MarshalJSON preserves the millisecond wire encoding. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Hey @ninan-nn — nice cleanup! We're contributing a Go SDK on our fork (
Commit: Usage looks like: sb.RunInSession(ctx, sessID, opensandbox.RunInSessionRequest{
Command: "sleep 10",
Timeout: 5 * time.Second,
})Happy to add the Go entry to |
a3c3ec9 to
19899d2
Compare

Summary
Refactor sandbox SDK
runInSession/run_in_sessiontimeout parameters to match each language's existing public SDK timeout style instead of leaking execd wire-format milliseconds.The main reason for this change is consistency and ambiguity reduction:
runInSessionwas an outlier that exposed raw millisecond semantics directly.This change keeps the server wire format unchanged (
timeoutis still sent in milliseconds), but updates the handwritten SDK public interfaces to use clearer SDK-facing timeout shapes:timeoutSecondstimedeltaDurationTimeoutSecondsAlso add an SDK guideline in
sdks/AGENTS.md: public SDK duration parameters should use language-native duration types where available, or explicit second-based fields such astimeoutSeconds.Testing
./gradlew test/Users/ninan/.nvm/versions/node/v22.21.1/bin/node --test tests/commands.run.test.mjs./.venv/bin/python -m pytest tests/test_command_service_adapter_streaming.py tests/test_sync_command_service_adapter_streaming.py -qNotes:
vstestsocket permission errors.uvbecauseuvwas unstable in this environment.Breaking Changes
This PR intentionally introduces SDK breaking changes so old timeout call sites fail fast instead of silently keeping ambiguous millisecond semantics.
Migration examples:
JavaScript
runInSession(id, cmd, { timeout: 5000 })runInSession(id, cmd, { timeoutSeconds: 5 })Python
run_in_session(id, cmd, timeout=5000)run_in_session(id, cmd, timeout=timedelta(seconds=5))Kotlin
runInSession(id, cmd, timeout = 5000)runInSession(id, cmd, timeout = 5.seconds)/Duration.ofSeconds(5)C#
new RunInSessionOptions { Timeout = 5000 }new RunInSessionOptions { TimeoutSeconds = 5 }Checklist