feat: get sandbox by metadata filter#6
Merged
Conversation
Add a "Get By" selector to the Sandbox > Get operation so a sandbox can
be retrieved either by ID (existing behavior, still the default) or by a
metadata filter. The filter is applied server-side via the `metadata`
query parameter of `GET /v2/sandboxes` (keys and values URL-encoded,
combined with AND), so it no longer requires listing all sandboxes and
filtering in a Code node. The matched sandbox is then fetched by ID so
the output shape is identical to Get by ID.
listSandboxes now takes an options object ({ limit, metadata }) to make
room for the new query parameter.
tomasvarga
approved these changes
Jul 8, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Get By selector to the Sandbox → Get operation:
Why
Finding a persistent sandbox by metadata currently requires Get Many + a Code node:
This breaks once the sandbox falls outside the Get Many limit, and it's a lot of ceremony for "give me my sandbox". The API already supports server-side filtering via the
metadataquery parameter ofGET /v2/sandboxes(same filter the JS SDK exposes asSandbox.list({ query: { metadata } })) — the node just didn't expose it.How
listSandboxesinclient.tsnow takes an options object ({ limit, metadata }) and serializes the metadata filter as URL-encodedkey=valuepairs joined with&, matching the SDK's encoding (verified against the live API).limit: 1+ the filter, then fetches the matched sandbox by ID, so the output shape is identical to Get by ID.NodeOperationError.Testing
pnpm test— 16/16 (5 new: get by ID routing, get by metadata, no match, empty filter, getMany limit passthrough)pnpm typecheck,pnpm lint,pnpm build— all clean?metadata=purpose%3D...returns the exact matching sandbox; unknown value returns[])