Skip to content

Fix bug when connecting to a sandbox with a longer timeout#1412

Closed
jakubno wants to merge 4 commits into
mainfrom
fix-bug-when-connecting-to-a-sandbox-with-longer-timeout-api-eng-3232
Closed

Fix bug when connecting to a sandbox with a longer timeout#1412
jakubno wants to merge 4 commits into
mainfrom
fix-bug-when-connecting-to-a-sandbox-with-longer-timeout-api-eng-3232

Conversation

@jakubno
Copy link
Copy Markdown
Member

@jakubno jakubno commented Oct 28, 2025

Note

Adds extend_only to sandbox timeout to control TTL extension vs reset, updates orchestrator/handlers accordingly, deprecates refresh endpoint, and adds integration tests.

  • API:
    • POST /sandboxes/{sandboxID}/timeout: add extend_only (default false) to control extending vs setting a new TTL.
    • POST /sandboxes/{sandboxID}/refreshes: marked as deprecated.
    • OpenAPI spec and generated code (spec.gen.go, types.gen.go, test models) updated.
  • Backend:
    • Rename/repurpose KeepAliveFor param to extendOnly and enforce non-shortening when true.
    • Refresh handler now calls KeepAliveFor(..., extendOnly=true).
    • Timeout handler reads extend_only and passes through.
  • Tests:
    • Add integration tests covering extend, no-shortening when extend_only=true, shortening when false/omitted, and not-found case.

Written by Cursor Bugbot for commit 9224e82. This will update automatically on new commits. Configure here.

@jakubno jakubno added the bug Something isn't working label Oct 28, 2025
@linear
Copy link
Copy Markdown

linear Bot commented Oct 28, 2025

)

func (o *Orchestrator) KeepAliveFor(ctx context.Context, sandboxID string, duration time.Duration, allowShorter bool) *api.APIError {
func (o *Orchestrator) KeepAliveFor(ctx context.Context, sandboxID string, duration time.Duration, extendOnly bool) *api.APIError {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed it here to keep it consistent with API. I wanted to add a parameter which is description + default false

@dobrac
Copy link
Copy Markdown
Contributor

dobrac commented Oct 28, 2025

whats the difference between set timeout extend_only=True and refresh?

@jakubno jakubno force-pushed the fix-bug-when-connecting-to-a-sandbox-with-longer-timeout-api-eng-3232 branch from 5cf1945 to 0106d1c Compare October 28, 2025 10:17
@jakubno
Copy link
Copy Markdown
Member Author

jakubno commented Oct 28, 2025

whats the difference between set timeout extend_only=True and refresh?

none, but refresh is deprecated

Also in SDK you probably don't want to do if (extend_only==True) {refresh()} else {setTimeout()}

@jakubno jakubno closed this Oct 28, 2025
@jakubno jakubno deleted the fix-bug-when-connecting-to-a-sandbox-with-longer-timeout-api-eng-3232 branch October 28, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants