Skip to content

Allow ms and Temporal.Duration timeouts for Sandboxes - #1777

Merged
jpwilliams merged 8 commits into
mainfrom
jack/sdk-duration-to-ms
Oct 14, 2026
Merged

jpwilliams merged 8 commits into
mainfrom
jack/sdk-duration-to-ms

Conversation

@jpwilliams

Copy link
Copy Markdown
Member

Summary

Standardises some of the duration handling across inngest, Sandboxes, and exports the functions for use in @inngest/ci later. This means that Sandboxes and CI will handle:

const sandbox = await step.sandbox.create("box", {
  name: "box",
  vcpu: 2,
  memoryMb: 2048,
  runningTimeout: Temporal.Duration.from({ minutes: 5 }),
});

await sandbox.commands.run("build", "npm run build", { timeout: "2m" });
await sandbox.commands.run("log", "npm version", { timeout: 100 });

Checklist

  • Added a docs PR that references this PR N/A Later bump
  • Added unit/integration tests
  • Added changesets if applicable

x and others added 7 commits October 10, 2026 00:35
…erimental

One helper turns milliseconds, an ms string (including compound forms like
1h30m) or a Temporal.Duration into milliseconds. Sandbox validation uses it
instead of its own ms parsing, and no longer caps durations client-side: the
Sandbox API decides what is too long.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move durationToMs and DurationInput from inngest/experimental to inngest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Restore the truncation test fixtures to match main and add a table-driven
test covering create runningTimeoutMs, exec timeoutMs and waitUntilRunning
timeoutMs with a 1h value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rationToMs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jpwilliams jpwilliams self-assigned this Oct 13, 2026
Copilot AI balanced review requested due to automatic review settings October 13, 2026 23:15
@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7556485

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
inngest Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI 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.

🟢 Approval recommended

The implementation is sound and tested; only minor release-note wording needs correction.

1 open finding
What changed in this PR

Adds shared duration conversion for Sandbox timeouts and future CI reuse.

Changes:

  • Adds and exports DurationInput and durationToMs.
  • Supports compound duration strings with validation.
  • Reuses conversion across Sandbox timeout normalization.
File Description
packages/​inngest/​src/​index.ts Exports duration utilities.
packages/​inngest/​src/​helpers/​duration.ts Implements duration conversion.
packages/​inngest/​src/​helpers/​duration.test.ts Tests parsing and rejection cases.
packages/​inngest/​src/​components/​sandbox/​validation.ts Centralizes Sandbox duration validation.
packages/​inngest/​src/​components/​InngestSandbox.test.ts Tests timeout limits across operations.
.changeset/​durations-to-ms.md Documents the Sandbox enhancement.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .changeset/durations-to-ms.md Outdated
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium impact] Adds duration parsing for sandbox timeout configuration.

The code appears safe to merge, with a non-blocking correction needed in the release example.

Findings

  1. P2 Release example cannot run ▶
Fix with agent prompt
### Issue 1
.changeset/durations-to-ms.md:8
Users who copy this example cannot create a sandbox. `step.sandbox.create` requires `name` and either `vcpu` plus `memoryMb`, or `snapshotId`. Even after adding those fields, `"1h30m"` exceeds the five-minute limit for `runningTimeout`.

Include the required create settings and use a compound timeout below the limit, such as `"4m30s"`.

```suggestion
await step.sandbox.create("build", {
  name: "build",
  vcpu: 2,
  memoryMb: 2048,
  runningTimeout: "4m30s",
});
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds a shared durationToMs helper and exports it with DurationInput.

  • Duration inputs convert to milliseconds through one shared helper.
  • Sandbox timeouts now accept compound duration strings.

Reviews (1) · Last reviewed commit: "fix(sandbox): cap durations where each o..." · Reviewed by Greptile

Comment thread .changeset/durations-to-ms.md Outdated
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jpwilliams
jpwilliams merged commit 700c58d into main Oct 14, 2026
46 checks passed
@jpwilliams
jpwilliams deleted the jack/sdk-duration-to-ms branch October 14, 2026 13:30
jpwilliams pushed a commit that referenced this pull request Oct 14, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @inngest/ci@0.3.0

### Minor Changes

- [#1769](#1769)
[`20b8d0cc`](20b8d0c)
Thanks [@jpwilliams](https://github.com/jpwilliams)! - Group a run's
steps into trace spans (one per job, one per command, one per extra
machine), name CI's own steps for what they do, and mark them as CI's
work so a trace can tell them from yours. Saving a sandbox is one
`snapshot` row.

`@inngest/ci` now needs `inngest` 4.23.1 or later, which takes a
snapshot's own trace span and always has the span API; older SDKs are no
longer supported.
## inngest@4.24.0

### Minor Changes

- [#1777](#1777)
[`700c58d9`](700c58d)
Thanks [@jpwilliams](https://github.com/jpwilliams)! - Sandbox durations
now accept compound strings like `"4m30s"`.

  ```ts
  await step.sandbox.create("build", {
    name: "build",
    vcpu: 2,
    memoryMb: 2048,
    runningTimeout: "4m30s",
  });
  ```

- [#1773](#1773)
[`eee1c61e`](eee1c61)
Thanks [@jpwilliams](https://github.com/jpwilliams)! - Sandboxes can now
be scoped with `await using`; they're destroyed when the block exits.

  ```ts
  await using sb = await step.sandbox.create("build");
  await sb.commands.run("npm test");
  ```

- [#1774](#1774)
[`4d8cac24`](4d8cac2)
Thanks [@jpwilliams](https://github.com/jpwilliams)! - Experimental:
`group.sandbox()` runs a callback with a fresh sandbox and destroys it
afterwards. The sandbox's whole lifetime shows as one group in the
trace, and a retried failure keeps the sandbox for the next attempt.

  ```ts
  await group.sandbox("build", async (sb) => {
    await sb.commands.run("test", "npm test");
  });
  ```

### Patch Changes

- [#1770](#1770)
[`714d46a7`](714d46a)
Thanks [@jpwilliams](https://github.com/jpwilliams)! - Mark the span
around a sandbox snapshot's create and wait steps as `kind: "snapshot"`,
and let a caller's `"~span"` option replace it, so a snapshot is one
statement in a trace. The group has no origin because the statement is
the user's; the create and wait steps inside it carry an
`inngest@<version>` origin. Step IDs are unchanged.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
jpwilliams added a commit that referenced this pull request Oct 19, 2026
## Summary
<!-- Succinctly describe your change, providing context, what you've
changed, and why. -->

Brings #1777's time inputs (`number` of milliseconds,
[ms](https://npm.im/ms)-compatible `string`, or `Temporal.Duration`) to
`@inngest/ci`'s:
- `maxAge`
- `keepOnFailure`
- `.timeout()`
- `waitForPort`
- `waitForHttp`
- `github.waitForChecks`
- `waitForWorkflow`

```ts
await $`pnpm test`.timeout(300_000);
await $`pnpm test`.timeout("5m");
await $`pnpm test`.timeout(Temporal.Duration.from({ minutes: 5 }));
```

## Checklist
<!-- Tick these items off as you progress. -->
<!-- If an item isn't applicable, ideally please strikeout the item by
wrapping it in "~~"" and suffix it with "N/A My reason for skipping
this." -->
<!-- e.g. "- [ ] ~~Added tests~~ N/A Only touches docs" -->

- [ ] ~Added a [docs PR](https://github.com/inngest/website) that
references this PR~ N/A Later bump
- [x] Added unit/integration tests
- [x] Added changesets if applicable

## Related
<!-- A space for any related links, issues, or PRs. -->
<!-- Linear issues are autolinked. -->
<!-- e.g. - INN-123 -->
<!-- GitHub issues/PRs can be linked using shorthand. -->
<!-- e.g. "- inngest/inngest#123" -->
<!-- Feel free to remove this section if there are no applicable related
links.-->
- Builds on #1777

---------

Co-authored-by: x <a@b>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 inngest Affects the `inngest` package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants