Skip to content

Send X-Arkor-Client during anonymous token bootstrap#43

Merged
soleil-colza merged 1 commit intomainfrom
eng-501
Apr 28, 2026
Merged

Send X-Arkor-Client during anonymous token bootstrap#43
soleil-colza merged 1 commit intomainfrom
eng-501

Conversation

@k-taro56
Copy link
Copy Markdown
Contributor

Summary

requestAnonymousToken was the one SDK call path that issued a raw fetch
instead of going through createClient(...), so it never set the
X-Arkor-Client: arkor/<version> header. The cloud API's SDK version gate
rejects header-less requests with 426 sdk_version_unsupported
(reason: "missing") — even while SUPPORTED_RANGE is *, by design, so
that pre-header SDK builds can't silently bypass policy during rollout.

End-to-end effect: on a fresh install with no ~/.arkor/credentials.json,
arkor dev fails to bootstrap an anonymous identity and exits with:

Error: Failed to acquire anonymous token (426): {"error":"sdk_version_unsupported","currentVersion":"unknown","supportedRange":"*","upgrade":"npm install -g arkor@latest","reason":"missing"}

This blocks the npm create arkorarkor dev happy path on every
machine that hasn't been onboarded yet.

Changes

  • packages/arkor/src/core/credentials.ts: add
    X-Arkor-Client: arkor/${SDK_VERSION} to the bootstrap fetch.
  • packages/arkor/src/core/credentials.test.ts: new requestAnonymousToken
    describe block covering (a) the header is present on the wire, (b) the
    response shape is mapped correctly, (c) non-2xx surfaces the status.

Test plan

  • pnpm --filter arkor test — green (12 files / 93 tests)
  • pnpm typecheck — clean workspace-wide
  • Manual: delete ~/.arkor/credentials.json, run arkor dev against a
    deployment with the gate enabled, confirm anonymous bootstrap completes
    and Studio reaches /api/credentials.

Follow-up

  • Cut a new arkor alpha so users unblocked by this fix can pnpm add arkor@alpha.
  • Consider a lint rule or test that fails if any /v1/* request in this
    package is built without going through createClient (would have caught
    this at PR time).

- Added tests for requestAnonymousToken to ensure correct behavior.
- Included X-Arkor-Client header in the request to the cloud API.
- Enhanced error handling for non-2xx responses.
@k-taro56 k-taro56 self-assigned this Apr 28, 2026
@k-taro56 k-taro56 added the bug Something isn't working label Apr 28, 2026
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

k-taro56 has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@soleil-colza soleil-colza self-requested a review April 28, 2026 13:57
@soleil-colza soleil-colza merged commit 51e7444 into main Apr 28, 2026
6 checks passed
@soleil-colza soleil-colza deleted the eng-501 branch April 28, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants