Skip to content

chore(api): validate sandbox auto resume config#2801

Draft
jakubno wants to merge 2 commits into
mainfrom
fix/create-sandbox-auto-resume-validation
Draft

chore(api): validate sandbox auto resume config#2801
jakubno wants to merge 2 commits into
mainfrom
fix/create-sandbox-auto-resume-validation

Conversation

@jakubno
Copy link
Copy Markdown
Member

@jakubno jakubno commented May 22, 2026

No description provided.

@cla-bot cla-bot Bot added the cla-signed label May 22, 2026
@cursor
Copy link
Copy Markdown

cursor Bot commented May 22, 2026

PR Summary

Low Risk
Low risk: small, isolated request-validation change in sandbox creation that can only cause additional 400 responses for previously-accepted invalid parameter combinations.

Overview
This introduces a new 400 validation failure when autoResume.enabled=true but autoPause is false/defaulted to false, which is potentially breaking for any clients relying on that combination being accepted. The new validation is only applied on sandbox creation (not updates), so behavior may diverge across endpoints if others accept autoResume without autoPause.

Reviewed by Cursor Bugbot for commit cf9d55f. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
2684 2 2682 7
View the full list of 6 ❄️ flaky test(s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/sandboxes::TestSnapshotTemplateCreate

Flake rate in main: 47.95% (Passed 521 times, Failed 480 times)

Stack Traces | 0s run time
=== RUN   TestSnapshotTemplateCreate
=== PAUSE TestSnapshotTemplateCreate
=== CONT  TestSnapshotTemplateCreate
--- FAIL: TestSnapshotTemplateCreate (0.00s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/sandboxes::TestSnapshotTemplateCreate/create_snapshot_without_name

Flake rate in main: 47.74% (Passed 521 times, Failed 476 times)

Stack Traces | 16.2s run time
=== RUN   TestSnapshotTemplateCreate/create_snapshot_without_name
=== PAUSE TestSnapshotTemplateCreate/create_snapshot_without_name
=== CONT  TestSnapshotTemplateCreate/create_snapshot_without_name
    snapshot_template_test.go:56: 
        	Error Trace:	.../api/sandboxes/snapshot_template_test.go:37
        	            				.../api/sandboxes/snapshot_template_test.go:56
        	Error:      	Not equal: 
        	            	expected: 201
        	            	actual  : 500
        	Test:       	TestSnapshotTemplateCreate/create_snapshot_without_name
--- FAIL: TestSnapshotTemplateCreate/create_snapshot_without_name (16.24s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestMultipleTagsOnSameTemplate

Flake rate in main: 47.69% (Passed 520 times, Failed 474 times)

Stack Traces | 168s run time
=== RUN   TestMultipleTagsOnSameTemplate
=== PAUSE TestMultipleTagsOnSameTemplate
=== CONT  TestMultipleTagsOnSameTemplate
    template_tags_test.go:285: Build failed: {<nil> build was cancelled <nil>}
--- FAIL: TestMultipleTagsOnSameTemplate (167.84s)
github.com/e2b-dev/infra/tests/integration/internal/tests/orchestrator::TestSandboxMemoryIntegrity

Flake rate in main: 61.27% (Passed 526 times, Failed 832 times)

Stack Traces | 82.2s run time
=== RUN   TestSandboxMemoryIntegrity
=== PAUSE TestSandboxMemoryIntegrity
=== CONT  TestSandboxMemoryIntegrity
    sandbox_memory_integrity_test.go:27: Build completed successfully
--- FAIL: TestSandboxMemoryIntegrity (82.16s)
github.com/e2b-dev/infra/tests/integration/internal/tests/orchestrator::TestSandboxMemoryIntegrity/tmpfs_hash

Flake rate in main: 61.49% (Passed 516 times, Failed 824 times)

Stack Traces | 113s run time
=== RUN   TestSandboxMemoryIntegrity/tmpfs_hash
=== PAUSE TestSandboxMemoryIntegrity/tmpfs_hash
=== CONT  TestSandboxMemoryIntegrity/tmpfs_hash
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{start:{pid:1253}}
Executing command bash in sandbox ijvhh2kwzy1fvkm05mi2o (user: root)
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stdout:"Total memory: 985 MB\nUsed memory before tmpfs mount: 191 MB\nFree memory before tmpfs mount: 793 MB\nMemory to use in integrity test (80% of free, min 64MB): 634 MB\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"634+0 records in\n634+0 records out\n664797184 bytes (665 MB, 634 MiB) copied, 3.28485 s, 202 MB/s\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\tCommand being "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"timed: \""}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"dd if=/dev/urandom"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" of=/mnt/testfile bs=1M count=634"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\"\n\tUs"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"er ti"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"me (seconds): 0.00\n\tSystem time"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" (seco"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"nds):"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" 3.26\n\t"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"Perce"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"nt o"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"f CP"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"U this job got: 99%\n\tElapsed (wall clock) time (h:m"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"m:ss o"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"r m:s"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"s): "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"0:03.29\n\tA"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"verage s"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"hared"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" text"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" size (kbytes): 0\n\tAverage unshared data size (kbytes): 0\n\t"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"Avera"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ge stack"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" siz"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"e (kb"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ytes)"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:": 0\n\tAverage total size (kbytes): 0\n\tMaximum resident set size (kbytes)"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:": 2736\n\tA"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"verag"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"e res"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ident"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" set si"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ze (k"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"bytes"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"): 0\n\tMajor (requiring I/O) page faults: 2\n\tMinor"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" (reclaimi"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ng a fra"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"me) p"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"age f"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ault"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"s: 348"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\n\tVoluntary context switches: 3\n\tInvoluntary context "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"switc"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"hes: "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"9\n\tS"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"waps: 0"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\n\tFil"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"e sys"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"tem i"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"nputs: 176\n\tFile system outputs: 0\n\tSocket messages"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" sent: 0"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\n\tSo"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"cket "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"mess"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ages"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" recei"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ved: "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"0\n\tSignals delivered: 0\n\tPage"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" size (bytes): 4096\n\tE"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"xit s"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"tatus: "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"0\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stdout:"Used memory after tmpfs mount and file fill: 828 MB\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{end:{exited:true status:"exit status 0"}}
    sandbox_memory_integrity_test.go:70: Command [bash] completed successfully in sandbox ibtqmfu0bgfevse6lnuon
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
    sandbox_memory_integrity_test.go:80: Command [bash] output: event:{start:{pid:1269}}
    sandbox_memory_integrity_test.go:80: Command [bash] output: event:{data:{stdout:"60c35e8acfb40f9d1af6e2347f7fd84e80934e482dda7686356de87f77384b20\n"}}
    sandbox_memory_integrity_test.go:80: Command [bash] output: event:{end:{exited:true status:"exit status 0"}}
    sandbox_memory_integrity_test.go:80: Command [bash] completed successfully in sandbox ibtqmfu0bgfevse6lnuon
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
    sandbox_memory_integrity_test.go:80: Command [bash] output: event:{start:{pid:1273}}
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
Executing command bash in sandbox ibtqmfu0bgfevse6lnuon (user: root)
    sandbox_memory_integrity_test.go:110: 
        	Error Trace:	.../tests/orchestrator/sandbox_memory_integrity_test.go:81
        	            				.../hostedtoolcache/go/1.26.3.../src/runtime/asm_amd64.s:1771
        	Error:      	Received unexpected error:
        	            	failed to execute command bash in sandbox ibtqmfu0bgfevse6lnuon: unavailable: HTTP status 502 Bad Gateway
    sandbox_memory_integrity_test.go:110: 
        	Error Trace:	.../tests/orchestrator/sandbox_memory_integrity_test.go:78
        	            				.../tests/orchestrator/sandbox_memory_integrity_test.go:110
        	Error:      	Condition never satisfied
        	Test:       	TestSandboxMemoryIntegrity/tmpfs_hash
--- FAIL: TestSandboxMemoryIntegrity/tmpfs_hash (112.96s)
github.com/e2b-dev/infra/tests/integration/internal/tests/proxies::TestSandboxAutoResumeViaProxy

Flake rate in main: 48.21% (Passed 520 times, Failed 484 times)

Stack Traces | 22.4s run time
=== RUN   TestSandboxAutoResumeViaProxy
=== PAUSE TestSandboxAutoResumeViaProxy
=== CONT  TestSandboxAutoResumeViaProxy
    auto_resume_test.go:97: [Status code: 502] Response body: {"sandboxId":"i5oyhofdexfe72wh87y8h","message":"The sandbox is running but port is not open","port":8000,"code":502}
    auto_resume_test.go:97: [Status code: 502] Response body: {"sandboxId":"i5oyhofdexfe72wh87y8h","message":"The sandbox is running but port is not open","port":8000,"code":502}
    auto_resume_test.go:97: [Status code: 502] Response body: {"sandboxId":"i5oyhofdexfe72wh87y8h","message":"The sandbox is running but port is not open","port":8000,"code":502}
Executing command ls in sandbox ipb7jeck21j8v06j2vg6g
    auto_resume_test.go:116: 
        	Error Trace:	.../tests/proxies/auto_resume_test.go:116
        	Error:      	Received unexpected error:
        	            	Get "http://localhost:3002": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
        	Test:       	TestSandboxAutoResumeViaProxy
--- FAIL: TestSandboxAutoResumeViaProxy (22.37s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces validation logic to ensure that autoResume is only enabled when autoPause is active. It adds a new validation function, an error message constant, and unit tests to verify the implementation. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant