Conversation
Merge main into feat/device-fingerprint-header, combining: - Device identity headers and DEVICE_LIMIT_REACHED handling (HEAD) - Improved API error normalization and auth dedup (main) - Fix duplicate import and clearCredentials in team-key action Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19c6f8bc3a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/utils/device.ts
Outdated
| cachedDevice = created; | ||
|
|
||
| try { | ||
| await writeDeviceData(created); | ||
| } catch { |
There was a problem hiding this comment.
Persist stable device identity when file writes fail
If ~/.kodus/device.json cannot be written (common in read-only HOME/CI environments), this catch suppresses the failure and keeps only an in-memory random UUID, so each new CLI process generates a different deviceId. That causes repeated invocations to look like new devices and can quickly exhaust the organization's device limit for a single user.
Useful? React with 👍 / 👎.
src/services/api/api.real.ts
Outdated
| const errorData = isJson | ||
| ? await response.json().catch(() => ({ message: 'Request failed' })) as { message?: string } | ||
| ? await response.json().catch(() => ({ message: 'Request failed' })) as ApiErrorPayload | ||
| : { message: `Request failed with status ${response.status}` }; |
There was a problem hiding this comment.
Unwrap error payload before device-limit message mapping
This path forwards the raw JSON body as errorData without unwrapping the API envelope, so responses shaped like { data: { code: 'DEVICE_LIMIT_REACHED', ... } } will never hit the device-limit branch and will fall back to a generic auth message. That makes the new user-facing device-limit error handling depend on backend payload shape instead of working consistently.
Useful? React with 👍 / 👎.
|
This PR modifies code that uses the environment variable |
|
The pull request description is empty and does not reference a related issue. Please update the description to include a closing statement like 'Closes #123' or 'Fixes #456' to automatically link and close the corresponding issue upon merging. Kody Rule violation: Ensure PR closes referenced issues |
- Deduplicate concurrent getDeviceIdentity() calls via shared promise
to prevent generating multiple device IDs on startup
- Unwrap API error envelope ({ data: { code, ... } }) so
DEVICE_LIMIT_REACHED is detected consistently
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
The pull request description does not reference any issues. To improve tracking and context, please link this PR to the relevant issue by adding a closing statement like |
Prevents discarding a direct error message when the response has both a top-level message and a data object with unrelated context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
The pull request description does not contain a reference to a GitHub issue. Please add a closing statement like 'Closes #123' or 'Fixes #123' to automatically link and close the relevant issue upon merging. Kody Rule violation: Ensure PR closes referenced issues |
This pull request introduces a device fingerprinting mechanism and enhances authentication handling within the CLI.
Key changes include:
src/utils/device.ts) is added to generate, store, and retrieve a unique device ID and an associated device token. This information is persistently stored in~/.kodus/device.json.RealApiservice and theauth team-keycommand now includeX-Kodus-Device-IdandX-Kodus-Device-Tokenheaders, if available.x-kodus-device-tokenin API response headers and automatically updates the stored device token.DEVICE_LIMIT_REACHEDerrors, including details about active devices and the limit.