fix(editor): Load credentials when opening node credential picker
Tier 2 easy typescript · local · real merged PR from n8n-io/n8n #30463
Ground-truth defects
On mount, the node credential picker calls `fetchAllCredentials({ projectId: projectsStore.currentProject?.id })`, scoping the credential list to the current project only. For a saved workflow the picker should fetch workflow-scoped credentials (which include credentials shared with the workflow), and when there is no current project it should fall back to the user's personal project. As written, credentials shared with the workflow are dropped from the picker, and when currentProject is undefined the fetch is issued with `projectId: undefined`.
The change under review
diff
@@ -220,6 +220,15 @@ describe('NodeCredentials', () => { expect(screen.queryByText('OpenAi account')).toBeInTheDocument(); }); + it('should refresh credentials from the server when mounted on an existing node', () => { + ndvStore.activeNode = httpNode; + credentialsStore.state.credentials = {}; + + renderComponent(); + + expect(credentialsStore.fetchAllCredentials).toHaveBeenCalled(); + }); + it('should ignore managed credentials in the dropdown if active node is the HTTP node', async () => { ndvStore.activeNode = httpNode; credentialsStore.state.credentials = { @@ -316,6 +316,10 @@ onMounted(() => { ndvEventBus.on('credential.createNew', onCreateAndAssignNewCredential); + void credentialsStore.fetchAllCredentials({ + projectId: projectsStore.currentProject?.id, + }); + void aiGateway.fetchConfig(); // Clear stale AI Gateway managed credentials if the feature is disabled
Leaderboard for this case
easy · 9 of 9 bots fully caught it (100% solve rate) · 100% avg coverage.
| # | Bot | Result | Caught | Coverage | Findings | False alarms |
|---|---|---|---|---|---|---|
| 1 | Claude Code (Opus 5.5) | solved | 1/1 | 100.0% | 3 | 0 |
| 2 | Cubic | solved | 1/1 | 100.0% | 3 | 0 |
| 3 | cursor | solved | 1/1 | 100.0% | 1 | 0 |
| 4 | Drape (Deep Review) | solved | 1/1 | 100.0% | 5 | 0 |
| 5 | Drape (Review) | solved | 1/1 | 100.0% | 4 | 0 |
| 6 | greptile | solved | 1/1 | 100.0% | 2 | 0 |
| 7 | Mjolnir (Opus 5.5) | solved | 1/1 | 100.0% | 4 | 0 |
| 8 | Mjolnir (Sonnet 5.5) | solved | 1/1 | 100.0% | 2 | 0 |
| 9 | qodo | solved | 1/1 | 100.0% | 3 | 0 |
Bot results
Claude Code (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
`fetchAllCredentials` calls `setCredentials`, which replaces the whole `state.credentials` map. Each mount now sends an unguarded request, so a slow or out-of-order response can overwrite credentials that were upserted after the request was sent, for example one created right after mount. Nothing in the code dedupes or orders these requests. [grounded: diff] [consensus 3/3: valid=3]
`fetchAllCredentials` awaits `credentialsApi.getAllCredentials` without a try/catch, and the new call site discards the promise with `void` and adds no `.catch`. A failed request therefore becomes an unhandled rejection, and the user is not told. [grounded: diff] [consensus 3/3: valid=3]
raw comments (3)
When the editor loads a workflow, it fills the store with `fetchAllCredentialsForWorkflow` (NodeView.vue:754, useWorkflowInitialization.ts:121). That call returns the credentials usable by this workflow's project. This change calls `fetchAllCredentials({ projectId: projectsStore.currentProject?.id })` on mount, and that call ends in `setCredentials`, which replaces the whole credential map rather than merging into it. The result is a list with a different scope: filtered by whatever `currentProject` happens to be, or every credential the user can see when it is undefined. That list overwrites the workflow-scoped one. Credentials the workflow can use may disappear from the dropdown, and credentials from other projects that the workflow cannot use may appear and be selectable, so the node ends up with a broken credential. The new list also replaces the store for every other component that reads it.
This component mounts every time the NDV opens a node, and possibly once for each node that shows credentials. Each mount now fires an unthrottled request for the full credential list. Several mounts can overlap, and their responses are applied in whatever order they arrive, each one replacing the whole map. A late response can wipe a credential that was just created or upserted, for example one added through `credential.createNew` right after mount. The result is flicker, or a newly assigned credential briefly disappearing.
The promise is discarded with `void` and has no `.catch`. If the request fails (network error, or a 403 for the project filter), the result is an unhandled promise rejection, and the user gets no feedback.
Cubic · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | exact |
In the store, `fetchAllCredentials` builds `filter = { projectId }` and calls `setCredentials`. When `projectId` is undefined, the request can go out with no project filter. Its result then replaces the workflow-scoped list that NodeView loaded with `fetchAllCredentialsForWorkflow`, so the dropdown can show credentials from other projects. The new call added in this diff causes this. [grounded: diff] [consensus 5/5: valid=5]
The fetch sits in `onMounted` with no guard and nothing to deduplicate it. Each NodeCredentials instance therefore sends its own GET /credentials. When several instances mount together, the same request is repeated, and each response overwrites the store again. [grounded: diff] [consensus 5/5: valid=5]
raw comments (4)
<!-- cubic:v=a5a8b823-1e47-411d-a95f-8949813a0b39 -->
<!-- cubic:review-run=dc7550a0-565e-59a1-ac88-7b1bf76f12aa -->
<!-- metadata:{"confidence":6} -->
P2: When `projectsStore.currentProject` is null the optional chaining yields `projectId: undefined`, which `fetchAllCredentials` treats as an empty filter (`isEmpty`) and issues an unfiltered `GET /credentials` for every credential the user owns across projects. Resolve the project id explicitly (fall back to the workflow's or personal project) or skip the refresh when it is unavailable, so the request stays project-scoped.
<details>
<summary>Prompt for AI agents</summary>
```text
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue, line 320:
<comment>When `projectsStore.currentProject` is null the optional chaining yields `projectId: undefined`, which `fetchAllCredentials` treats as an empty filter (`isEmpty`) and issues an unfiltered `GET /credentials` for every credential the user owns across projects. Resolve the project id explicitly (fall back to the workflow's or personal project) or skip the refresh when it is unavailable, so the request stays project-scoped.</comment>
<file context>
@@ -316,6 +316,10 @@ onMounted(() => {
ndvEventBus.on('credential.createNew', onCreateAndAssignNewCredential);
+ void credentialsStore.fetchAllCredentials({
+ projectId: projectsStore.currentProject?.id,
+ });
+
</file context>
```
</details>
```suggestion
projectId: projectsStore.currentProject?.id ?? projectsStore.personalProject?.id,
```
<!-- cubic:v=674bae22-4131-4841-8157-030777a10f0a -->
<!-- cubic:review-run=dc7550a0-565e-59a1-ac88-7b1bf76f12aa -->
<!-- metadata:{"confidence":7} -->
P2: This fetch runs on every `NodeCredentials` mount, and the component is mounted once per credential-typed parameter (`CredentialsSelect`) and twice in `NodeSettings`, so opening the NDV credential panel fires several identical `GET /credentials` requests and duplicates the preload that surfaces such as `InstanceAiCredentialSetup` already do. Gate the refresh (e.g. only when the store has no credentials for the type, or fetch once per project with a cached flag) instead of fetching on each mount.
<details>
<summary>Prompt for AI agents</summary>
```text
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue, line 319:
<comment>This fetch runs on every `NodeCredentials` mount, and the component is mounted once per credential-typed parameter (`CredentialsSelect`) and twice in `NodeSettings`, so opening the NDV credential panel fires several identical `GET /credentials` requests and duplicates the preload that surfaces such as `InstanceAiCredentialSetup` already do. Gate the refresh (e.g. only when the store has no credentials for the type, or fetch once per project with a cached flag) instead of fetching on each mount.</comment>
<file context>
@@ -316,6 +316,10 @@ onMounted(() => {
ndvEventBus.on('credential.createNew', onCreateAndAssignNewCredential);
+ void credentialsStore.fetchAllCredentials({
+ projectId: projectsStore.currentProject?.id,
+ });
</file context>
```
</details>
<!-- cubic:v=760569d2-1bad-48cc-b457-8bdc5d3a59c1 -->
<!-- cubic:review-run=dc7550a0-565e-59a1-ac88-7b1bf76f12aa -->
<!-- metadata:{"confidence":5} -->
P2: The new mount-time fetch calls `credentialsStore.fetchAllCredentials`, which replaces the whole credential map (`setCredentials`) instead of merging. Because it starts at mount it resolves after the workflow-scoped `fetchAllCredentialsForWorkflow` load, so credentials that are usable in the workflow but not returned for `projectsStore.currentProject` get removed from the store and vanish from the dropdown. Scope the refresh to the same workflow/project fetch the editor already uses, or merge the result instead of replacing.
<details>
<summary>Prompt for AI agents</summary>
```text
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue, line 319:
<comment>The new mount-time fetch calls `credentialsStore.fetchAllCredentials`, which replaces the whole credential map (`setCredentials`) instead of merging. Because it starts at mount it resolves after the workflow-scoped `fetchAllCredentialsForWorkflow` load, so credentials that are usable in the workflow but not returned for `projectsStore.currentProject` get removed from the store and vanish from the dropdown. Scope the refresh to the same workflow/project fetch the editor already uses, or merge the result instead of replacing.</comment>
<file context>
@@ -316,6 +316,10 @@ onMounted(() => {
ndvEventBus.on('credential.createNew', onCreateAndAssignNewCredential);
+ void credentialsStore.fetchAllCredentials({
+ projectId: projectsStore.currentProject?.id,
+ });
</file context>
```
</details>
<!-- cubic:review-summary:start -->
**3 issues found** across 2 files
<!-- cubic:review-summary:end -->
<details>
<summary>Prompt for AI agents (unresolved issues)</summary>
```text
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue">
<violation number="1" location="packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319">
P2: This fetch runs on every `NodeCredentials` mount, and the component is mounted once per credential-typed parameter (`CredentialsSelect`) and twice in `NodeSettings`, so opening the NDV credential panel fires several identical `GET /credentials` requests and duplicates the preload that surfaces such as `InstanceAiCredentialSetup` already do. Gate the refresh (e.g. only when the store has no credentials for the type, or fetch once per project with a cached flag) instead of fetching on each mount.</violation>
<violation number="2" location="packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319">
P2: The new mount-time fetch calls `credentialsStore.fetchAllCredentials`, which replaces the whole credential map (`setCredentials`) instead of merging. Because it starts at mount it resolves after the workflow-scoped `fetchAllCredentialsForWorkflow` load, so credentials that are usable in the workflow but not returned for `projectsStore.currentProject` get removed from the store and vanish from the dropdown. Scope the refresh to the same workflow/project fetch the editor already uses, or merge the result instead of replacing.</violation>
<violation number="3" location="packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320">
P2: When `projectsStore.currentProject` is null the optional chaining yields `projectId: undefined`, which `fetchAllCredentials` treats as an empty filter (`isEmpty`) and issues an unfiltered `GET /credentials` for every credential the user owns across projects. Resolve the project id explicitly (fall back to the workflow's or personal project) or skip the refresh when it is unavailable, so the request stays project-scoped.</violation>
</file>
```
</details>
<sub>Reply with feedback, questions, or to request a fix.<br /><br />[Re-trigger cubic](https://www.cubic.dev/action/re-review/pr/drape-io/crbench-cubic-2026-09/58/ai_pr_review_github_delivery_6c7c2bbf4d7f6bf6aebc7499ec825933b1b4a3d13c5ef2b414e312564a74c38c?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F58)</sub>
<!-- cubic:review-post:ai_pr_review_github_delivery_6c7c2bbf4d7f6bf6aebc7499ec825933b1b4a3d13c5ef2b414e312564a74c38c:a9fbe10fb025a15bce092493b655951994d083a0:dc7550a0-565e-59a1-ac88-7b1bf76f12aa -->
cursor · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
raw comments (2)
### Wrong credentials fetch overwrites store
**High Severity**
<!-- DESCRIPTION START -->
On mount, `fetchAllCredentials` replaces the whole credentials store with a project-filtered `GET /credentials` result. The node editor already loads usable credentials via `fetchAllCredentialsForWorkflow`, so this can drop credentials the workflow can use, surface ones it cannot, and ignore the `projectId` prop in favor of `projectsStore.currentProject`.
<!-- DESCRIPTION END -->
<!-- BUGBOT_BUG_ID: b38c11ed-bfd4-49e6-bf3d-5f908463dbbf -->
<!-- LOCATIONS START
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue#L318-L321
LOCATIONS END -->
<div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmU3MTkyZGU0LTcxMzEtNGEzNS04YWQzLTRhOTkxZWFlOTk3YiIsImVuY3J5cHRpb25LZXkiOiIybFZWNTd3UmJOazZlZzc3cXI0MjBaYXFkY3UzbElmZTF1X1ZPdGxoMjFBIiwiYnJhbmNoIjoidDItbjhuLTMwNDYzIiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmU3MTkyZGU0LTcxMzEtNGEzNS04YWQzLTRhOTkxZWFlOTk3YiIsImVuY3J5cHRpb25LZXkiOiIybFZWNTd3UmJOazZlZzc3cXI0MjBaYXFkY3UzbElmZTF1X1ZPdGxoMjFBIiwiYnJhbmNoIjoidDItbjhuLTMwNDYzIiwicmVwb093bmVyIjoiZHJhcGUtaW8iLCJyZXBvTmFtZSI6ImNyYmVuY2gtY3Vyc29yLTIwMjYtMDkiLCJwck51bWJlciI6NjAsImNvbW1pdFNoYSI6IjBkNGEzMTNjMGI0YWIxOTc1ZDYzNThhNTkxNThlM2EyNmE3MTU0MDYiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>
<sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0d4a313c0b4ab1975d6358a59158e3a26a715406. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- BUGBOT_REVIEW -->
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
<!-- BUGBOT_FIX_ALL -->
<a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTpkNzU5Nzk5Zi00Njc1LTQ4OTYtOGI5Zi0zOTYzZDJmNzAwNjUiLCJlbmNyeXB0aW9uS2V5Ijoia2poQlhEVFZrMHhhTGI0T0tHaUdmSm16aGtFOGRJTk9pQnhGRmI5VHFqRSIsImJyYW5jaCI6InQyLW44bi0zMDQ2MyIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
<!-- /BUGBOT_FIX_ALL -->
<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN -->
<sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END -->
<sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0d4a313c0b4ab1975d6358a59158e3a26a715406. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
Drape (Deep Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
The new mount-time fetch runs even when `standalone` is true. It scopes the request to `currentProject` and ignores `props.projectId`. Its result replaces the shared credentials store through `setCredentials`, so a standalone surface can overwrite the store with another project's credentials. [grounded: diff] [consensus 3/3: valid=3]
The promise is discarded with `void` and has no catch. If the API call fails, the error becomes an unhandled rejection and the user is never told. [grounded: diff] [consensus 3/3: valid=3]
The fetch sits in `onMounted` with no dedupe, so each mounted NodeCredentials instance sends its own full `/credentials` request. Each response replaces the whole store through `setCredentials`. [grounded: diff] [consensus 3/3: valid=3]
`fetchAllCredentials` replaces the whole credentials map. If `createNewCredential` upserts a credential while the mount fetch is still in flight, the older response arrives afterwards and removes the new credential. The race is narrow but real. [grounded: tree packages/frontend/editor-ui/src/features/credentials/credentials.store.ts] [consensus 3/3: valid=3]
raw comments (5)
**Standalone mode still overwrites the global credential store**
In `standalone` mode (Instance AI, agents), the component is meant to avoid global store writes and to use `props.projectId`. The new fetch ignores both: it uses `projectsStore.currentProject` and replaces the shared credentials store. Skip the fetch when `props.standalone`, or at least scope it to `props.projectId`.
```
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319 void credentialsStore.fetchAllCredentials({
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320 projectId: projectsStore.currentProject?.id,
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:321 });
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:66 /** When true, skip all global store writes (workflowsStore, nodeHelpers).
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:67 * Used by Instance AI to render credential selection without polluting the active workflow. */
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:68 standalone?: boolean;
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:69 /** Project ID to scope new credential creation to the correct project. */
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:70 projectId?: string;
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:313 setCredentials(credentials);
```
**Failed credential refresh becomes an unhandled rejection**
The promise is discarded with `void` and has no catch. A network or permission error on `/credentials` turns into an unhandled promise rejection and is not reported to the user. Add a `.catch` that reports the error with `toast.showError`.
```
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319 void credentialsStore.fetchAllCredentials({
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320 projectId: projectsStore.currentProject?.id,
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:321 });
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:306 const credentials = await credentialsApi.getAllCredentials(rootStore.restApiContext, {
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:307 filter: isEmpty(filter) ? undefined : filter,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:308 includeScopes,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:309 onlySharedWithMe,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:310 includeGlobal,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:311 externalSecretsStore,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:312 });
```
**Each mounted credential picker refetches every credential**
Every NodeCredentials mount sends a full `/credentials` request, so views with many pickers (setup panel cards) fire N identical requests whose responses race to overwrite the store. Refresh once from the parent view, or dedupe in the store.
```
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319 void credentialsStore.fetchAllCredentials({
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320 projectId: projectsStore.currentProject?.id,
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:321 });
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:306 const credentials = await credentialsApi.getAllCredentials(rootStore.restApiContext, {
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:307 filter: isEmpty(filter) ? undefined : filter,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:308 includeScopes,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:309 onlySharedWithMe,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:310 includeGlobal,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:311 externalSecretsStore,
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:312 });
```
**Opening a node replaces workflow-scoped credential list**
This call overwrites the store that NodeView filled with `fetchAllCredentialsForWorkflow`, using `/credentials` filtered by `currentProject`. On shared workflows that is null, so every credential the user can see gets listed. Use `fetchAllCredentialsForWorkflow` with the workflow id, or drop this refetch.
```
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319 void credentialsStore.fetchAllCredentials({
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320 projectId: projectsStore.currentProject?.id,
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:321 });
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:253 const setCredentials = (credentials: ICredentialsResponse[]) => {
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:254 state.value.credentials = credentials.reduce(
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:255 (accu: ICredentialMap, cred: ICredentialsResponse) => {
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:256 if (cred.id) {
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:257 accu[cred.id] = cred;
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:258 }
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:259 return accu;
```
**Slow refetch can wipe a just-created credential**
The response replaces the whole store. If a credential is created while this request is in flight, the stale response deletes it and the auto-selected credential shows as unavailable. Merge with `addCredentials` instead of replacing, or fetch once per workflow.
```
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319 void credentialsStore.fetchAllCredentials({
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320 projectId: projectsStore.currentProject?.id,
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:321 });
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:286 case 'createNewCredential':
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:287 if (result) {
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:288 onCredentialSelected(credentialType, (result as ICredentialsResponse).id);
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:289 }
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:265 const upsertCredential = (credential: ICredentialsResponse) => {
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:266 if (credential.id) {
packages/frontend/editor-ui/src/features/credentials/credentials.store.ts:267 state.value.credentials = {
```
Drape (Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
The store's fetchAllCredentials awaits the API call without any try/catch, and the new call site uses `void` without `.catch`, so a network or API failure becomes an unhandled rejection that the user never sees. [grounded: diff] [consensus 3/3: valid=3]
NodeCredentials is used by many components, including setup cards and the Instance AI setup. Each mount now fires a full fetch, and each response calls setCredentials, which replaces the store, so concurrent requests are redundant and race each other. [grounded: diff] [consensus 3/3: valid=3]
getAllCredentials always sends includeData: true, so the new fetch on every mount pulls all credential data just to fill a dropdown. This is a real performance regression added by this change. [grounded: tree packages/frontend/editor-ui/src/features/credentials/credentials.api.ts] [consensus 3/3: valid=3]
raw comments (4)
**Mounting overwrites workflow-scoped credentials list**
On every mount, NodeCredentials calls `fetchAllCredentials`, and `setCredentials` replaces the whole credentials store. That wipes the workflow-scoped list that `fetchAllCredentialsForWorkflow` loaded, and uses the unrelated `currentProject` as the filter. Refresh with `fetchAllCredentialsForWorkflow` for the workflow, or merge the result with `addCredentials` instead of replacing.
```
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319 void credentialsStore.fetchAllCredentials({
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320 projectId: projectsStore.currentProject?.id,
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:321 });
```
**Credential refresh failure is an unhandled rejection**
The `void fetchAllCredentials(...)` call has no catch, so a network or API error becomes an unhandled promise rejection inside onMounted, with no user feedback. Add `.catch(...)` that shows a toast or ignores the error.
```
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319 void credentialsStore.fetchAllCredentials({
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320 projectId: projectsStore.currentProject?.id,
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:321 });
```
**Full credentials refetch on every card mount**
NodeCredentials is mounted once per card in the setup panel and Instance AI setup, and each mount now fires its own full `fetchAllCredentials`. Each response replaces the store, so the requests race. Fetch once in the parent, or dedupe in-flight requests in the store.
```
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319 void credentialsStore.fetchAllCredentials({
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320 projectId: projectsStore.currentProject?.id,
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:321 });
```
**Every node open fetches all credentials with data**
`fetchAllCredentials` always sends `includeData: true`, so each NodeCredentials mount requests every credential with its data just to fill a dropdown that needs names and types. Use the lighter `for-workflow` endpoint, or skip the refetch when the store is already populated.
```
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319 void credentialsStore.fetchAllCredentials({
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:320 projectId: projectsStore.currentProject?.id,
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:321 });
packages/frontend/editor-ui/src/features/credentials/credentials.api.ts:66 return await makeRestApiRequest(context, 'GET', '/credentials', {
packages/frontend/editor-ui/src/features/credentials/credentials.api.ts:67 ...(includeScopes ? { includeScopes } : {}),
packages/frontend/editor-ui/src/features/credentials/credentials.api.ts:68 includeData: true,
```
greptile · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
NodeSettings.vue mounts NodeCredentials both in the credential panel (v-if openPanel==='credential') and inside the v-show params section, and other surfaces (setup panel cards) mount many instances; the newly added unconditional fetch in onMounted fires once per instance with no dedup in fetchAllCredentials. The overwrite concern is weak since the queries are identical, but redundant requests are real. [grounded: diff] [consensus 3/3: valid=3]
raw comments (3)
<a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> **Refresh loses workflow scope**
When the credential editor opens for a shared workflow, `currentProject` is null. This call therefore omits the project filter and replaces the workflow-scoped credential store with an unscoped response. The node editor can then show credentials outside the workflow's project or lose the workflow-specific credential list. Refresh credentials using the active workflow's scope rather than the navigation state.
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> **Mounts duplicate credential requests**
The NDV keeps one `NodeCredentials` instance mounted in the parameters section with `v-show`, then mounts another when the credential panel opens. This unconditional fetch runs from both instances. Since the store neither deduplicates these requests nor merges their results, this adds avoidable network traffic and allows overlapping responses to overwrite each other. Centralize or deduplicate the refresh.
<h3>Greptile Summary</h3>
The PR refreshes the credentials store whenever `NodeCredentials` mounts and adds a test asserting that refresh.
- Adds an on-mount credential fetch using the navigation-level current project.
- Adds coverage for invoking the refresh while an existing node is active.
- The refresh can discard workflow scoping and is duplicated when multiple credential components mount.
<h3>Confidence Score: 4/5</h3>
The PR is not safe to merge until the mount-time refresh preserves the active workflow's credential scope.
Shared workflows clear `currentProject`, causing the new request to omit its project filter and replace correctly workflow-scoped credential state; multiple mounted instances also repeat this replacement request.
**Files Needing Attention:** packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue | Adds an unconditional project-scoped refresh that can overwrite workflow-scoped credentials and issue duplicate requests. |
| packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.test.ts | Adds coverage that confirms the mount-time action call, but does not validate its scope or lifecycle behavior. |
</details>
<!-- greptile_other_comments_section -->
<sub>Reviews (1): Last reviewed commit: ["Update packages/frontend/editor-ui/src/f..."](https://github.com/drape-io/crbench-greptile-2026-09/commit/10808420a042ac3b71c3102db1b1ca5f06eb7dab) | [Re-trigger Greptile](https://app.greptile.com/api/retrigger?id=64284661)</sub>
Mjolnir (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
fetchAllCredentials calls setCredentials and replaces the whole store. The editor fills that store with fetchAllCredentialsForWorkflow, which is scoped to the workflow. The new mount-time call replaces it with a list scoped by currentProject, and with no filter at all when currentProject is null, so the dropdown can offer credentials the workflow cannot use. [grounded: diff] [consensus 3/3: valid=3]
Each mounted instance fires its own unguarded fetch, and each response overwrites the store through setCredentials. The promise is only voided with no catch, so a failed request becomes an unhandled rejection. [grounded: diff] [consensus 3/3: valid=3]
The fetch runs even when the standalone prop is set, although that prop's doc says it should skip global store writes. It also ignores props.projectId. NodeToolSettingsContent and Instance AI fill the store with a project- or workflow-scoped list first, and this fetch overwrites it. [grounded: diff] [consensus 3/3: valid=3]
raw comments (4)
[P1] Mount-time fetch swaps the workflow-scoped credential list for a different one
The editor loads credentials with `fetchAllCredentialsForWorkflow({ workflowId })` (NodeView.vue:754, useWorkflowInitialization.ts:121). That call returns only the credentials the user can use in this workflow: the intersection of what the user can read and what the workflow's project can access, plus global credentials (credentials.service.ts:516-538). The new `fetchAllCredentials({ projectId: projectsStore.currentProject?.id })` calls `setCredentials`, which replaces the whole store with a differently scoped list. `currentProject` is `null` in some cases: a workflow shared with the user, or another user's personal workflow (projects.store.ts:232-247). In those cases the request goes out with no filter and returns every credential the user can read; for owners and admins that is every credential on the instance. The dropdown then offers credentials the workflow cannot use, and choosing one fails later at save or run time. The same overwrite affects other places that mount this component with their own scoped list: `WorkflowSetupSectionBody`, which uses `fetchAllCredentialsForWorkflow`, and `AskCredentialCard` in agents. In those views `currentProject` has nothing to do with the workflow or agent being configured.
[P2] Every mounted instance fires the same full credential request
The fetch sits in `onMounted` and nothing deduplicates or caches it. Every `NodeCredentials` instance sends its own `GET /credentials` and rewrites the whole store. That happens each time the NDV opens. Views that render many cards at once (setup panel `SetupCardBody`, instance AI workflow setup) send one identical request per card, and the responses race to overwrite each other. The promise also has no `.catch` (it is only `void`-ed), so a failed request becomes an unhandled rejection and the user gets no feedback.
[P1] Mount-time refetch replaces the workflow-scoped credential list with a different, wrongly-scoped one
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319-321 The workflow editor loads credentials with `fetchAllCredentialsForWorkflow({ workflowId | projectId })` (NodeView.vue:754, useWorkflowInitialization.ts:121), which asks the backend for only the credentials usable in that workflow's project. The new call uses `fetchAllCredentials`, and its `setCredentials` replaces `state.credentials` entirely, so every time the NDV mounts NodeCredentials the workflow-scoped list is thrown away and swapped for `GET /credentials` filtered by `projectsStore.currentProject?.id`. `currentProject` is frequently null or unrelated to the workflow. projects.store.ts sets it to `null` for workflows shared with the user, and leaves it unchanged for workflows in another user's personal project. In those cases the call has no project filter and returns every credential the user can access. The dropdown (`allUsableCredentialsByType`) then offers credentials from other projects that the workflow can't use at execution time, and any workflow-specific credentials the scoped endpoint returned can disappear. The response arrives asynchronously, so a credential created or upserted while the request is in flight is also overwritten by the stale response.
[P2] Fetch ignores `standalone`/`projectId` props and overwrites the global store for Instance AI and agent surfaces
packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue:319-321 The props say `standalone` is meant to "skip all global store writes", and `projectId` is there so callers can scope credentials to the right project. Instance AI (`useWorkflowSetupBootstrap.ts` → `fetchAllCredentialsForWorkflow({ workflowId })`), agents (`AgentIntegrationsPanel.vue`, `AgentBuilderView.vue` → `fetchAllCredentialsForWorkflow({ projectId })`) and `NodeToolSettingsContent.vue` all fill the credentials store with a project-scoped list before rendering NodeCredentials. The new unconditional fetch replaces that list with whatever `projectsStore.currentProject` points to, not `props.projectId`, so these surfaces can end up listing the wrong project's credentials. Each NodeCredentials instance also fires its own full list request, so a setup panel with N cards sends N redundant requests that overwrite each other.
Mjolnir (Sonnet 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | exact |
`fetchAllCredentials` calls `setCredentials(credentials)`, which replaces the whole `state.credentials` map (credentials.store.ts:313 and 253-262). The editor loads that map with `fetchAllCredentialsForWorkflow` (NodeView, useWorkflowInitialization), so the new mount-time call swaps the workflow-scoped set for a list filtered by project. That can drop credentials selected on nodes that sit outside the current project. [grounded: diff] [consensus 3/3: valid=3]
raw comments (2)
[P2] Mount-time fetch replaces the workflow-scoped credential list
On every mount of `NodeCredentials` (every time an NDV opens), `fetchAllCredentials({ projectId: projectsStore.currentProject?.id })` runs. The store's `setCredentials` replaces the whole `state.credentials` map with the response. The editor normally populates that map with `fetchAllCredentialsForWorkflow`, which returns the credentials usable by this workflow. Scoping the overwrite to `currentProject` (or to all credentials when it is undefined) can drop credentials that are selected on nodes but outside that project filter. Examples are credentials shared in from another project, or a workflow opened outside its project context. When that happens, selected credentials may render as missing or invalid and the dropdown options change after the async response lands. Because the fetch is not awaited, the list can also change under the user mid-interaction. Consider upserting into the existing map, or fetching only when the store has no credentials loaded, instead of replacing the list on every mount.
[P2] Mount-time fetch can overwrite the workflow-scoped credential list
`fetchAllCredentials` ends in `setCredentials`, which replaces the whole credentials map in the store. The workflow and NDV views populate that map through `fetchAllCredentialsForWorkflow` (see `useWorkflowInitialization.ts:121` and `NodeView.vue:754`). That call includes credentials that are usable by the workflow but live outside the current project, such as credentials shared into it. Every time `NodeCredentials` mounts, for example each time a node's NDV opens, this new call issues an unrelated `getAllCredentials` request filtered by `projectsStore.currentProject?.id`. When it resolves, it can drop those workflow-scoped credentials from the store. Selected credentials from other projects could then show as missing in the dropdown, or the credential-issues check could flag them. The two responses also race, so which list wins depends on timing. Nothing re-fetches the workflow-scoped list afterwards. The fix should either merge the response into the store instead of replacing it, or reuse the workflow-scoped fetch.
qodo · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | medium | ✓ | off by one |
The component has a `projectId` prop, and standalone callers like AskCredentialCard pass `:project-id="projectId"`. The new fetch ignores that prop and uses currentProject instead. Since fetchAllCredentials calls setCredentials, which replaces the whole store, credentials from the wrong project can overwrite the ones already loaded. [grounded: diff] [consensus 3/3: valid=3]
The new onMounted call runs the full credential fetch and replaces the store on every mount. Nothing skips the request when one is already in flight or the data is fresh, so remounts cause repeated network requests and store replacements. This is a real but modest performance regression. [grounded: diff] [consensus 3/3: valid=3]
raw comments (5)
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
1\. Shared workflow credentials disappear <code>🐞 Bug</code> <code>≡ Correctness</code>
<pre>
<b><i>onMounted</i></b> calls <b><i>fetchAllCredentials</i></b> with a project filter, and that action replaces the map
previously loaded by <b><i>fetchAllCredentialsForWorkflow</i></b>. When the opened workflow can use a credential
shared from another project, the later general-project response omits that workflow-authorized
credential and every node credential dropdown reading the shared store loses it.
</pre>
<details>
<summary><strong>Agent Prompt</strong></summary>
```
## Issue description
The mount-time general credential fetch replaces the workflow-scoped credential set and can remove credentials shared into the workflow from another project.
## Fix Focus Areas
- packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[319-321]
- packages/frontend/editor-ui/src/features/credentials/credentials.store.ts[285-325]
- packages/frontend/editor-ui/src/app/views/NodeView.vue[736-755]
## Recommended Fix
Do not replace workflow-scoped credentials with a general project fetch from this child component. Refresh through the workflow-aware loading path using the active workflow identifier, or move the refresh to the parent workflow initialization where the correct scope is available.
```
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
</details>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
2\. Standalone pickers load wrong project <code>🐞 Bug</code> <code>≡ Correctness</code>
<pre>
<b><i>NodeCredentials</i></b> ignores its <b><i>projectId</i></b> prop and scopes the new request with
<b><i>projectsStore.currentProject?.id</i></b> instead. Standalone agent, setup, and tool-config callers can
target a different project, and one parent sets <b><i>currentProject</i></b> only after child mount, so the
wrong response replaces their correctly prefetched choices.
</pre>
<details>
<summary><strong>Agent Prompt</strong></summary>
```
## Issue description
Standalone callers pass an explicit target project, but the new refresh ignores it and can replace the shared store with credentials from the current navigation project.
## Fix Focus Areas
- packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[319-321]
- packages/frontend/editor-ui/src/features/agents/components/interactive/AskCredentialCard.vue[90-98]
- packages/frontend/editor-ui/src/features/shared/toolConfig/NodeToolSettingsContent.vue[371-380]
## Recommended Fix
Use `props.projectId` as the credential request scope whenever it is provided, falling back to the current project only for callers without an explicit scope. Ensure the refresh cannot overwrite a newer request for a different project.
```
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
</details>
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended">
3\. Panel switches repeat full reloads <code>🐞 Bug</code> <code>➹ Performance</code>
<pre>
<b><i>NodeCredentials</i></b> starts a network request on every mount even though workflow initialization
already loads the workflow's credentials. Switching repeatedly to the credential panel creates the
component through a <b><i>v-if</i></b> branch, so each visit repeats a full credential-list request and store
replacement.
</pre>
<details>
<summary><strong>Agent Prompt</strong></summary>
```
## Issue description
Every component mount performs a full credential refresh, including remounts caused by normal node-panel navigation after credentials were already initialized.
## Fix Focus Areas
- packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[319-321]
- packages/frontend/editor-ui/src/features/ndv/settings/components/NodeSettings.vue[738-779]
- packages/frontend/editor-ui/src/app/composables/useWorkflowInitialization.ts[103-122]
## Recommended Fix
Centralize credential refresh in the owning workflow or standalone parent and reuse the initialized store in `NodeCredentials`. If the component must initiate loading, add a scope-aware in-flight and freshness guard so remounts do not issue duplicate requests.
```
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
</details>
<h3>PR Summary by Qodo</h3>
Refresh credentials when the node credential selector mounts
<code>🐞 Bug fix</code> <code>🧪 Tests</code> <code>🕐 Less than 10 minutes</code>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<details>
<summary>AI Description</summary>
<dl>
<dd>
<br/>
><pre>
>• Refreshes project-scoped credentials whenever the node credentials selector mounts.
>• Prevents existing nodes from showing stale or missing credential options.
>• Adds regression coverage confirming the server refresh occurs.
></pre>
</dd>
</dl>
</details>
<details>
<summary>Diagram</summary>
<dl>
<dd>
<br/>
```mermaid
sequenceDiagram
participant NC as Node Credentials
participant PS as Project Store
participant CS as Credentials Store
participant API as Credentials API
NC->>PS: Read project ID
NC->>CS: Fetch credentials
CS->>API: Request credentials
API-->>CS: Return credentials
CS-->>NC: Refresh options
```
</dd>
</dl>
</details>
<details>
<summary>High-Level Assessment</summary>
<dl>
<dd>
<br/>
>The direct mount-time refresh is appropriate because NodeCredentials can otherwise render stale store state. Reusing the existing project-scoped store action keeps API and state-management logic centralized; relying solely on parent views to preload credentials would leave independently mounted selectors vulnerable to stale data.
</dd>
</dl>
</details>
<details>
<summary> Files changed (2) <code> +13 / -0 </code> </summary>
<dl>
<dd>
<br/>
<details>
<summary>Bug fix (1) <code> +4 / -0 </code></summary>
<dl>
<dd>
<details>
<summary>NodeCredentials.vue<code>Refresh project credentials during component mounting</code> <code>+4/-0</code></summary>
<br/>
>Refresh project credentials during component mounting
>
><pre>
>• Calls fetchAllCredentials when the selector mounts, scoped to the current project. This ensures existing nodes use current server-side credential data instead of potentially stale local state.
></pre>
>
><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/56/files#diff-482cab688da7c590f0be737ad690ab19790e0be720f0dd0cfcd2906aee9cada4'>packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue</a>
</details>
</dd>
</dl>
</details>
<details>
<summary>Tests (1) <code> +9 / -0 </code></summary>
<dl>
<dd>
<details>
<summary>NodeCredentials.test.ts<code>Cover credential refresh on component mount</code> <code>+9/-0</code></summary>
<br/>
>Cover credential refresh on component mount
>
><pre>
>• Adds a regression test verifying that mounting NodeCredentials for an existing node invokes the credentials store refresh action.
></pre>
>
><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/56/files#diff-076dd6a7a584f09adce1f22c177df7109b7d1ec389f1203568cf8f5b5b4b53c1'>packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.test.ts</a>
</details>
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<h3>Code Review by Qodo</h3>
<code>🐞 Bugs (3)</code> <code>📘 Rule violations (0)</code> <code>📜 Skill insights (0)</code>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<br/>
<img src="https://img.shields.io/badge/High-634FD1?style=flat-square" height="20px" alt="Action required">
<details>
<summary> 1. Shared workflow credentials disappear <code>🐞 Bug</code> <code>≡ Correctness</code></summary>
<br/>
> <details open>
><summary>Description</summary>
><br/>
>
><pre>
><b><i>onMounted</i></b> calls <b><i>fetchAllCredentials</i></b> with a project filter, and that action replaces the map
>previously loaded by <b><i>fetchAllCredentialsForWorkflow</i></b>. When the opened workflow can use a credential
>shared from another project, the later general-project response omits that workflow-authorized
>credential and every node credential dropdown reading the shared store loses it.
></pre>
></details>
> <details>
><summary>Code</summary>
><br/>
>
><code>[packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[R319-321]](https://github.com/drape-io/crbench-qodo-2026-09/pull/56/files#diff-482cab688da7c590f0be737ad690ab19790e0be720f0dd0cfcd2906aee9cada4R319-R321)</code>
>
>```diff
>+ void credentialsStore.fetchAllCredentials({
>+ projectId: projectsStore.currentProject?.id,
>+ });
>```
></details>
> <details>
><summary>Evidence</summary>
><br/>
>
><pre>
>The NDV loads credentials through the workflow-specific action, while the added call uses the
>general project endpoint; both actions call <b><i>setCredentials</i></b>, which replaces the entire credential
>map. The backend workflow query includes credentials available through workflow and project access,
>so a project-only response is not an equivalent replacement.
></pre>
>
> <code>[packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[319-321]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue/#L319-L321)</code>
> <code>[packages/frontend/editor-ui/src/features/credentials/credentials.store.ts[285-325]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/credentials/credentials.store.ts/#L285-L325)</code>
> <code>[packages/frontend/editor-ui/src/app/views/NodeView.vue[736-755]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/app/views/NodeView.vue/#L736-L755)</code>
> <code>[packages/cli/src/credentials/credentials.service.ts[516-551]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/cli/src/credentials/credentials.service.ts/#L516-L551)</code>
></details>
> <details>
><summary>Agent prompt</summary>
><br/>
>
>```
>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
>
>## Issue description
>The mount-time general credential fetch replaces the workflow-scoped credential set and can remove credentials shared into the workflow from another project.
>
>## Fix Focus Areas
>- packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[319-321]
>- packages/frontend/editor-ui/src/features/credentials/credentials.store.ts[285-325]
>- packages/frontend/editor-ui/src/app/views/NodeView.vue[736-755]
>
>## Recommended Fix
>Do not replace workflow-scoped credentials with a general project fetch from this child component. Refresh through the workflow-aware loading path using the active workflow identifier, or move the refresh to the parent workflow initialization where the correct scope is available.
>```
> <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
<details>
<summary> 2. Standalone pickers load wrong project <code>🐞 Bug</code> <code>≡ Correctness</code></summary>
<br/>
> <details open>
><summary>Description</summary>
><br/>
>
><pre>
><b><i>NodeCredentials</i></b> ignores its <b><i>projectId</i></b> prop and scopes the new request with
><b><i>projectsStore.currentProject?.id</i></b> instead. Standalone agent, setup, and tool-config callers can
>target a different project, and one parent sets <b><i>currentProject</i></b> only after child mount, so the
>wrong response replaces their correctly prefetched choices.
></pre>
></details>
> <details>
><summary>Code</summary>
><br/>
>
><code>[packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[R319-321]](https://github.com/drape-io/crbench-qodo-2026-09/pull/56/files#diff-482cab688da7c590f0be737ad690ab19790e0be720f0dd0cfcd2906aee9cada4R319-R321)</code>
>
>```diff
>+ void credentialsStore.fetchAllCredentials({
>+ projectId: projectsStore.currentProject?.id,
>+ });
>```
></details>
> <details>
><summary>Evidence</summary>
><br/>
>
><pre>
>Multiple standalone callers explicitly pass <b><i>projectId</i></b>, while the added request reads unrelated
>mutable project-store state. <b><i>fetchAllCredentials</i></b> then replaces all stored credentials, and the
>tool-config parent demonstrates that its current-project assignment occurs after the child can
>mount.
></pre>
>
> <code>[packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[69-71]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue/#L69-L71)</code>
> <code>[packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[319-321]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue/#L319-L321)</code>
> <code>[packages/frontend/editor-ui/src/features/agents/components/interactive/AskCredentialCard.vue[90-98]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/agents/components/interactive/AskCredentialCard.vue/#L90-L98)</code>
> <code>[packages/frontend/editor-ui/src/features/agents/views/AgentBuilderView.vue[557-563]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/agents/views/AgentBuilderView.vue/#L557-L563)</code>
> <code>[packages/frontend/editor-ui/src/features/shared/toolConfig/NodeToolSettingsContent.vue[314-326]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/shared/toolConfig/NodeToolSettingsContent.vue/#L314-L326)</code>
> <code>[packages/frontend/editor-ui/src/features/shared/toolConfig/NodeToolSettingsContent.vue[371-380]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/shared/toolConfig/NodeToolSettingsContent.vue/#L371-L380)</code>
> <code>[packages/frontend/editor-ui/src/features/credentials/credentials.store.ts[302-314]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/credentials/credentials.store.ts/#L302-L314)</code>
></details>
> <details>
><summary>Agent prompt</summary>
><br/>
>
>```
>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
>
>## Issue description
>Standalone callers pass an explicit target project, but the new refresh ignores it and can replace the shared store with credentials from the current navigation project.
>
>## Fix Focus Areas
>- packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[319-321]
>- packages/frontend/editor-ui/src/features/agents/components/interactive/AskCredentialCard.vue[90-98]
>- packages/frontend/editor-ui/src/features/shared/toolConfig/NodeToolSettingsContent.vue[371-380]
>
>## Recommended Fix
>Use `props.projectId` as the credential request scope whenever it is provided, falling back to the current project only for callers without an explicit scope. Ensure the refresh cannot overwrite a newer request for a different project.
>```
> <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
<br/>
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended">
<details>
<summary> 3. Panel switches repeat full reloads <code>🐞 Bug</code> <code>➹ Performance</code></summary>
<br/>
> <details open>
><summary>Description</summary>
><br/>
>
><pre>
><b><i>NodeCredentials</i></b> starts a network request on every mount even though workflow initialization
>already loads the workflow's credentials. Switching repeatedly to the credential panel creates the
>component through a <b><i>v-if</i></b> branch, so each visit repeats a full credential-list request and store
>replacement.
></pre>
></details>
> <details>
><summary>Code</summary>
><br/>
>
><code>[packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[R319-321]](https://github.com/drape-io/crbench-qodo-2026-09/pull/56/files#diff-482cab688da7c590f0be737ad690ab19790e0be720f0dd0cfcd2906aee9cada4R319-R321)</code>
>
>```diff
>+ void credentialsStore.fetchAllCredentials({
>+ projectId: projectsStore.currentProject?.id,
>+ });
>```
></details>
> <details>
><summary>Evidence</summary>
><br/>
>
><pre>
>Workflow initialization already loads credentials before the picker is used, while node settings
>conditionally creates another picker whenever the credential panel is entered. Since the added
>callback has no loaded-state or in-flight guard, every such mount reaches the API and replaces the
>store.
></pre>
>
> <code>[packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[319-321]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue/#L319-L321)</code>
> <code>[packages/frontend/editor-ui/src/features/ndv/settings/components/NodeSettings.vue[738-779]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/ndv/settings/components/NodeSettings.vue/#L738-L779)</code>
> <code>[packages/frontend/editor-ui/src/app/composables/useWorkflowInitialization.ts[103-122]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/app/composables/useWorkflowInitialization.ts/#L103-L122)</code>
> <code>[packages/frontend/editor-ui/src/features/credentials/credentials.store.ts[285-315]](https://github.com/drape-io/crbench-qodo-2026-09/blob/038cfe04bbfe6a96bb55008969036ba3af79153b/packages/frontend/editor-ui/src/features/credentials/credentials.store.ts/#L285-L315)</code>
></details>
> <details>
><summary>Agent prompt</summary>
><br/>
>
>```
>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
>
>## Issue description
>Every component mount performs a full credential refresh, including remounts caused by normal node-panel navigation after credentials were already initialized.
>
>## Fix Focus Areas
>- packages/frontend/editor-ui/src/features/credentials/components/NodeCredentials.vue[319-321]
>- packages/frontend/editor-ui/src/features/ndv/settings/components/NodeSettings.vue[738-779]
>- packages/frontend/editor-ui/src/app/composables/useWorkflowInitialization.ts[103-122]
>
>## Recommended Fix
>Centralize credential refresh in the owning workflow or standalone parent and reuse the initialized store in `NodeCredentials`. If the component must initiate loading, add a scope-aware in-flight and freshness guard so remounts do not issue duplicate requests.
>```
> <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-context:start -->
<details><summary><strong>Context sources</strong></summary>
<div>Review mode: <code>⚖️ Balanced</code>: This is a localized runtime behavior change that adds credential fetching on component mount, affecting project-scoped credential state and requiring a careful correctness review.</div>
<!-- qodo-context:end -->
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:start -->
<details>
<summary><strong>Tip of the day</strong></summary>
<br/>
<pre>💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper</pre>
<a href="https://docs.qodo.ai/tips-and-tricks">More tips ↗</a> | <a href="https://app.qodo.ai/configurations?tab=display-preferences">Customize Qodo ↗</a> | <a href="https://docs.qodo.ai">Qodo docs ↗</a>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:end -->
<!-- https://github.com/drape-io/crbench-qodo-2026-09/commit/038cfe04bbfe6a96bb55008969036ba3af79153b -->
<a href="https://www.qodo.ai"><img src="https://www.qodo.ai/wp-content/uploads/2025/03/qodo-logo.svg" width="80" alt="Qodo Logo"></a>