Skip to content

perf(cli): lambda deploy warms the video function so the first render does not wait for its image - #6376

Merged
miguel-heygen merged 4 commits into
mainfrom
perf/lambda-deploy-warm
Oct 26, 2026
Merged

miguel-heygen merged 4 commits into
mainfrom
perf/lambda-deploy-warm

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Problem

A newly deployed container-image function loads its image on first use. On a share of fresh deploys the first render's plan took 13 to 17 s instead of 2 to 3 s, and no later render did. The first render after an upgrade is the one people judge the stack on.

Change

hyperframes lambda deploy invokes the video function's existing warm action once, after the stack is up and the state file is written, and prints one line (Warming up the video function). On by default; --no-warm skips it. A failed warm-up prints a warning and the deploy still succeeds. Nothing to warm on --video-arch x86_64 (no image function).

Evidence

  • Tests: the deploy calls warm once with the stack's function and region, after the state is written; a throwing warm-up still finishes the deploy; warm: false and --video-arch x86_64 do not call it. The first two fail with the call removed or the failure made fatal.
  • Cost: the warm call is billed at about 3 s of the 10 GB function, roughly $0.0004 per deploy, and adds nothing to any render.
  • Honest limit: in a controlled before/after on fresh image digests the warm call saved about 1 s of the first render's plan. The 12 s case did not show up in either arm of that test, so this change is not proven against it; the field data above is why it is worth a cent per deploy.

… does not wait for its image

A freshly deployed container-image function loads its image on first use, which added about 12 s to the first render's plan on some deploys. Deploy now invokes the function's warm action once after the stack is up (default on, --no-warm skips it). A failed warm-up prints a warning and the deploy still succeeds.
@mintlify

mintlify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Oct 26, 2026, 2:06 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@heygengenesis heygengenesis 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.

Verdict: REQUEST CHANGES · 1 blocker · 0 important · 1 nit · head f98ae01f

  • blocker: required check Skills: manifest in sync fails — skills/hyperframes-cli/references/lambda.md changed without regenerating skills-manifest.json (bun packages/cli/scripts/gen-skills-manifest.ts, then commit).

The warm path itself looks right: the handler's Action: "warm" branch exists, every failure (missing CLI, timeout, non-zero exit, FunctionError) is caught and kept non-fatal, and the x86_64 skip is covered.

Scope / CI

Read the full diff plus handler.ts warm branch, sam.ts and template.yaml video-function outputs. Didn't run tests locally (no bun in the sandbox), so I relied on CI. Fallow audit (not required) also fails: runDeploy goes over the complexity gate (24/20), and touching sam.ts surfaces the existing samDeploy/samDelete clone. Pulling the warm block into a helper would clear the first one.

Comment thread packages/cli/src/commands/lambda/sam.ts Resolved
…kills manifest

Regenerates skills-manifest.json for the lambda reference change, keeps runDeploy under the complexity gate by pulling the warm step into a helper, and leaves sam.ts untouched.
…r the profile sets

A profile configured for text or yaml output made the reply unparseable, which printed a spurious warm-up warning.

@heygengenesis heygengenesis 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.

Verdict: APPROVE — 2 resolved, 0 open, 0 new · f98ae01f → 729519de

The manifest is back in sync and the invoke now passes --output json. Fallow audit still fails, though it isn't required: runDeploy is at 23/20, so the helper extraction didn't clear it, despite the update. Tests on windows-latest: engine-cli hung in studioServer.test.ts's history test, which this PR doesn't touch, and passed on rerun.

@heygengenesis heygengenesis 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.

Verdict: APPROVE — 0 resolved, 0 open, 0 new · 729519de → 76d9803f

This is a pure extraction: the warm guard moved into warmVideoFunction, and the concurrency notice is unchanged. All CI passes on this head, including Fallow audit and the Windows tests.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit a11280e Oct 26, 2026
68 checks passed
@miguel-heygen
miguel-heygen deleted the perf/lambda-deploy-warm branch October 26, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant