You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(secrets): hold the system-vault busy flag across the delete confirm (#20756) - #21157
The system-vault Delete button was already disabled while a write ran, but busy was only set after the delete confirm resolved. A second click while the confirm was open started another confirm and could send a second DELETE, which 404s and surfaces the unconfirmed-write error for a secret that was already deleted.
What Changed
SystemVaultSecrets.vue: busy is now held across the delete confirm (askToDelete), so the button is disabled for the whole interaction, and remove returns early when busy is set, so a re-entrant call is a no-op.
AC 2 (reword the "list has been reloaded" message): no change needed on current main. The system-vault alert now uses the shared security.secretsManager.writeFailed string (since bug(secrets): deleting a user secret ignores the dependents refusal and every write failure is silent, unlike the system vault #20732), which already reads "The change could not be confirmed. It may have been refused, or applied with the response lost. Check the list before retrying." The systemVault.failed key named in the issue no longer exists, and no English string says the list has been reloaded.
Verification
New spec in SystemVaultSecrets.test.ts: a second delete click while the confirm is open, and another after the write is in flight, opens no second confirm and sends no second DELETE.
vitest run SystemVaultSecrets.test.ts in a scratch copy: 12 passed.
Model Used
Claude (Anthropic), via Claude Code.
Refs
Closes#21175
Refs #20756 (closed via #20763; this PR covers the confirm-window hole and the shared resolver defect it left)
Single-issue rationale: a one-file frontend defect with its own spec; no other open issue touches this component.
Summary by CodeRabbit
Bug Fixes
Prevented repeated delete requests while a confirmation is pending or a deletion is in progress, avoiding duplicate prompts and actions.
Cancelling a deletion confirmation now leaves the Delete action available for future use. The interface also safely ignores repeated delete attempts during these busy periods, providing more predictable behaviour when users click quickly or trigger the action more than once.
The system vault delete flow now ignores repeated delete calls while confirmation or deletion is pending. Tests cover repeated clicks and cancellation.
Changes: System vault deletion
Layer / File(s)
Summary
Guard delete confirmation and calls autobot-frontend/src/components/secrets/SystemVaultSecrets.vue, autobot-frontend/src/components/secrets/__tests__/SystemVaultSecrets.test.ts
askToDelete holds busy while confirmation is open and clears it after confirmation resolves or throws. remove returns when busy is true and starts deletion only when confirmation succeeds. Tests cover repeated clicks during confirmation and deletion, direct repeated handler calls, and cancellation.
Severity of issue fixed: Low
Merge Risk: Low · previous review ec255
The repeated-click protection works, but an overlapping confirmation can leave Rotate and Delete disabled until the panel is reopened. Merge risk is bounded if this edge case is explicitly accepted for follow-up.
Pre-merge checks: 4 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Linked Issues check
Issue #20756 has two coding items.
(1) Delete during a write [#20756]: Met at the reviewed head. The head template already binds :disabled="busy" on the Delete button. The diff changes only the scr…
Provide the en.json entries for security.secretsManager.writeFailed and security.secretsManager.systemVault.failed. Confirm whether the systemVault.failed key still exists and whether any English string still says the list was reloa…
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the fix in the secrets area and the busy flag held across the delete confirmation. The changeset matches this: SystemVaultSecrets.vue keeps busy set across askToDelete and returns earl…
Out of Scope Changes check
The reviewed changes stay within the scope of #20756. SystemVaultSecrets.vue changes only the delete path: askToDelete is added, busy is held across the confirm, and remove has a re-entrancy g…
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check
Explanation
The title names the fix in the secrets area and the busy flag held across the delete confirmation. The changeset matches this: SystemVaultSecrets.vue keeps busy set across askToDelete and returns early from remove when busy, and the test file adds re-entrancy coverage. The title is specific and describes the main change, though it omits the failure-message wording point from linked issue #20756, which the PR resolves without a code change.
Full details: Out of Scope Changes check
Explanation
The reviewed changes stay within the scope of #20756. SystemVaultSecrets.vue changes only the delete path: askToDelete is added, busy is held across the confirm, and remove has a re-entrancy guard. The new spec in SystemVaultSecrets.test.ts covers those same repeated-click cases, so it supports the objective. The PR does not change any unrelated component or locale file in the reviewed diff summary. The change set has no unrelated work.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)
Full details: Linked Issues check
Explanation
Issue #20756 has two coding items.
(1) Delete during a write [#20756]: Met at the reviewed head. The head template already binds :disabled="busy" on the Delete button. The diff changes only the script. The new askToDelete sets busy before confirm and clears it in finally. remove returns early when busy is set. A second click during the confirm, or during the write, therefore opens no second confirm and sends no second DELETE. The issue text that says the button has no :disabled="busy" does not match the head code.
(2) Failure message wording [#20756]: Not established. At the head, SystemVaultSecrets.vue no longer references security.secretsManager.systemVault.failed. It renders security.secretsManager.writeFailed. The PR states that this string says "The change could not be confirmed ... Check the list before retrying." and that the systemVault.failed key was removed. en.json is larger than the 16000-byte read limit. The read truncated before the relevant keys, so the text of writeFailed and the presence of systemVault.failed could not be checked.
Resolution
Provide the en.json entries for security.secretsManager.writeFailed and security.secretsManager.systemVault.failed. Confirm whether the systemVault.failed key still exists and whether any English string still says the list was reloaded. Either an excerpt or a narrower read of those keys is sufficient.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Notice: 29 open PRs — past the runaway threshold (25)
This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.
This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.
If the queue is draining normally, ignore this. Otherwise:
Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
Look for a loop opening near-identical PRs
Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.
SystemVaultSecrets.test.ts (new spec, 2nd and 3rd trigger('click'))
The spec proves the disabled attribute, which would fail without the fix (the button would not be disabled while the confirm is open). But test-utils trigger is a no-op on a disabled element, so the later clicks never reach remove. The if (busy.value) return guard is therefore not exercised on its own.
Call the handler directly, e.g. wrapper.findComponent(...).vm.$emit('click') or button.element.click()-equivalent bypassing disabled, and assert confirm stays at one call.
Low
same spec
No case for the cancel path (confirm resolves false). The code is correct (finally in askToDelete resets busy), but nothing pins "no stuck-disabled after cancel".
Add: resolve false, flush, assert disabled is absent and deleteSecret not called.
Info
SystemVaultSecrets.vueremove
Between askToDelete's finally (busy=false) and run setting busy=true there is one microtask where busy is false. No user event can land in it, so not a real window.
None needed.
busy reset / stuck-disabled check:askToDelete resets busy in finally, so it is cleared on confirm resolve true, false, or reject. run already resets in finally for the write. No path leaves busy set. remove returns early before touching busy, so it cannot clear another operation's flag.
AC2 evidence (systemVault.failed): verified against origin/main.
SystemVaultSecrets.vue:39 on main: <BaseAlert v-if="failed" variant="error" :message="t('security.secretsManager.writeFailed')" />
en.json:6929security.secretsManager.writeFailed: "The change could not be confirmed. It may have been refused, or applied with the response lost. Check the list before retrying."
grep -i reloaded over main en.json: 0 matches. No string says the list "has been reloaded".
git grep 'systemVault\.failed' over main frontend src: 0 matches.
AC2 is satisfied on main; no wording change is needed. AC1 is met by the diff (confirm window and write window both covered by busy).
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Code review (code-reviewer pass) follow-up at ec255db
Both LOW findings are fixed, in the spec only (SystemVaultSecrets.test.ts); no component change was needed.
Busy guard: remove() itself ignores a re-entrant call while busy, bypassing the disabled button (#20756). It emits click straight to the bound handler, since trigger is a no-op on a disabled element. It asserts confirm was called once and deleteSecret never. With the if (busy.value) return line removed, this test fails (mutation checked); with it, it passes.
Confirm cancel: cancelling the confirm re-enables Delete and deletes nothing (#20756). The confirm resolves false; Delete is enabled again and deleteSecret was not called.
vitest on this spec: 14 passed (14), 1 file. eslint on the spec: clean.
Code review (code-reviewer pass) follow-up at 631818d: (1) test: emitted click on the component while DELETE is pending is a no-op; (2) shared useConfirmDialog.confirm() now settles a replaced pending confirmation with false, so busy can no longer stick after a dismissed overlap. New tests: useConfirmDialog.test.ts, SystemVaultSecrets.overlap.test.ts; 31 specs of the dialog's consumers pass and eslint is clean.
Only caller where false is not "stop": forceReindex = await confirm(...) then indexing starts anyway (non-force). A replaced confirm now settles false and starts a non-forced doc index the user never answered; before, it hung with nothing started. Same outcome as pressing Cancel today, not destructive or irreversible.
Optional: a follow-up issue to give this dialog a distinct three-way answer. Not for this PR.
Tagged #20756; the issue this PR closes is #21175.
Info only.
Callers of useConfirmDialog (37 files import it; confirm call sites reviewed in each). A plain confirm or cancel is unchanged: _resolve (useConfirmDialog.ts:30-36) is untouched, and the new lines (19-22) only run when a resolver is already pending. All other callers treat false as "do nothing" (if (!ok) return or if (ok) { ... }), so a replaced confirm is a no-op for them. That includes every destructive or irreversible path: ChatSidebar:760 / ChatFilePanel:412,463 / ChatFolderNode:211 / ChatMessages:1046 / ChatInterface:788, KnowledgeEntries:650,660, FailedVectorizationsManager:126,134, DeduplicationManager:244,266, KnowledgeHealthTools:189-193 (two-step clear, a false at either step returns), DeviceManagementPanel:124 (unpair), MemoryPrivacyPanel:158,180, VoiceSettingsPanel:251, WatchFoldersPanel:336, FileBrowser:319, SourceManager:342, CodebaseAnalyticsLanding:345, PatternAnalysis:344, BrowserSessionManager:344, DocumentChangeFeed:296, ShareKnowledgeDialog:355 (false keeps the dialog open), SystemKnowledgeManager:308,365,485,628, TerminalWindow:893, the five llc/workflowPlanner callers, composables/useSharedTokenRevoke.ts:43-47 (revoke), composables/security/useSecretWrites.ts:61-65 (forced dependent delete), AdvancedControlView:652 (emergency stop), CustomDashboard:338, llc/CompanyDashboard:146. No destructive, revoking, sending or rotating path runs on false. The one non-"stop" caller is row 1.
Spec evidence:useConfirmDialog.test.ts covers an overlap settling the first with false, and a dismissed overlap settling both. SystemVaultSecrets.overlap.test.ts covers the vault panel against the real dialog. frontend-tests on this head shows cancelled, so AC3 below rests on the callers' unchanged logic, not on a green run.
CodeRabbit threads: 2 total; both answered and resolved. (1) test strength, SystemVaultSecrets.test.ts:111 emits click on the component during the pending DELETE, which CodeRabbit confirmed. (2) the shared resolver overwrite, fixed at useConfirmDialog.ts:19-22. CodeRabbit's follow-up suggests a test that replaces an already-open vault confirmation. That is optional; the mechanism is covered at composable level.
AC1 ✓ useConfirmDialog.ts:19-22 (resolveRef.value?.(false) before replacing); two-overlap test at useConfirmDialog.test.ts:25-33.
AC2 ✓ SystemVaultSecrets.vue:97-108 (askToDelete sets busy across the confirm, clears it in finally) and :110-112 (remove returns early on busy). Tests: SystemVaultSecrets.test.ts:80 (second click during the confirm and during the write), :97 and :111 (re-entrant call), :126 (cancel re-enables Delete).
AC3 ✓ by code read (see callers above); CI frontend-tests is cancelled on this head, so confirm green before merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workingfrontendphase:M3.9Chat, Agents, Analytics and Settings screens
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
The system-vault Delete button was already disabled while a write ran, but
busywas only set after the delete confirm resolved. A second click while the confirm was open started another confirm and could send a second DELETE, which 404s and surfaces the unconfirmed-write error for a secret that was already deleted.What Changed
SystemVaultSecrets.vue:busyis now held across the delete confirm (askToDelete), so the button is disabled for the whole interaction, andremovereturns early whenbusyis set, so a re-entrant call is a no-op.security.secretsManager.writeFailedstring (since bug(secrets): deleting a user secret ignores the dependents refusal and every write failure is silent, unlike the system vault #20732), which already reads "The change could not be confirmed. It may have been refused, or applied with the response lost. Check the list before retrying." ThesystemVault.failedkey named in the issue no longer exists, and no English string says the list has been reloaded.Verification
SystemVaultSecrets.test.ts: a second delete click while the confirm is open, and another after the write is in flight, opens no second confirm and sends no second DELETE.vitest run SystemVaultSecrets.test.tsin a scratch copy: 12 passed.Model Used
Claude (Anthropic), via Claude Code.
Refs
Closes #21175
Refs #20756 (closed via #20763; this PR covers the confirm-window hole and the shared resolver defect it left)
Single-issue rationale: a one-file frontend defect with its own spec; no other open issue touches this component.
Summary by CodeRabbit