Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@ jobs:
run: ./scripts/build

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/kernel-typescript'
if: |-
github.repository == 'stainless-sdks/kernel-typescript' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
if: github.repository == 'stainless-sdks/kernel-typescript'
if: |-
github.repository == 'stainless-sdks/kernel-typescript' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.42.1"
".": "0.42.2"
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.42.2 (2026-03-07)

Full Changelog: [v0.42.1...v0.42.2](https://github.com/kernel/kernel-node-sdk/compare/v0.42.1...v0.42.2)

### Bug Fixes

* **client:** preserve URL params already embedded in path ([d7ab66f](https://github.com/kernel/kernel-node-sdk/commit/d7ab66fa9cb44f5b56113ff57f745b86d10e4ba8))


### Chores

* **ci:** skip uploading artifacts on stainless-internal branches ([2e40c24](https://github.com/kernel/kernel-node-sdk/commit/2e40c24ead5d5d2b8a98d0dde705e62d346b63ae))
* **internal:** codegen related update ([1185eae](https://github.com/kernel/kernel-node-sdk/commit/1185eae6d84aadd098de9429a24192187a00a74c))
* update placeholder string ([7608d8b](https://github.com/kernel/kernel-node-sdk/commit/7608d8b49713c24693c52d2eee64284f974158af))

## 0.42.1 (2026-03-05)

Full Changelog: [v0.42.0...v0.42.1](https://github.com/kernel/kernel-node-sdk/compare/v0.42.0...v0.42.1)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onkernel/sdk",
"version": "0.42.1",
"version": "0.42.2",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
Expand Down
11 changes: 6 additions & 5 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,9 @@ export class Kernel {
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));

const defaultQuery = this.defaultQuery();
if (!isEmptyObj(defaultQuery)) {
query = { ...defaultQuery, ...query };
const pathQuery = Object.fromEntries(url.searchParams);
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
query = { ...pathQuery, ...defaultQuery, ...query };
}

if (typeof query === 'object' && query && !Array.isArray(query)) {
Expand Down Expand Up @@ -716,9 +717,9 @@ export class Kernel {
}
}

// If the API asks us to wait a certain amount of time (and it's a reasonable amount),
// just do what it says, but otherwise calculate a default
if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
// If the API asks us to wait a certain amount of time, just do what it
// says, but otherwise calculate a default
if (timeoutMillis === undefined) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing validation allows NaN/negative retry timeouts

Medium Severity

The old guard !(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000) validated that timeoutMillis was a positive, finite, reasonable number. The new check timeoutMillis === undefined only catches the undefined case. When Date.parse(retryAfterHeader) fails on an invalid date string, timeoutMillis becomes NaN (since NaN - Date.now() is NaN). Since NaN !== undefined, the fallback is skipped and sleep(NaN) is called, which resolves immediately via setTimeout(resolve, NaN). Similarly, a past-date retry-after header produces a negative timeoutMillis, also resolving immediately. Both cases bypass exponential backoff entirely, risking a retry storm against an already-struggling server.

Fix in Cursor Fix in Web

const maxRetries = options.maxRetries ?? this.maxRetries;
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
}
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.42.1'; // x-release-please-version
export const VERSION = '0.42.2'; // x-release-please-version
4 changes: 2 additions & 2 deletions tests/api-resources/browsers/browsers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ describe('resource browsers', () => {
// Mock server tests are disabled
test.skip('loadExtensions: only required params', async () => {
const responsePromise = client.browsers.loadExtensions('id', {
extensions: [{ name: 'name', zip_file: await toFile(Buffer.from('# my file contents'), 'README.md') }],
extensions: [{ name: 'name', zip_file: await toFile(Buffer.from('Example data'), 'README.md') }],
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
Expand All @@ -162,7 +162,7 @@ describe('resource browsers', () => {
// Mock server tests are disabled
test.skip('loadExtensions: required and optional params', async () => {
const response = await client.browsers.loadExtensions('id', {
extensions: [{ name: 'name', zip_file: await toFile(Buffer.from('# my file contents'), 'README.md') }],
extensions: [{ name: 'name', zip_file: await toFile(Buffer.from('Example data'), 'README.md') }],
});
});
});
12 changes: 6 additions & 6 deletions tests/api-resources/browsers/fs/fs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('resource fs', () => {
// Mock server tests are disabled
test.skip('upload: only required params', async () => {
const responsePromise = client.browsers.fs.upload('id', {
files: [{ dest_path: '/J!', file: await toFile(Buffer.from('# my file contents'), 'README.md') }],
files: [{ dest_path: '/J!', file: await toFile(Buffer.from('Example data'), 'README.md') }],
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
Expand All @@ -159,15 +159,15 @@ describe('resource fs', () => {
// Mock server tests are disabled
test.skip('upload: required and optional params', async () => {
const response = await client.browsers.fs.upload('id', {
files: [{ dest_path: '/J!', file: await toFile(Buffer.from('# my file contents'), 'README.md') }],
files: [{ dest_path: '/J!', file: await toFile(Buffer.from('Example data'), 'README.md') }],
});
});

// Mock server tests are disabled
test.skip('uploadZip: only required params', async () => {
const responsePromise = client.browsers.fs.uploadZip('id', {
dest_path: '/J!',
zip_file: await toFile(Buffer.from('# my file contents'), 'README.md'),
zip_file: await toFile(Buffer.from('Example data'), 'README.md'),
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
Expand All @@ -182,15 +182,15 @@ describe('resource fs', () => {
test.skip('uploadZip: required and optional params', async () => {
const response = await client.browsers.fs.uploadZip('id', {
dest_path: '/J!',
zip_file: await toFile(Buffer.from('# my file contents'), 'README.md'),
zip_file: await toFile(Buffer.from('Example data'), 'README.md'),
});
});

// Mock server tests are disabled
test.skip('writeFile: only required params', async () => {
const responsePromise = client.browsers.fs.writeFile(
'id',
await toFile(Buffer.from('# my file contents'), 'README.md'),
await toFile(Buffer.from('Example data'), 'README.md'),
{ path: '/J!' },
);
const rawResponse = await responsePromise.asResponse();
Expand All @@ -206,7 +206,7 @@ describe('resource fs', () => {
test.skip('writeFile: required and optional params', async () => {
const response = await client.browsers.fs.writeFile(
'id',
await toFile(Buffer.from('# my file contents'), 'README.md'),
await toFile(Buffer.from('Example data'), 'README.md'),
{ path: '/J!', mode: '0611' },
);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/api-resources/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('resource extensions', () => {
// Mock server tests are disabled
test.skip('upload: only required params', async () => {
const responsePromise = client.extensions.upload({
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
file: await toFile(Buffer.from('Example data'), 'README.md'),
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
Expand All @@ -54,7 +54,7 @@ describe('resource extensions', () => {
// Mock server tests are disabled
test.skip('upload: required and optional params', async () => {
const response = await client.extensions.upload({
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
file: await toFile(Buffer.from('Example data'), 'README.md'),
name: 'name',
});
});
Expand Down