From da092eb2570717d3a15cbe1f683388ea46608a2b Mon Sep 17 00:00:00 2001
From: Aizat Hawari
Date: Fri, 27 Nov 2026 18:43:08 +0000
Subject: [PATCH 1/3] chore: propose settings-confirm-dialogs change
Every settings save and settings job action on the Settings and Memory
pages will confirm through the shared settings dialog first. Planning
artifacts only; validate --strict passes.
---
.../settings-confirm-dialogs/.openspec.yaml | 2 +
.../settings-confirm-dialogs/design.md | 60 +++++++
.../settings-confirm-dialogs/proposal.md | 43 +++++
.../specs/web-memory-hosts/spec.md | 25 +++
.../specs/web-memory/spec.md | 25 +++
.../specs/web-settings/spec.md | 153 ++++++++++++++++++
.../changes/settings-confirm-dialogs/tasks.md | 71 ++++++++
7 files changed, 379 insertions(+)
create mode 100644 openspec/changes/settings-confirm-dialogs/.openspec.yaml
create mode 100644 openspec/changes/settings-confirm-dialogs/design.md
create mode 100644 openspec/changes/settings-confirm-dialogs/proposal.md
create mode 100644 openspec/changes/settings-confirm-dialogs/specs/web-memory-hosts/spec.md
create mode 100644 openspec/changes/settings-confirm-dialogs/specs/web-memory/spec.md
create mode 100644 openspec/changes/settings-confirm-dialogs/specs/web-settings/spec.md
create mode 100644 openspec/changes/settings-confirm-dialogs/tasks.md
diff --git a/openspec/changes/settings-confirm-dialogs/.openspec.yaml b/openspec/changes/settings-confirm-dialogs/.openspec.yaml
new file mode 100644
index 00000000..8c7aa0b9
--- /dev/null
+++ b/openspec/changes/settings-confirm-dialogs/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-11-27
diff --git a/openspec/changes/settings-confirm-dialogs/design.md b/openspec/changes/settings-confirm-dialogs/design.md
new file mode 100644
index 00000000..17341fe0
--- /dev/null
+++ b/openspec/changes/settings-confirm-dialogs/design.md
@@ -0,0 +1,60 @@
+## Context
+
+- The shared pattern exists: `web/src/hooks/useSettingsConfirm.tsx` (`ask(request)` plus one rendered `dialog`) and `web/src/lib/components/settings/SettingsConfirmDialog.tsx`. The dialog runs the request only after confirm, shows progress, keeps a server error inside itself and closes on success. `onCancel` lets a card put a save-on-change control back to its saved value. `ReasoningLevel.tsx` shows that use.
+- The Memorisation page already follows the rule through `web/src/hooks/useMemorisationConfirm.tsx` (PR #311).
+- An audit of `web/src` (2026-11-27) listed every settings action without a dialog. The tasks name each card and trigger.
+- Most cards stage edits in a form and save with one button. A few save on change: the summary language select, the two Skill learning switches, and the automatic import checkbox when turned off. A few are one-click actions: Pause, Resume, Retry, Retry now, Use external API, Generate token, Save password, Clear password, Record past turns, Ignore and Restore.
+- File sizes: `memory/DirectoryMapsSection.tsx` is at the 500-line limit. `settings/ExternalApiSection.tsx` (456), `settings/EmbeddingSection.tsx` (431) and `memory/RerankerSection.tsx` (417) are close to it.
+
+## Goals / Non-Goals
+
+**Goals:**
+
+- Every settings save and settings job action on the Settings and Memory pages confirms first, through one shared dialog.
+- The dialog says exactly what will change: each setting with its old and new value, or one sentence for a job.
+- Same request bodies as today. No server change.
+
+**Non-Goals:**
+
+- Actions that are not settings saves: memory delete, cleanup and dedup (`window.confirm` in `useMemoriesExplorer.ts`), "Analyse waiting prompts", Add memory, pin and unpin, profile Refresh, skill proposal Apply, Reject and Undo, skill mode and drafts, and the chat folder move. These go to a later change.
+- Local-only view preferences (theme, palette, date and time format, language, sidebar, paging, filters). They write no server state.
+- Test buttons and the Health check. They change nothing.
+- A new dialog component, or a change to `SettingsConfirmDialog` beyond what the change list needs.
+
+## Decisions
+
+1. **Reuse `useSettingsConfirm` in every card.** Each card calls `ask` from its save handler and renders `dialog` once. A second dialog component was rejected because it would split the progress, error and close behaviour into two copies.
+
+2. **One shared change list.** A pure helper `settingsChanges(saved, draft, fields)` returns the changed rows as `{ label, from, to }`, and a small `SettingsChangeList` component renders them as a definition list. Each card passes its own labels and value formatters: On and Off for booleans, the translated option name for selects, a number with its unit, and "Default (value)" for a reset. A text body per card was rejected: it would drift from the real edits, and nothing would test that it matches what is sent.
+
+3. **One dialog per click.** When a card already opens a special dialog on a path, that dialog is the confirmation for that click, and its text gains the change list where it fits. Examples are memory cleanup's count dialog, the reranker's "Replace the key file?", the capture trace and zero-retention dialogs, and the external API's Save anyway. A second dialog after the first was rejected as noise.
+
+4. **Test, then confirm.** A Save that runs a test call (external API, reranker, embedding) runs the test first, because a test changes nothing. A passing test opens the confirm dialog. A refused key still saves nothing and opens no dialog. A test that cannot reach the server opens the existing Save anyway dialog, which is the confirmation.
+
+5. **Save-on-change controls hold a pending value.** The control shows the new value while the dialog is open, and `onCancel` puts the saved value back. This matches `ReasoningLevel.tsx`. Leaving the control on its saved value until confirm was rejected, because the user could not see what they had chosen.
+
+6. **Page checks first.** A value the page can check (range, URL scheme, empty required field) shows its message on the page, and no dialog opens. A dialog for a save that cannot succeed was rejected.
+
+7. **Job actions get one sentence.** Pause, Resume, Retry, Retry now and Record past turns each say what the job does and whether it calls a model. Pause is included because it changes saved state; the cost is one extra click.
+
+8. **The redaction warning moves into the dialog.** The inline Callout before turning off "Remove private text and secrets" becomes the shared dialog, with the same warning text in its body.
+
+9. **Size limits.** Cards near 500 lines move their confirm wiring into a small hook beside them, as `useMemorisationConfirm.tsx` does. `DirectoryMapsSection.tsx` is split first: the ignored-folders list moves to its own component. `tests/file-size-ceiling.test.ts` gets no new entry.
+
+10. **Docs and rules.** `web/AGENTS.md` says that the rule covers settings saves and settings job actions, and that local-only view preferences are excluded. The two web UI guides say each save asks first.
+
+## Risks / Trade-offs
+
+- [One more click on every save] → This is the rule the project chose. The dialog shows the exact changes, so the click is a check, not a formality.
+- [Many tests expect an immediate request] → Each is updated to confirm first and still asserts the same request body. Each card also gets a test that no request is sent before confirm.
+- [Pending values on save-on-change controls can leave a control showing an unsaved value] → `onCancel` and the dialog's close path always restore the saved value. A test covers Escape and the close button as well as Cancel.
+- [Special dialogs and the change list can disagree] → Decision 3 keeps one dialog per click, built from the same edits object that is sent.
+- [Large diff across about 25 files] → The work is split by page, so the groups do not touch the same files.
+
+## Migration Plan
+
+Web only. No data or config migration. Rollback: revert the commit.
+
+## Open Questions
+
+None.
diff --git a/openspec/changes/settings-confirm-dialogs/proposal.md b/openspec/changes/settings-confirm-dialogs/proposal.md
new file mode 100644
index 00000000..a67d58f3
--- /dev/null
+++ b/openspec/changes/settings-confirm-dialogs/proposal.md
@@ -0,0 +1,43 @@
+## Why
+
+`web/AGENTS.md` says every action that changes state opens a confirm dialog first. Many settings cards do not follow it. PR #311 made the Memorisation page confirm every save, and a read-only audit of `web/src` then found the rest of the app split three ways:
+
+- About 25 settings actions on the Settings and Memory pages write at once, with no dialog.
+- 7 cards confirm on one path only, for example the reranker's "Replace the key file?". Their ordinary Save still writes at once.
+- 9 cards already use the shared dialog (`useSettingsConfirm` and `SettingsConfirmDialog`).
+
+So the same kind of click asks first on one card and writes at once on the next. This change gives every settings save in the app the same confirm step.
+
+## What Changes
+
+- Every settings action on the Settings page and the Memory pages opens the shared settings confirm dialog before it sends a request. This covers Save buttons, settings that save on change (selects, switches, checkboxes), per-row Reset to default, and buttons that start or stop a settings job (Pause, Resume, Retry, Retry now, Record past turns, Use external API, Generate token, Save password and Clear password).
+- The dialog names the card, and lists each setting that changes with its old and new value in plain words. It has Cancel and a confirm button. Nothing is sent until the user confirms. It shows progress while the request runs. It shows a server error inside itself and stays open, and it closes on success.
+- **Cancel** sends nothing. A setting that saves on change goes back to its saved value. Text the user typed in a form stays as a draft.
+- A value that breaks a rule on the page still shows its message on the page, and no dialog opens.
+- The 7 partly covered cards keep their special dialogs. Their ordinary Save also confirms: capture retention, reasoning level, the external API Save (including the empty URL or model that turns it off), OpenRouter routing, memory cleanup (turning it off or raising the days), reranker and profile learning.
+- The inline Callout that asks before turning off "Remove private text and secrets" in Skill learning is replaced by the same shared dialog.
+- Every new string is in English, Chinese and Arabic. `docs/web-ui-settings.md`, `docs/web-ui-memory.md` and `web/AGENTS.md` describe the rule and its exceptions.
+
+No server, API or config change. The same requests are sent with the same bodies, only after the user confirms.
+
+Out of scope, for a later change: actions that are not settings saves, which the audit also found without the shared dialog. These are memory delete, cleanup and dedup through `window.confirm`, "Analyse waiting prompts", Add memory, pin and unpin, the profile Refresh, skill proposal Apply, Reject and Undo, skill mode and drafts, and the chat folder move. Local-only view preferences (theme, palette, date format, language, sidebar and paging state) stay without a dialog, because they change no server state.
+
+## Capabilities
+
+### New Capabilities
+
+None.
+
+### Modified Capabilities
+
+- `web-settings`: the shared confirm dialog for settings saves, its content and Cancel behaviour, and the Settings page cards that use it.
+- `web-memory`: the shared Memory page cards (memory limits, keyword mode, reranker, profile learning, profile auto cleanup and catch-up, directory maps) confirm before saving.
+- `web-memory-hosts`: the host cards and the overview (host model, automatic import off, Use external API, Pause, Resume and Retry, opening context and compaction, ignored folders) confirm before saving.
+
+## Impact
+
+- Web only, in `web/src/lib/components/settings/`, `web/src/lib/components/memory/` and `web/src/lib/components/skills/use-skill-settings.ts`. These use the existing `web/src/hooks/useSettingsConfirm.tsx` and `web/src/lib/components/settings/SettingsConfirmDialog.tsx`, plus one small shared helper that lists the changed settings.
+- Translation tables in `web/src/lib/i18n/` (English, Chinese, Arabic).
+- Tests in `web/tests/` for each card: no request before confirm, Cancel sends nothing, confirm sends the same body as today, and a server error stays in the dialog. Existing tests that expect an immediate request are updated to confirm first, without weakening what they check.
+- Docs: `docs/web-ui-settings.md`, `docs/web-ui-memory.md`, `web/AGENTS.md`.
+- Users: one more click per settings save.
diff --git a/openspec/changes/settings-confirm-dialogs/specs/web-memory-hosts/spec.md b/openspec/changes/settings-confirm-dialogs/specs/web-memory-hosts/spec.md
new file mode 100644
index 00000000..1b2a277f
--- /dev/null
+++ b/openspec/changes/settings-confirm-dialogs/specs/web-memory-hosts/spec.md
@@ -0,0 +1,25 @@
+## ADDED Requirements
+
+### Requirement: Host and overview saves confirm first
+
+On the host pages and the Memory overview these actions SHALL use the shared settings confirm dialog before they send a request: the host Save model, turning automatic import off, Use external API, Pause, Resume and Retry, Ignore on a folder row, and the opening context and compaction Save. The dialog content, Cancel and page checks SHALL follow the Settings rules. Turning automatic import on SHALL keep its existing dialog.
+
+#### Scenario: Turn automatic import off
+
+- **WHEN** the user clears "Import past chats automatically" for Pi
+- **THEN** a confirm dialog opens, and Cancel leaves the box ticked
+
+#### Scenario: Retry an import
+
+- **WHEN** the user selects **Retry** on a host whose import failed
+- **THEN** a confirm dialog says the retry calls the model again, and no run starts before the user confirms
+
+#### Scenario: Use external API
+
+- **WHEN** the user selects **Use external API** for OpenCode
+- **THEN** a confirm dialog says OpenCode will use the external API model, and nothing is saved before the user confirms
+
+#### Scenario: Opening context
+
+- **WHEN** the user changes the opening context and selects **Save**
+- **THEN** a confirm dialog lists the change and nothing is sent before the user confirms
diff --git a/openspec/changes/settings-confirm-dialogs/specs/web-memory/spec.md b/openspec/changes/settings-confirm-dialogs/specs/web-memory/spec.md
new file mode 100644
index 00000000..694c3014
--- /dev/null
+++ b/openspec/changes/settings-confirm-dialogs/specs/web-memory/spec.md
@@ -0,0 +1,25 @@
+## ADDED Requirements
+
+### Requirement: Shared Memory page saves confirm first
+
+On the shared Memory page these actions SHALL use the shared settings confirm dialog before they send a request: Save memory limits and each row's Reset to default, keyword mode, the reranker card's Save, profile learning Save, profile auto cleanup Save, catch-up Pause, and the directory maps Save removals and Restore. The dialog content, Cancel and page checks SHALL follow the Settings rules.
+
+#### Scenario: Memory limits
+
+- **WHEN** the user changes the maximum memories and selects **Save memory limits**
+- **THEN** a confirm dialog lists the change and nothing is sent before the user confirms
+
+#### Scenario: Reset one row
+
+- **WHEN** the user selects **Reset to default** on the similarity threshold row
+- **THEN** a confirm dialog shows the saved value and the default, and nothing is sent before the user confirms
+
+#### Scenario: Reranker switch
+
+- **WHEN** the user turns the reranker off and selects **Save**
+- **THEN** a confirm dialog opens, and Cancel leaves the saved reranker settings unchanged
+
+#### Scenario: Restore an ignored folder
+
+- **WHEN** the user selects **Restore** on an ignored folder
+- **THEN** a confirm dialog names the folder, and the folder stays ignored until the user confirms
diff --git a/openspec/changes/settings-confirm-dialogs/specs/web-settings/spec.md b/openspec/changes/settings-confirm-dialogs/specs/web-settings/spec.md
new file mode 100644
index 00000000..c5a2e914
--- /dev/null
+++ b/openspec/changes/settings-confirm-dialogs/specs/web-settings/spec.md
@@ -0,0 +1,153 @@
+## ADDED Requirements
+
+### Requirement: Settings saves confirm before sending
+
+Every action on the Settings and Memory pages that writes a setting or starts or stops a settings job SHALL open the shared settings confirm dialog first. The page SHALL send no request until the user confirms. The dialog SHALL show progress while the request runs, show a server error inside itself and stay open, and close on success. The confirmed request SHALL have the same body as it had before this rule.
+
+#### Scenario: Save button
+
+- **WHEN** the user changes the web app autostart box and selects **Save**
+- **THEN** a confirm dialog opens and no request is sent
+
+#### Scenario: Confirm
+
+- **WHEN** the user selects the confirm button in that dialog
+- **THEN** the page sends `webServerAutoStart` as before, shows progress, and closes the dialog when the save succeeds
+
+#### Scenario: Server refusal
+
+- **WHEN** the server refuses a confirmed save
+- **THEN** the dialog shows the server's reason and stays open
+
+### Requirement: Cancel and page checks
+
+**Cancel** SHALL send nothing. A control that saves on change, such as a select, switch or checkbox, SHALL show its saved value again after Cancel. Text the user typed in a form SHALL stay as a draft after Cancel. A value that breaks a rule the page checks SHALL show its message on the page, and no dialog SHALL open.
+
+#### Scenario: Cancel a select
+
+- **WHEN** the user picks a new summary language and then selects **Cancel**
+- **THEN** nothing is saved and the select shows the saved language
+
+#### Scenario: Cancel a form
+
+- **WHEN** the user types a Claude Code folder, selects **Save folder** and then **Cancel**
+- **THEN** nothing is saved and the typed folder stays in the box
+
+#### Scenario: Invalid value
+
+- **WHEN** the user enters an interval outside its range and selects **Save**
+- **THEN** the page shows the range message and no dialog opens
+
+### Requirement: The dialog lists the changes
+
+The dialog SHALL name the card and list each setting the save changes, with its saved value and its new value in plain words. A reset to default SHALL show the default as the new value. A job action SHALL say in one sentence what the job does, for example that a retry calls the model again.
+
+#### Scenario: Two settings change
+
+- **WHEN** the user turns off automatic capture, picks a new default scope and selects **Save**
+- **THEN** the dialog lists both settings, each with its old and new value
+
+#### Scenario: Job action
+
+- **WHEN** the user selects **Retry now** for a host
+- **THEN** the dialog says the waiting captures will be sent to the model again
+
+### Requirement: Settings page cards confirm every save
+
+On the Settings page these actions SHALL confirm first: the host model Save, the summary language, the Claude Code folder, web app autostart, Memory basics, the two Skill learning switches, Record past turns, Save password, Clear password, Generate token, the embedding Retry, capture Retry now, capture retention, the reasoning level, the external API Save, OpenRouter routing and memory cleanup. Each card's own special dialogs SHALL stay.
+
+#### Scenario: External API turned off
+
+- **WHEN** the user empties the external API URL and selects **Save settings**
+- **THEN** a confirm dialog says the external API will be turned off, and nothing is sent before the user confirms
+
+#### Scenario: Turn off redaction
+
+- **WHEN** the user turns off "Remove private text and secrets"
+- **THEN** the shared confirm dialog opens in place of the inline warning, and Cancel leaves redaction on
+
+#### Scenario: Memory cleanup turned off
+
+- **WHEN** the user turns off memory cleanup and selects **Save**
+- **THEN** a confirm dialog opens, although turning it off deletes nothing
+
+## MODIFIED Requirements
+
+### Requirement: Every settings card saves the same way
+
+Each settings card with a server SHALL test the values in the form, not the saved values. Each card SHALL save with a Save button, not on leaving a field, SHALL confirm with the shared settings confirm dialog before it saves, and SHALL show a plain message after each test and save. A Save that tests first SHALL test, then confirm; when the test cannot reach the server, the existing Save anyway dialog SHALL be the confirmation. An optional URL or model field SHALL be clearable, which removes the key. Every URL field SHALL accept only `http://` or `https://` URLs. An invalid number SHALL show a message next to the field.
+
+#### Scenario: Testing an unsaved model
+
+- **WHEN** the user types a new model on the External API card and selects Test without saving
+- **THEN** the test call SHALL use the typed model
+
+#### Scenario: Clearing the API URL
+
+- **WHEN** the user empties the API URL, saves and confirms
+- **THEN** `memoryApiUrl` SHALL be removed from the global config
+
+#### Scenario: A URL without a scheme
+
+- **WHEN** the user saves `api.example.com/v1` as the API URL
+- **THEN** the save SHALL be refused with a message that the URL must start with `http://` or `https://`
+
+### Requirement: The page controls automatic import
+
+Each host view on the Memory page SHALL have a settings card with the **Import past chats automatically** switch for `autoBackfill`, which applies to every host, and, for Pi and OpenCode, a backfill model choice for `piBackfillModel` or `opencodeBackfillModel`: **Same as live capture** (saves `inherit`), **External API** (saves `external`), or a manual `provider/model`. Claude Code's backfill always uses the external API. The host view's status header SHALL show the backfill state, including paused and off, the counts of imported, skipped, failed, and pending exchanges, the number of sessions whose project cannot be resolved with a link to that host's list of sessions that need a folder, the model used, the cutoff, the last error, and the progress bar, percentage, and time left defined by the import progress capability. It SHALL offer Pause, Resume and Retry as the import progress capability defines. The counts SHALL refresh while a run is active. The settings card SHALL say that a model change takes effect at the next run, except that turning the switch off also stops a running automatic backfill after its current exchange. It SHALL say that automatic import makes model calls. Turning the switch on SHALL open the same confirm dialog as **Turn on** in the status header, and only its **Turn on** SHALL save; turning the switch off SHALL save at once with no dialog.
+
+#### Scenario: Turning automatic import off
+
+- **WHEN** the user turns off the switch while an automatic Pi backfill runs, and confirms
+- **THEN** the global config SHALL have `autoBackfill` set to `false`
+- **AND** the Pi backfill SHALL stop after its current exchange
+- **AND** the Pi status header SHALL read **Off** once the run has stopped
+
+#### Scenario: Choosing a backfill model for Pi
+
+- **WHEN** the user picks provider `zai` and model `glm-5-turbo` for Pi's backfill and saves
+- **THEN** the global config SHALL have `piBackfillModel` set to `zai/glm-5-turbo`
+- **AND** `piProvider` and `piModel` SHALL be unchanged
+
+#### Scenario: Choosing the external API for OpenCode's backfill
+
+- **WHEN** the user chooses External API for OpenCode's backfill and saves
+- **THEN** the global config SHALL have `opencodeBackfillModel` set to `external`
+
+#### Scenario: Watching progress
+
+- **WHEN** a backfill runs while the host view is open
+- **THEN** the counts, progress bar, percentage, and time left SHALL update without a page reload
+
+#### Scenario: Opening the section with no active run
+
+The scenario title is kept so the archive step can match it. The Automatic import section and its host cards no longer exist; each host view holds one host.
+
+- **WHEN** no host has a running or paused run and the user opens `/memory/pi`
+- **THEN** the status header SHALL show Pi's state, pending exchanges, and unresolved sessions
+
+#### Scenario: A run is active
+
+- **WHEN** a Pi backfill is running and the user opens `/memory/pi`
+- **THEN** the status header SHALL show the progress bar, percentage and time left
+
+#### Scenario: Keeping a card's state during refresh
+
+The scenario title is kept so the archive step can match it.
+
+- **WHEN** the counts refresh while the user edits Pi's backfill model choice
+- **THEN** the unsaved model choice SHALL stay
+
+#### Scenario: Reading automatic import without duplicate pills
+
+The scenario title is kept so the archive step can match it.
+
+- **WHEN** the user opens `/memory/opencode`
+- **THEN** the status header SHALL show the host name without an overall import-status pill
+- **AND** it SHALL keep its operational state and its one main action
+
+#### Scenario: Following the automatic import directory link
+
+- **WHEN** the user activates OpenCode's unresolved-directory link in the status header
+- **THEN** OpenCode's list of sessions that need a folder SHALL open and its summary SHALL receive focus
+- **AND** other hosts' drafts and disclosure states SHALL remain unchanged
diff --git a/openspec/changes/settings-confirm-dialogs/tasks.md b/openspec/changes/settings-confirm-dialogs/tasks.md
new file mode 100644
index 00000000..4e40b341
--- /dev/null
+++ b/openspec/changes/settings-confirm-dialogs/tasks.md
@@ -0,0 +1,71 @@
+## 1. Shared change list
+
+- [ ] 1.1 Write tests for a pure `settingsChanges(saved, draft, fields)` helper in `web/src/lib/settings-changes.ts`. Cover these cases:
+ - no change
+ - one change
+ - two changes in field order
+ - a boolean as On and Off
+ - a reset to default shown as "Default (value)"
+ - a nested key such as `compaction.enabled`
+
+ Run them and confirm that they fail.
+
+- [ ] 1.2 Add the helper and a `SettingsChangeList` component that renders the rows. Make 1.1 pass. Add its strings in English, Chinese and Arabic.
+- [ ] 1.3 Split `web/src/lib/components/memory/DirectoryMapsSection.tsx` (500 lines): move the ignored-folders list into its own component, with no behaviour change. Run its tests and `tests/file-size-ceiling.test.ts`.
+
+## 2. Settings page cards
+
+For each task: write the tests first and prove that they fail. Each card's tests cover:
+
+- no request before confirm
+- Cancel sends nothing, and a save-on-change control shows its saved value again
+- confirm sends the same body as today
+- a server error stays in the dialog
+
+Update existing tests that expect an immediate request, without weakening what they check.
+
+- [ ] 2.1 `settings/ModelsSection.tsx` (Save model), `settings/ClaudeFolderSection.tsx` (Save folder), `settings/WebAppSection.tsx` (Save), `settings/MemoryBasicsSection.tsx` (Save).
+- [ ] 2.2 `settings/CaptureLanguageSection.tsx` (the select saves on change; it holds a pending value and `onCancel` restores it).
+- [ ] 2.3 `settings/SkillLearningSection.tsx` and `skills/use-skill-settings.ts`:
+ - the Record agent turns switch
+ - the redaction switch, where the inline Callout is replaced by the dialog and both directions confirm
+ - `skills/RecordPast.tsx` (Record past turns)
+- [ ] 2.4 `settings/KeysAccessSection.tsx` (Save password, Clear password) and `settings/ApiTokensTable.tsx` (Generate token).
+- [ ] 2.5 `settings/EmbeddingSection.tsx` (Retry after a failed re-embed) and `settings/CaptureControls.tsx`:
+ - Retry now, also through `DiagnosticsSection.tsx`
+ - the plain retention Save; the trace and zero-retention dialogs stay as the confirmation for their paths
+- [ ] 2.6 `settings/ReasoningLevel.tsx` (normal Save), `settings/OpenRouterRouting.tsx` (Save routing), `settings/MemoryCleanupSection.tsx` (turning off and raising the days; the count dialog stays for turning on and lowering the days).
+- [ ] 2.7 `settings/ExternalApiSection.tsx`:
+ - a passing test opens the confirm dialog
+ - an emptied URL or model confirms that the external API turns off
+ - Save anyway stays as the confirmation when the test cannot reach the server
+
+ Keep the file at 500 lines or fewer.
+
+## 3. Memory page cards
+
+Test-first rule as in group 2.
+
+- [ ] 3.1 `memory/MemorySection.tsx`: Save memory limits and each row's Reset to default.
+- [ ] 3.2 `memory/KeywordModeSection.tsx`, `memory/AutoCleanupSettings.tsx`, `memory/ProfileLearningSettingsSection.tsx` (Save; the Reset to default dialog stays) and `memory/ProfileCatchUpSection.tsx` (Pause).
+- [ ] 3.3 `memory/RerankerSection.tsx`: Save confirms after a passing test; "Replace the key file?" stays as the confirmation for its path. Keep the file at 500 lines or fewer.
+- [ ] 3.4 `memory/DirectoryMapsSection.tsx`: Save removals and Restore. `settings/DirectoryMapHost.tsx`: Ignore.
+- [ ] 3.5 `memory/HostSettings.tsx`: Save model, and turning automatic import off (turning it on keeps `TurnOnDialog`).
+- [ ] 3.6 `memory/HostStatusHeader.tsx` and `memory/use-backfill.ts`: Use external API, Pause, Resume and Retry.
+- [ ] 3.7 `memory/MemoryInjectionSection.tsx`: Save. The draft-only Reset to default opens no dialog; the Save after it lists the removed keys.
+
+## 4. Docs and rules
+
+- [ ] 4.1 Update `web/AGENTS.md` (Actions): the rule covers settings saves and settings job actions, and local-only view preferences are excluded. Update `docs/web-ui-settings.md` and `docs/web-ui-memory.md`: each save asks first, with the dialog shown once in each guide. Run Prettier on the changed files.
+
+## 5. Verification
+
+- [ ] 5.1 Run `bun run check` and the web test files changed in groups 1 to 3, then `tests/file-size-ceiling.test.ts`.
+- [ ] 5.2 Browser check with Orca on a scratch web app (scratch HOME, free port). Check one form Save, one save-on-change select, one job action and one Reset to default:
+ - Cancel writes nothing (check the scratch config file)
+ - confirm writes the same value as before
+
+ Check desktop and 390 px widths and the Arabic layout. Save the screenshots in the scratchpad.
+
+- [ ] 5.3 Run `bun run ci:local` and confirm that the exit line shows exit 0.
+- [ ] 5.4 Run `graphify update .`.
From d23be9b8079a4ef29205415dc498e0897b5bba4e Mon Sep 17 00:00:00 2001
From: Aizat Hawari
Date: Fri, 27 Nov 2026 20:54:13 +0000
Subject: [PATCH 2/3] feat: confirm every settings save and job action before
sending
Every save and job action on the Settings and Memory pages now opens the
shared confirm dialog. It lists each change from old to new, or gives one
sentence for a job. Cancel sends nothing. A save-on-change control returns
to its saved value, and typed text stays as a draft.
Also uses the shared Switch and Input in HostSettings and Skill learning,
and gives Arabic day and hour counts the right plural form.
OpenSpec change settings-confirm-dialogs archived and synced.
---
docs/web-ui-memory.md | 19 +-
docs/web-ui-settings.md | 33 +-
.../.openspec.yaml | 0
.../design.md | 12 +-
.../proposal.md | 2 +-
.../specs/web-memory-hosts/spec.md | 0
.../specs/web-memory/spec.md | 0
.../specs/web-settings/spec.md | 7 +-
.../tasks.md | 44 +--
openspec/specs/web-memory-hosts/spec.md | 24 ++
openspec/specs/web-memory/spec.md | 24 ++
openspec/specs/web-settings/spec.md | 82 ++++-
web/AGENTS.md | 3 +
web/src/hooks/useDirectoryMapConfirm.tsx | 80 +++++
web/src/hooks/useExternalApiConfirm.tsx | 92 ++++++
web/src/hooks/useSettingsChanges.ts | 34 +++
.../components/memory/AutoCleanupSettings.tsx | 38 ++-
.../memory/DirectoryMapIgnoredList.tsx | 45 +++
.../memory/DirectoryMapsSection.tsx | 119 ++++----
.../lib/components/memory/HostSettings.tsx | 96 +++++-
.../components/memory/HostStatusHeader.tsx | 58 +++-
.../components/memory/KeywordModeSection.tsx | 34 ++-
.../memory/MemoryInjectionSection.tsx | 43 ++-
.../lib/components/memory/MemorySection.tsx | 57 +++-
.../memory/ProfileCatchUpSection.tsx | 37 ++-
.../memory/ProfileLearningSettingsSection.tsx | 31 +-
.../lib/components/memory/RerankerSection.tsx | 84 +++++-
web/src/lib/components/memory/use-backfill.ts | 27 +-
.../components/settings/CaptureControls.tsx | 59 +++-
.../settings/CaptureLanguageSection.tsx | 67 ++++-
.../settings/ClaudeFolderSection.tsx | 50 +++-
.../settings/DiagnosticsSection.tsx | 5 +-
.../components/settings/EmbeddingSection.tsx | 39 ++-
.../settings/ExternalApiSection.tsx | 79 +++--
.../components/settings/KeysAccessSection.tsx | 107 +++++--
.../settings/MemoryBasicsSection.tsx | 53 +++-
.../settings/MemoryCleanupSection.tsx | 37 ++-
.../lib/components/settings/ModelsSection.tsx | 51 +++-
.../components/settings/OpenRouterRouting.tsx | 70 ++++-
.../components/settings/ReasoningLevel.tsx | 41 ++-
.../settings/SettingsChangeList.tsx | 30 ++
.../settings/SkillLearningSection.tsx | 150 ++++++----
.../lib/components/settings/WebAppSection.tsx | 46 ++-
web/src/lib/components/skills/RecordPast.tsx | 39 ++-
.../lib/components/skills/use-record-past.ts | 10 +-
web/src/lib/i18n/arabic-count.ts | 33 ++
web/src/lib/i18n/openrouter.ts | 5 +
web/src/lib/i18n/reasoning-level.ts | 1 +
web/src/lib/i18n/settings-cards-text.ts | 36 +++
web/src/lib/i18n/settings-cards.ts | 29 +-
web/src/lib/i18n/settings-catalogue-rows.ts | 3 +
web/src/lib/i18n/settings.ts | 58 ++++
web/src/lib/i18n/skills.ts | 8 +
web/src/lib/settings-changes.ts | 61 ++++
web/tests/arabic-count.spec.ts | 32 ++
.../automatic-import-navigation.spec.tsx | 2 +-
web/tests/capture-language-confirm.spec.tsx | 169 +++++++++++
web/tests/claude-folder-confirm.spec.tsx | 182 ++++++++++++
web/tests/diagnostics-retention.spec.tsx | 159 +++++++++-
web/tests/directory-map-review.spec.tsx | 55 +++-
web/tests/directory-maps-confirm.spec.tsx | 260 ++++++++++++++++
web/tests/embedding-retry-confirm.spec.tsx | 119 ++++++++
web/tests/external-api-section.spec.tsx | 165 +++++++++-
web/tests/host-settings-confirm.spec.tsx | 219 ++++++++++++++
web/tests/host-status-confirm.spec.tsx | 173 +++++++++++
web/tests/host-status-header.spec.tsx | 6 +
web/tests/ignore-all.spec.tsx | 12 +-
web/tests/keys-access-revoke.spec.tsx | 165 +++++++++-
web/tests/keyword-mode-section.spec.tsx | 129 +++++++-
web/tests/memory-basics-section.spec.tsx | 79 ++++-
web/tests/memory-cleanup-section.spec.tsx | 89 +++++-
web/tests/memory-injection-confirm.spec.tsx | 231 ++++++++++++++
web/tests/memory-limits-plain.spec.tsx | 118 ++++++++
web/tests/memory-profile-actions.spec.tsx | 68 +++++
web/tests/memory-section.spec.tsx | 146 ++++++++-
web/tests/models-section-confirm.spec.tsx | 171 +++++++++++
web/tests/openrouter-routing.spec.tsx | 114 ++++++-
web/tests/profile-learning-section.spec.tsx | 55 ++++
web/tests/reasoning-level.spec.tsx | 103 ++++++-
web/tests/reranker-section.spec.tsx | 135 +++++++++
web/tests/settings-catalogue.spec.ts | 2 +
web/tests/settings-change-list.spec.tsx | 100 +++++++
web/tests/settings-changes.spec.ts | 99 ++++++
web/tests/skill-learning-confirm.spec.tsx | 281 ++++++++++++++++++
web/tests/skills-components.spec.tsx | 8 +-
web/tests/turn-on-confirm.spec.tsx | 42 ++-
web/tests/web-app-confirm.spec.tsx | 125 ++++++++
87 files changed, 5641 insertions(+), 464 deletions(-)
rename openspec/changes/{settings-confirm-dialogs => archive/2026-11-27-settings-confirm-dialogs}/.openspec.yaml (100%)
rename openspec/changes/{settings-confirm-dialogs => archive/2026-11-27-settings-confirm-dialogs}/design.md (66%)
rename openspec/changes/{settings-confirm-dialogs => archive/2026-11-27-settings-confirm-dialogs}/proposal.md (95%)
rename openspec/changes/{settings-confirm-dialogs => archive/2026-11-27-settings-confirm-dialogs}/specs/web-memory-hosts/spec.md (100%)
rename openspec/changes/{settings-confirm-dialogs => archive/2026-11-27-settings-confirm-dialogs}/specs/web-memory/spec.md (100%)
rename openspec/changes/{settings-confirm-dialogs => archive/2026-11-27-settings-confirm-dialogs}/specs/web-settings/spec.md (97%)
rename openspec/changes/{settings-confirm-dialogs => archive/2026-11-27-settings-confirm-dialogs}/tasks.md (67%)
create mode 100644 web/src/hooks/useDirectoryMapConfirm.tsx
create mode 100644 web/src/hooks/useExternalApiConfirm.tsx
create mode 100644 web/src/hooks/useSettingsChanges.ts
create mode 100644 web/src/lib/components/memory/DirectoryMapIgnoredList.tsx
create mode 100644 web/src/lib/components/settings/SettingsChangeList.tsx
create mode 100644 web/src/lib/i18n/arabic-count.ts
create mode 100644 web/src/lib/settings-changes.ts
create mode 100644 web/tests/arabic-count.spec.ts
create mode 100644 web/tests/capture-language-confirm.spec.tsx
create mode 100644 web/tests/claude-folder-confirm.spec.tsx
create mode 100644 web/tests/directory-maps-confirm.spec.tsx
create mode 100644 web/tests/embedding-retry-confirm.spec.tsx
create mode 100644 web/tests/host-settings-confirm.spec.tsx
create mode 100644 web/tests/host-status-confirm.spec.tsx
create mode 100644 web/tests/memory-injection-confirm.spec.tsx
create mode 100644 web/tests/models-section-confirm.spec.tsx
create mode 100644 web/tests/settings-change-list.spec.tsx
create mode 100644 web/tests/settings-changes.spec.ts
create mode 100644 web/tests/skill-learning-confirm.spec.tsx
create mode 100644 web/tests/web-app-confirm.spec.tsx
diff --git a/docs/web-ui-memory.md b/docs/web-ui-memory.md
index 1f1968a7..90eba655 100644
--- a/docs/web-ui-memory.md
+++ b/docs/web-ui-memory.md
@@ -14,6 +14,8 @@ Every view starts with the same four cards, including **Shared**, so one click r
Browse stored results on **Project memories** (`/project-memories`) and **User profile** (`/user-profile`). `/` opens Project memories. Settings retains models, access controls, diagnostics and profile identity controls. See [Settings page](web-ui-settings.md).
+Every save and every job action on this page asks you to confirm first, as on the Settings page. The dialog lists each setting the save changes, or says in one sentence what the job does. **Cancel** sends nothing. See [Each save asks first](web-ui-settings.md#each-save-asks-first).
+
## Welcome panel
A new install has no memories. In that case the **Project memories** page shows a welcome panel in place of the plain "No memories found" line. The panel says that memories appear after your first sessions in OpenCode, Pi or Claude Code, and lists each host with its capture state:
@@ -70,8 +72,8 @@ Each row leads with its plain name and a one-line description, then the default
- The first-message option adds memories once, with the first message of a new session, on every host. Claude Code does this on its first prompt, not at its `SessionStart` hook. OMMS searches with the query and adds only matching memories. The **Opening search text** holds up to 500 characters. An empty text runs no search. The text area shows a counter.
- Subagents get the memories that match their task, and no recall rows. Claude Code adds them once, when the subagent starts. OpenCode V2 and Pi add them with each prompt the subagent gets. On Pi, a subagent gets memories only when its agent maps the OMMS extension in om-pi-subagents. Turn it on in `/omps-settings`, Agent capabilities, Memory.
- The restore switch adds the memories that the session captured when it resumes or compacts. **Memories added back after a summary** takes a positive whole number.
-- **Save** writes only the changed keys to the global file, through the [safe global save](web-ui-settings.md#how-saving-works). A rejected value shows a message that names the key and the rule.
-- **Reset to default** returns the form to the defaults. Select **Save** after it. The save removes the five keys from the file, so each value follows its default again.
+- **Save** lists each change in a dialog first. After you confirm, it writes only the changed keys to the global file, through the [safe global save](web-ui-settings.md#how-saving-works). A rejected value shows a message that names the key and the rule.
+- **Reset to default** returns the form to the defaults and opens no dialog. Select **Save** after it. The dialog lists each key the save removes, with its default. The save removes the five keys from the file, so each value follows its default again.
- A project config can turn the first-message and subagent options off, never on. It can turn the restore on or off. See [Configuration: Memory injection](configuration.md#memory-injection).
## A host view
@@ -283,11 +285,11 @@ Ignored folders leave unresolved counts without importing their sessions. Histor
Automatic import, or backfill, reads older conversations in the background and populates project memories and user profile input. It makes model calls. It starts about 30 seconds after Pi or OpenCode starts. Claude Code starts it after the first session start that reaches the web app.
-**Import past chats automatically** keeps the existing global `autoBackfill` switch. Ticking it opens the same question as **Turn on**, and only the dialog's **Turn on** saves. Turning it off saves at once and stops a running backfill after its current exchange. The first backfill fixes each host's cutoff; later starts resume pending work with that cutoff and ledger. Live capture handles newer turns. A model change applies at the next run.
+**Import past chats automatically** keeps the existing global `autoBackfill` switch. Turning it on opens the same question as **Turn on**, and only the dialog's **Turn on** saves. Turning it off asks you to confirm in a dialog, and **Cancel** leaves the switch on. Confirming stops a running backfill after its current exchange. The first backfill fixes each host's cutoff; later starts resume pending work with that cutoff and ledger. Live capture handles newer turns. A model change applies at the next run.
Each host's view holds its own automatic-import controls: the status header, the run facts below it, and the host's settings. The overview card shows the state in one line. Unsaved model choices stay while counts refresh.
-The Pi and OpenCode **Backfill model** choices remain:
+The Pi and OpenCode **Backfill model** choices remain. **Save model** lists the change in a dialog before it saves:
- **Same as live capture:** saves `inherit` to `piBackfillModel` or `opencodeBackfillModel`.
- **External API:** saves `external` and can run with no host open.
@@ -301,6 +303,7 @@ Counts refresh every three seconds during a run. Operational progress leaves alr
### Pause and Resume
+- **Pause**, **Resume** and **Retry** each ask you to confirm first, with one sentence on what they do. **Resume** and **Retry** make model calls. **Use external API** asks first too, and then sets the host's backfill model to the external API.
- **Pause** stops after the current exchange, including a run in another process. With no run going, it saves the pause so no automatic run starts. The pause survives host restarts.
- **Resume** clears the pause and starts the host's backfill from the ledger, with its existing cutoff, maps and model rule.
@@ -415,7 +418,7 @@ Saving edits only the keys in the table. Comments and unrelated keys retain thei
### Reset to default
-Every row has a **Reset to default** button. Selecting it removes that key from the global file through the same safe save flow, so the value follows the default again. Reset never writes a project file. A row whose key is absent from the file has its Reset button disabled.
+Every row has a **Reset to default** button. Selecting it opens a dialog with the saved value and the default. Confirming removes that key from the global file through the same safe save flow, so the value follows the default again. Reset never writes a project file. A row whose key is absent from the file has its Reset button disabled.
A row whose saved value differs from its default shows a **Differs from default** marker. This is how a file that still holds the old template's `"similarityThreshold": 0.6` becomes visible: with the `qwen3-embedding:0.6b` embedder the row shows the marker, and Reset removes the line so the default 0.5 applies again. A value equal to the default, or no saved value, shows no marker.
@@ -473,11 +476,11 @@ See [Configuration: Reranker](configuration.md#reranker) for the endpoint contra
A directory map links a recorded project folder to its current folder, for example after moving a repository or deleting a worktree. Saved maps apply globally to every host at the next import or backfill run.
- **Saved maps** starts collapsed and shows the `importPathMaps` count. Maps are grouped by target folder, largest group first. Each target group is collapsed.
-- **Remove** marks a saved map for removal; **Keep** undoes it. **Save removals** saves pending removals.
+- **Remove** marks a saved map for removal; **Keep** undoes it. **Save removals** shows how many saved maps remain, and saves after you confirm.
- Keep maps after importing their sessions. Resolution happens before ledger checks. Removing a needed map makes its sessions unresolved again. Previously stored memories remain.
-- **Ignored directories** lists `importIgnoredDirectories`. **Restore** immediately saves removal from that list. The folder returns to each host list that reported it.
+- **Ignored directories** lists `importIgnoredDirectories`. **Restore** names the folder in a dialog, and saves its removal from that list after you confirm. The folder returns to each host list that reported it.
- Each host view lists its **Unresolved directories** open, with a folder field on every row. Its summary counts directories, unresolved sessions and rows with targets. Collapsing keeps unsaved targets. **Shared** keeps **Saved maps** and **Ignored directories**.
-- **Ignore** immediately saves the folder to `importIgnoredDirectories`. Its sessions leave unresolved counts and stay unimported. Maps, ledger and history files remain unchanged.
+- **Ignore** names the folder in a dialog, and saves it to `importIgnoredDirectories` after you confirm. Its sessions leave unresolved counts and stay unimported. Maps, ledger and history files remain unchanged.
- **Ignore all** lists every directory it will ignore, with session counts, and saves them in one global save after you confirm. Cancel saves nothing. It never covers **No directory recorded**.
- Sessions with **No directory recorded** cannot be mapped or ignored.
diff --git a/docs/web-ui-settings.md b/docs/web-ui-settings.md
index e5e4e9ac..78089c21 100644
--- a/docs/web-ui-settings.md
+++ b/docs/web-ui-settings.md
@@ -47,11 +47,22 @@ Every card with a server follows the same steps:
1. Edit the values.
2. Select **Test**, where the card has one. The test uses the values in the form, saved or not.
3. Select **Save**. Leaving a field saves nothing.
-4. Read the plain message that follows.
+4. Read the dialog, then select its confirm button.
+5. Read the plain message that follows.
You can clear an optional field, such as the API URL or the model. Saving an empty field removes its key from the file. A URL field accepts only `http://` or `https://` addresses. A number that is not valid shows a message next to the field and keeps **Save** off.
-A save that deletes stored data opens a confirmation first. It says what OMMS deletes and how many items, when OMMS knows the count. Nothing is saved until you confirm. The confirmation has **Cancel** as its first choice.
+### Each save asks first
+
+When you select **Save**, a dialog opens before OMMS sends anything. Its title names the card, for example **Save memory basics?**. Its body lists each setting that the save changes, with the saved value struck through and the new value after it. A reset to a default shows **Default (value)** as the new value.
+
+- **Cancel** sends nothing. The text you typed stays in the form, so you can select **Save** again.
+- A setting that saves when you change it, such as **Summary language**, shows your choice while the dialog is open. **Cancel** puts the saved value back.
+- A button that starts or stops a job, such as **Retry now** or **Record past turns**, asks first with one sentence. The sentence says what the job does.
+- A value that fails a check on the page shows its message on the page, and no dialog opens.
+- A choice that changes only how the page looks, such as the theme and the date format, saves with no dialog.
+
+A save that deletes stored data keeps its own confirmation. It says what OMMS deletes and how many items, when OMMS knows the count. Nothing is saved until you confirm. The confirmation has **Cancel** as its first choice.
### Key entry
@@ -87,7 +98,7 @@ This card holds the only switch that turns on automatic deletion of memories.
The card warns you that deletion removes memories that are not pinned and have not changed for that many days, in every project, and that OMMS cannot restore a deleted memory. A project file cannot change these two settings. OpenCode, Pi and Claude Code follow the same switch.
-Turning the switch on, or lowering the number of days while it is on, opens a confirmation first. It states how many memories have not changed for that many days, and that OMMS deletes them at its next daily check, not when you save. OMMS counts them with the same selection the deletion uses and deletes nothing while it counts. The number is what goes: the check deletes old prompts and the memories captured from them in the same run. The confirmation also says that pinned memories and memorisations stay. It has **Cancel** as its first choice. Nothing is saved until you confirm, and **Cancel** puts the switch back to its saved state. When OMMS cannot read the count, the confirmation says so and does not let you turn deletion on. Turning the switch off needs no confirmation.
+Turning the switch on, or lowering the number of days while it is on, opens a confirmation first. It states how many memories have not changed for that many days, and that OMMS deletes them at its next daily check, not when you save. OMMS counts them with the same selection the deletion uses and deletes nothing while it counts. The number is what goes: the check deletes old prompts and the memories captured from them in the same run. The confirmation also says that pinned memories and memorisations stay. It has **Cancel** as its first choice. Nothing is saved until you confirm, and **Cancel** puts the switch back to its saved state. When OMMS cannot read the count, the confirmation says so and does not let you turn deletion on. Turning the switch off, or raising the number of days, opens a dialog that lists the change, although it deletes nothing. **Cancel** puts the switch back to its saved state.
The older `autoCleanupEnabled` key was removed in 7.0.0. OMMS ignores it, so a file that still sets `"autoCleanupEnabled": true` deletes nothing. Only the switch on this card turns deletion on. OMMS does not change your file by itself.
@@ -110,7 +121,7 @@ The card sets four values:
| Model | `memoryModel` | The model name at that endpoint, for example `glm-5.3`. Not needed for `orcarouter`. |
| API key | `memoryApiKey` | Where the key comes from. See the three key sources below. |
-Select **Save settings** to save the provider, URL, model and key. **Save settings** first runs the same test as **Test**, once, with the values in the form, and saves only when the test passes. A key the provider refuses (HTTP 401 or 403) is never saved, and the card says nothing was saved. When OMMS cannot reach the address at all (a network error or a timeout), a dialog asks whether to save anyway or cancel. Empty the API URL or the model and save to turn the external API off and remove the key from the file; that save needs no test. The hint under each field says so: an empty field turns the external API off, except for OrcaRouter, which has its own address and picks its own model. The URL must start with `http://` or `https://`.
+Select **Save settings** to save the provider, URL, model and key. **Save settings** first runs the same test as **Test**, once, with the values in the form. A passing test opens a dialog that lists each change. The key shows only as where it is kept, never its value. Nothing is saved until you confirm. A key the provider refuses (HTTP 401 or 403) is never saved, no dialog opens, and the card says nothing was saved. When OMMS cannot reach the address at all (a network error or a timeout), a dialog asks whether to save anyway or cancel. That dialog also lists the changes. Empty the API URL or the model and save to turn the external API off and remove the key from the file; that save needs no test, and its dialog says the external API will be turned off. The hint under each field says so: an empty field turns the external API off, except for OrcaRouter, which has its own address and picks its own model. The URL must start with `http://` or `https://`.
### Preset
@@ -445,7 +456,7 @@ To create a token:
1. Type a **Token name**.
2. Choose **Expires after**: 7, 30, or 90 days, or **Never**.
-3. Select **Generate token**.
+3. Select **Generate token**, then confirm in the dialog.
4. Select **Copy**, and keep the token in a safe place.
The page shows the token value once. OMMS keeps only a hash of it, so nobody can show it again.
@@ -458,9 +469,9 @@ The routes are `GET` and `POST /api/settings/tokens`, and `DELETE /api/settings/
The browser password turns on HTTP Basic Auth. The browser then asks for a user name and password before the page opens.
-- To set it, type the **Password** and, optionally, the **User name**. Then select **Save password**. The default user name is your computer user name.
+- To set it, type the **Password** and, optionally, the **User name**. Then select **Save password** and confirm in the dialog. The default user name is your computer user name.
- OMMS writes the password to `~/.config/omms/secrets/web-password.key` with mode `0600`. It saves `webServerAuthPassword: file://...` and `webServerAuthUsername` in the global config.
-- **Clear password** removes both config keys and deletes the password file.
+- **Clear password** asks you to confirm first. It then removes both config keys and deletes the password file.
- Restart the web app to use a new password. Use the [power button](web-ui.md#power-button).
The route is `POST /api/settings/web-password`. It needs a caller on this machine and the local token file.
@@ -494,7 +505,7 @@ When a live capture fails because the capture model cannot be reached, OMMS keep
- **Retry retention (hours).** How long a waiting turn is kept. The default is 72 hours. The range is 0 to 720.
- Set it to 0 to turn the queue off. When you select **Save retention**, OMMS counts the waiting turns again, and a confirmation says how many it deletes. Nothing is saved until you confirm. The save then deletes the waiting turns at once.
- **Turns waiting for retry** shows the number of waiting turns for Pi, OpenCode, and Claude Code.
-- **Retry now** retries the waiting turns of Pi and Claude Code at once. OpenCode's waiting turns retry at the next OpenCode session start, because only an OpenCode session can call OpenCode's models. The page says so.
+- **Retry now** asks you to confirm first, because it sends the waiting turns to the model again. It then retries the waiting turns of Pi and Claude Code at once. OpenCode's waiting turns retry at the next OpenCode session start, because only an OpenCode session can call OpenCode's models. The page says so.
- The web app always runs the Claude Code retry pass, so **Retry now** works for Claude Code in any web app.
- **Retry now** is disabled when the host has no waiting turns or the queue is off.
- Queued turns can contain conversation content. OMMS removes text inside `` tags and common API key formats first.
@@ -544,7 +555,7 @@ Use this section when Claude Code does not keep its data in `~/.claude`, for exa
Use this card to choose the language that new memory summaries are written in.
-- **Summary language** (`autoCaptureLanguage`) is **Automatic** or one language. Choosing a language saves it at once.
+- **Summary language** (`autoCaptureLanguage`) is **Automatic** or one language. When you choose a language, a dialog asks you to confirm the change. **Cancel** keeps the saved language.
- **Automatic** detects the language of your prompt. Detection is unreliable on short text, so a Latin-script prompt under 100 characters counts as English. Pick a fixed language if your memories come out in a language you do not use.
- A save applies to the next capture. Memories that exist already keep their language.
@@ -625,8 +636,8 @@ See [CLI: Global install](cli.md#global-install-optional) and [Updating and upgr
The card holds the settings of [skill learning](configuration.md#skill-learning). It saves through the same safe flow as the other cards. See [How saving works](#how-saving-works).
-- **Record agent turns** (`skillLearning`) switches recording on or off. While it is on, the card shows a warning. It says that OMMS stores full prompts, replies and tool calls in `skills.db` on this computer, that drafting sends recorded turns to the external API, that the file holds whatever the turns hold, and that the memory chat sends skill counts and short change summaries to the external API, never turn text. A project config can turn recording off for its project. It cannot turn it on.
-- **Record past turns** appears while recording is on. It starts one grouped import of all past history with only **Skill turns** ticked. It makes no model call. A progress bar shows the **Skill turns** phase. When the run ends, the card shows the count of turns recorded.
+- **Record agent turns** (`skillLearning`) switches recording on or off. Each change asks you to confirm it in a dialog. While it is on, the card shows a warning. It says that OMMS stores full prompts, replies and tool calls in `skills.db` on this computer, that drafting sends recorded turns to the external API, that the file holds whatever the turns hold, and that the memory chat sends skill counts and short change summaries to the external API, never turn text. A project config can turn recording off for its project. It cannot turn it on.
+- **Record past turns** appears while recording is on. It asks you to confirm first. It then starts one grouped import of all past history with only **Skill turns** ticked. It makes no model call. A progress bar shows the **Skill turns** phase. When the run ends, the card shows the count of turns recorded.
- **Remove private text and secrets** (`skillLearningRedact`) is on by default. Turning it off needs a confirmation. While it is off, the card shows a danger notice: `` text, API keys and passwords are stored as written and sent to the external API when OMMS drafts.
- **Recorded turns** and **File size** show the contents of `skills.db`.
- **Delete recorded turns** asks first. The confirmation states the number of turns. Confirming deletes all of them, and the card then shows 0 turns. Proposals and skill versions stay.
diff --git a/openspec/changes/settings-confirm-dialogs/.openspec.yaml b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/.openspec.yaml
similarity index 100%
rename from openspec/changes/settings-confirm-dialogs/.openspec.yaml
rename to openspec/changes/archive/2026-11-27-settings-confirm-dialogs/.openspec.yaml
diff --git a/openspec/changes/settings-confirm-dialogs/design.md b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/design.md
similarity index 66%
rename from openspec/changes/settings-confirm-dialogs/design.md
rename to openspec/changes/archive/2026-11-27-settings-confirm-dialogs/design.md
index 17341fe0..950e1de4 100644
--- a/openspec/changes/settings-confirm-dialogs/design.md
+++ b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/design.md
@@ -1,6 +1,6 @@
## Context
-- The shared pattern exists: `web/src/hooks/useSettingsConfirm.tsx` (`ask(request)` plus one rendered `dialog`) and `web/src/lib/components/settings/SettingsConfirmDialog.tsx`. The dialog runs the request only after confirm, shows progress, keeps a server error inside itself and closes on success. `onCancel` lets a card put a save-on-change control back to its saved value. `ReasoningLevel.tsx` shows that use.
+- The shared pattern exists: `web/src/hooks/useSettingsConfirm.tsx` (`ask(request)` plus one rendered `dialog`) and `web/src/lib/components/settings/SettingsConfirmDialog.tsx`. The dialog runs the request only after confirm, shows progress, keeps a server error inside itself and closes on success. `onCancel` lets a card put a save-on-change control back to its saved value. `MemoryCleanupSection.tsx` shows that use for a switch.
- The Memorisation page already follows the rule through `web/src/hooks/useMemorisationConfirm.tsx` (PR #311).
- An audit of `web/src` (2026-11-27) listed every settings action without a dialog. The tasks name each card and trigger.
- Most cards stage edits in a form and save with one button. A few save on change: the summary language select, the two Skill learning switches, and the automatic import checkbox when turned off. A few are one-click actions: Pause, Resume, Retry, Retry now, Use external API, Generate token, Save password, Clear password, Record past turns, Ignore and Restore.
@@ -25,13 +25,13 @@
1. **Reuse `useSettingsConfirm` in every card.** Each card calls `ask` from its save handler and renders `dialog` once. A second dialog component was rejected because it would split the progress, error and close behaviour into two copies.
-2. **One shared change list.** A pure helper `settingsChanges(saved, draft, fields)` returns the changed rows as `{ label, from, to }`, and a small `SettingsChangeList` component renders them as a definition list. Each card passes its own labels and value formatters: On and Off for booleans, the translated option name for selects, a number with its unit, and "Default (value)" for a reset. A text body per card was rejected: it would drift from the real edits, and nothing would test that it matches what is sent.
+2. **One shared change list.** A pure helper `settingsChanges(saved, edits, fields, words)` returns the changed rows as `{ key, label, from, to }`, and a small `SettingsChangeList` component renders them as a definition list: the saved value struck through, then the new value. `saved` and `edits` use the keys of the request, and `edits` is the body the card is about to send. A `null` edit removes the key, so the row shows the field's default as "Default (value)". A value that was never saved reads "Not set". The helper throws when the request changes a key that no field describes, so the dialog can never leave a change out. `useSettingsChanges()` gives the helper with the words of the page (On, Off, Not set, Default) and each setting's catalogue name, so cards do not repeat them. Each card passes its own labels and value formatters: the translated option name for selects, and a number with its unit. A screen reader hears "changes to" between the two values, and the arrow mirrors for Arabic. A text body per card was rejected: it would drift from the real edits, and nothing would test that it matches what is sent.
3. **One dialog per click.** When a card already opens a special dialog on a path, that dialog is the confirmation for that click, and its text gains the change list where it fits. Examples are memory cleanup's count dialog, the reranker's "Replace the key file?", the capture trace and zero-retention dialogs, and the external API's Save anyway. A second dialog after the first was rejected as noise.
-4. **Test, then confirm.** A Save that runs a test call (external API, reranker, embedding) runs the test first, because a test changes nothing. A passing test opens the confirm dialog. A refused key still saves nothing and opens no dialog. A test that cannot reach the server opens the existing Save anyway dialog, which is the confirmation.
+4. **Test, then confirm.** A Save that runs a test call runs the test first, because a test changes nothing. Only the external API Save does this. A passing test opens the confirm dialog. A refused key still saves nothing and opens no dialog. A test that cannot reach the server opens the existing Save anyway dialog, which is the confirmation. The reranker and embedding cards keep **Test** as its own button. The reranker's Save runs no test, so it opens the confirm dialog at once. The embedding card's Re-embed needs a passing Test first and keeps its own Re-embed dialog.
-5. **Save-on-change controls hold a pending value.** The control shows the new value while the dialog is open, and `onCancel` puts the saved value back. This matches `ReasoningLevel.tsx`. Leaving the control on its saved value until confirm was rejected, because the user could not see what they had chosen.
+5. **Save-on-change controls hold a pending value.** The control shows the new value while the dialog is open, and `onCancel` puts the saved value back. The pending value is cleared after a successful save, once the snapshot has reloaded, so a later change to the file shows on the control. `MemoryCleanupSection.tsx` and `CaptureLanguageSection.tsx` show this. Leaving the control on its saved value until confirm was rejected, because the user could not see what they had chosen.
6. **Page checks first.** A value the page can check (range, URL scheme, empty required field) shows its message on the page, and no dialog opens. A dialog for a save that cannot succeed was rejected.
@@ -39,7 +39,7 @@
8. **The redaction warning moves into the dialog.** The inline Callout before turning off "Remove private text and secrets" becomes the shared dialog, with the same warning text in its body.
-9. **Size limits.** Cards near 500 lines move their confirm wiring into a small hook beside them, as `useMemorisationConfirm.tsx` does. `DirectoryMapsSection.tsx` is split first: the ignored-folders list moves to its own component. `tests/file-size-ceiling.test.ts` gets no new entry.
+9. **Size limits.** Cards near 500 lines move their confirm wiring into a small hook beside them, as `useMemorisationConfirm.tsx` does. `DirectoryMapsSection.tsx` is split first: the ignored-folders list moves to its own component, `DirectoryMapIgnoredList.tsx`. `tests/file-size-ceiling.test.ts` gets no new entry.
10. **Docs and rules.** `web/AGENTS.md` says that the rule covers settings saves and settings job actions, and that local-only view preferences are excluded. The two web UI guides say each save asks first.
@@ -47,7 +47,7 @@
- [One more click on every save] → This is the rule the project chose. The dialog shows the exact changes, so the click is a check, not a formality.
- [Many tests expect an immediate request] → Each is updated to confirm first and still asserts the same request body. Each card also gets a test that no request is sent before confirm.
-- [Pending values on save-on-change controls can leave a control showing an unsaved value] → `onCancel` and the dialog's close path always restore the saved value. A test covers Escape and the close button as well as Cancel.
+- [Pending values on save-on-change controls can leave a control showing an unsaved value] → `onCancel` and the dialog's close path always restore the saved value, and a successful save clears the pending value. A test covers Escape and the close button as well as Cancel, and a change to the file after a save.
- [Special dialogs and the change list can disagree] → Decision 3 keeps one dialog per click, built from the same edits object that is sent.
- [Large diff across about 25 files] → The work is split by page, so the groups do not touch the same files.
diff --git a/openspec/changes/settings-confirm-dialogs/proposal.md b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/proposal.md
similarity index 95%
rename from openspec/changes/settings-confirm-dialogs/proposal.md
rename to openspec/changes/archive/2026-11-27-settings-confirm-dialogs/proposal.md
index a67d58f3..08a75ae0 100644
--- a/openspec/changes/settings-confirm-dialogs/proposal.md
+++ b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/proposal.md
@@ -36,7 +36,7 @@ None.
## Impact
-- Web only, in `web/src/lib/components/settings/`, `web/src/lib/components/memory/` and `web/src/lib/components/skills/use-skill-settings.ts`. These use the existing `web/src/hooks/useSettingsConfirm.tsx` and `web/src/lib/components/settings/SettingsConfirmDialog.tsx`, plus one small shared helper that lists the changed settings.
+- Web only, in `web/src/lib/components/settings/`, `web/src/lib/components/memory/` and `web/src/lib/components/skills/use-skill-settings.ts`. These use the existing `web/src/hooks/useSettingsConfirm.tsx` and `web/src/lib/components/settings/SettingsConfirmDialog.tsx`, plus three small shared pieces: the helper `web/src/lib/settings-changes.ts`, its hook `web/src/hooks/useSettingsChanges.ts`, and `web/src/lib/components/settings/SettingsChangeList.tsx`.
- Translation tables in `web/src/lib/i18n/` (English, Chinese, Arabic).
- Tests in `web/tests/` for each card: no request before confirm, Cancel sends nothing, confirm sends the same body as today, and a server error stays in the dialog. Existing tests that expect an immediate request are updated to confirm first, without weakening what they check.
- Docs: `docs/web-ui-settings.md`, `docs/web-ui-memory.md`, `web/AGENTS.md`.
diff --git a/openspec/changes/settings-confirm-dialogs/specs/web-memory-hosts/spec.md b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/specs/web-memory-hosts/spec.md
similarity index 100%
rename from openspec/changes/settings-confirm-dialogs/specs/web-memory-hosts/spec.md
rename to openspec/changes/archive/2026-11-27-settings-confirm-dialogs/specs/web-memory-hosts/spec.md
diff --git a/openspec/changes/settings-confirm-dialogs/specs/web-memory/spec.md b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/specs/web-memory/spec.md
similarity index 100%
rename from openspec/changes/settings-confirm-dialogs/specs/web-memory/spec.md
rename to openspec/changes/archive/2026-11-27-settings-confirm-dialogs/specs/web-memory/spec.md
diff --git a/openspec/changes/settings-confirm-dialogs/specs/web-settings/spec.md b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/specs/web-settings/spec.md
similarity index 97%
rename from openspec/changes/settings-confirm-dialogs/specs/web-settings/spec.md
rename to openspec/changes/archive/2026-11-27-settings-confirm-dialogs/specs/web-settings/spec.md
index c5a2e914..21ef686d 100644
--- a/openspec/changes/settings-confirm-dialogs/specs/web-settings/spec.md
+++ b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/specs/web-settings/spec.md
@@ -75,7 +75,7 @@ On the Settings page these actions SHALL confirm first: the host model Save, the
### Requirement: Every settings card saves the same way
-Each settings card with a server SHALL test the values in the form, not the saved values. Each card SHALL save with a Save button, not on leaving a field, SHALL confirm with the shared settings confirm dialog before it saves, and SHALL show a plain message after each test and save. A Save that tests first SHALL test, then confirm; when the test cannot reach the server, the existing Save anyway dialog SHALL be the confirmation. An optional URL or model field SHALL be clearable, which removes the key. Every URL field SHALL accept only `http://` or `https://` URLs. An invalid number SHALL show a message next to the field.
+Each settings card with a server SHALL test the values in the form, not the saved values. Each card SHALL save with a Save button, not on leaving a field, SHALL confirm with the shared settings confirm dialog before it saves, and SHALL show a plain message after each test and save. A Save that tests first SHALL test, then confirm; when the test cannot reach the server, the existing Save anyway dialog SHALL be the confirmation.
#### Scenario: Testing an unsaved model
@@ -92,6 +92,11 @@ Each settings card with a server SHALL test the values in the form, not the save
- **WHEN** the user saves `api.example.com/v1` as the API URL
- **THEN** the save SHALL be refused with a message that the URL must start with `http://` or `https://`
+#### Scenario: An invalid number
+
+- **WHEN** the user enters a value that is not a valid number in a number field and selects Save
+- **THEN** a message SHALL show next to the field, and no confirm dialog SHALL open
+
### Requirement: The page controls automatic import
Each host view on the Memory page SHALL have a settings card with the **Import past chats automatically** switch for `autoBackfill`, which applies to every host, and, for Pi and OpenCode, a backfill model choice for `piBackfillModel` or `opencodeBackfillModel`: **Same as live capture** (saves `inherit`), **External API** (saves `external`), or a manual `provider/model`. Claude Code's backfill always uses the external API. The host view's status header SHALL show the backfill state, including paused and off, the counts of imported, skipped, failed, and pending exchanges, the number of sessions whose project cannot be resolved with a link to that host's list of sessions that need a folder, the model used, the cutoff, the last error, and the progress bar, percentage, and time left defined by the import progress capability. It SHALL offer Pause, Resume and Retry as the import progress capability defines. The counts SHALL refresh while a run is active. The settings card SHALL say that a model change takes effect at the next run, except that turning the switch off also stops a running automatic backfill after its current exchange. It SHALL say that automatic import makes model calls. Turning the switch on SHALL open the same confirm dialog as **Turn on** in the status header, and only its **Turn on** SHALL save; turning the switch off SHALL save at once with no dialog.
diff --git a/openspec/changes/settings-confirm-dialogs/tasks.md b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/tasks.md
similarity index 67%
rename from openspec/changes/settings-confirm-dialogs/tasks.md
rename to openspec/changes/archive/2026-11-27-settings-confirm-dialogs/tasks.md
index 4e40b341..f3b7d9af 100644
--- a/openspec/changes/settings-confirm-dialogs/tasks.md
+++ b/openspec/changes/archive/2026-11-27-settings-confirm-dialogs/tasks.md
@@ -1,6 +1,6 @@
## 1. Shared change list
-- [ ] 1.1 Write tests for a pure `settingsChanges(saved, draft, fields)` helper in `web/src/lib/settings-changes.ts`. Cover these cases:
+- [x] 1.1 Write tests for a pure `settingsChanges(saved, draft, fields)` helper in `web/src/lib/settings-changes.ts`. Cover these cases:
- no change
- one change
- two changes in field order
@@ -10,8 +10,8 @@
Run them and confirm that they fail.
-- [ ] 1.2 Add the helper and a `SettingsChangeList` component that renders the rows. Make 1.1 pass. Add its strings in English, Chinese and Arabic.
-- [ ] 1.3 Split `web/src/lib/components/memory/DirectoryMapsSection.tsx` (500 lines): move the ignored-folders list into its own component, with no behaviour change. Run its tests and `tests/file-size-ceiling.test.ts`.
+- [x] 1.2 Add the helper and a `SettingsChangeList` component that renders the rows. Make 1.1 pass. Add its strings in English, Chinese and Arabic.
+- [x] 1.3 Split `web/src/lib/components/memory/DirectoryMapsSection.tsx` (500 lines): move the ignored-folders list into its own component, with no behaviour change. Run its tests and `tests/file-size-ceiling.test.ts`.
## 2. Settings page cards
@@ -24,18 +24,18 @@ For each task: write the tests first and prove that they fail. Each card's tests
Update existing tests that expect an immediate request, without weakening what they check.
-- [ ] 2.1 `settings/ModelsSection.tsx` (Save model), `settings/ClaudeFolderSection.tsx` (Save folder), `settings/WebAppSection.tsx` (Save), `settings/MemoryBasicsSection.tsx` (Save).
-- [ ] 2.2 `settings/CaptureLanguageSection.tsx` (the select saves on change; it holds a pending value and `onCancel` restores it).
-- [ ] 2.3 `settings/SkillLearningSection.tsx` and `skills/use-skill-settings.ts`:
+- [x] 2.1 `settings/ModelsSection.tsx` (Save model), `settings/ClaudeFolderSection.tsx` (Save folder), `settings/WebAppSection.tsx` (Save), `settings/MemoryBasicsSection.tsx` (Save).
+- [x] 2.2 `settings/CaptureLanguageSection.tsx` (the select saves on change; it holds a pending value and `onCancel` restores it).
+- [x] 2.3 `settings/SkillLearningSection.tsx` and `skills/use-skill-settings.ts`:
- the Record agent turns switch
- the redaction switch, where the inline Callout is replaced by the dialog and both directions confirm
- `skills/RecordPast.tsx` (Record past turns)
-- [ ] 2.4 `settings/KeysAccessSection.tsx` (Save password, Clear password) and `settings/ApiTokensTable.tsx` (Generate token).
-- [ ] 2.5 `settings/EmbeddingSection.tsx` (Retry after a failed re-embed) and `settings/CaptureControls.tsx`:
+- [x] 2.4 `settings/KeysAccessSection.tsx` (Save password, Clear password) and `settings/ApiTokensTable.tsx` (Generate token).
+- [x] 2.5 `settings/EmbeddingSection.tsx` (Retry after a failed re-embed) and `settings/CaptureControls.tsx`:
- Retry now, also through `DiagnosticsSection.tsx`
- the plain retention Save; the trace and zero-retention dialogs stay as the confirmation for their paths
-- [ ] 2.6 `settings/ReasoningLevel.tsx` (normal Save), `settings/OpenRouterRouting.tsx` (Save routing), `settings/MemoryCleanupSection.tsx` (turning off and raising the days; the count dialog stays for turning on and lowering the days).
-- [ ] 2.7 `settings/ExternalApiSection.tsx`:
+- [x] 2.6 `settings/ReasoningLevel.tsx` (normal Save), `settings/OpenRouterRouting.tsx` (Save routing), `settings/MemoryCleanupSection.tsx` (turning off and raising the days; the count dialog stays for turning on and lowering the days).
+- [x] 2.7 `settings/ExternalApiSection.tsx`:
- a passing test opens the confirm dialog
- an emptied URL or model confirms that the external API turns off
- Save anyway stays as the confirmation when the test cannot reach the server
@@ -46,26 +46,26 @@ Update existing tests that expect an immediate request, without weakening what t
Test-first rule as in group 2.
-- [ ] 3.1 `memory/MemorySection.tsx`: Save memory limits and each row's Reset to default.
-- [ ] 3.2 `memory/KeywordModeSection.tsx`, `memory/AutoCleanupSettings.tsx`, `memory/ProfileLearningSettingsSection.tsx` (Save; the Reset to default dialog stays) and `memory/ProfileCatchUpSection.tsx` (Pause).
-- [ ] 3.3 `memory/RerankerSection.tsx`: Save confirms after a passing test; "Replace the key file?" stays as the confirmation for its path. Keep the file at 500 lines or fewer.
-- [ ] 3.4 `memory/DirectoryMapsSection.tsx`: Save removals and Restore. `settings/DirectoryMapHost.tsx`: Ignore.
-- [ ] 3.5 `memory/HostSettings.tsx`: Save model, and turning automatic import off (turning it on keeps `TurnOnDialog`).
-- [ ] 3.6 `memory/HostStatusHeader.tsx` and `memory/use-backfill.ts`: Use external API, Pause, Resume and Retry.
-- [ ] 3.7 `memory/MemoryInjectionSection.tsx`: Save. The draft-only Reset to default opens no dialog; the Save after it lists the removed keys.
+- [x] 3.1 `memory/MemorySection.tsx`: Save memory limits and each row's Reset to default.
+- [x] 3.2 `memory/KeywordModeSection.tsx`, `memory/AutoCleanupSettings.tsx`, `memory/ProfileLearningSettingsSection.tsx` (Save; the Reset to default dialog stays) and `memory/ProfileCatchUpSection.tsx` (Pause).
+- [x] 3.3 `memory/RerankerSection.tsx`: Save confirms (it runs no test call; Test is its own button); "Replace the key file?" stays as the confirmation for its path. Keep the file at 500 lines or fewer.
+- [x] 3.4 `memory/DirectoryMapsSection.tsx`: Save removals and Restore. `settings/DirectoryMapHost.tsx`: Ignore.
+- [x] 3.5 `memory/HostSettings.tsx`: Save model, and turning automatic import off (turning it on keeps `TurnOnDialog`).
+- [x] 3.6 `memory/HostStatusHeader.tsx` and `memory/use-backfill.ts`: Use external API, Pause, Resume and Retry.
+- [x] 3.7 `memory/MemoryInjectionSection.tsx`: Save. The draft-only Reset to default opens no dialog; the Save after it lists the removed keys.
## 4. Docs and rules
-- [ ] 4.1 Update `web/AGENTS.md` (Actions): the rule covers settings saves and settings job actions, and local-only view preferences are excluded. Update `docs/web-ui-settings.md` and `docs/web-ui-memory.md`: each save asks first, with the dialog shown once in each guide. Run Prettier on the changed files.
+- [x] 4.1 Update `web/AGENTS.md` (Actions): the rule covers settings saves and settings job actions, and local-only view preferences are excluded. Update `docs/web-ui-settings.md` and `docs/web-ui-memory.md`: each save asks first, with the dialog shown once in each guide. Run Prettier on the changed files.
## 5. Verification
-- [ ] 5.1 Run `bun run check` and the web test files changed in groups 1 to 3, then `tests/file-size-ceiling.test.ts`.
-- [ ] 5.2 Browser check with Orca on a scratch web app (scratch HOME, free port). Check one form Save, one save-on-change select, one job action and one Reset to default:
+- [x] 5.1 Run `bun run check` and the web test files changed in groups 1 to 3, then `tests/file-size-ceiling.test.ts`.
+- [x] 5.2 Browser check with Orca on a scratch web app (scratch HOME, free port). Check one form Save, one save-on-change select, one job action and one Reset to default:
- Cancel writes nothing (check the scratch config file)
- confirm writes the same value as before
Check desktop and 390 px widths and the Arabic layout. Save the screenshots in the scratchpad.
-- [ ] 5.3 Run `bun run ci:local` and confirm that the exit line shows exit 0.
-- [ ] 5.4 Run `graphify update .`.
+- [x] 5.3 Run `bun run ci:local` and confirm that the exit line shows exit 0.
+- [x] 5.4 Run `graphify update .`.
diff --git a/openspec/specs/web-memory-hosts/spec.md b/openspec/specs/web-memory-hosts/spec.md
index 7210e714..e245719b 100644
--- a/openspec/specs/web-memory-hosts/spec.md
+++ b/openspec/specs/web-memory-hosts/spec.md
@@ -686,3 +686,27 @@ Every name, description, option and message in the learning table SHALL have Chi
- **WHEN** the language is Arabic and the user opens the Profile learning row
- **THEN** every label and option SHALL show in Arabic
- **AND** the config keys SHALL read left-to-right
+
+### Requirement: Host and overview saves confirm first
+
+On the host pages and the Memory overview these actions SHALL use the shared settings confirm dialog before they send a request: the host Save model, turning automatic import off, Use external API, Pause, Resume and Retry, Ignore on a folder row, and the opening context and compaction Save. The dialog content, Cancel and page checks SHALL follow the Settings rules. Turning automatic import on SHALL keep its existing dialog.
+
+#### Scenario: Turn automatic import off
+
+- **WHEN** the user clears "Import past chats automatically" for Pi
+- **THEN** a confirm dialog opens, and Cancel leaves the box ticked
+
+#### Scenario: Retry an import
+
+- **WHEN** the user selects **Retry** on a host whose import failed
+- **THEN** a confirm dialog says the retry calls the model again, and no run starts before the user confirms
+
+#### Scenario: Use external API
+
+- **WHEN** the user selects **Use external API** for OpenCode
+- **THEN** a confirm dialog says OpenCode will use the external API model, and nothing is saved before the user confirms
+
+#### Scenario: Opening context
+
+- **WHEN** the user changes the opening context and selects **Save**
+- **THEN** a confirm dialog lists the change and nothing is sent before the user confirms
diff --git a/openspec/specs/web-memory/spec.md b/openspec/specs/web-memory/spec.md
index 3232f0ef..15328815 100644
--- a/openspec/specs/web-memory/spec.md
+++ b/openspec/specs/web-memory/spec.md
@@ -279,3 +279,27 @@ Every string in the welcome panel SHALL exist in English, Chinese and Arabic. Th
- **WHEN** the language is Arabic and the screen is 390 px wide
- **THEN** the panel SHALL show Arabic text, right-to-left, with no sideways scrolling
+
+### Requirement: Shared Memory page saves confirm first
+
+On the shared Memory page these actions SHALL use the shared settings confirm dialog before they send a request: Save memory limits and each row's Reset to default, keyword mode, the reranker card's Save, profile learning Save, profile auto cleanup Save, catch-up Pause, and the directory maps Save removals and Restore. The dialog content, Cancel and page checks SHALL follow the Settings rules.
+
+#### Scenario: Memory limits
+
+- **WHEN** the user changes the maximum memories and selects **Save memory limits**
+- **THEN** a confirm dialog lists the change and nothing is sent before the user confirms
+
+#### Scenario: Reset one row
+
+- **WHEN** the user selects **Reset to default** on the similarity threshold row
+- **THEN** a confirm dialog shows the saved value and the default, and nothing is sent before the user confirms
+
+#### Scenario: Reranker switch
+
+- **WHEN** the user turns the reranker off and selects **Save**
+- **THEN** a confirm dialog opens, and Cancel leaves the saved reranker settings unchanged
+
+#### Scenario: Restore an ignored folder
+
+- **WHEN** the user selects **Restore** on an ignored folder
+- **THEN** a confirm dialog names the folder, and the folder stays ignored until the user confirms
diff --git a/openspec/specs/web-settings/spec.md b/openspec/specs/web-settings/spec.md
index 749edc96..5a25061b 100644
--- a/openspec/specs/web-settings/spec.md
+++ b/openspec/specs/web-settings/spec.md
@@ -465,7 +465,7 @@ Each host view on the Memory page SHALL have a settings card with the **Import p
#### Scenario: Turning automatic import off
-- **WHEN** the user turns off the switch while an automatic Pi backfill runs
+- **WHEN** the user turns off the switch while an automatic Pi backfill runs, and confirms
- **THEN** the global config SHALL have `autoBackfill` set to `false`
- **AND** the Pi backfill SHALL stop after its current exchange
- **AND** the Pi status header SHALL read **Off** once the run has stopped
@@ -1212,7 +1212,7 @@ The External API, Embedding and Reranker cards SHALL use one key-entry control w
### Requirement: Every settings card saves the same way
-Each settings card with a server SHALL test the values in the form, not the saved values. Each card SHALL save with a Save button, not on leaving a field, and SHALL show a plain message after each test and save. An optional URL or model field SHALL be clearable, which removes the key. Every URL field SHALL accept only `http://` or `https://` URLs. An invalid number SHALL show a message next to the field.
+Each settings card with a server SHALL test the values in the form, not the saved values. Each card SHALL save with a Save button, not on leaving a field, SHALL confirm with the shared settings confirm dialog before it saves, and SHALL show a plain message after each test and save. A Save that tests first SHALL test, then confirm; when the test cannot reach the server, the existing Save anyway dialog SHALL be the confirmation.
#### Scenario: Testing an unsaved model
@@ -1221,7 +1221,7 @@ Each settings card with a server SHALL test the values in the form, not the save
#### Scenario: Clearing the API URL
-- **WHEN** the user empties the API URL and saves
+- **WHEN** the user empties the API URL, saves and confirms
- **THEN** `memoryApiUrl` SHALL be removed from the global config
#### Scenario: A URL without a scheme
@@ -1229,6 +1229,11 @@ Each settings card with a server SHALL test the values in the form, not the save
- **WHEN** the user saves `api.example.com/v1` as the API URL
- **THEN** the save SHALL be refused with a message that the URL must start with `http://` or `https://`
+#### Scenario: An invalid number
+
+- **WHEN** the user enters a value that is not a valid number in a number field and selects Save
+- **THEN** a message SHALL show next to the field, and no confirm dialog SHALL open
+
### Requirement: A save that deletes data asks first
A save that deletes stored data at once SHALL open a confirm dialog that states what will be deleted, with a count when one is known. Saving retry retention 0 SHALL read the waiting count again when Save is pressed and state how many waiting turns will be deleted. Nothing SHALL be saved until the user confirms.
@@ -1328,3 +1333,74 @@ Every link that names a Settings section SHALL select its chip and bring the sec
- **WHEN** the user searches for `retention` and chooses a result on the Memory cleanup card
- **THEN** the page SHALL show the Memory cleanup section with its chip pressed
- **AND** keyboard focus SHALL move to the card heading
+
+### Requirement: Settings saves confirm before sending
+
+Every action on the Settings and Memory pages that writes a setting or starts or stops a settings job SHALL open the shared settings confirm dialog first. The page SHALL send no request until the user confirms. The dialog SHALL show progress while the request runs, show a server error inside itself and stay open, and close on success. The confirmed request SHALL have the same body as it had before this rule.
+
+#### Scenario: Save button
+
+- **WHEN** the user changes the web app autostart box and selects **Save**
+- **THEN** a confirm dialog opens and no request is sent
+
+#### Scenario: Confirm
+
+- **WHEN** the user selects the confirm button in that dialog
+- **THEN** the page sends `webServerAutoStart` as before, shows progress, and closes the dialog when the save succeeds
+
+#### Scenario: Server refusal
+
+- **WHEN** the server refuses a confirmed save
+- **THEN** the dialog shows the server's reason and stays open
+
+### Requirement: Cancel and page checks
+
+**Cancel** SHALL send nothing. A control that saves on change, such as a select, switch or checkbox, SHALL show its saved value again after Cancel. Text the user typed in a form SHALL stay as a draft after Cancel. A value that breaks a rule the page checks SHALL show its message on the page, and no dialog SHALL open.
+
+#### Scenario: Cancel a select
+
+- **WHEN** the user picks a new summary language and then selects **Cancel**
+- **THEN** nothing is saved and the select shows the saved language
+
+#### Scenario: Cancel a form
+
+- **WHEN** the user types a Claude Code folder, selects **Save folder** and then **Cancel**
+- **THEN** nothing is saved and the typed folder stays in the box
+
+#### Scenario: Invalid value
+
+- **WHEN** the user enters an interval outside its range and selects **Save**
+- **THEN** the page shows the range message and no dialog opens
+
+### Requirement: The dialog lists the changes
+
+The dialog SHALL name the card and list each setting the save changes, with its saved value and its new value in plain words. A reset to default SHALL show the default as the new value. A job action SHALL say in one sentence what the job does, for example that a retry calls the model again.
+
+#### Scenario: Two settings change
+
+- **WHEN** the user turns off automatic capture, picks a new default scope and selects **Save**
+- **THEN** the dialog lists both settings, each with its old and new value
+
+#### Scenario: Job action
+
+- **WHEN** the user selects **Retry now** for a host
+- **THEN** the dialog says the waiting captures will be sent to the model again
+
+### Requirement: Settings page cards confirm every save
+
+On the Settings page these actions SHALL confirm first: the host model Save, the summary language, the Claude Code folder, web app autostart, Memory basics, the two Skill learning switches, Record past turns, Save password, Clear password, Generate token, the embedding Retry, capture Retry now, capture retention, the reasoning level, the external API Save, OpenRouter routing and memory cleanup. Each card's own special dialogs SHALL stay.
+
+#### Scenario: External API turned off
+
+- **WHEN** the user empties the external API URL and selects **Save settings**
+- **THEN** a confirm dialog says the external API will be turned off, and nothing is sent before the user confirms
+
+#### Scenario: Turn off redaction
+
+- **WHEN** the user turns off "Remove private text and secrets"
+- **THEN** the shared confirm dialog opens in place of the inline warning, and Cancel leaves redaction on
+
+#### Scenario: Memory cleanup turned off
+
+- **WHEN** the user turns off memory cleanup and selects **Save**
+- **THEN** a confirm dialog opens, although turning it off deletes nothing
diff --git a/web/AGENTS.md b/web/AGENTS.md
index d324a762..4bf7d83a 100644
--- a/web/AGENTS.md
+++ b/web/AGENTS.md
@@ -64,6 +64,9 @@ One dialog per space operation, in `src/lib/components/spaces/`. The owners are
- Every action that sends a request shows a visible answer at once and again when it ends (see the "Feedback after a click" section of the design reference).
- Every action that changes state opens a confirm dialog first (`SpaceConfirmDialog` is the example): a title that names the thing, a plain sentence on the effect, Cancel and a confirm button. Nothing is sent until the user confirms. The dialog shows progress while the request runs, shows a server error inside itself and stays open, and closes on success.
+- A settings save or a settings job action on the Settings page or the Memory page uses the shared settings confirm dialog (`useSettingsConfirm`). This covers Save buttons, controls that save on change, Reset to default, and buttons that start or stop a job, such as Pause, Resume and Retry.
+- The settings dialog has a title that names the card, and a body from `useSettingsChanges` and `SettingsChangeList`. Build the list from the same edits object that the request sends. A job action gets one sentence. Open one dialog for each click: when a card has its own special dialog for a path, that dialog is the confirmation. A page check comes first, and no dialog opens when the page refuses a value. **Cancel** sends nothing. A control that saves on change shows its saved value again. Typed text stays as a draft. Copy `MemoryBasicsSection.tsx` for a form, or `CaptureLanguageSection.tsx` for a control that saves on change.
+- A choice that changes only how the page looks needs no dialog, because it writes no server state. These are the theme, the palette, the date and time format, the language, the sidebar, paging and filters.
- A delete or another action that cannot be undone asks for the exact name in a dialog. The confirm button stays disabled until the text matches.
- Every clickable control shows a pointer cursor, and a disabled one does not. The shared `Button` carries `cursor-pointer` and `disabled:pointer-events-none`. A raw `
)}
+ {dialog}
);
}
diff --git a/web/src/lib/components/memory/DirectoryMapIgnoredList.tsx b/web/src/lib/components/memory/DirectoryMapIgnoredList.tsx
new file mode 100644
index 00000000..ecb0793d
--- /dev/null
+++ b/web/src/lib/components/memory/DirectoryMapIgnoredList.tsx
@@ -0,0 +1,45 @@
+import { Button } from "$lib/components/ui/button";
+import { useSettingsText } from "$lib/i18n/settings";
+
+type Props = {
+ ignored?: string[];
+ restoreDisabled: boolean;
+ onRestore: (directory: string) => void;
+};
+
+/** The Ignored directories disclosure; each Restore asks before it saves. */
+export function DirectoryMapIgnoredList({ ignored, restoreDisabled, onRestore }: Props) {
+ const s = useSettingsText();
+ return (
+
+
+
{s("Ignored directories")}
·{" "}
+ {ignored?.length ?? 0}
+
+ {s("Ignored directories stay unimported and leave the unresolved counts.")}
+
+
+
+ {!ignored?.length &&
{s("none")}
}
+ {ignored?.map((directory) => (
+
+
+ {directory}
+
+
+
+ ))}
+
+
+ );
+}
diff --git a/web/src/lib/components/memory/DirectoryMapsSection.tsx b/web/src/lib/components/memory/DirectoryMapsSection.tsx
index eca07ab5..8da799b9 100644
--- a/web/src/lib/components/memory/DirectoryMapsSection.tsx
+++ b/web/src/lib/components/memory/DirectoryMapsSection.tsx
@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from "react";
+import { useDirectoryMapConfirm } from "@/hooks/useDirectoryMapConfirm";
import {
onSettingsSnapshot,
publishSettingsSnapshot,
@@ -18,6 +19,7 @@ import {
type DirectoryMapReview,
type SuggestedDirectory,
} from "$lib/directory-maps";
+import { DirectoryMapIgnoredList } from "./DirectoryMapIgnoredList";
import { DirectoryMapHost } from "../settings/DirectoryMapHost";
import { DirectoryMapReviewDialog } from "../settings/DirectoryMapReviewDialog";
import { IgnoreAllDialog } from "../settings/IgnoreAllDialog";
@@ -39,6 +41,7 @@ type View = {
};
const ALL_HOSTS = ["pi", "opencode", "claude-code"] as const;
+const LOADING = "The list is still loading. Try again in a moment.";
/**
* The Directory maps card. The Shared view shows the saved maps and ignored
@@ -57,6 +60,7 @@ export function DirectoryMapsSection({
anchorId?: string;
} = {}) {
const s = useSettingsText();
+ const confirms = useDirectoryMapConfirm();
const [ignoringAll, setIgnoringAll] = useState<{ host: WebHost; rows: Suggested[] }>();
const [snapshot, setSnapshot] = useState();
const [view, setView] = useState();
@@ -124,20 +128,21 @@ export function DirectoryMapsSection({
// The server supplies resolved paths, also used by rows and Restore.
const ignoredList = () => view?.ignored ?? [];
- /** Save removals, Ignore, and Restore: one immediate save, then a fresh list. */
+ /** The page check before a dialog opens. A refused save must say so; a pending refresh and a
+ * running save already show their own message. */
+ function ready(): boolean {
+ if (snapshot && view && !saving.current && !refreshNeeded) return true;
+ if (!saving.current && !refreshNeeded) setMessage(LOADING);
+ return false;
+ }
+ /** Save removals, Ignore, and Restore: one save, then a fresh list. The answer is the
+ * failure message, or undefined once saved, so the confirm dialog can show the reason. */
async function saveNow(
edits: Record,
done: string,
failed: string
- ): Promise {
- if (!snapshot || !view || saving.current || refreshNeeded) {
- // A refused save must say so; a silent no-op looks like a broken button.
- // A pending refresh and a running save already show their own message.
- if (!saving.current && !refreshNeeded) {
- setMessage("The list is still loading. Try again in a moment.");
- }
- return false;
- }
+ ): Promise {
+ if (!snapshot || !ready()) return LOADING;
saving.current = true;
setBusy(true);
try {
@@ -151,18 +156,19 @@ export function DirectoryMapsSection({
if (!conflict) {
setMessage(failed);
await reloadSettingsSnapshot();
- return false;
+ return failed;
}
- setMessage("Settings changed elsewhere. Check the list and try again.");
+ let failure = "Settings changed elsewhere. Check the list and try again.";
+ setMessage(failure);
try {
await refreshReview();
} catch {
setRefreshNeeded("conflict");
- setMessage(
- "Settings changed elsewhere and could not be refreshed. Refresh the list, then try again."
- );
+ failure =
+ "Settings changed elsewhere and could not be refreshed. Refresh the list, then try again.";
+ setMessage(failure);
}
- return false;
+ return failure;
} finally {
saving.current = false;
setBusy(false);
@@ -180,22 +186,30 @@ export function DirectoryMapsSection({
saving.current = false;
setBusy(false);
}
- return true;
+ return undefined;
}
function saveRemovals() {
- void saveNow(
- { importPathMaps: mapsToSave(view?.saved ?? [], removed) },
- "Saved. Removed maps stop applying at the next import or backfill run.",
- "Removals could not be saved. Try again."
- ).then((saved) => {
- if (saved) setRemoved(new Set());
+ if (!ready()) return;
+ const maps = view?.saved ?? [];
+ const edits = mapsToSave(maps, removed);
+ confirms.askRemovals(maps, edits, async () => {
+ const failure = await saveNow(
+ { importPathMaps: edits },
+ "Saved. Removed maps stop applying at the next import or backfill run.",
+ "Removals could not be saved. Try again."
+ );
+ if (failure === undefined) setRemoved(new Set());
+ return failure;
});
}
function ignore(row: Suggested) {
- void saveNow(
- { importIgnoredDirectories: [...new Set([...ignoredList(), row.directory])] },
- "Ignored. The directory stays unimported.",
- "The directory could not be ignored. Try again."
+ if (!ready()) return;
+ confirms.askIgnore(row.directory, () =>
+ saveNow(
+ { importIgnoredDirectories: [...new Set([...ignoredList(), row.directory])] },
+ "Ignored. The directory stays unimported.",
+ "The directory could not be ignored. Try again."
+ )
);
}
function ignoreAll() {
@@ -205,16 +219,19 @@ export function DirectoryMapsSection({
{ importIgnoredDirectories: ignoreAllList(ignoredList(), rows) },
"Ignored. The directories stay unimported.",
"The directories could not be ignored. Try again."
- ).then((saved) => {
+ ).then((failure) => {
// A failed or refused save keeps the dialog open, with the reason on the page.
- if (saved) setIgnoringAll(undefined);
+ if (failure === undefined) setIgnoringAll(undefined);
});
}
function restore(directory: string) {
- void saveNow(
- { importIgnoredDirectories: ignoredList().filter((item) => item !== directory) },
- "Restored. The directory shows again in each host list that reported it.",
- "The directory could not be restored. Try again."
+ if (!ready()) return;
+ confirms.askRestore(directory, () =>
+ saveNow(
+ { importIgnoredDirectories: ignoredList().filter((item) => item !== directory) },
+ "Restored. The directory shows again in each host list that reported it.",
+ "The directory could not be restored. Try again."
+ )
);
}
async function refreshReview() {
@@ -408,36 +425,11 @@ export function DirectoryMapsSection({
))}
-
-
-
))}
diff --git a/web/src/lib/i18n/settings-catalogue-rows.ts b/web/src/lib/i18n/settings-catalogue-rows.ts
index ab7b3a8e..69504bef 100644
--- a/web/src/lib/i18n/settings-catalogue-rows.ts
+++ b/web/src/lib/i18n/settings-catalogue-rows.ts
@@ -29,6 +29,14 @@ export const settingsCatalogueRowText = {
None: ["无", "لا شيء"],
// The list of changes in a settings confirm dialog.
"changes to": ["改为", "يتغير إلى"],
+ "Nothing changes. Saving writes the current values again.": [
+ "没有更改。保存会再次写入当前值。",
+ "لا يتغير شيء. الحفظ يكتب القيم الحالية مرة أخرى.",
+ ],
+ "Close this dialog and save again, so it shows the current settings.": [
+ "请关闭此对话框并重新保存,以显示当前设置。",
+ "أغلق هذه النافذة واحفظ مرة أخرى، لتعرض الإعدادات الحالية.",
+ ],
"This project": ["本项目", "هذا المشروع"],
"OpenAI Chat Completions": ["OpenAI Chat Completions", "OpenAI Chat Completions"],
"Session model": ["会话模型", "نموذج الجلسة"],
diff --git a/web/tests/claude-folder-confirm.spec.tsx b/web/tests/claude-folder-confirm.spec.tsx
index 92378ce8..2aa7ac25 100644
--- a/web/tests/claude-folder-confirm.spec.tsx
+++ b/web/tests/claude-folder-confirm.spec.tsx
@@ -88,15 +88,19 @@ it("lists the typed folder and sends nothing until the user confirms", async ()
expect(patches()).toHaveLength(0);
});
-it("saves with no dialog when the folder did not change, as it did before it asked first", async () => {
+it("opens the dialog with an empty change list when the folder did not change, and saves only on confirm", async () => {
folder = "/data/claude";
let tree = await settle(, own);
expect(field(tree).props.value).toBe("/data/claude");
buttonOf(tree, "Save folder").props.onClick();
tree = await settle(, own);
- // Save stays on for an unchanged folder, and the dialog has nothing to list for it.
- expect(dialogOf(tree)).toBeUndefined();
+ // Save stays on for an unchanged folder. The dialog opens with nothing to list.
+ expect(dialogOf(tree)).toBeDefined();
+ expect(rowsOf(dialogOf(tree)!)).toEqual([]);
+ expect(patches()).toHaveLength(0);
+
+ await confirm(tree);
expect(patches()).toHaveLength(1);
expect(patches()[0]!.body).toEqual({
edits: { claudeConfigDir: "/data/claude" },
diff --git a/web/tests/directory-maps-confirm.spec.tsx b/web/tests/directory-maps-confirm.spec.tsx
index fba91dca..1deebe31 100644
--- a/web/tests/directory-maps-confirm.spec.tsx
+++ b/web/tests/directory-maps-confirm.spec.tsx
@@ -186,7 +186,7 @@ it("sends nothing when the user cancels an Ignore, and the row stays", async ()
expect(button(tree, "Ignore")).toBeDefined();
});
-it("keeps a failed Ignore in the dialog, with the card's reason", async () => {
+it("keeps a failed Ignore in the dialog, with the card's reason and the server's message", async () => {
refusal = { status: 400, error: "Target unavailable" };
let tree = await shown();
button(tree, "Ignore").props.onClick();
@@ -195,7 +195,7 @@ it("keeps a failed Ignore in the dialog, with the card's reason", async () => {
const result = await dialogOf(tree)!.props.onConfirm();
expect(result).toEqual({
success: false,
- error: "The directory could not be ignored. Try again.",
+ error: "The directory could not be ignored. Try again. Target unavailable",
});
tree = await shown();
expect(dialogOf(tree)).toBeDefined();
diff --git a/web/tests/ignore-all.spec.tsx b/web/tests/ignore-all.spec.tsx
index efa73a0e..8d42ca6e 100644
--- a/web/tests/ignore-all.spec.tsx
+++ b/web/tests/ignore-all.spec.tsx
@@ -203,7 +203,7 @@ it("keeps the dialog open and says why when the save fails", async () => {
await settle();
const after = render();
expect(dialog(after)).toBeDefined();
- expect(texts(after)).toContain("The directories could not be ignored. Try again.");
+ expect(texts(after)).toContain("The directories could not be ignored. Try again. stale");
});
it("says so, and keeps the dialog open, when the list is not ready to save", async () => {
diff --git a/web/tests/models-section-confirm.spec.tsx b/web/tests/models-section-confirm.spec.tsx
index 4d4893e9..ebb12193 100644
--- a/web/tests/models-section-confirm.spec.tsx
+++ b/web/tests/models-section-confirm.spec.tsx
@@ -92,14 +92,18 @@ it("names the host, lists the model change and sends nothing until the user conf
expect(patches()).toHaveLength(0);
});
-it("saves with no dialog when the choice did not change, as it did before it asked first", async () => {
+it("opens the dialog with an empty change list when the choice did not change, and saves only on confirm", async () => {
let tree = await settle(, own);
expect(choice(tree).props.value).toBe("inherit");
saveModel(tree).props.onClick();
tree = await settle(, own);
- // Save stays on for an unchanged choice, and the dialog has nothing to list for it.
- expect(dialogOf(tree)).toBeUndefined();
+ // Save stays on for an unchanged choice. The dialog opens with nothing to list.
+ expect(dialogOf(tree)).toBeDefined();
+ expect(rowsOf(dialogOf(tree)!)).toEqual([]);
+ expect(patches()).toHaveLength(0);
+
+ await confirm(tree);
expect(patches()).toHaveLength(1);
expect(patches()[0]!.body).toEqual({ edits: { opencodeModel: "inherit" }, revision: "r1" });
});
diff --git a/web/tests/openrouter-routing.spec.tsx b/web/tests/openrouter-routing.spec.tsx
index 39e97b6c..24376fac 100644
--- a/web/tests/openrouter-routing.spec.tsx
+++ b/web/tests/openrouter-routing.spec.tsx
@@ -478,7 +478,7 @@ it("asks before it saves the routing, and sends the same request once the user c
expect(requests.some((request) => request.path === "/api/settings")).toBe(true);
});
-it("saves with no dialog when no routing choice changed, as it did before it asked first", async () => {
+it("opens the dialog with an empty change list when no routing choice changed, and saves only on confirm", async () => {
requests = installFetch((request) => {
if (request.path.startsWith(LIST)) return { body: { ok: true, providers: rows } };
if (request.path === SAVE) return { body: { revision: "rev-10", provider: {} } };
@@ -488,8 +488,12 @@ it("saves with no dialog when no routing choice changed, as it did before it ask
(buttonNamed(tree, "Save routing").props.onClick as () => void)();
tree = await settle(block(), own);
- // Save routing stays on when nothing changed, and the dialog has nothing to list for it.
- expect(dialogOf(tree)).toBeUndefined();
+ // Save routing stays on when nothing changed. The dialog opens with nothing to list.
+ expect(dialogOf(tree)).toBeDefined();
+ expect(rowsOf(dialogOf(tree)!)).toEqual([]);
+ expect(posts()).toHaveLength(0);
+ await confirm(tree);
+ tree = await settle(block(), own);
expect(posts()).toHaveLength(1);
expect(posts()[0]!.body).toMatchObject({ revision: "rev-9" });
expect(posts()[0]!.body.routing).toBeDefined();
@@ -823,6 +827,8 @@ it("clears Routing saved. as soon as any routing control changes", async () => {
let tree = await settle(block(), own);
(buttonNamed(tree, "Save routing").props.onClick as () => void)();
tree = await settle(block(), own);
+ await confirm(tree);
+ tree = await settle(block(), own);
expect(statusLines(tree).join(" ")).toContain("Routing saved.");
const edits: Array<(tree: Node[]) => void> = [
@@ -836,6 +842,8 @@ it("clears Routing saved. as soon as any routing control changes", async () => {
tree = await settle(block(), own);
(buttonNamed(tree, "Save routing").props.onClick as () => void)();
tree = await settle(block(), own);
+ await confirm(tree);
+ tree = await settle(block(), own);
expect(statusLines(tree).join(" ")).toContain("Routing saved.");
edit(tree);
tree = await settle(block(), own);
@@ -870,6 +878,8 @@ it("clears Routing saved. when Use only these providers changes", async () => {
let tree = await settle(block({ saved: { order: ["deepinfra"] } }), own);
(buttonNamed(tree, "Save routing").props.onClick as () => void)();
tree = await settle(block({ saved: { order: ["deepinfra"] } }), own);
+ await confirm(tree);
+ tree = await settle(block({ saved: { order: ["deepinfra"] } }), own);
expect(statusLines(tree).join(" ")).toContain("Routing saved.");
(box(tree, "openrouter-only").props.onCheckedChange as (v: boolean) => void)(true);
tree = await settle(block({ saved: { order: ["deepinfra"] } }), own);
diff --git a/web/tests/reasoning-level.spec.tsx b/web/tests/reasoning-level.spec.tsx
index b4752beb..13f70c01 100644
--- a/web/tests/reasoning-level.spec.tsx
+++ b/web/tests/reasoning-level.spec.tsx
@@ -219,8 +219,11 @@ it("drops a pending pick that the new saved endpoint does not offer", async () =
expect(select(tree).props.value).toBe("default");
(saveButton(tree).props.onClick as () => void)();
tree = await settle(card(other), own);
- // The level on screen is the saved one, so the dialog has nothing to list and none opens.
- expect(dialogOf(tree)).toBeUndefined();
+ // The level on screen is the saved one, so the dialog opens with nothing to list.
+ expect(dialogOf(tree)).toBeDefined();
+ expect(rowsOf(dialogOf(tree)!)).toEqual([]);
+ expect(posts()).toHaveLength(0);
+ await confirm(tree);
expect(requests.find((request) => request.path === SAVE)!.body).toEqual({
revision: "rev-9",
level: "default",
@@ -407,7 +410,7 @@ it("keeps a server refusal inside the ordinary-save dialog, which stays open", a
expect(allText(tree)).not.toContain("Reasoning level saved.");
});
-it("saves a level that did not change with no dialog, because the dialog has nothing to list", async () => {
+it("opens the dialog with an empty change list for a level that did not change, and saves only on confirm", async () => {
// Save stays on for an unchanged level, and it sends the same request as before this rule.
const same = { saved: { reasoning: { effort: "high" } } };
let tree = await settle(card(same), own);
@@ -415,7 +418,11 @@ it("saves a level that did not change with no dialog, because the dialog has not
(saveButton(tree).props.onClick as () => void)();
tree = await settle(card(same), own);
- expect(dialogOf(tree)).toBeUndefined();
+ expect(dialogOf(tree)).toBeDefined();
+ expect(rowsOf(dialogOf(tree)!)).toEqual([]);
+ expect(posts()).toHaveLength(0);
+ await confirm(tree);
+ tree = await settle(card(same), own);
expect(posts()).toHaveLength(1);
expect(posts()[0]!.body).toEqual({ revision: "rev-9", level: "high" });
expect(allText(tree)).toContain("Reasoning level saved.");
diff --git a/web/tests/reranker-section.spec.tsx b/web/tests/reranker-section.spec.tsx
index 812cd9ea..be524509 100644
--- a/web/tests/reranker-section.spec.tsx
+++ b/web/tests/reranker-section.spec.tsx
@@ -370,7 +370,7 @@ it("lists a key that changes but keeps its source, so a new key is never left ou
});
});
-it("saves with no dialog when nothing changed, as it did before it asked first", async () => {
+it("opens the dialog with an empty change list when nothing changed, and saves only on confirm", async () => {
const MODEL = "Qwen3-Reranker-0.6B";
const entry = (value: unknown) => ({ value, source: "global", globalValue: value });
const same = {
@@ -387,7 +387,12 @@ it("saves with no dialog when nothing changed, as it did before it asked first",
requests.length = 0;
await click(after(), "Save");
- expect(byType(after(), SettingsConfirmDialog)).toHaveLength(0);
+ // Nothing changed, so the dialog opens with no rows and sends nothing yet.
+ const dialog = byType(after(), SettingsConfirmDialog)[0]!;
+ expect(dialog.props.body.props.changes).toEqual([]);
+ expect(requests.find((request) => request.method === "PATCH")).toBeUndefined();
+ await dialog.props.onConfirm();
+ await flush();
const patch = requests.find((request) => request.method === "PATCH")!;
expect(patch.body.edits).toEqual({
rerankerEnabled: true,
diff --git a/web/tests/settings-change-list.spec.tsx b/web/tests/settings-change-list.spec.tsx
index 6d68f0b2..fbb7650e 100644
--- a/web/tests/settings-change-list.spec.tsx
+++ b/web/tests/settings-change-list.spec.tsx
@@ -50,9 +50,10 @@ it("reads the link between the values in Arabic", async () => {
expect(allText(tree)).not.toContain("changes to");
});
-it("shows nothing when the save changes nothing", async () => {
+it("says that nothing changes when the save changes nothing", async () => {
const tree = await settle(list([]), own);
- expect(allText(tree).trim()).toBe("");
+ expect(allText(tree).trim()).toBe("Nothing changes. Saving writes the current values again.");
+ expect(typed(tree, "dt")).toEqual([]);
});
it("gives the helper the words and the setting names of the page", async () => {
diff --git a/web/tests/settings-confirm-retry.spec.tsx b/web/tests/settings-confirm-retry.spec.tsx
new file mode 100644
index 00000000..b5a33f6d
--- /dev/null
+++ b/web/tests/settings-confirm-retry.spec.tsx
@@ -0,0 +1,86 @@
+import { beforeEach, expect, it } from "bun:test";
+import { byType, installReact, resetRender, settle, type Node } from "./space-kit.tsx";
+
+installReact();
+
+const { useSettingsConfirm } = await import("../src/hooks/useSettingsConfirm.tsx");
+const { SettingsConfirmDialog } =
+ await import("../src/lib/components/settings/SettingsConfirmDialog.tsx");
+const { setLanguage } = await import("../src/lib/i18n/index.ts");
+
+const STALE = "Close this dialog and save again, so it shows the current settings.";
+type Result = { success: boolean; error?: string };
+
+let ask: ReturnType["ask"];
+/** A card with nothing but the shared confirm: the spec asks through `ask`. */
+function Card() {
+ const confirm = useSettingsConfirm();
+ ask = confirm.ask;
+ return
{confirm.dialog}
;
+}
+const own = [Card];
+const el = () => ;
+const dialogOf = (tree: Node[]) => byType(tree, SettingsConfirmDialog)[0];
+
+beforeEach(() => {
+ resetRender();
+ setLanguage("en");
+});
+
+function request(run: () => Promise) {
+ return { title: "Save?", body: "Body", confirmLabel: "Save", run };
+}
+
+it("turns confirm off after a failed run, so a retry cannot resend the values from the click", async () => {
+ let runs = 0;
+ await settle(el(), own);
+ ask(request(async () => (runs++, { success: false, error: "Config changed." })));
+ let tree = await settle(el(), own);
+ expect(dialogOf(tree)!.props.blocked).toBeUndefined();
+
+ expect(await dialogOf(tree)!.props.onConfirm()).toEqual({
+ success: false,
+ error: "Config changed.",
+ });
+ tree = await settle(el(), own);
+ expect(dialogOf(tree)!.props.blocked).toBe(STALE);
+ expect(runs).toBe(1);
+});
+
+it("starts the next question with confirm on again", async () => {
+ await settle(el(), own);
+ ask(request(async () => ({ success: false, error: "No." })));
+ let tree = await settle(el(), own);
+ await dialogOf(tree)!.props.onConfirm();
+ tree = await settle(el(), own);
+ dialogOf(tree)!.props.onClose();
+ tree = await settle(el(), own);
+ expect(dialogOf(tree)).toBeUndefined();
+
+ ask(request(async () => ({ success: true })));
+ tree = await settle(el(), own);
+ expect(dialogOf(tree)!.props.blocked).toBeUndefined();
+});
+
+it("does not block a follow-up question that the run asked", async () => {
+ await settle(el(), own);
+ ask(
+ request(async () => {
+ // As the External API card does when the key-file dialog takes over the click.
+ ask({ ...request(async () => ({ success: true })), title: "Replace the key file?" });
+ return { success: false, error: "" };
+ })
+ );
+ let tree = await settle(el(), own);
+ await dialogOf(tree)!.props.onConfirm();
+ tree = await settle(el(), own);
+ expect(dialogOf(tree)!.props.title).toBe("Replace the key file?");
+ expect(dialogOf(tree)!.props.blocked).toBeUndefined();
+});
+
+it("keeps the card's own blocked reason when nothing has failed", async () => {
+ await settle(el(), own);
+ ask({ ...request(async () => ({ success: true })), blocked: "The count could not be read." });
+ const tree = await settle(el(), own);
+ expect(dialogOf(tree)!.props.blocked).toBe("The count could not be read.");
+});