Skip to content

fix(secrets): hold the system-vault busy flag across the delete confirm (#20756) - #21157

Merged
mrveiss merged 7 commits into
mainfrom
issue-20756
Nov 8, 2026
Merged

mrveiss merged 7 commits into
mainfrom
issue-20756

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

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.

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ec255db and 12d0c4c.

Files selected for processing: 5

  • autobot-frontend/src/components/secrets/SystemVaultSecrets.vue
  • autobot-frontend/src/components/secrets/__tests__/SystemVaultSecrets.overlap.test.ts
  • autobot-frontend/src/components/secrets/__tests__/SystemVaultSecrets.test.ts
  • autobot-frontend/src/composables/__tests__/useConfirmDialog.test.ts
  • autobot-frontend/src/composables/useConfirmDialog.ts
Walkthrough

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: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive 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 Passed checks: 4 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed 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 Passed 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.

Share

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. 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
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@mrveiss mrveiss added this to the M3 - Refined GUI complete milestone Nov 8, 2026
@mrveiss mrveiss added bug Something isn't working frontend phase:M3.9 Chat, Agents, Analytics and Settings screens labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) follow-up at 279b22d

Verdict: APPROVE (two low-severity test-strength notes, non-blocking)

Severity File:line Finding Fix
Low 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.vue remove 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.

  • en.json security.secretsManager.systemVault (line 6930) contains only: title, unavailable, empty, newValue, rotate, save, cancel, delete, deleteTitle, deleteMessage. No failed key.
  • SystemVaultSecrets.vue:39 on main: <BaseAlert v-if="failed" variant="error" :message="t('security.secretsManager.writeFailed')" />
  • en.json:6929 security.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).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b936aa2 and ec255db.

Files selected for processing: 2

  • autobot-frontend/src/components/secrets/SystemVaultSecrets.vue
  • autobot-frontend/src/components/secrets/__tests__/SystemVaultSecrets.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

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.

  1. 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.
  2. 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.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

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.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) at 631818d

Verdict: APPROVE (0 blocking, 0 med; two low notes)

# Severity File:line Issue Fix
1 LOW components/knowledge/SystemKnowledgeManager.vue:577-580 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.
2 LOW SystemVaultSecrets.test.ts spec titles, commit subjects 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.

AC coverage (Closes #21175):

Main-merge commits: clean. git show --cc 631818d3d6 is empty, and the PR's three-dot diff is 5 files, +170/-5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend phase:M3.9 Chat, Agents, Analytics and Settings screens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ui): a replaced confirmation never settles, and the vault Delete can open a second confirm while the first is showing

1 participant