Repository navigation
Allow ms and Temporal.Duration timeouts for Sandboxes - #1777
Conversation
…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>
🦋 Changeset detectedLatest commit: 7556485 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this comment.
🟢 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
DurationInputanddurationToMs. - 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.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
## 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>

Summary
Standardises some of the duration handling across
inngest, Sandboxes, and exports the functions for use in@inngest/cilater. This means that Sandboxes and CI will handle:numberof millisecondsstringChecklist
Added a docs PR that references this PRN/A Later bump