Repository navigation
Conversation
- Map an all-FORBIDDEN errors[] response (HTTP 200) to the `forbidden` error, same as an HTTP 403. It previously read as a generic "could not complete this request". - Append the server's error code to generic account-plane failures, and name the real cause in `environment_unresolved` instead of always blaming the network. - Send `teamProjectsV2` with only the fields the CLI reads. The catalog version pulled the full Environment fragment, so one failing resolver broke environment resolution for every env-scoped command. BREAKING CHANGE: `workos project list --json` environments now contain only id, name, sandbox and clientId instead of every raw backend field.
[Medium impact] The PR appears safe to merge, with no outstanding findings. SummaryThe PR reports account-plane permission refusals as
Reviews (3) · Last reviewed commit: "test: detect team projects catalog drift..." · Reviewed by Greptile |
|
We’re seeing similar symptoms on macOS with CLI v0.23.0 and v0.24.0: workos environment list --json
# graphql_error: The WorkOS account plane could not complete this request.
workos authkit redirect-uris list --environment-id <environment_id> --json
# environment_unresolvedThe second command fails even with an explicit environment ID, across two Staging environments. Additional checks:
|
| }); | ||
| }); |
There was a problem hiding this comment.
DOCUMENT_OVERRIDES.teamProjectsV2 is a second copy of the selection that catalog:vendor never refreshes. If the dashboard renames projectsV2/clientId/sandbox, the snapshot updates but the override keeps sending the old name, and since this query backs every env-scoped command the blast radius is the one this PR is shrinking. This test only compares the override to string literals, so CI wouldn't catch that.
Suggest a subset guard next to it. Passes today; fails with expected [ 'bogusField' ] to deeply equal [] when I inject a stray field into the override. loadManagementCatalog is already imported at the top of this file.
| }); | |
| }); | |
| }); | |
| // The override is a second copy of the selection that `catalog:vendor` never | |
| // refreshes: every name it sends must still exist in the vendored document. | |
| it('selects only fields the vendored catalog also selects', () => { | |
| const op = getOperation('teamProjectsV2'); | |
| const catalog = loadManagementCatalog(undefined, { includeFeatureFlagged: true }); | |
| const vendored = [op.document, ...op.fragmentNames.map((name) => catalog.fragments[name])].join('\n'); | |
| const vendoredNames = new Set(vendored.match(/\w+/g)); | |
| const drift = (resolveExecutableDocument(op).match(/\w+/g) ?? []).filter((name) => !vendoredNames.has(name)); | |
| expect(drift).toEqual([]); | |
| }); | |
| }); |
| const cause = | ||
| error instanceof DashboardGraphqlError ? `: ${dashboardErrorMessage(error)}` : ' (network or server error).'; | ||
| exitWithError({ | ||
| code: 'environment_unresolved', | ||
| message: `Could not resolve the target WorkOS environment (network or server error). Try again. ${remedies()}`, | ||
| message: `Could not resolve the target WorkOS environment${cause} Try again. ${remedies()}`, |
There was a problem hiding this comment.
nit: for a network_error, dashboardErrorMessage() already ends with "Check your connection and try again.", so this reads "…and try again. Try again. Pass --environment-id…". One option is to move the retry hint into the fallback branch (oxfmt-clean, both spec files still pass). Trade-off: a 5xx / graphql_error then relies on remedies() alone and loses the explicit "Try again." — fine to leave as-is if you'd rather keep that.
| const cause = | |
| error instanceof DashboardGraphqlError ? `: ${dashboardErrorMessage(error)}` : ' (network or server error).'; | |
| exitWithError({ | |
| code: 'environment_unresolved', | |
| message: `Could not resolve the target WorkOS environment (network or server error). Try again. ${remedies()}`, | |
| message: `Could not resolve the target WorkOS environment${cause} Try again. ${remedies()}`, | |
| const cause = | |
| error instanceof DashboardGraphqlError | |
| ? `: ${dashboardErrorMessage(error)}` | |
| : ' (network or server error). Try again.'; | |
| exitWithError({ | |
| code: 'environment_unresolved', | |
| message: `Could not resolve the target WorkOS environment${cause} ${remedies()}`, |
Riker-Verification: check
Riker-Verification: check
Riker-Verification: check
Prompted by agent feedback in #mcp-agent-feedback:
workos project listandorganization listfailed with "The WorkOS account plane could not complete this request." while MCPwhoamiworked for the same team.What was wrong
errors[].extensions.code: FORBIDDEN, but the client only recognizedUNAUTHENTICATED. A permission/capability refusal showed up as a generic server failure. Reproduced on my own account:mainprints the generic message, this branch printsforbidden.environment_unresolvedblamed "network or server error" for any failure.teamProjectsV2(used for environment resolution by every env-scoped command, plusproject list) selected the fullEnvironmentfragment: certificate expiry, custom domains, resource counts. If one of those resolvers fails for any environment, every command breaks for that team.Changes
FORBIDDENerrors[]→forbidden(403), same as HTTP 403. The forbidden copy now also mentions team role.graphql_errorcopy appends the server error code, e.g.(INTERNAL_SERVER_ERROR). Only clean uppercase identifiers are shown; aGRAPHQL_prefix is stripped and messages are never echoed (the no-graphql-leak gate covers this).environment_unresolvednames the account-plane failure instead of always saying network.teamProjectsV2is sent with onlyid,name,environments { id name sandbox clientId }, via an override inresolveExecutableDocument. The vendored snapshot is untouched and the operation name is kept, so the spec routing still matches.Breaking
workos project list --jsonenvironments now contain onlyid,name,sandbox,clientId. Before, it dumped raw backend fields with uncurated enum casing.Testing
bun run typecheck,bun run lint, andoxfmt --checkpasssrc/lib,src/catalog,src/commands: 2607 passedbun src/bin.ts project list --jsonagainst a team without the capability now returns{"error":{"code":"forbidden",...}}Riker job 365: Fix two review notes
(test -x node_modules/.bin/vitest || timeout 300 bun install --frozen-lockfile …passed on 2496021 (run 3)riker job 365·riker watch 365Verification: Riker's check passed on exactly this code. Head 2496021, 2026-11-23 17:02 UTC.