Skip to content

refactor(orchestrator): make startingSandboxes limit configurable via feature flag#2622

Merged
jakubno merged 4 commits into
mainfrom
refactor/starting-sandboxes-feature-flag
May 11, 2026
Merged

refactor(orchestrator): make startingSandboxes limit configurable via feature flag#2622
jakubno merged 4 commits into
mainfrom
refactor/starting-sandboxes-feature-flag

Conversation

@jakubno

@jakubno jakubno commented May 11, 2026

Copy link
Copy Markdown
Member

Replace the hardcoded maxStartingInstancesPerNode=3 weighted semaphore with an AdjustableSemaphore driven by the MaxStartingInstancesPerNode feature flag, so per-node start/resume concurrency can be tuned at runtime without a redeploy. A background refresher resizes the semaphore every 30s.

… feature flag

Replace the hardcoded maxStartingInstancesPerNode=3 weighted semaphore with
an AdjustableSemaphore driven by the MaxStartingInstancesPerNode feature
flag, so per-node start/resume concurrency can be tuned at runtime without
a redeploy. A background refresher resizes the semaphore every 30s.
@cla-bot cla-bot Bot added the cla-signed label May 11, 2026
@cursor

cursor Bot commented May 11, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Concurrency limiting for sandbox start/resume is now driven by a runtime feature flag and resized in the background, so misconfiguration or unexpected resizing behavior could throttle or overload nodes and affect request availability.

Overview
This change replaces the hardcoded startingSandboxes limit with a MaxStartingInstancesPerNode feature flag and a background refresher that adjusts the semaphore every 30s. If the flag is set to <= 0, server startup can fail (on initial read) or the refresher will silently ignore updates, leaving the old limit in place.

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

@codecov

codecov Bot commented May 11, 2026

Copy link
Copy Markdown

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
2611 4 2607 5
View the full list of 12 ❄️ flaky test(s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/metrics::TestTeamMetrics

Flake rate in main: 67.88% (Passed 115 times, Failed 243 times)

Stack Traces | 0.78s run time
=== RUN   TestTeamMetrics
=== PAUSE TestTeamMetrics
=== CONT  TestTeamMetrics
    team_metrics_test.go:61: 
        	Error Trace:	.../api/metrics/team_metrics_test.go:61
        	Error:      	Should be true
        	Test:       	TestTeamMetrics
        	Messages:   	MaxConcurrentSandboxes should be >= 0
--- FAIL: TestTeamMetrics (0.78s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/sandboxes::TestUpdateNetworkConfig

Flake rate in main: 75.98% (Passed 122 times, Failed 386 times)

Stack Traces | 82.3s run time
=== RUN   TestUpdateNetworkConfig
=== PAUSE TestUpdateNetworkConfig
=== CONT  TestUpdateNetworkConfig
--- FAIL: TestUpdateNetworkConfig (82.27s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/sandboxes::TestUpdateNetworkConfig/pause_resume_preserves_allow_internet_access_false

Flake rate in main: 76.46% (Passed 117 times, Failed 380 times)

Stack Traces | 1.22s run time
=== RUN   TestUpdateNetworkConfig/pause_resume_preserves_allow_internet_access_false
Executing command curl in sandbox i6megts5gxf4s36z60q4q
    sandbox_network_update_test.go:372: Command [curl] output: event:{start:{pid:1364}}
    sandbox_network_update_test.go:372: Command [curl] output: event:{end:{exit_code:35 exited:true status:"exit status 35" error:"exit status 35"}}
Executing command curl in sandbox i6megts5gxf4s36z60q4q
    sandbox_network_update_test.go:372: Command [curl] output: event:{start:{pid:1365}}
    sandbox_network_update_test.go:372: Command [curl] output: event:{end:{exit_code:35 exited:true status:"exit status 35" error:"exit status 35"}}
Executing command curl in sandbox i7n2blpz6shooowsdiqhv
    sandbox_network_update_test.go:391: Command [curl] output: event:{start:{pid:1366}}
    sandbox_network_update_test.go:391: Command [curl] output: event:{data:{stdout:"HTTP/2 302 \r\nx-content-type-options: nosniff\r\nlocation: https://dns.google/\r\ndate: Mon, 11 May 2026 14:56:12 GMT\r\ncontent-type: text/html; charset=UTF-8\r\nserver: HTTP server (unknown)\r\ncontent-length: 216\r\nx-xss-protection: 0\r\nx-frame-options: SAMEORIGIN\r\nalt-svc: h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000\r\n\r\n"}}
    sandbox_network_update_test.go:391: Command [curl] output: event:{end:{exited:true status:"exit status 0"}}
    sandbox_network_update_test.go:391: Command [curl] completed successfully in sandbox i6megts5gxf4s36z60q4q
    sandbox_network_update_test.go:391: 
        	Error Trace:	.../api/sandboxes/sandbox_network_out_test.go:74
        	            				.../api/sandboxes/sandbox_network_update_test.go:60
        	            				.../api/sandboxes/sandbox_network_update_test.go:391
        	Error:      	An error is expected but got nil.
        	Test:       	TestUpdateNetworkConfig/pause_resume_preserves_allow_internet_access_false
        	Messages:   	https://8.8.8.8 should be blocked
--- FAIL: TestUpdateNetworkConfig/pause_resume_preserves_allow_internet_access_false (1.22s)
github.com/e2b-dev/infra/tests/integration/internal/tests/api/templates::TestTemplateBuildENV

Flake rate in main: 59.12% (Passed 112 times, Failed 162 times)

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

Flake rate in main: 60.23% (Passed 105 times, Failed 159 times)

Stack Traces | 7.08s run time
=== RUN   TestTemplateBuildENV/ENV_with_multiline_value
=== PAUSE TestTemplateBuildENV/ENV_with_multiline_value
=== CONT  TestTemplateBuildENV/ENV_with_multiline_value
    build_template_test.go:134: test-ubuntu-env-multiline: [info] Building template zx9kknotftyp0ghk1lu0/2146744e-920f-4910-b6ff-ed522b5e3e12
    build_template_test.go:134: test-ubuntu-env-multiline: [info] CACHED [base] FROM ubuntu:22.04 [ffd709f131f42dfab282de47a91dd2c139e900c1c11fc574b49b517a05ef0a32]
    build_template_test.go:134: test-ubuntu-env-multiline: [info] CACHED [base] DEFAULT USER user [90bdd4afa342293c931373351bf578872dec9179214ba3e8bf9edba311466213]
    build_template_test.go:134: test-ubuntu-env-multiline: [info] [builder 1/2] ENV MULTILINE line1
        line2
        line3 [e93da3f3765f20eb6407c336b9e4e0b9321d994ec5f6cb547743a2a4070eed23]
    build_template_test.go:134: test-ubuntu-env-multiline: [info] [builder 2/2] RUN [[ $(echo "$MULTILINE" | wc -l) -eq 3 ]] || exit 1 [477610d61cdf858776262d3331809539bcbcf16f706aac18515a57337bae1786]
    build_template_test.go:134: test-ubuntu-env-multiline: [error] Build failed: failed to run command '[[ $(echo "$MULTILINE" | wc -l) -eq 3 ]] || exit 1': exit status 1
    build_template_test.go:374: Build failed: {<nil> failed to run command '[[ $(echo "$MULTILINE" | wc -l) -eq 3 ]] || exit 1': exit status 1 0xc0005a94e0}
--- FAIL: TestTemplateBuildENV/ENV_with_multiline_value (7.08s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestBindLocalhost

Flake rate in main: 57.79% (Passed 206 times, Failed 282 times)

Stack Traces | 0s run time
=== RUN   TestBindLocalhost
=== PAUSE TestBindLocalhost
=== CONT  TestBindLocalhost
--- FAIL: TestBindLocalhost (0.00s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestBindLocalhost/bind_0_0_0_0

Flake rate in main: 63.19% (Passed 113 times, Failed 194 times)

Stack Traces | 8.42s run time
=== RUN   TestBindLocalhost/bind_0_0_0_0
=== PAUSE TestBindLocalhost/bind_0_0_0_0
=== CONT  TestBindLocalhost/bind_0_0_0_0
Executing command /bin/bash in sandbox iwgdgd77sya6bo7j8ka58
    localhost_bind_test.go:69: Command [python] output: event:{start:{pid:1259}}
Executing command python in sandbox iyfsmci8acg60zq3vcg9o
    localhost_bind_test.go:90: 
        	Error Trace:	.../tests/envd/localhost_bind_test.go:90
        	Error:      	Not equal: 
        	            	expected: 200
        	            	actual  : 502
        	Test:       	TestBindLocalhost/bind_0_0_0_0
        	Messages:   	Unexpected status code 502 for bind address 0.0.0.0
--- FAIL: TestBindLocalhost/bind_0_0_0_0 (8.42s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestBindLocalhost/bind_::1

Flake rate in main: 64.91% (Passed 113 times, Failed 209 times)

Stack Traces | 7.69s run time
=== RUN   TestBindLocalhost/bind_::1
=== PAUSE TestBindLocalhost/bind_::1
=== CONT  TestBindLocalhost/bind_::1
    localhost_bind_test.go:69: Command [python] output: event:{start:{pid:1259}}
    localhost_bind_test.go:90: 
        	Error Trace:	.../tests/envd/localhost_bind_test.go:90
        	Error:      	Not equal: 
        	            	expected: 200
        	            	actual  : 502
        	Test:       	TestBindLocalhost/bind_::1
        	Messages:   	Unexpected status code 502 for bind address ::1
--- FAIL: TestBindLocalhost/bind_::1 (7.69s)
github.com/e2b-dev/infra/tests/integration/internal/tests/envd::TestBindLocalhost/bind_localhost

Flake rate in main: 65.02% (Passed 113 times, Failed 210 times)

Stack Traces | 7.55s run time
=== RUN   TestBindLocalhost/bind_localhost
=== PAUSE TestBindLocalhost/bind_localhost
=== CONT  TestBindLocalhost/bind_localhost
Executing command python in sandbox iczfqn0gq0av9ip04mbk4
    localhost_bind_test.go:69: Command [python] output: event:{start:{pid:1259}}
    localhost_bind_test.go:90: 
        	Error Trace:	.../tests/envd/localhost_bind_test.go:90
        	Error:      	Not equal: 
        	            	expected: 200
        	            	actual  : 502
        	Test:       	TestBindLocalhost/bind_localhost
        	Messages:   	Unexpected status code 502 for bind address localhost
--- FAIL: TestBindLocalhost/bind_localhost (7.55s)
github.com/e2b-dev/infra/tests/integration/internal/tests/orchestrator::TestSandboxMemoryIntegrity

Flake rate in main: 65.64% (Passed 123 times, Failed 235 times)

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

Flake rate in main: 66.96% (Passed 113 times, Failed 229 times)

Stack Traces | 49.8s 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:1261}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stdout:"Total memory: 985 MB\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stdout:"Used memory before tmpfs mount: 185 MB\nFree memory before tmpfs mount: 800 MB\nMemory to use in integrity test (80% of free, min 64MB): 640 MB\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"640+0 records in\n640+0 records out\n671088640 bytes (671 MB, 640 MiB) copied, 19.1205 s, 35.1 MB/s\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\t"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"C"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"o"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"m"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"m"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"a"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"nd being timed: \"dd if=/dev/urandom of=/mnt/testfile"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" bs=1M count=640\"\n\tUser time (seconds): "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"0.00\n\tS"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"ystem time (seco"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"nds): 18.83\n\tPerce"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"nt of CPU thi"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"s job got: 98%\n"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"\tElapsed (wall"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" clock)"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" time (h:mm:ss or m:ss): 0:19.17\n\tAverage shared text"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" size (kbytes)"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:":"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" 0\n\tAverage uns"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"hared data size"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" (kbytes): 0\n\tAver"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"age stack size "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"(kbytes): 0\n\tAverage t"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"o"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"tal"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" size (kbytes):"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" 0\n\tMaximum reside"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"nt set size ("}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"kbytes): 2696\n\tAv"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"erage resident "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"set size"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" (kbytes): 0\n\tMajor (requiring"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" I/O) page faults"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:": 3\n\tMinor (reclaiming a frame"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:")"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" page faults: 344\n\tVoluntary context switche"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"s: 4\n\tInvoluntary context s"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"witches: "}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"71\n\tSwaps: 0\n\tFile system inputs: 176\n\tFile syste"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"m outputs: 0\n\tSock"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"et"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" messages sent: 0\n\tSocket messages received"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:": 0\n\tSignals delivered:"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:" 0\n\tPage siz"}}
    sandbox_memory_integrity_test.go:70: Command [bash] output: event:{data:{stderr:"e (bytes): 4096\n\tExit status:"}}
    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: 833 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 iv4gsdh4wk8tn05j77emy
Executing command bash in sandbox iv4gsdh4wk8tn05j77emy (user: root)
    sandbox_memory_integrity_test.go:74: Command [bash] output: event:{start:{pid:1277}}
    sandbox_memory_integrity_test.go:74: Command [bash] output: event:{data:{stdout:"5b03727622e41fd89bbbb469faa767d151fb3b28caffe823484f2172cd73567b\n"}}
    sandbox_memory_integrity_test.go:74: Command [bash] output: event:{end:{exited:true status:"exit status 0"}}
    sandbox_memory_integrity_test.go:74: Command [bash] completed successfully in sandbox iv4gsdh4wk8tn05j77emy
Executing command bash in sandbox iv4gsdh4wk8tn05j77emy (user: root)
    sandbox_memory_integrity_test.go:99: Command [bash] output: event:{start:{pid:1280}}
    sandbox_memory_integrity_test.go:100: 
        	Error Trace:	.../tests/orchestrator/sandbox_memory_integrity_test.go:100
        	Error:      	Received unexpected error:
        	            	failed to execute command bash in sandbox iv4gsdh4wk8tn05j77emy: invalid_argument: protocol error: incomplete envelope: unexpected EOF
        	Test:       	TestSandboxMemoryIntegrity/tmpfs_hash
--- FAIL: TestSandboxMemoryIntegrity/tmpfs_hash (49.80s)
github.com/e2b-dev/infra/tests/integration/internal/tests/proxies::TestMaskRequestHostAPIParameter

Flake rate in main: 54.03% (Passed 114 times, Failed 134 times)

Stack Traces | 18.7s run time
=== RUN   TestMaskRequestHostAPIParameter
=== PAUSE TestMaskRequestHostAPIParameter
=== CONT  TestMaskRequestHostAPIParameter
Executing command ls in sandbox ibz3kinev6tdlqggzqtjo
    mask_request_host_test.go:39: Command [apt-get] output: event:{start:{pid:1252}}
    mask_request_host_test.go:39: Command [apt-get] output: event:{data:{stdout:"Hit:1 http://deb.debian.org/debian bookworm InRelease\nHit:2 http://deb.debian.org/debian bookworm-updates InRelease\n"}}
    mask_request_host_test.go:39: Command [apt-get] output: event:{data:{stdout:"Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease\n"}}
    mask_request_host_test.go:39: Command [apt-get] output: event:{data:{stdout:"Reading package lists..."}}
    mask_request_host_test.go:39: Command [apt-get] output: event:{data:{stdout:"\n"}}
    mask_request_host_test.go:39: Command [apt-get] output: event:{end:{exited:true  status:"exit status 0"}}
    mask_request_host_test.go:39: Command [apt-get] completed successfully in sandbox i89ox0r1jcho7779zdyvk
Executing command apt-get in sandbox i89ox0r1jcho7779zdyvk (user: root)
    mask_request_host_test.go:41: Command [apt-get] output: event:{start:{pid:1353}}
    mask_request_host_test.go:42: 
        	Error Trace:	.../tests/proxies/mask_request_host_test.go:42
        	Error:      	Received unexpected error:
        	            	failed to execute command apt-get in sandbox i89ox0r1jcho7779zdyvk: invalid_argument: protocol error: incomplete envelope: unexpected EOF
        	Test:       	TestMaskRequestHostAPIParameter
--- FAIL: TestMaskRequestHostAPIParameter (18.69s)

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

Starting the background goroutine before initialization is complete can cause a resource leak if subsequent steps fail. The background refresher should track the last applied limit to avoid unnecessary semaphore broadcasts when the value hasn't changed.

Comment thread packages/orchestrator/pkg/server/main.go Outdated
Comment thread packages/orchestrator/pkg/server/main.go

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 276ca2f. Configure here.

Comment thread packages/orchestrator/pkg/server/main.go Outdated
@jakubno jakubno marked this pull request as ready for review May 11, 2026 15:18

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization has reached its monthly code review spending cap.

An organization admin can view or raise the cap at claude.ai/admin-settings/claude-code. The cap resets at the start of the next billing period.

Once the cap resets or is raised, reopen this pull request to trigger a review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7fcede7bba

ℹ️ 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".

Comment on lines +86 to +89
startingLimit := cfg.FeatureFlags.IntFlag(ctx, featureflags.MaxStartingInstancesPerNode)
startingSandboxes, err := utils.NewAdjustableSemaphore(int64(startingLimit))
if err != nil {
return nil, fmt.Errorf("failed to create starting sandboxes semaphore: %w", err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Fall back when startup flag value is non-positive

New now constructs startingSandboxes directly from MaxStartingInstancesPerNode, but if LaunchDarkly is misconfigured to 0 or a negative value, NewAdjustableSemaphore returns an error and the orchestrator fails to start. This is a regression from the previous hardcoded limit path and is especially problematic because the periodic refresher already treats <= 0 as invalid and skips applying it, so startup should likewise clamp or fall back instead of hard-failing the whole service.

Useful? React with 👍 / 👎.

@jakubno jakubno merged commit 94d002d into main May 11, 2026
90 of 94 checks passed
@jakubno jakubno deleted the refactor/starting-sandboxes-feature-flag branch May 11, 2026 20:53
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.

3 participants