Skip to content

fix(orchestrator): remove hardcoded customer template IDs from GetDefaultReadyCommand - #3353

Closed
AdaAibaby wants to merge 1 commit into
e2b-dev:mainfrom
AdaAibaby:fix/remove-hardcoded-template-start-timeout
Closed

AdaAibaby wants to merge 1 commit into
e2b-dev:mainfrom
AdaAibaby:fix/remove-hardcoded-template-start-timeout

Conversation

@AdaAibaby

@AdaAibaby AdaAibaby commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

GetDefaultReadyCommand hard-codes three customer template IDs to extend the default ready-wait from 20 s to 120 s:

// HACK: This is a temporary fix for a customer that needs a bigger time to start the command.
// TODO: Remove this after we can add customizable wait time for building templates.
if templateID == "zegbt9dl3l2ixqem82mm" || templateID == "ot5bidkk3j2so2j02uuz" || templateID == "0zeou1s7agaytqitvmzc" {
    return fmt.Sprintf("sleep %d", int((120 * time.Second).Seconds()))
}

This is a security concern (customer IDs in source), makes the function untestable, and blocks the TODO to make the timeout user-configurable.

Fixes #3349.

Solution

  • Add StartCmdTimeout time.Duration to TemplateConfig. Zero (the zero value) means "use the built-in default (20 s)", preserving backward-compatibility for every existing build request that omits the field.
  • Change GetDefaultReadyCommand(templateID string) → GetDefaultReadyCommand(startCmdTimeout time.Duration) and remove the three hardcoded IDs.
  • Update the sole call-site in builder.go to pass ppb.Config.StartCmdTimeout.

StartCmdTimeout is intentionally left un-wired from the proto/API in this PR so the diff stays minimal. A follow-up can expose it as start_cmd_timeout_sec in TemplateConfig.

Migration

The three previously hard-coded templates should add an explicit ready_cmd to their build configuration (e.g. ready_cmd: "sleep 120" in their e2b.toml) so their 120 s wait is preserved after this change.

Test plan

  • go build ./packages/orchestrator/pkg/template/... passes
  • A template build with no ready_cmd and no start_cmd still uses sleep 0
  • A template build with a start_cmd and no ready_cmd uses sleep 20
  • A template build with StartCmdTimeout: 120*time.Second uses sleep 120

/cc @jakubno @dobrac @ValentaTomas @arkamar @tvi Looking forward to your code review.

…Command

GetDefaultReadyCommand previously hard-coded three customer template IDs
to use a 120 s wait instead of the standard 20 s. This made the function
untestable, was a security concern (customer IDs in source), and blocked
the TODO to make the timeout user-configurable.

Changes:
- Add StartCmdTimeout time.Duration to TemplateConfig; zero means the
  built-in default (20 s) is used, preserving backward-compat for every
  existing build request that omits the field.
- Change GetDefaultReadyCommand(templateID string) to
  GetDefaultReadyCommand(startCmdTimeout time.Duration) and remove the
  three hardcoded IDs.
- Update the sole call-site in builder.go to pass the new field.

Migration: the three previously hard-coded templates should add an
explicit ready_cmd (e.g. "sleep 120") to their build configuration so
their 120 s wait is preserved.

Closes e2b-dev#3349
@cla-bot cla-bot Bot added the cla-signed label Jul 23, 2026
@ValentaTomas
ValentaTomas force-pushed the main branch 2 times, most recently from 5aad415 to d71980e Compare July 25, 2026 22:53
@ryan-sana ryan-sana closed this Oct 15, 2026
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.

orchestrator: hardcoded customer template IDs bypass configurable ready-wait (HACK in GetDefaultReadyCommand)

3 participants