Conversation
📝 WalkthroughWalkthroughThe Claude extension adds hidden per-connection workspace configuration keys and an exported PROVIDER_ID. The inference manager now stores per-connection secrets (derived by PROVIDER_ID+id), updates/clears ChangesPer-connection Configuration and Secrets Management
Sequence Diagram(s)sequenceDiagram
participant Client
participant ClaudeInferenceManager
participant ConfigurationAPI
participant SecretStorage
Client->>ClaudeInferenceManager: registerInferenceProviderConnection({id, token, baseUrl?})
ClaudeInferenceManager->>SecretStorage: store per-connection token (PROVIDER_ID:id:token)
ClaudeInferenceManager->>ConfigurationAPI: update `claude.connection._type` = PROVIDER_ID
ClaudeInferenceManager->>ConfigurationAPI: update `claude.connection.token` = PROVIDER_ID:id:token
Client->>ClaudeInferenceManager: lifecycle.delete(id)
ClaudeInferenceManager->>ConfigurationAPI: unset `claude.connection._type` / `claude.connection.token`
ClaudeInferenceManager->>SecretStorage: delete per-connection token (PROVIDER_ID:id:token)
ClaudeInferenceManager->>ClaudeInferenceManager: remove in-memory connection and update legacy list
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@extensions/claude/src/manager/claude-inference-manager.ts`:
- Around line 109-111: The write path uses
configuration.getConfiguration(undefined, connection) while the clear path (and
package.json) expect the 'claude.connection' namespace; update the write calls
so configuration.getConfiguration('claude.connection', connection) is used
before calling config.update('_type', PROVIDER_ID) and config.update('token',
secretName) so both write and clear target the same namespace (refer to
configuration.getConfiguration, update('_type', PROVIDER_ID), update('token',
secretName), and the clear path using getConfiguration('claude.connection',
connection)).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 87dcdee6-75bc-4768-8ad6-462bcae22aac
📒 Files selected for processing (4)
extensions/claude/package.jsonextensions/claude/src/claude-extension.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: typecheck
- GitHub Check: macOS
- GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
- GitHub Check: unit tests / ubuntu-24.04
- GitHub Check: smoke-e2e-tests (dev) / ubuntu-24.04 (ollama)
- GitHub Check: Windows
- GitHub Check: unit tests / windows-2025
- GitHub Check: linter, formatters
- GitHub Check: unit tests / macos-15
- GitHub Check: Linux
🧰 Additional context used
📓 Path-based instructions (4)
extensions/*/package.json
📄 CodeRabbit inference engine (AGENTS.md)
extensions/*/package.json: Extensions must declareengines.kaidenversion compatibility in theirpackage.json
Extensionpackage.jsonmust havemainfield pointing to./dist/extension.js
Configuration properties for API keys, tokens, or secrets must use"format": "password"in the configuration definition to ensure input masking in the UI
Files:
extensions/claude/package.json
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use
/@/path aliases instead of relative paths for imports outside the current directory's module group; use relative imports only for sibling modules within the same directory
Files:
extensions/claude/src/claude-extension.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
extensions/*/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Register inference, container, and Kubernetes providers through the
ProviderRegistryvia extension APIs
Files:
extensions/claude/src/claude-extension.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
**/*.spec.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.spec.{ts,tsx,js,jsx}: Usetest()instead ofit()for test cases in Vitest unit tests
Usevi.mock(import('...'))for auto-mocking modules in unit tests; avoid manual mock factories when possible
Usevi.resetAllMocks()inbeforeEachhooks instead ofvi.clearAllMocks()for resetting mocks between tests
When an auto-mocked function or class method needs a real implementation, usevi.mocked(...)with the prototype pattern for class methods:vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)
Files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
🧠 Learnings (25)
📓 Common learnings
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:181-189
Timestamp: 2026-05-05T03:38:00.098Z
Learning: In the openkaiden/kaiden repository, the explicit design decision for `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) is: only non-secret runtime config flags (e.g. UV_SYSTEM_CERTS) are written as plaintext env vars to workspace.json for command/package-spawned MCPs. When a spawned MCP requires a secret env var, the planned approach is to route it through `kdn secret create` and write a secret reference (not the raw value) into workspace.json. This will be implemented in a separate follow-up PR.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2018
File: extensions/claude/src/manager/claude-inference-manager.ts:91-94
Timestamp: 2026-06-01T13:20:17.021Z
Learning: In the Claude extension (`extensions/claude/src/manager/claude-inference-manager.ts`), `removeConnection` intentionally filters stored `StoredConnection[]` records by token rather than by connection ID. This is safe because the `connections.has(tokenHash)` guard in `registerInferenceProviderConnection` throws if a duplicate token is already registered, making it impossible for two `StoredConnection` records with the same token to coexist in secret storage. Token-based removal is therefore equivalent to ID-based removal in practice. Do not flag this as a bug in future reviews.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1603
File: packages/renderer/src/lib/guided-setup/guided-setup-steps.ts:35-45
Timestamp: 2026-05-04T17:36:14.229Z
Learning: In openkaiden/kaiden, `OnboardingModelSelection` (packages/renderer/src/lib/guided-setup/guided-setup-steps.ts) intentionally omits `connectionName` because the Claude extension sets `connectionName` to the raw API key value. Persisting `connectionName` would write the raw API key to settings.json, which is a security risk. The `providerId + label` pair is sufficient for the CLI `--model` flag and for workspace creation; `connectionName` must not be re-added to this interface unless a safe (non-secret) identifier can be substituted.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:24.999Z
Learning: In the `openkaiden/kaiden` repository, cloud provider extensions (Gemini, Claude, Mistral, OpenAI-compatible, Vertex AI) use `ProviderConnectionStatus = 'unknown'` when registering inference provider connections. This means "connection was set up but is not continuously monitored." Only Ollama uses `'started'` because it actively polls a local server. Do not flag `'unknown'` status as incorrect for cloud provider extension connections in `extensions/*/src/*.ts`.
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:167-177
Timestamp: 2026-05-03T09:13:45.692Z
Learning: In the openkaiden/kaiden repository, URL-based (remote) MCPs that require API tokens use the secret manager (`SafeStorageRegistry`) for credential storage. Command/package-spawned MCPs (e.g., uvx, npx) generally do not require API keys, so their env vars (e.g., UV_SYSTEM_CERTS) are safely persisted in plaintext in workspace.json. Flagging plaintext env persistence in `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) as a security issue for command-based MCPs is not currently applicable, but may be worth a follow-up if command-based MCPs ever need secrets.
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to extensions/*/package.json : Configuration properties for API keys, tokens, or secrets must use `"format": "password"` in the configuration definition to ensure input masking in the UI
Applied to files:
extensions/claude/package.json
📚 Learning: 2026-06-01T13:20:17.021Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2018
File: extensions/claude/src/manager/claude-inference-manager.ts:91-94
Timestamp: 2026-06-01T13:20:17.021Z
Learning: In the Claude extension (`extensions/claude/src/manager/claude-inference-manager.ts`), `removeConnection` intentionally filters stored `StoredConnection[]` records by token rather than by connection ID. This is safe because the `connections.has(tokenHash)` guard in `registerInferenceProviderConnection` throws if a duplicate token is already registered, making it impossible for two `StoredConnection` records with the same token to coexist in secret storage. Token-based removal is therefore equivalent to ID-based removal in practice. Do not flag this as a bug in future reviews.
Applied to files:
extensions/claude/package.jsonextensions/claude/src/claude-extension.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-04T17:36:14.229Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1603
File: packages/renderer/src/lib/guided-setup/guided-setup-steps.ts:35-45
Timestamp: 2026-05-04T17:36:14.229Z
Learning: In openkaiden/kaiden, `OnboardingModelSelection` (packages/renderer/src/lib/guided-setup/guided-setup-steps.ts) intentionally omits `connectionName` because the Claude extension sets `connectionName` to the raw API key value. Persisting `connectionName` would write the raw API key to settings.json, which is a security risk. The `providerId + label` pair is sufficient for the CLI `--model` flag and for workspace creation; `connectionName` must not be re-added to this interface unless a safe (non-secret) identifier can be substituted.
Applied to files:
extensions/claude/package.jsonextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-17T20:26:32.946Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1379
File: packages/renderer/src/lib/models/models-utils.ts:11-20
Timestamp: 2026-04-17T20:26:32.946Z
Learning: In `packages/renderer/src/lib/models/models-utils.ts` (openkaiden/kaiden), `InferenceConnectionSummary.connectionType` is intentionally optional. It is only `undefined` for the single synthetic `'not-configured'` entry (emitted when a provider has `inferenceProviderConnectionCreation` but no active `inferenceConnections`). All consumers guard with optional chaining. A discriminated union was considered but deferred as unnecessary complexity for v1, since the invariant (`connectionType` is defined iff `status !== 'not-configured'`) is self-evident from the `status` field. Do not flag this as a type-safety issue.
Applied to files:
extensions/claude/package.jsonextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-05T17:30:24.999Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:24.999Z
Learning: In the `openkaiden/kaiden` repository, cloud provider extensions (Gemini, Claude, Mistral, OpenAI-compatible, Vertex AI) use `ProviderConnectionStatus = 'unknown'` when registering inference provider connections. This means "connection was set up but is not continuously monitored." Only Ollama uses `'started'` because it actively polls a local server. Do not flag `'unknown'` status as incorrect for cloud provider extension connections in `extensions/*/src/*.ts`.
Applied to files:
extensions/claude/package.jsonextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-06T11:29:33.170Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/package.json:9-11
Timestamp: 2026-05-06T11:29:33.170Z
Learning: In the openkaiden/kaiden repo, all built-in extensions under extensions/ should specify engines with kaiden: "^0.0.1" in package.json. Do not flag each extension individually; enforce a repo-wide alignment in a single PR. During reviews, verify that every extensions/*/package.json has "engines": { "kaiden": "^0.0.1" }. If a file deviates, surface the discrepancy as a single repo-wide task rather than per-file.
Applied to files:
extensions/claude/package.json
📚 Learning: 2026-05-05T17:30:20.418Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:20.418Z
Learning: In the openkaiden/kaiden repo, for cloud inference provider extension code under `extensions/*/src/*.ts`, treat `ProviderConnectionStatus = 'unknown'` as a valid/expected value when registering provider connections (e.g., Gemini/Claude/Mistral/OpenAI-compatible/Vertex AI). `'unknown'` indicates the connection was set up but is not continuously monitored—so do not flag it as incorrect. Only Ollama is expected to use `'started'` because it actively polls a local server.
Applied to files:
extensions/claude/src/claude-extension.ts
📚 Learning: 2026-04-17T20:27:11.322Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1379
File: packages/renderer/src/stores/model-catalog.ts:26-28
Timestamp: 2026-04-17T20:27:11.322Z
Learning: In `packages/renderer/src/stores/model-catalog.ts`, provider IDs used as the first component of `modelKey(providerId, label)` are always simple colon-free slug strings (e.g. `gemini`, `claude`, `openai`, `openshiftai`). The `:` separator in `modelKey` does not risk key collisions because provider IDs are guaranteed never to contain a colon by convention. Do not flag this as a collision risk in future reviews.
Applied to files:
extensions/claude/src/claude-extension.ts
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to extensions/*/src/**/*.{ts,tsx} : Register inference, container, and Kubernetes providers through the `ProviderRegistry` via extension APIs
Applied to files:
extensions/claude/src/claude-extension.ts
📚 Learning: 2026-05-05T17:44:50.991Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:363-387
Timestamp: 2026-05-05T17:44:50.991Z
Learning: In this repo (openkaiden/kaiden), do not raise a code review issue when an extension’s `InferenceProviderConnectionFactory.create` factory method implementation omits (or does not use) the optional `logger` and/or `CancellationToken` parameters in its method signature/implementation. Current extensions (e.g., Vertex AI, Gemini, Claude, Mistral, OpenAI-compatible) follow this pattern, so reviewers should treat it as acceptable for `extensions/*` TypeScript source files.
Applied to files:
extensions/claude/src/claude-extension.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-12T10:01:14.248Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1810
File: extensions/kdn/src/kdn-extension.ts:43-46
Timestamp: 2026-05-12T10:01:14.248Z
Learning: In this repo’s extension code, when logging from binary discovery/resolution logic (e.g., choosing/validating custom paths, extension storage locations, or bundled resource paths), it’s intentional to include full filesystem paths in `console.log`/`console.warn` (such as in `extensions/**/src/*-extension.ts`). During review, do not flag these specific full-path messages as a privacy/security issue as long as they are clearly part of the binary resolution steps. If full-path logging appears outside binary discovery/resolution, review/flag it as usual.
Applied to files:
extensions/claude/src/claude-extension.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-12T17:14:02.153Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1850
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte:66-70
Timestamp: 2026-05-12T17:14:02.153Z
Learning: When reviewing code that uses `AgentWorkspaceSummaryUI.runtime`, treat it as a required, non-null `string` per the `openkaiden/kdn-api` 0.12.0 schema. Therefore, code like `a.runtime.localeCompare(b.runtime)` is safe and should not trigger warnings about possible `undefined`/`null` values or suggestions to use nullish coalescing/optional chaining for `runtime` (unless the current local types still mark `runtime` as optional, indicating a schema/version mismatch).
Applied to files:
extensions/claude/src/claude-extension.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-23T04:28:25.544Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1417
File: extensions/kdn/vite.config.js:60-62
Timestamp: 2026-04-23T04:28:25.544Z
Learning: In openkaiden/kaiden, the `__mocks__/` directory (containing `vitest-generate-api-global-setup.ts` and `openkaiden/api.js`) lives at the repository root, NOT under `extensions/`. Extensions (e.g., `extensions/kdn`, `extensions/gemini`) use `join(PACKAGE_ROOT, '..', '..', '__mocks__', ...)` in their `vite.config.js` to correctly resolve to the repo-root `__mocks__/` folder. Do not flag this two-level-up path traversal as incorrect in future reviews.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-06-01T15:06:39.800Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2025
File: extensions/vertex-ai/src/vertex-ai.ts:166-170
Timestamp: 2026-06-01T15:06:39.800Z
Learning: In openkaiden/kaiden, the Vertex AI extension's `removeConnection` (previously `removeConnectionConfig`) intentionally removes stored entries by config hash rather than by persisted `id`. This is safe because `factory()` (line ~423) has an in-memory duplicate guard (`this.connections.has(this.getConfigHash(config))`) that rejects same-config calls before any `saveConnection` write occurs, making the hash-collision/race scenario impossible. Switching to ID-based removal is considered a future design improvement, not a correctness fix, and was explicitly scoped out of PR `#2025` (issue `#1942`).
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-20T14:31:10.155Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1396
File: packages/renderer/src/lib/guided-setup/CodingAgentStep.spec.ts:114-123
Timestamp: 2026-04-20T14:31:10.155Z
Learning: In `packages/renderer/src/lib/guided-setup/CodingAgentStep.spec.ts`, the team's convention is that a test's name plus its stub setup lines serve as sufficient documentation of intent; inline comments restating what the stubs do are considered redundant and are intentionally omitted. Do not flag the absence of such comments as a clarity issue.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-29T13:43:18.280Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2001
File: packages/main/src/plugin/provider-registry.ts:1966-1971
Timestamp: 2026-05-29T13:43:18.280Z
Learning: In `openkaiden/kaiden`, `getInferenceSDK`, `getInferenceConnectionType`, and `getInferenceConnectionEndpoint` in `packages/main/src/plugin/provider-registry.ts` intentionally resolve inference connections by `name` (not `id`), because downstream consumers (InferenceParameters, chat history DB) persist `connectionName` rather than `connectionId`. Migrating these helpers to id-based lookup is deferred to the storage format redesign epic (`#1917`). Do not flag these name-based lookups as issues in reviews until that epic is addressed.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to **/*.spec.{ts,tsx,js,jsx} : When an auto-mocked function or class method needs a real implementation, use `vi.mocked(...)` with the prototype pattern for class methods: `vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)`
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to **/*.spec.{ts,tsx,js,jsx} : Use `vi.resetAllMocks()` in `beforeEach` hooks instead of `vi.clearAllMocks()` for resetting mocks between tests
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to **/*.spec.{ts,tsx,js,jsx} : Use `vi.mock(import('...'))` for auto-mocking modules in unit tests; avoid manual mock factories when possible
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-04-20T14:30:15.867Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1396
File: packages/renderer/src/lib/guided-setup/CodingAgentStep.spec.ts:30-45
Timestamp: 2026-04-20T14:30:15.867Z
Learning: In `packages/renderer/src/lib/guided-setup/CodingAgentStep.spec.ts`, the `stubOllama` helper intentionally only re-stubs `fetch` and relies on `beforeEach`'s `stubRamalama(false)` call to keep `getProviderInfos` in place. This is a deliberate standard Vitest `beforeEach` + per-test override pattern. Do not flag the implicit dependency between `stubOllama` and the `beforeEach` ramalama stub as a robustness issue.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-04-15T08:51:09.866Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1336
File: packages/renderer/src/lib/guided-setup/GuidedSetup.spec.ts:64-69
Timestamp: 2026-04-15T08:51:09.866Z
Learning: In `packages/renderer/src/**/*.spec.ts` files that use `render` from `testing-library/svelte` (Svelte component tests), `vi.useFakeTimers({ shouldAdvanceTime: true })` must be called inside `beforeEach`. This is a required coding guideline for all Svelte component tests in this repo: it prevents flaky behavior caused by Svelte's internal tick scheduling, regardless of whether individual tests explicitly manipulate timers. Do not flag or suggest removing this call.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-03T09:13:45.692Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:167-177
Timestamp: 2026-05-03T09:13:45.692Z
Learning: In the openkaiden/kaiden repository, URL-based (remote) MCPs that require API tokens use the secret manager (`SafeStorageRegistry`) for credential storage. Command/package-spawned MCPs (e.g., uvx, npx) generally do not require API keys, so their env vars (e.g., UV_SYSTEM_CERTS) are safely persisted in plaintext in workspace.json. Flagging plaintext env persistence in `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) as a security issue for command-based MCPs is not currently applicable, but may be worth a follow-up if command-based MCPs ever need secrets.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-04-30T12:38:39.371Z
Learnt from: jeffmaury
Repo: openkaiden/kaiden PR: 1524
File: extensions/openshift-ai/src/openshiftai.ts:233-235
Timestamp: 2026-04-30T12:38:39.371Z
Learning: In `extensions/openshift-ai/src/openshiftai.ts` (openkaiden/kaiden), `getInferenceServices()` intentionally swallows all API/auth/network exceptions and returns `[]`. This is by design: a cluster may restrict visibility of certain resources via RBAC, so an empty result is a valid unified signal for both "no inference services exist" and "no inference services are visible to this user." Do not flag this error-swallowing as hiding failures — the caller (`registerInferenceProviderConnection`) then throws a meaningful error when `connectionInfos.length === 0`.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-13T15:59:29.742Z
Learnt from: jeffmaury
Repo: openkaiden/kaiden PR: 1295
File: packages/extension-api/src/extension-api.d.ts:651-651
Timestamp: 2026-04-13T15:59:29.742Z
Learning: In the openkaiden/kaiden repository, the project relies on TypeScript's static type checking (not runtime validation) to enforce type correctness for `InferenceProviderConnection.type` (`InferenceProviderConnectionType`). Runtime normalization/validation guards for this field are not needed or desired.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
🔇 Additional comments (2)
extensions/claude/package.json (1)
29-40: LGTM!extensions/claude/src/claude-extension.ts (1)
27-27: LGTM!Also applies to: 54-54
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| await this.secrets.store(secretName, token); | ||
|
|
||
| const config = configuration.getConfiguration(undefined, connection); | ||
| await config.update('_type', PROVIDER_ID); |
There was a problem hiding this comment.
issue: should be the whole property name
|
|
||
| const config = configuration.getConfiguration(undefined, connection); | ||
| await config.update('_type', PROVIDER_ID); | ||
| await config.update('token', secretName); |
| await this.secrets.delete(secretName); | ||
|
|
||
| const config = configuration.getConfiguration('claude.connection', connection); | ||
| await config.update('_type', undefined); |
|
|
||
| const config = configuration.getConfiguration('claude.connection', connection); | ||
| await config.update('_type', undefined); | ||
| await config.update('token', undefined); |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
extensions/claude/src/manager/claude-inference-manager.spec.ts (1)
322-338: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider asserting
_typeconfiguration for each restored connection.The test restores two connections but only asserts
claude.connection._typeonce. WhiletoHaveBeenCalledWithverifies the call happened, it doesn't confirm it was called for both connections. This could mask a regression where only one connection's_typegets set.♻️ Suggested improvement
expect(SECRET_STORAGE_MOCK.store).toHaveBeenCalledWith(`${PROVIDER_ID}:id-1:token`, 'key1'); expect(SECRET_STORAGE_MOCK.store).toHaveBeenCalledWith(`${PROVIDER_ID}:id-2:token`, 'key2'); - expect(CONFIG_UPDATE_MOCK).toHaveBeenCalledWith('claude.connection._type', PROVIDER_ID); + // Verify _type is set for both connections + expect(CONFIG_UPDATE_MOCK).toHaveBeenCalledWith('claude.connection._type', PROVIDER_ID); + // Called twice (once per connection) + expect(CONFIG_UPDATE_MOCK.mock.calls.filter( + ([key, val]) => key === 'claude.connection._type' && val === PROVIDER_ID + )).toHaveLength(2); expect(CONFIG_UPDATE_MOCK).toHaveBeenCalledWith('claude.connection.token', `${PROVIDER_ID}:id-1:token`); expect(CONFIG_UPDATE_MOCK).toHaveBeenCalledWith('claude.connection.token', `${PROVIDER_ID}:id-2:token`);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@extensions/claude/src/manager/claude-inference-manager.spec.ts` around lines 322 - 338, The test currently only verifies one call to set 'claude.connection._type' but restores two connections; update the assertions for CONFIG_UPDATE_MOCK so the _type config is validated for each restored connection (e.g., assert CONFIG_UPDATE_MOCK was called twice for 'claude.connection._type' with PROVIDER_ID or use toHaveBeenNthCalledWith / filter the mock.calls to confirm two entries), referencing the existing test flow around manager.init(), CONFIG_UPDATE_MOCK, and PROVIDER_ID to locate where to add/replace the assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@extensions/claude/src/manager/claude-inference-manager.spec.ts`:
- Around line 322-338: The test currently only verifies one call to set
'claude.connection._type' but restores two connections; update the assertions
for CONFIG_UPDATE_MOCK so the _type config is validated for each restored
connection (e.g., assert CONFIG_UPDATE_MOCK was called twice for
'claude.connection._type' with PROVIDER_ID or use toHaveBeenNthCalledWith /
filter the mock.calls to confirm two entries), referencing the existing test
flow around manager.init(), CONFIG_UPDATE_MOCK, and PROVIDER_ID to locate where
to add/replace the assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0fb7abfd-e7bd-4f66-8127-a8c3ff3d837d
📒 Files selected for processing (2)
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: smoke-e2e-tests (dev) / ubuntu-24.04 (ollama)
- GitHub Check: macOS
- GitHub Check: smoke-e2e-tests (prod) / ubuntu-24.04 (ollama)
- GitHub Check: linter, formatters
- GitHub Check: unit tests / ubuntu-24.04
- GitHub Check: Windows
- GitHub Check: Linux
- GitHub Check: typecheck
- GitHub Check: unit tests / windows-2025
- GitHub Check: unit tests / macos-15
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use
/@/path aliases instead of relative paths for imports outside the current directory's module group; use relative imports only for sibling modules within the same directory
Files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
**/*.spec.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.spec.{ts,tsx,js,jsx}: Usetest()instead ofit()for test cases in Vitest unit tests
Usevi.mock(import('...'))for auto-mocking modules in unit tests; avoid manual mock factories when possible
Usevi.resetAllMocks()inbeforeEachhooks instead ofvi.clearAllMocks()for resetting mocks between tests
When an auto-mocked function or class method needs a real implementation, usevi.mocked(...)with the prototype pattern for class methods:vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)
Files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
extensions/*/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Register inference, container, and Kubernetes providers through the
ProviderRegistryvia extension APIs
Files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
🧠 Learnings (23)
📓 Common learnings
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2093
File: extensions/claude/src/manager/claude-inference-manager.ts:109-111
Timestamp: 2026-06-08T14:22:17.045Z
Learning: In openkaiden/kaiden, cloud provider inference manager extensions (e.g., Mistral at `extensions/mistral/src/manager/mistral-inference-manager.ts`, Claude at `extensions/claude/src/manager/claude-inference-manager.ts`) intentionally use `configuration.getConfiguration(undefined, connection)` for the write path (setConnectionConfiguration) and `configuration.getConfiguration('<provider>.connection', connection)` for the clear path (clearConnectionConfiguration). The `connection` parameter provides the namespace scoping on the write path; the explicit namespace string on the clear path is required to correctly clear the persisted keys. Do not flag this asymmetry as a bug in future reviews.
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:181-189
Timestamp: 2026-05-05T03:38:00.098Z
Learning: In the openkaiden/kaiden repository, the explicit design decision for `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) is: only non-secret runtime config flags (e.g. UV_SYSTEM_CERTS) are written as plaintext env vars to workspace.json for command/package-spawned MCPs. When a spawned MCP requires a secret env var, the planned approach is to route it through `kdn secret create` and write a secret reference (not the raw value) into workspace.json. This will be implemented in a separate follow-up PR.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2018
File: extensions/claude/src/manager/claude-inference-manager.ts:91-94
Timestamp: 2026-06-01T13:20:17.021Z
Learning: In the Claude extension (`extensions/claude/src/manager/claude-inference-manager.ts`), `removeConnection` intentionally filters stored `StoredConnection[]` records by token rather than by connection ID. This is safe because the `connections.has(tokenHash)` guard in `registerInferenceProviderConnection` throws if a duplicate token is already registered, making it impossible for two `StoredConnection` records with the same token to coexist in secret storage. Token-based removal is therefore equivalent to ID-based removal in practice. Do not flag this as a bug in future reviews.
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:167-177
Timestamp: 2026-05-03T09:17:22.271Z
Learning: In the openkaiden/kaiden repository, command-based (package-spawned) MCPs like `kubernetes-mcp-server` (containers/kubernetes-mcp-server) may fail inside devcontainer workspaces with "invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable" because no kubeconfig is available at `~/.kube/config` inside the container. The fix is to pass a `KUBECONFIG` env var or `--kubeconfig` flag via the MCP command spec's `env`/`args` fields in workspace.json. This is a motivating example for extending command-based MCP env var support in `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts).
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:167-177
Timestamp: 2026-05-03T09:13:45.692Z
Learning: In the openkaiden/kaiden repository, URL-based (remote) MCPs that require API tokens use the secret manager (`SafeStorageRegistry`) for credential storage. Command/package-spawned MCPs (e.g., uvx, npx) generally do not require API keys, so their env vars (e.g., UV_SYSTEM_CERTS) are safely persisted in plaintext in workspace.json. Flagging plaintext env persistence in `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) as a security issue for command-based MCPs is not currently applicable, but may be worth a follow-up if command-based MCPs ever need secrets.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1603
File: packages/renderer/src/lib/guided-setup/GuidedSetup.svelte:54-68
Timestamp: 2026-05-04T17:38:39.097Z
Learning: In openkaiden/kaiden's guided-setup Svelte UI (`GuidedSetup.svelte`), the `vertexConfig.credentialsDir` field (previously `credentialsPath`) always holds a **directory** path (selected via the OS `openDirectory` picker, labelled "Google Cloud credentials directory"). When building workspace mounts for the `claude-vertex` agent, mounting `credentialsDir` → `$HOME/.config/gcloud` (read-only, directory-to-directory) is intentional: Claude Code on Vertex requires the full ADC directory (not just `application_default_credentials.json`) because it relies on additional auxiliary config files alongside the ADC JSON. Do not flag or suggest narrowing this mount to only the single ADC file path.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1603
File: packages/renderer/src/lib/guided-setup/guided-setup-steps.ts:35-45
Timestamp: 2026-05-04T17:36:14.229Z
Learning: In openkaiden/kaiden, `OnboardingModelSelection` (packages/renderer/src/lib/guided-setup/guided-setup-steps.ts) intentionally omits `connectionName` because the Claude extension sets `connectionName` to the raw API key value. Persisting `connectionName` would write the raw API key to settings.json, which is a security risk. The `providerId + label` pair is sufficient for the CLI `--model` flag and for workspace creation; `connectionName` must not be re-added to this interface unless a safe (non-secret) identifier can be substituted.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:24.999Z
Learning: In the `openkaiden/kaiden` repository, cloud provider extensions (Gemini, Claude, Mistral, OpenAI-compatible, Vertex AI) use `ProviderConnectionStatus = 'unknown'` when registering inference provider connections. This means "connection was set up but is not continuously monitored." Only Ollama uses `'started'` because it actively polls a local server. Do not flag `'unknown'` status as incorrect for cloud provider extension connections in `extensions/*/src/*.ts`.
📚 Learning: 2026-06-01T13:20:17.021Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2018
File: extensions/claude/src/manager/claude-inference-manager.ts:91-94
Timestamp: 2026-06-01T13:20:17.021Z
Learning: In the Claude extension (`extensions/claude/src/manager/claude-inference-manager.ts`), `removeConnection` intentionally filters stored `StoredConnection[]` records by token rather than by connection ID. This is safe because the `connections.has(tokenHash)` guard in `registerInferenceProviderConnection` throws if a duplicate token is already registered, making it impossible for two `StoredConnection` records with the same token to coexist in secret storage. Token-based removal is therefore equivalent to ID-based removal in practice. Do not flag this as a bug in future reviews.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-06-08T14:22:17.045Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2093
File: extensions/claude/src/manager/claude-inference-manager.ts:109-111
Timestamp: 2026-06-08T14:22:17.045Z
Learning: In openkaiden/kaiden, cloud provider inference manager extensions (e.g., Mistral at `extensions/mistral/src/manager/mistral-inference-manager.ts`, Claude at `extensions/claude/src/manager/claude-inference-manager.ts`) intentionally use `configuration.getConfiguration(undefined, connection)` for the write path (setConnectionConfiguration) and `configuration.getConfiguration('<provider>.connection', connection)` for the clear path (clearConnectionConfiguration). The `connection` parameter provides the namespace scoping on the write path; the explicit namespace string on the clear path is required to correctly clear the persisted keys. Do not flag this asymmetry as a bug in future reviews.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-06-01T15:06:39.800Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2025
File: extensions/vertex-ai/src/vertex-ai.ts:166-170
Timestamp: 2026-06-01T15:06:39.800Z
Learning: In openkaiden/kaiden, the Vertex AI extension's `removeConnection` (previously `removeConnectionConfig`) intentionally removes stored entries by config hash rather than by persisted `id`. This is safe because `factory()` (line ~423) has an in-memory duplicate guard (`this.connections.has(this.getConfigHash(config))`) that rejects same-config calls before any `saveConnection` write occurs, making the hash-collision/race scenario impossible. Switching to ID-based removal is considered a future design improvement, not a correctness fix, and was explicitly scoped out of PR `#2025` (issue `#1942`).
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-29T13:43:18.280Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2001
File: packages/main/src/plugin/provider-registry.ts:1966-1971
Timestamp: 2026-05-29T13:43:18.280Z
Learning: In `openkaiden/kaiden`, `getInferenceSDK`, `getInferenceConnectionType`, and `getInferenceConnectionEndpoint` in `packages/main/src/plugin/provider-registry.ts` intentionally resolve inference connections by `name` (not `id`), because downstream consumers (InferenceParameters, chat history DB) persist `connectionName` rather than `connectionId`. Migrating these helpers to id-based lookup is deferred to the storage format redesign epic (`#1917`). Do not flag these name-based lookups as issues in reviews until that epic is addressed.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-23T04:28:25.544Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1417
File: extensions/kdn/vite.config.js:60-62
Timestamp: 2026-04-23T04:28:25.544Z
Learning: In openkaiden/kaiden, the `__mocks__/` directory (containing `vitest-generate-api-global-setup.ts` and `openkaiden/api.js`) lives at the repository root, NOT under `extensions/`. Extensions (e.g., `extensions/kdn`, `extensions/gemini`) use `join(PACKAGE_ROOT, '..', '..', '__mocks__', ...)` in their `vite.config.js` to correctly resolve to the repo-root `__mocks__/` folder. Do not flag this two-level-up path traversal as incorrect in future reviews.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-04T17:36:14.229Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1603
File: packages/renderer/src/lib/guided-setup/guided-setup-steps.ts:35-45
Timestamp: 2026-05-04T17:36:14.229Z
Learning: In openkaiden/kaiden, `OnboardingModelSelection` (packages/renderer/src/lib/guided-setup/guided-setup-steps.ts) intentionally omits `connectionName` because the Claude extension sets `connectionName` to the raw API key value. Persisting `connectionName` would write the raw API key to settings.json, which is a security risk. The `providerId + label` pair is sufficient for the CLI `--model` flag and for workspace creation; `connectionName` must not be re-added to this interface unless a safe (non-secret) identifier can be substituted.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-13T09:26:42.026Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1858
File: packages/renderer/src/lib/secret-vault/columns/SecretVaultActions.spec.ts:70-79
Timestamp: 2026-05-13T09:26:42.026Z
Learning: In `packages/renderer/src/lib/secret-vault/columns/SecretVaultActions.spec.ts` (and the parallel `SecretVaultDetails.spec.ts`), when testing that a cancel response from a mocked `window.showMessageBox` (resolving with `{ response: 1 }`) prevents `window.removeSecret` from being called, it is correct and sufficient to assert directly after `await fireEvent.click(removeButton)` without wrapping in `waitFor`. `fireEvent.click` is wrapped in `act()` by Testing Library, which flushes the microtask queue including the resolved mock promise, so the confirmation logic completes before the assertion runs. Do not flag this pattern as potentially flaky or suggest adding `waitFor` around the negative assertion.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-05T17:30:24.999Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:24.999Z
Learning: In the `openkaiden/kaiden` repository, cloud provider extensions (Gemini, Claude, Mistral, OpenAI-compatible, Vertex AI) use `ProviderConnectionStatus = 'unknown'` when registering inference provider connections. This means "connection was set up but is not continuously monitored." Only Ollama uses `'started'` because it actively polls a local server. Do not flag `'unknown'` status as incorrect for cloud provider extension connections in `extensions/*/src/*.ts`.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-20T14:30:15.867Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1396
File: packages/renderer/src/lib/guided-setup/CodingAgentStep.spec.ts:30-45
Timestamp: 2026-04-20T14:30:15.867Z
Learning: In `packages/renderer/src/lib/guided-setup/CodingAgentStep.spec.ts`, the `stubOllama` helper intentionally only re-stubs `fetch` and relies on `beforeEach`'s `stubRamalama(false)` call to keep `getProviderInfos` in place. This is a deliberate standard Vitest `beforeEach` + per-test override pattern. Do not flag the implicit dependency between `stubOllama` and the `beforeEach` ramalama stub as a robustness issue.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-05T17:44:50.991Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:363-387
Timestamp: 2026-05-05T17:44:50.991Z
Learning: In this repo (openkaiden/kaiden), do not raise a code review issue when an extension’s `InferenceProviderConnectionFactory.create` factory method implementation omits (or does not use) the optional `logger` and/or `CancellationToken` parameters in its method signature/implementation. Current extensions (e.g., Vertex AI, Gemini, Claude, Mistral, OpenAI-compatible) follow this pattern, so reviewers should treat it as acceptable for `extensions/*` TypeScript source files.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-12T10:01:14.248Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1810
File: extensions/kdn/src/kdn-extension.ts:43-46
Timestamp: 2026-05-12T10:01:14.248Z
Learning: In this repo’s extension code, when logging from binary discovery/resolution logic (e.g., choosing/validating custom paths, extension storage locations, or bundled resource paths), it’s intentional to include full filesystem paths in `console.log`/`console.warn` (such as in `extensions/**/src/*-extension.ts`). During review, do not flag these specific full-path messages as a privacy/security issue as long as they are clearly part of the binary resolution steps. If full-path logging appears outside binary discovery/resolution, review/flag it as usual.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-12T17:14:02.153Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1850
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte:66-70
Timestamp: 2026-05-12T17:14:02.153Z
Learning: When reviewing code that uses `AgentWorkspaceSummaryUI.runtime`, treat it as a required, non-null `string` per the `openkaiden/kdn-api` 0.12.0 schema. Therefore, code like `a.runtime.localeCompare(b.runtime)` is safe and should not trigger warnings about possible `undefined`/`null` values or suggestions to use nullish coalescing/optional chaining for `runtime` (unless the current local types still mark `runtime` as optional, indicating a schema/version mismatch).
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-06-08T14:22:17.045Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2093
File: extensions/claude/src/manager/claude-inference-manager.ts:109-111
Timestamp: 2026-06-08T14:22:17.045Z
Learning: In provider inference manager extensions (e.g., Mistral/Claude), the `configuration.getConfiguration(...)` argument is intentionally asymmetric:
- For `setConnectionConfiguration`, call `configuration.getConfiguration(undefined, connection)` and rely on the `connection` parameter to apply namespace scoping.
- For `clearConnectionConfiguration`, call `configuration.getConfiguration('<provider>.connection', connection)` (using the explicit provider namespace string) so the persisted keys are cleared correctly.
In future reviews, do not flag this `undefined` vs explicit namespace difference as a bug; it is required for correct write-vs-clear behavior.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-17T20:26:32.946Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1379
File: packages/renderer/src/lib/models/models-utils.ts:11-20
Timestamp: 2026-04-17T20:26:32.946Z
Learning: In `packages/renderer/src/lib/models/models-utils.ts` (openkaiden/kaiden), `InferenceConnectionSummary.connectionType` is intentionally optional. It is only `undefined` for the single synthetic `'not-configured'` entry (emitted when a provider has `inferenceProviderConnectionCreation` but no active `inferenceConnections`). All consumers guard with optional chaining. A discriminated union was considered but deferred as unnecessary complexity for v1, since the invariant (`connectionType` is defined iff `status !== 'not-configured'`) is self-evident from the `status` field. Do not flag this as a type-safety issue.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-30T12:38:39.371Z
Learnt from: jeffmaury
Repo: openkaiden/kaiden PR: 1524
File: extensions/openshift-ai/src/openshiftai.ts:233-235
Timestamp: 2026-04-30T12:38:39.371Z
Learning: In `extensions/openshift-ai/src/openshiftai.ts` (openkaiden/kaiden), `getInferenceServices()` intentionally swallows all API/auth/network exceptions and returns `[]`. This is by design: a cluster may restrict visibility of certain resources via RBAC, so an empty result is a valid unified signal for both "no inference services exist" and "no inference services are visible to this user." Do not flag this error-swallowing as hiding failures — the caller (`registerInferenceProviderConnection`) then throws a meaningful error when `connectionInfos.length === 0`.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-13T15:59:29.742Z
Learnt from: jeffmaury
Repo: openkaiden/kaiden PR: 1295
File: packages/extension-api/src/extension-api.d.ts:651-651
Timestamp: 2026-04-13T15:59:29.742Z
Learning: In the openkaiden/kaiden repository, the project relies on TypeScript's static type checking (not runtime validation) to enforce type correctness for `InferenceProviderConnection.type` (`InferenceProviderConnectionType`). Runtime normalization/validation guards for this field are not needed or desired.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to extensions/*/src/**/*.{ts,tsx} : Register inference, container, and Kubernetes providers through the `ProviderRegistry` via extension APIs
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-03T09:13:45.692Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:167-177
Timestamp: 2026-05-03T09:13:45.692Z
Learning: In the openkaiden/kaiden repository, URL-based (remote) MCPs that require API tokens use the secret manager (`SafeStorageRegistry`) for credential storage. Command/package-spawned MCPs (e.g., uvx, npx) generally do not require API keys, so their env vars (e.g., UV_SYSTEM_CERTS) are safely persisted in plaintext in workspace.json. Flagging plaintext env persistence in `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) as a security issue for command-based MCPs is not currently applicable, but may be worth a follow-up if command-based MCPs ever need secrets.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-20T15:05:12.921Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1396
File: packages/renderer/src/lib/guided-setup/CodingAgentStep.svelte:54-65
Timestamp: 2026-04-20T15:05:12.921Z
Learning: In `packages/renderer/src/lib/guided-setup/CodingAgentStep.svelte`, the `$effect` block unconditionally writes all credential/vertex fields (`anthropicApiKey`, `vertexProjectId`, `vertexRegion`, `vertexMountGcloud`, `vertexMountClaudeConfig`) into the `onboarding` object regardless of `selectedVariant`. This is intentional: (1) only `onboarding.agent` is persisted today (to `settings.json` via `window.updateConfigurationValue`); all credential fields are ephemeral in-memory and discarded when the wizard closes, so leaving them populated is harmless. (2) Preserving inputs across variant switches is a deliberate UX decision to avoid data loss on accidental clicks. Variant-scoped filtering will be added in the follow-up agents.json IPC work. Do not flag the unconditional credential mirroring as a bug or suggest clearing fields on variant switch until that IPC work lands.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-05T03:38:00.098Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:181-189
Timestamp: 2026-05-05T03:38:00.098Z
Learning: In the openkaiden/kaiden repository, the explicit design decision for `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) is: only non-secret runtime config flags (e.g. UV_SYSTEM_CERTS) are written as plaintext env vars to workspace.json for command/package-spawned MCPs. When a spawned MCP requires a secret env var, the planned approach is to route it through `kdn secret create` and write a secret reference (not the raw value) into workspace.json. This will be implemented in a separate follow-up PR.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-30T12:44:46.782Z
Learnt from: fbricon
Repo: openkaiden/kaiden PR: 1509
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:103-112
Timestamp: 2026-04-30T12:44:46.782Z
Learning: In `packages/main/src/plugin/kdn-cli/kdn-cli.ts` (`createWorkspace`), silently skipping `--model` with a `console.warn` when `options.model` does not start with `ollama::` or `ramalama::` is intentional and temporary. This is because only OpenCode currently supports that scheme for local runtimes; broader support is tracked in openkaiden/kdn#354. Do not flag this as a silent-failure bug or suggest throwing an error in future reviews.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-30T12:45:43.072Z
Learnt from: fbricon
Repo: openkaiden/kaiden PR: 1509
File: packages/api/src/agent-workspace-info.ts:53-53
Timestamp: 2026-04-30T12:45:43.072Z
Learning: In `packages/api/src/agent-workspace-info.ts`, the `model` field on `AgentWorkspaceCreateOptions` is intentionally typed as `model?: string` (not a narrowed template-literal type). The current CLI-side filtering (only forwarding `ollama::` / `ramalama::` prefixes) in `kdn-cli.ts` is a temporary measure until broader agent support lands (tracked in openkaiden/kdn#354). Do not suggest narrowing this type to a union or template-literal type in future reviews.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
🔇 Additional comments (4)
extensions/claude/src/manager/claude-inference-manager.ts (2)
109-112: LGTM!
114-121: LGTM!extensions/claude/src/manager/claude-inference-manager.spec.ts (2)
283-292: LGTM!
302-320: LGTM!
Store per-connection secrets and configuration entries (provider type and token reference) so agent workspaces can resolve Claude credentials, matching the pattern already used by Mistral and OpenAI extensions. Closes openkaiden#1841 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
The write and clear paths used short keys (_type, token) which resolved incorrectly when getConfiguration was called without a section prefix, causing configuration entries to be stored under wrong keys. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
ea05f6c to
0e3a965
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
extensions/claude/src/manager/claude-inference-manager.spec.ts (1)
34-40:⚠️ Potential issue | 🟡 MinorReplace manual
node:cryptomock factory with auto-mock
extensions/claude/src/manager/claude-inference-manager.spec.tscurrently uses a customvi.mock(import('node:crypto'), async importOriginal => ...)factory solely to overriderandomUUID, but the test already setsrandomUUIDinbeforeEachviavi.mocked(randomUUID).mockReturnValue(...). Switch to plainvi.mock(import('node:crypto'))and keep thebeforeEachvi.mocked(randomUUID)override to align with the repo’s “avoid manual mock factories when possible” guideline.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@extensions/claude/src/manager/claude-inference-manager.spec.ts` around lines 34 - 40, Replace the manual mock factory for node:crypto in claude-inference-manager.spec.ts with a plain auto-mock: change the vi.mock(import('node:crypto'), async importOriginal => {...}) call to simply vi.mock(import('node:crypto')), and rely on the existing beforeEach that calls vi.mocked(randomUUID).mockReturnValue(...) to set randomUUID; ensure the test still imports randomUUID from 'node:crypto' so the beforeEach stub applies.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@extensions/claude/src/manager/claude-inference-manager.ts`:
- Around line 174-179: The delete and registration flows are not failure-safe;
wrap operations in try/catch/finally so dispose, this.connections.delete(id) and
persistent removals always run (or rollback) even if setConnectionConfiguration
or clearConnectionConfiguration throws. For registration (where
setConnectionConfiguration is called), if setConnectionConfiguration fails after
adding the connection to this.connections and persisting, catch the error and
rollback by disposing the instance, deleting from this.connections and removing
any persisted entry via removeConnection, then rethrow. For delete (the delete:
async method and the similar blocks at lines referenced), perform
clearConnectionConfiguration inside try, but move dispose +
this.connections.delete(id) + await removeConnection(id) into a finally block so
cleanup always occurs; if you need to surface the original error, capture it and
rethrow after final cleanup. Ensure these changes are applied to the other
similar blocks (the registration block around setConnectionConfiguration and the
other delete blocks at the referenced locations).
---
Outside diff comments:
In `@extensions/claude/src/manager/claude-inference-manager.spec.ts`:
- Around line 34-40: Replace the manual mock factory for node:crypto in
claude-inference-manager.spec.ts with a plain auto-mock: change the
vi.mock(import('node:crypto'), async importOriginal => {...}) call to simply
vi.mock(import('node:crypto')), and rely on the existing beforeEach that calls
vi.mocked(randomUUID).mockReturnValue(...) to set randomUUID; ensure the test
still imports randomUUID from 'node:crypto' so the beforeEach stub applies.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1e7e4649-cbcd-4efc-825d-e6b35e557a8f
📒 Files selected for processing (4)
extensions/claude/package.jsonextensions/claude/src/claude-extension.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/manager/claude-inference-manager.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (4)
extensions/*/package.json
📄 CodeRabbit inference engine (AGENTS.md)
extensions/*/package.json: Extensions must declareengines.kaidenversion compatibility in theirpackage.json
Extensionpackage.jsonmust havemainfield pointing to./dist/extension.js
Configuration properties for API keys, tokens, or secrets must use"format": "password"in the configuration definition to ensure input masking in the UI
Files:
extensions/claude/package.json
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use
/@/path aliases instead of relative paths for imports outside the current directory's module group; use relative imports only for sibling modules within the same directory
Files:
extensions/claude/src/manager/claude-inference-manager.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/claude-extension.ts
extensions/*/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Register inference, container, and Kubernetes providers through the
ProviderRegistryvia extension APIs
Files:
extensions/claude/src/manager/claude-inference-manager.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/claude-extension.ts
**/*.spec.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.spec.{ts,tsx,js,jsx}: Usetest()instead ofit()for test cases in Vitest unit tests
Usevi.mock(import('...'))for auto-mocking modules in unit tests; avoid manual mock factories when possible
Usevi.resetAllMocks()inbeforeEachhooks instead ofvi.clearAllMocks()for resetting mocks between tests
When an auto-mocked function or class method needs a real implementation, usevi.mocked(...)with the prototype pattern for class methods:vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)
Files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
🧠 Learnings (28)
📓 Common learnings
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:181-189
Timestamp: 2026-05-05T03:38:00.098Z
Learning: In the openkaiden/kaiden repository, the explicit design decision for `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) is: only non-secret runtime config flags (e.g. UV_SYSTEM_CERTS) are written as plaintext env vars to workspace.json for command/package-spawned MCPs. When a spawned MCP requires a secret env var, the planned approach is to route it through `kdn secret create` and write a secret reference (not the raw value) into workspace.json. This will be implemented in a separate follow-up PR.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2093
File: extensions/claude/src/manager/claude-inference-manager.ts:109-111
Timestamp: 2026-06-08T14:22:17.045Z
Learning: In openkaiden/kaiden, cloud provider inference manager extensions (e.g., Mistral at `extensions/mistral/src/manager/mistral-inference-manager.ts`, Claude at `extensions/claude/src/manager/claude-inference-manager.ts`) intentionally use `configuration.getConfiguration(undefined, connection)` for the write path (setConnectionConfiguration) and `configuration.getConfiguration('<provider>.connection', connection)` for the clear path (clearConnectionConfiguration). The `connection` parameter provides the namespace scoping on the write path; the explicit namespace string on the clear path is required to correctly clear the persisted keys. Do not flag this asymmetry as a bug in future reviews.
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:167-177
Timestamp: 2026-05-03T09:17:22.271Z
Learning: In the openkaiden/kaiden repository, command-based (package-spawned) MCPs like `kubernetes-mcp-server` (containers/kubernetes-mcp-server) may fail inside devcontainer workspaces with "invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable" because no kubeconfig is available at `~/.kube/config` inside the container. The fix is to pass a `KUBECONFIG` env var or `--kubeconfig` flag via the MCP command spec's `env`/`args` fields in workspace.json. This is a motivating example for extending command-based MCP env var support in `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts).
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:167-177
Timestamp: 2026-05-03T09:13:45.692Z
Learning: In the openkaiden/kaiden repository, URL-based (remote) MCPs that require API tokens use the secret manager (`SafeStorageRegistry`) for credential storage. Command/package-spawned MCPs (e.g., uvx, npx) generally do not require API keys, so their env vars (e.g., UV_SYSTEM_CERTS) are safely persisted in plaintext in workspace.json. Flagging plaintext env persistence in `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) as a security issue for command-based MCPs is not currently applicable, but may be worth a follow-up if command-based MCPs ever need secrets.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2018
File: extensions/claude/src/manager/claude-inference-manager.ts:91-94
Timestamp: 2026-06-01T13:20:17.021Z
Learning: In the Claude extension (`extensions/claude/src/manager/claude-inference-manager.ts`), `removeConnection` intentionally filters stored `StoredConnection[]` records by token rather than by connection ID. This is safe because the `connections.has(tokenHash)` guard in `registerInferenceProviderConnection` throws if a duplicate token is already registered, making it impossible for two `StoredConnection` records with the same token to coexist in secret storage. Token-based removal is therefore equivalent to ID-based removal in practice. Do not flag this as a bug in future reviews.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1603
File: packages/renderer/src/lib/guided-setup/guided-setup-steps.ts:35-45
Timestamp: 2026-05-04T17:36:14.229Z
Learning: In openkaiden/kaiden, `OnboardingModelSelection` (packages/renderer/src/lib/guided-setup/guided-setup-steps.ts) intentionally omits `connectionName` because the Claude extension sets `connectionName` to the raw API key value. Persisting `connectionName` would write the raw API key to settings.json, which is a security risk. The `providerId + label` pair is sufficient for the CLI `--model` flag and for workspace creation; `connectionName` must not be re-added to this interface unless a safe (non-secret) identifier can be substituted.
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:24.999Z
Learning: In the `openkaiden/kaiden` repository, cloud provider extensions (Gemini, Claude, Mistral, OpenAI-compatible, Vertex AI) use `ProviderConnectionStatus = 'unknown'` when registering inference provider connections. This means "connection was set up but is not continuously monitored." Only Ollama uses `'started'` because it actively polls a local server. Do not flag `'unknown'` status as incorrect for cloud provider extension connections in `extensions/*/src/*.ts`.
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to extensions/*/package.json : Configuration properties for API keys, tokens, or secrets must use `"format": "password"` in the configuration definition to ensure input masking in the UI
Applied to files:
extensions/claude/package.json
📚 Learning: 2026-06-01T13:20:17.021Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2018
File: extensions/claude/src/manager/claude-inference-manager.ts:91-94
Timestamp: 2026-06-01T13:20:17.021Z
Learning: In the Claude extension (`extensions/claude/src/manager/claude-inference-manager.ts`), `removeConnection` intentionally filters stored `StoredConnection[]` records by token rather than by connection ID. This is safe because the `connections.has(tokenHash)` guard in `registerInferenceProviderConnection` throws if a duplicate token is already registered, making it impossible for two `StoredConnection` records with the same token to coexist in secret storage. Token-based removal is therefore equivalent to ID-based removal in practice. Do not flag this as a bug in future reviews.
Applied to files:
extensions/claude/package.jsonextensions/claude/src/manager/claude-inference-manager.tsextensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-06-08T14:22:17.045Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2093
File: extensions/claude/src/manager/claude-inference-manager.ts:109-111
Timestamp: 2026-06-08T14:22:17.045Z
Learning: In openkaiden/kaiden, cloud provider inference manager extensions (e.g., Mistral at `extensions/mistral/src/manager/mistral-inference-manager.ts`, Claude at `extensions/claude/src/manager/claude-inference-manager.ts`) intentionally use `configuration.getConfiguration(undefined, connection)` for the write path (setConnectionConfiguration) and `configuration.getConfiguration('<provider>.connection', connection)` for the clear path (clearConnectionConfiguration). The `connection` parameter provides the namespace scoping on the write path; the explicit namespace string on the clear path is required to correctly clear the persisted keys. Do not flag this asymmetry as a bug in future reviews.
Applied to files:
extensions/claude/package.jsonextensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-04T17:36:14.229Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1603
File: packages/renderer/src/lib/guided-setup/guided-setup-steps.ts:35-45
Timestamp: 2026-05-04T17:36:14.229Z
Learning: In openkaiden/kaiden, `OnboardingModelSelection` (packages/renderer/src/lib/guided-setup/guided-setup-steps.ts) intentionally omits `connectionName` because the Claude extension sets `connectionName` to the raw API key value. Persisting `connectionName` would write the raw API key to settings.json, which is a security risk. The `providerId + label` pair is sufficient for the CLI `--model` flag and for workspace creation; `connectionName` must not be re-added to this interface unless a safe (non-secret) identifier can be substituted.
Applied to files:
extensions/claude/package.jsonextensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-06T11:29:33.170Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/package.json:9-11
Timestamp: 2026-05-06T11:29:33.170Z
Learning: In the openkaiden/kaiden repo, all built-in extensions under extensions/ should specify engines with kaiden: "^0.0.1" in package.json. Do not flag each extension individually; enforce a repo-wide alignment in a single PR. During reviews, verify that every extensions/*/package.json has "engines": { "kaiden": "^0.0.1" }. If a file deviates, surface the discrepancy as a single repo-wide task rather than per-file.
Applied to files:
extensions/claude/package.json
📚 Learning: 2026-06-08T14:22:17.045Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2093
File: extensions/claude/src/manager/claude-inference-manager.ts:109-111
Timestamp: 2026-06-08T14:22:17.045Z
Learning: In provider inference manager extensions (e.g., Mistral/Claude), the `configuration.getConfiguration(...)` argument is intentionally asymmetric:
- For `setConnectionConfiguration`, call `configuration.getConfiguration(undefined, connection)` and rely on the `connection` parameter to apply namespace scoping.
- For `clearConnectionConfiguration`, call `configuration.getConfiguration('<provider>.connection', connection)` (using the explicit provider namespace string) so the persisted keys are cleared correctly.
In future reviews, do not flag this `undefined` vs explicit namespace difference as a bug; it is required for correct write-vs-clear behavior.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-05T17:30:24.999Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:24.999Z
Learning: In the `openkaiden/kaiden` repository, cloud provider extensions (Gemini, Claude, Mistral, OpenAI-compatible, Vertex AI) use `ProviderConnectionStatus = 'unknown'` when registering inference provider connections. This means "connection was set up but is not continuously monitored." Only Ollama uses `'started'` because it actively polls a local server. Do not flag `'unknown'` status as incorrect for cloud provider extension connections in `extensions/*/src/*.ts`.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-29T13:43:18.280Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2001
File: packages/main/src/plugin/provider-registry.ts:1966-1971
Timestamp: 2026-05-29T13:43:18.280Z
Learning: In `openkaiden/kaiden`, `getInferenceSDK`, `getInferenceConnectionType`, and `getInferenceConnectionEndpoint` in `packages/main/src/plugin/provider-registry.ts` intentionally resolve inference connections by `name` (not `id`), because downstream consumers (InferenceParameters, chat history DB) persist `connectionName` rather than `connectionId`. Migrating these helpers to id-based lookup is deferred to the storage format redesign epic (`#1917`). Do not flag these name-based lookups as issues in reviews until that epic is addressed.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.tsextensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-06-01T15:06:39.800Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 2025
File: extensions/vertex-ai/src/vertex-ai.ts:166-170
Timestamp: 2026-06-01T15:06:39.800Z
Learning: In openkaiden/kaiden, the Vertex AI extension's `removeConnection` (previously `removeConnectionConfig`) intentionally removes stored entries by config hash rather than by persisted `id`. This is safe because `factory()` (line ~423) has an in-memory duplicate guard (`this.connections.has(this.getConfigHash(config))`) that rejects same-config calls before any `saveConnection` write occurs, making the hash-collision/race scenario impossible. Switching to ID-based removal is considered a future design improvement, not a correctness fix, and was explicitly scoped out of PR `#2025` (issue `#1942`).
Applied to files:
extensions/claude/src/manager/claude-inference-manager.tsextensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-04-30T12:38:39.371Z
Learnt from: jeffmaury
Repo: openkaiden/kaiden PR: 1524
File: extensions/openshift-ai/src/openshiftai.ts:233-235
Timestamp: 2026-04-30T12:38:39.371Z
Learning: In `extensions/openshift-ai/src/openshiftai.ts` (openkaiden/kaiden), `getInferenceServices()` intentionally swallows all API/auth/network exceptions and returns `[]`. This is by design: a cluster may restrict visibility of certain resources via RBAC, so an empty result is a valid unified signal for both "no inference services exist" and "no inference services are visible to this user." Do not flag this error-swallowing as hiding failures — the caller (`registerInferenceProviderConnection`) then throws a meaningful error when `connectionInfos.length === 0`.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-17T20:26:32.946Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1379
File: packages/renderer/src/lib/models/models-utils.ts:11-20
Timestamp: 2026-04-17T20:26:32.946Z
Learning: In `packages/renderer/src/lib/models/models-utils.ts` (openkaiden/kaiden), `InferenceConnectionSummary.connectionType` is intentionally optional. It is only `undefined` for the single synthetic `'not-configured'` entry (emitted when a provider has `inferenceProviderConnectionCreation` but no active `inferenceConnections`). All consumers guard with optional chaining. A discriminated union was considered but deferred as unnecessary complexity for v1, since the invariant (`connectionType` is defined iff `status !== 'not-configured'`) is self-evident from the `status` field. Do not flag this as a type-safety issue.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-03T09:13:45.692Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:167-177
Timestamp: 2026-05-03T09:13:45.692Z
Learning: In the openkaiden/kaiden repository, URL-based (remote) MCPs that require API tokens use the secret manager (`SafeStorageRegistry`) for credential storage. Command/package-spawned MCPs (e.g., uvx, npx) generally do not require API keys, so their env vars (e.g., UV_SYSTEM_CERTS) are safely persisted in plaintext in workspace.json. Flagging plaintext env persistence in `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) as a security issue for command-based MCPs is not currently applicable, but may be worth a follow-up if command-based MCPs ever need secrets.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.tsextensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-04-20T15:05:12.921Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1396
File: packages/renderer/src/lib/guided-setup/CodingAgentStep.svelte:54-65
Timestamp: 2026-04-20T15:05:12.921Z
Learning: In `packages/renderer/src/lib/guided-setup/CodingAgentStep.svelte`, the `$effect` block unconditionally writes all credential/vertex fields (`anthropicApiKey`, `vertexProjectId`, `vertexRegion`, `vertexMountGcloud`, `vertexMountClaudeConfig`) into the `onboarding` object regardless of `selectedVariant`. This is intentional: (1) only `onboarding.agent` is persisted today (to `settings.json` via `window.updateConfigurationValue`); all credential fields are ephemeral in-memory and discarded when the wizard closes, so leaving them populated is harmless. (2) Preserving inputs across variant switches is a deliberate UX decision to avoid data loss on accidental clicks. Variant-scoped filtering will be added in the follow-up agents.json IPC work. Do not flag the unconditional credential mirroring as a bug or suggest clearing fields on variant switch until that IPC work lands.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-05T03:38:00.098Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1517
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:181-189
Timestamp: 2026-05-05T03:38:00.098Z
Learning: In the openkaiden/kaiden repository, the explicit design decision for `writeWorkspaceConfig` (packages/main/src/plugin/kdn-cli/kdn-cli.ts) is: only non-secret runtime config flags (e.g. UV_SYSTEM_CERTS) are written as plaintext env vars to workspace.json for command/package-spawned MCPs. When a spawned MCP requires a secret env var, the planned approach is to route it through `kdn secret create` and write a secret reference (not the raw value) into workspace.json. This will be implemented in a separate follow-up PR.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-12T17:14:02.153Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1850
File: packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte:66-70
Timestamp: 2026-05-12T17:14:02.153Z
Learning: When reviewing code that uses `AgentWorkspaceSummaryUI.runtime`, treat it as a required, non-null `string` per the `openkaiden/kdn-api` 0.12.0 schema. Therefore, code like `a.runtime.localeCompare(b.runtime)` is safe and should not trigger warnings about possible `undefined`/`null` values or suggestions to use nullish coalescing/optional chaining for `runtime` (unless the current local types still mark `runtime` as optional, indicating a schema/version mismatch).
Applied to files:
extensions/claude/src/manager/claude-inference-manager.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/claude-extension.ts
📚 Learning: 2026-05-05T17:44:50.991Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:363-387
Timestamp: 2026-05-05T17:44:50.991Z
Learning: In this repo (openkaiden/kaiden), do not raise a code review issue when an extension’s `InferenceProviderConnectionFactory.create` factory method implementation omits (or does not use) the optional `logger` and/or `CancellationToken` parameters in its method signature/implementation. Current extensions (e.g., Vertex AI, Gemini, Claude, Mistral, OpenAI-compatible) follow this pattern, so reviewers should treat it as acceptable for `extensions/*` TypeScript source files.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/claude-extension.ts
📚 Learning: 2026-04-30T12:44:46.782Z
Learnt from: fbricon
Repo: openkaiden/kaiden PR: 1509
File: packages/main/src/plugin/kdn-cli/kdn-cli.ts:103-112
Timestamp: 2026-04-30T12:44:46.782Z
Learning: In `packages/main/src/plugin/kdn-cli/kdn-cli.ts` (`createWorkspace`), silently skipping `--model` with a `console.warn` when `options.model` does not start with `ollama::` or `ramalama::` is intentional and temporary. This is because only OpenCode currently supports that scheme for local runtimes; broader support is tracked in openkaiden/kdn#354. Do not flag this as a silent-failure bug or suggest throwing an error in future reviews.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-04-30T12:45:43.072Z
Learnt from: fbricon
Repo: openkaiden/kaiden PR: 1509
File: packages/api/src/agent-workspace-info.ts:53-53
Timestamp: 2026-04-30T12:45:43.072Z
Learning: In `packages/api/src/agent-workspace-info.ts`, the `model` field on `AgentWorkspaceCreateOptions` is intentionally typed as `model?: string` (not a narrowed template-literal type). The current CLI-side filtering (only forwarding `ollama::` / `ramalama::` prefixes) in `kdn-cli.ts` is a temporary measure until broader agent support lands (tracked in openkaiden/kdn#354). Do not suggest narrowing this type to a union or template-literal type in future reviews.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to extensions/*/src/**/*.{ts,tsx} : Register inference, container, and Kubernetes providers through the `ProviderRegistry` via extension APIs
Applied to files:
extensions/claude/src/manager/claude-inference-manager.ts
📚 Learning: 2026-05-12T10:01:14.248Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1810
File: extensions/kdn/src/kdn-extension.ts:43-46
Timestamp: 2026-05-12T10:01:14.248Z
Learning: In this repo’s extension code, when logging from binary discovery/resolution logic (e.g., choosing/validating custom paths, extension storage locations, or bundled resource paths), it’s intentional to include full filesystem paths in `console.log`/`console.warn` (such as in `extensions/**/src/*-extension.ts`). During review, do not flag these specific full-path messages as a privacy/security issue as long as they are clearly part of the binary resolution steps. If full-path logging appears outside binary discovery/resolution, review/flag it as usual.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.tsextensions/claude/src/manager/claude-inference-manager.spec.tsextensions/claude/src/claude-extension.ts
📚 Learning: 2026-04-23T04:28:25.544Z
Learnt from: bmahabirbu
Repo: openkaiden/kaiden PR: 1417
File: extensions/kdn/vite.config.js:60-62
Timestamp: 2026-04-23T04:28:25.544Z
Learning: In openkaiden/kaiden, the `__mocks__/` directory (containing `vitest-generate-api-global-setup.ts` and `openkaiden/api.js`) lives at the repository root, NOT under `extensions/`. Extensions (e.g., `extensions/kdn`, `extensions/gemini`) use `join(PACKAGE_ROOT, '..', '..', '__mocks__', ...)` in their `vite.config.js` to correctly resolve to the repo-root `__mocks__/` folder. Do not flag this two-level-up path traversal as incorrect in future reviews.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to **/*.spec.{ts,tsx,js,jsx} : When an auto-mocked function or class method needs a real implementation, use `vi.mocked(...)` with the prototype pattern for class methods: `vi.mocked(MyClass.prototype.myMethod).mockImplementation(...)`
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to **/*.spec.{ts,tsx,js,jsx} : Use `vi.resetAllMocks()` in `beforeEach` hooks instead of `vi.clearAllMocks()` for resetting mocks between tests
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-12T16:35:51.592Z
Learnt from: CR
Repo: openkaiden/kaiden PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-12T16:35:51.592Z
Learning: Applies to **/*.spec.{ts,tsx,js,jsx} : Use `vi.mock(import('...'))` for auto-mocking modules in unit tests; avoid manual mock factories when possible
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-04-20T14:30:15.867Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1396
File: packages/renderer/src/lib/guided-setup/CodingAgentStep.spec.ts:30-45
Timestamp: 2026-04-20T14:30:15.867Z
Learning: In `packages/renderer/src/lib/guided-setup/CodingAgentStep.spec.ts`, the `stubOllama` helper intentionally only re-stubs `fetch` and relies on `beforeEach`'s `stubRamalama(false)` call to keep `getProviderInfos` in place. This is a deliberate standard Vitest `beforeEach` + per-test override pattern. Do not flag the implicit dependency between `stubOllama` and the `beforeEach` ramalama stub as a robustness issue.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-04-15T08:51:09.866Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1336
File: packages/renderer/src/lib/guided-setup/GuidedSetup.spec.ts:64-69
Timestamp: 2026-04-15T08:51:09.866Z
Learning: In `packages/renderer/src/**/*.spec.ts` files that use `render` from `testing-library/svelte` (Svelte component tests), `vi.useFakeTimers({ shouldAdvanceTime: true })` must be called inside `beforeEach`. This is a required coding guideline for all Svelte component tests in this repo: it prevents flaky behavior caused by Svelte's internal tick scheduling, regardless of whether individual tests explicitly manipulate timers. Do not flag or suggest removing this call.
Applied to files:
extensions/claude/src/manager/claude-inference-manager.spec.ts
📚 Learning: 2026-05-05T17:30:20.418Z
Learnt from: MarsKubeX
Repo: openkaiden/kaiden PR: 1671
File: extensions/vertex-ai/src/vertex-ai.ts:272-302
Timestamp: 2026-05-05T17:30:20.418Z
Learning: In the openkaiden/kaiden repo, for cloud inference provider extension code under `extensions/*/src/*.ts`, treat `ProviderConnectionStatus = 'unknown'` as a valid/expected value when registering provider connections (e.g., Gemini/Claude/Mistral/OpenAI-compatible/Vertex AI). `'unknown'` indicates the connection was set up but is not continuously monitored—so do not flag it as incorrect. Only Ollama is expected to use `'started'` because it actively polls a local server.
Applied to files:
extensions/claude/src/claude-extension.ts
🔇 Additional comments (2)
extensions/claude/package.json (1)
23-46: LGTM!extensions/claude/src/claude-extension.ts (1)
27-55: LGTM!
|
@coderabbitai resolve |
✅ Action performedComments resolved and changes approved. |
Store per-connection secrets and configuration entries (provider type and token reference) so agent workspaces can resolve Claude credentials, matching the pattern already used by Mistral and OpenAI extensions.
Closes #1841