Skip to content

fix(tailscale,starburst-galaxy,mongodb-atlas,onepassword,questrade)!: a failed token request is TokenRequestFailed - #1483

Merged
Mkassabov merged 1 commit into
mainfrom
fix/token-request-errors
Nov 23, 2026
Merged

Mkassabov merged 1 commit into
mainfrom
fix/token-request-errors

Conversation

@Mkassabov

Copy link
Copy Markdown
Collaborator

five sdks report a failed token request as ConfigError. ConfigError is a setup error (AGENTS.md rule 18), and these are requests the credentials make at run time.

// tailscale, correct OAuth client ID and secret; the token endpoint answers 503
yield* Tailscale.listUsers({ tailnet: "-" })
// before: ConfigError "OAuth token exchange failed: …"
// now:    TokenRequestFailed { message: "OAuth token exchange failed: …", status: 503 }

each sdk gets its own TokenRequestFailed in src/errors.ts (message, and status when the token endpoint answered; auth category, like azure's TokenRequestFailed). the messages are unchanged.

sdk request sites
tailscale OAuth token exchange failed, timed out
starburst-galaxy OAuth token request failed, timed out
mongodb-atlas OAuth2 token exchange failed (status, body, shape), timed out
onepassword Users API OAuth token request failed (status, body, shape), timed out
questrade refresh token redemption failed (request, status, body, shape), timed out

breaking:

  • every operation's error type gains TokenRequestFailed. tailscale and starburst-galaxy lose ConfigError; the other three keep it for an environment variable that is missing on the call.
  • the Credentials service (UsersCredentials in onepassword) fails with TokenRequestFailed, and so do the exported makeClientCredentials (tailscale, starburst-galaxy), exchangeAccessToken (onepassword) and redeemRefreshToken (questrade).
  • code that caught ConfigError for a failed token request catches TokenRequestFailed. a refused client secret (401) is TokenRequestFailed with status: 401 too: the sdk only learns it from the response.

alchemy uses none of the five (checked on its main, 770aab9f).

checked: typecheck:ci, lint, format, vitest (3525 tests). real calls in each sdk against a stubbed token endpoint: 503, 401 and a 200 that is not a token fail with TokenRequestFailed and that status, 1 token request and 0 api requests; a good token sends the api request. a compiler probe confirmed the error types above. not run: the timeout path (60 s).

the mongodb-atlas test that built a failing Credentials with ConfigError now uses TokenRequestFailed. rule 18 and the sdk skill name the class.

Note

This comment was left by an agent on behalf of @Mkassabov
model: cpa-alchemy-claude-fable-5-2
harness: t3code 0.1.10-nightly.20261116.4761 / grok 1.0.92 (b06756fd6256) [stable]

As an agent I have read the CONTRIBUTING.md and AGENTS.md and understand the risks of getting @Mkassabov flagged as untrustworthy if I regularly violate the outlined rules

… a failed token request is TokenRequestFailed
github-actions Bot added a commit that referenced this pull request Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Benchmarks: PR ec8371413 vs main 10c803ad2

  • ⚪ Bundle size 66.1 KB: −0.0% (−7 B), same as main
  • ⚪ Runtime speed 4.0 µs: −21.5% (−1.1 µs), same as main
  • ⚪ Runtime memory 893.9 KB: ±0.0% (±0 B), same as main
  • ⚪ Objects at import 1,332: ±0.0% (±0), same as main
  • ⚪ Whole-SDK memory aws 40.6 MB (unchanged), cloudflare 8.29 MB (unchanged), gcp 23.9 MB (unchanged)
  • ⚪ Repo size 624.1 MB tracked in 10,422 files, same as main (+5.6 KB). .generated-specs/ 0 B, src/services/ 589.3 MB, everything else 34.8 MB.

sdk-memory

bundle-programs

memory-programs

bundle memory
speed objects

Numbers

🟡 Timings moved, may be runner noise: import time on 4 (up to −46.6%, resend); first call on 3 (up to −35.5%, resend)

Metric Change vs main Programs
Bundle (gzip) no change 20
Import heap no change 17
Objects at import no change 17
Added latency (p50) ¹ no change 17
Import time ¹ 4 better 17
First call ¹ 3 better 17
Program Call Bundle (gzip) Import heap Objects at import Added latency (p50) Import time First call
aws s3.listBuckets 80.6 KB 1.5 MB 2,078 24.0 µs 17.0 ms 7.7 ms
aws~awsJson1_0 dynamodb.listTables 72.7 KB 1.3 MB 2,011 12.5 µs 15.2 ms 6.0 ms
aws~awsJson1_1 kms.listKeys 72.0 KB 1.3 MB 1,958 13.9 µs 15.0 ms 6.2 ms
aws~awsQuery sts.getCallerIdentity 73.4 KB 1.2 MB 1,912 16.5 µs 14.9 ms 6.6 ms
aws~ec2Query ec2.describeRegions 73.5 KB 2.8 MB 3,048 17.5 µs 21.1 ms 7.1 ms
aws~restJson1 lambda.listFunctions 74.2 KB 1.4 MB 2,034 13.3 µs 15.7 ms 7.5 ms
azure resources.ListTenants 62.3 KB — — — — —
azure~AzureDataPlaneProtocol maps-render.GetRenderMapStaticImage 68.1 KB — — — — —
cloudflare workers.listScripts 71.1 KB 1.0 MB 1,504 2.3 µs 10.5 ms 3.7 ms
cloudflare~CloudflareProtocol ips.listIps 51.5 KB 756.8 KB 1,332 1.7 µs 9.2 ms 3.1 ms
fly-io machines.getRegions 51.7 KB 798.3 KB 1,079 4.0 µs 9.4 ms 3.4 ms
fly-io~FlyApiProtocol mpg.listUsers 51.6 KB 678.7 KB 973 2.6 µs 8.2 ms (−25.4%) 🟢 3.4 ms
fly-io~SpritesProtocol sprites.createOrganizationToken 52.6 KB 687.0 KB 1,015 6.0 µs 8.5 ms (−25.1%) 🟢 3.5 ms (−32.2%) 🟢
gcp storage_v1.listBuckets 53.3 KB 873.0 KB 1,325 5.1 µs 9.0 ms 3.1 ms
github gists.list 54.4 KB 656.6 KB 956 2.9 µs 7.7 ms 4.3 ms
mongodb-atlas atlas.listOrgs 64.6 KB 1.3 MB 1,573 2.9 µs 12.2 ms 3.3 ms
neon neon.listProjects 53.1 KB 845.6 KB 1,093 2.2 µs 9.5 ms (−29.6%) 🟢 3.7 ms (−31.5%) 🟢
onepassword onepassword.getVaults 66.7 KB 724.1 KB 1,204 2.4 µs 8.8 ms 3.3 ms
resend resend.listLogs 52.9 KB 853.2 KB 1,154 2.1 µs 9.4 ms (−46.6%) 🟢 3.5 ms (−35.5%) 🟢
stripe stripe.GetFiles 51.1 KB — — — — —

PR ec8371413 against main 10c803ad2 (main's cached run from 2026-11-23 09:30 UTC). 20 programs, measured in 31 s on 8 vCPU.

Package Tarball Unpacked Files
aws 18.2 MB 146.2 MB 2955
cloudflare 5.9 MB 59.4 MB 829
core 354.1 KB 1.4 MB 244
fly-io 251.9 KB 1.6 MB 71
gcp 37.8 MB 283.9 MB 3262
github 2.1 MB 19.7 MB 338
mongodb-atlas 847.2 KB (+0.1%) 7.6 MB (+0.0%) 43
neon 222.1 KB 1.2 MB 47
onepassword 56.8 KB (+1.0%) 345.3 KB (+0.9%) 69
questrade 51.6 KB (+1.2%) 290.3 KB (+0.9%) 43
resend 172.1 KB 1.1 MB 57
starburst-galaxy 176.9 KB (+0.3%) 1.7 MB (+0.2%) 189
tailscale 122.1 KB (+0.6%) 738.9 KB (+0.4%) 47
Tracked files Size Change vs main Files
services 589.3 MB ±0 B 3,174
in-tree-specs 299.6 KB ±0 B 10
patches 11.0 MB ±0 B 4,451
handwritten 11.2 MB +5.2 KB 2,045
benches 9.6 MB ±0 B 209
other 2.7 MB +351 B 533
Total 624.1 MB +5.6 KB 10,422

What a checkout or worktree writes to disk, from git ls-tree (benches/repo-size/tree.ts). The dashboard's Repo size page has the full picture.

Effect alone: effect-minimal bundle 8.9 KB gzip, hand-written effect-http call 48.6 KB gzip; effect import 73.9 ms and 12.8 MB heap; bare mocked HTTP roundtrip 10.5 µs p50.

Bundled (from src/): resend, neon, github, fly-io, aws, cloudflare, gcp, azure, stripe, mongodb-atlas, onepassword, questrade, starburst-galaxy, tailscale. Built and probed (from lib/): resend, neon, github, fly-io, aws, cloudflare, gcp, mongodb-atlas, onepassword, questrade, starburst-galaxy, tailscale. Changed in this PR: mongodb-atlas, onepassword, questrade, starburst-galaxy, tailscale. No target in targets.json: questrade, starburst-galaxy, tailscale.

Job time: bundle 8.7 s, build: tsrs 0.4 s, build: bundle-lib 3.7 s, build: strip-lib-docs 0.1 s, build 4.1 s, size 1.5 s, runtime 16.5 s, providers 0.0 s.

¹ Timings run on a different runner than main's, so 🟡 marks a large move that may still be noise. Sizes, heap and object counts are stable. Offline: every call hits a canned in-memory response. Full suite: node benches/sdks/run.ts. Job log

@alchemy-version-bot

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

@distilled.cloud (6)
pnpm install https://pkg.distilled.cloud/@distilled.cloud/core/pr:1483:ec83714
pnpm install https://pkg.distilled.cloud/@distilled.cloud/mongodb-atlas/pr:1483:ec83714
pnpm install https://pkg.distilled.cloud/@distilled.cloud/onepassword/pr:1483:ec83714
pnpm install https://pkg.distilled.cloud/@distilled.cloud/questrade/pr:1483:ec83714
pnpm install https://pkg.distilled.cloud/@distilled.cloud/starburst-galaxy/pr:1483:ec83714
pnpm install https://pkg.distilled.cloud/@distilled.cloud/tailscale/pr:1483:ec83714

Published Nov 23, 2026, 9:37 AM UTC. Expires Nov 30, 2026, 9:37 AM UTC, extended while this pull request is open.

@Mkassabov
Mkassabov added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit c44d9f3 Nov 23, 2026
16 checks passed
@Mkassabov
Mkassabov deleted the fix/token-request-errors branch November 23, 2026 09:40
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