Skip to content

feat(memory): redesign settings ux#1901

Merged
zerob13 merged 4 commits into
devfrom
feat/memory-settings-ux-redesign
Jul 9, 2026
Merged

feat(memory): redesign settings ux#1901
zerob13 merged 4 commits into
devfrom
feat/memory-settings-ux-redesign

Conversation

@yyhhyyyyyy

@yyhhyyyyyy yyhhyyyyyy commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator
  • flatten the page IA into memories, persona, and diagnostics tabs
  • replace the old manager/config/health panels with inline components
  • add inline memory view, edit, create, archive, restore, and delete flows
  • add memory.update with manual-edit events and visible status counts
  • make config changes apply immediately with agent-scoped stale guards
  • trim diagnostics and add localized audit labels
  • update renderer and main-process memory tests

Summary by CodeRabbit

  • New Features

    • Redesigned Memory settings with separate views for memories, persona, and diagnostics.
    • Added inline memory viewing, editing, creation, and per-item archive/restore/remove actions.
    • Introduced an inbox for conflict resolution and persona draft review.
    • Added diagnostics with health indicators, reindex controls, audit activity, and “clear all” memory.
    • Added support for updating memory content and metadata (including category/importance).
  • Bug Fixes

    • Improved accuracy of memory status/counts and refresh behavior.
    • Refined handling of memory edit outcomes (no-op, folded, superseded) with clearer UI feedback and audit recording.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2e6770e7-77e3-4492-9c3e-66fc2111e4f4

📥 Commits

Reviewing files that changed from the base of the PR and between 4abc620 and fed6e4d.

📒 Files selected for processing (10)
  • src/renderer/settings/components/MemoryDiagnosticsPanel.vue
  • src/renderer/settings/components/MemoryInlinePanel.vue
  • src/renderer/settings/components/MemoryListView.vue
  • src/renderer/settings/components/MemorySettings.vue
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • test/renderer/components/MemoryDiagnosticsPanel.test.ts
  • test/renderer/components/MemoryInlinePanel.test.ts
  • test/renderer/components/MemoryListView.test.ts
  • test/renderer/components/MemorySettings.test.ts
✅ Files skipped from review due to trivial changes (2)
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • test/renderer/components/MemoryInlinePanel.test.ts
  • src/renderer/settings/components/MemoryDiagnosticsPanel.vue
  • test/renderer/components/MemorySettings.test.ts
  • src/renderer/settings/components/MemoryInlinePanel.vue
  • src/renderer/settings/components/MemorySettings.vue
  • src/renderer/settings/components/MemoryListView.vue

📝 Walkthrough

Walkthrough

This PR adds a manual memory update flow across presenter, service, route, contract, and renderer client layers, and replaces the memory settings UI with a redesigned shell built from inline configuration, list, diagnostics, inbox, persona, and empty-state components. It also updates shared status/result contracts, localization, and tests.

Changes

Manual Memory Update Backend Flow

Layer / File(s) Summary
Shared contracts and types
src/shared/contracts/routes/memory.routes.ts, src/shared/contracts/routes.ts, src/shared/contracts/events/memory.events.ts, src/main/presenter/memoryPresenter/types.ts
Adds the memory update route/result contract, expanded memory status fields, new repository aggregate methods, and the manual-edit update reason.
Row mutation fold/supersede logic
src/main/presenter/memoryPresenter/services/rowMutations.ts
Extends manual content edits with a superseded result and provided-field-aware fold resolution.
ManagementService update/status flow
src/main/presenter/memoryPresenter/services/managementService.ts
Implements updateMemory validation, metadata-only updates, transactional content edits, audit emission, embedding sync, and expanded status aggregation.
SQLite table methods
src/main/presenter/sqlitePresenter/tables/agentMemory.ts
Adds metadata patching plus updated status, conflict, and persona count queries.
Presenter entry point and route dispatch
src/main/presenter/memoryPresenter/index.ts, src/main/routes/index.ts
Adds the public updateMemory method and dispatches memory.update with deepchat agent gating.
Renderer client method
src/renderer/api/MemoryClient.ts
Adds the renderer update API and patch input type.
Backend tests
test/main/presenter/fakes/memoryFakes.ts, test/main/presenter/memoryPresenter.test.ts, test/main/presenter/memoryUpdate.test.ts, test/main/routes/memoryDto.test.ts
Adds fake support and coverage for update outcomes, status counts, and route parsing.

Memory Settings UI Redesign

Layer / File(s) Summary
Redesign utilities
src/renderer/settings/components/memoryRedesignUtils.ts
Adds importance, labeling, toast, relative-time, and audit-key helpers.
Inline panel
src/renderer/settings/components/MemoryInlinePanel.vue, test/renderer/components/MemoryInlinePanel.test.ts
Adds the memory view/edit/create panel with save, archive, restore, remove, source, lifecycle, and discard-prompt behavior.
List view
src/renderer/settings/components/MemoryListView.vue, test/renderer/components/MemoryListView.test.ts
Adds the searchable list with inline expansion, filters, row actions, and dirty-state handling.
Config inline panel
src/renderer/settings/components/MemoryConfigInlinePanel.vue, test/renderer/components/MemoryConfigInlinePanel.test.ts
Adds the inline configuration panel with optimistic per-field writes.
Diagnostics panel
src/renderer/settings/components/MemoryDiagnosticsPanel.vue, test/renderer/components/MemoryDiagnosticsPanel.test.ts
Adds the diagnostics panel with health, archive preview, audit events, reindex, and clear-all flows.
Inbox, persona, empty-state components
src/renderer/settings/components/MemoryInboxBar.vue, src/renderer/settings/components/MemoryPersonaPanel.vue, src/renderer/settings/components/MemoryEmptyState.vue
Adds the inbox, persona timeline, and empty-state UI pieces.
Settings shell integration
src/renderer/settings/components/MemorySettings.vue, test/renderer/components/MemorySettings.test.ts
Rewrites the settings shell around the new panels and status summary.
Localization
src/renderer/src/i18n/*/settings.json
Adds memory.redesign translation blocks and audit labels across locales.

Estimated code review effort: 4 (Complex) | ~75 minutes

Possibly related PRs

Suggested reviewers: deepinfect

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: a memory settings UX redesign.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/memory-settings-ux-redesign

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (3)
src/main/presenter/sqlitePresenter/tables/agentMemory.ts (1)

1387-1422: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Centralize the conflict-pair predicate. countConflictPairs() duplicates the same validity rules as ConflictService.listConflicts(), so a future change can make the status count disagree with the list view. Extract the predicate into one shared helper or SQL fragment.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/presenter/sqlitePresenter/tables/agentMemory.ts` around lines 1387 -
1422, The conflict-pair validity logic is duplicated between
countConflictPairs() and ConflictService.listConflicts(), so they can drift out
of sync. Extract the shared predicate into a common helper or reusable SQL
fragment, then have countConflictPairs() and the list-conflict path both use it
so the challenger/target status checks stay identical.
test/renderer/components/MemoryInlinePanel.test.ts (1)

145-360: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add tests for archive, restore, and remove actions.

The suite thoroughly covers editing flows (create, update, noop, supersede, fold, stale responses, discard prompt, Escape handling), but the three footer action buttons — archive, restore, and delete — have no test coverage. These are destructive/irreversible user actions that warrant verification of correct memoryClient calls, changed/close emission, and toast-on-error behavior.

🧪 Suggested test additions
it('archives the memory and emits changed + close', async () => {
  const { wrapper, memoryClient } = await setup()
  const archiveButton = wrapper
    .findAll('button')
    .find((button) => button.text() === 'settings.memory.redesign.archive')
  await archiveButton!.trigger('click')
  await flushPromises()

  expect(memoryClient.archive).toHaveBeenCalledWith('deepchat', 'm1')
  expect(wrapper.emitted('changed')).toHaveLength(1)
  expect(wrapper.emitted('close')).toHaveLength(1)
  wrapper.unmount()
})

it('restores an archived memory and emits changed', async () => {
  const { wrapper, memoryClient } = await setup({
    item: memory({ status: 'archived' })
  })
  const restoreButton = wrapper
    .findAll('button')
    .find((button) => button.text() === 'settings.deepchatAgents.memoryManager.restore')
  await restoreButton!.trigger('click')
  await flushPromises()

  expect(memoryClient.restore).toHaveBeenCalledWith('deepchat', 'm1')
  expect(wrapper.emitted('changed')).toHaveLength(1)
  wrapper.unmount()
})

it('removes the memory and emits changed + close', async () => {
  const { wrapper, memoryClient } = await setup()
  const deleteButton = wrapper
    .findAll('button')
    .find((button) => button.text() === 'settings.deepchatAgents.memoryManager.deletePermanent')
  await deleteButton!.trigger('click')
  await flushPromises()

  expect(memoryClient.remove).toHaveBeenCalledWith('deepchat', 'm1')
  expect(wrapper.emitted('changed')).toHaveLength(1)
  expect(wrapper.emitted('close')).toHaveLength(1)
  wrapper.unmount()
})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/renderer/components/MemoryInlinePanel.test.ts` around lines 145 - 360,
Add coverage for the footer actions in MemoryInlinePanel by testing the archive,
restore, and delete flows. In the MemoryInlinePanel test suite, locate the
existing setup-based cases and add assertions around the archive/restore/remove
button handlers to verify the matching memoryClient methods are called with the
current memory id, the expected changed and close events are emitted, and error
paths show the toast behavior when those actions fail. Use the existing setup,
memoryClient, and wrapper.emitted patterns to keep the new tests consistent with
the other action-flow cases.
test/renderer/components/MemoryDiagnosticsPanel.test.ts (1)

87-122: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add test coverage for the clearAll destructive action.

The clear mock is configured but no test exercises the AlertDialog "Clear All" flow. This is a destructive operation that warrants verification of the correct memoryClient.clear call, subsequent load() reload, and error handling.

🧪 Suggested test
it('calls clear and reloads on clearAll action', async () => {
  const { wrapper, memoryClient } = await setup()
  const clearButton = wrapper
    .findAll('button')
    .find((b) => b.text().includes('settings.deepchatAgents.memoryManager.clearAll'))!
  // AlertDialogAction is stubbed as ButtonStub, so clicking it triggers clearAll
  await clearButton.trigger('click')
  await flushPromises()

  expect(memoryClient.clear).toHaveBeenCalledWith('deepchat')
  expect(memoryClient.getHealth).toHaveBeenCalled()
})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/renderer/components/MemoryDiagnosticsPanel.test.ts` around lines 87 -
122, Add test coverage for the destructive clearAll flow in
MemoryDiagnosticsPanel.vue: the current setup() already mocks
memoryClient.clear, but no test verifies the AlertDialog path. Add a test that
locates the Clear All action, triggers the dialog action, and asserts
memoryClient.clear is called with the agentId and that the panel reloads via
getHealth/load afterward; also cover the error path if clear fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/renderer/settings/components/MemoryDiagnosticsPanel.vue`:
- Around line 390-397: The clearAll flow in MemoryDiagnosticsPanel.vue should
match the loading/agent-snapshot handling used by load() and reindex(): capture
props.agentId at the start of clearAll, set loading while the clear is in
progress, and restore it in a finally block. Then call memoryClient.clear with
the captured agent id and invoke load() using that same captured id so a
mid-operation agent switch or refresh click cannot fetch the wrong agent’s data
or run concurrently.

In `@src/renderer/settings/components/MemoryListView.vue`:
- Around line 628-662: The MemoryListView handlers archive, restore, and
confirmRemove are only checking for thrown errors, but memoryClient methods can
also return false on failure. Update these functions to explicitly check the
boolean result from memoryClient.archive/restore/remove and call notifyFailed
when the result is false, not just in catch blocks. After a successful archive,
restore, or remove, refresh the list or update memories.value so the UI reflects
the change; use the existing archive, restore, confirmRemove, and deleteTarget
logic to locate the affected code.

In `@src/renderer/settings/components/MemorySettings.vue`:
- Around line 360-364: Reset the cached status when `selectedAgentId` changes so
counts don’t briefly show the previous agent’s data. In the
`watch(selectedAgentId, ...)` block, clear `status.value` before calling
`loadResolved()` and `loadStatus()`, so `activeMemoryCount`,
`archivedMemoryCount`, and the `MemoryInboxBar` props (`conflictCount`,
`personaDraftCount`) don’t render stale values during the switch. Keep the
existing single reload flow in place and apply the change in the
`selectedAgentId` watcher.

In `@src/renderer/src/i18n/zh-HK/settings.json`:
- Line 2917: The zh-HK translation for inboxTitle uses a simplified Chinese
character and should be updated to Traditional Chinese. In the zh-HK locale
settings JSON, fix the inboxTitle entry so it uses the traditional form “待處理”
instead of “待处理”, keeping the translation consistent with the locale.

In `@src/renderer/src/i18n/zh-TW/settings.json`:
- Line 2917: The zh-TW translation for inboxTitle uses a simplified Chinese
character and should be corrected to Traditional Chinese. Update the inboxTitle
entry in the zh-TW settings localization so it uses the traditional form “待處理”
instead of “待处理”, keeping the change localized to the i18n JSON entry with the
same key.

---

Nitpick comments:
In `@src/main/presenter/sqlitePresenter/tables/agentMemory.ts`:
- Around line 1387-1422: The conflict-pair validity logic is duplicated between
countConflictPairs() and ConflictService.listConflicts(), so they can drift out
of sync. Extract the shared predicate into a common helper or reusable SQL
fragment, then have countConflictPairs() and the list-conflict path both use it
so the challenger/target status checks stay identical.

In `@test/renderer/components/MemoryDiagnosticsPanel.test.ts`:
- Around line 87-122: Add test coverage for the destructive clearAll flow in
MemoryDiagnosticsPanel.vue: the current setup() already mocks
memoryClient.clear, but no test verifies the AlertDialog path. Add a test that
locates the Clear All action, triggers the dialog action, and asserts
memoryClient.clear is called with the agentId and that the panel reloads via
getHealth/load afterward; also cover the error path if clear fails.

In `@test/renderer/components/MemoryInlinePanel.test.ts`:
- Around line 145-360: Add coverage for the footer actions in MemoryInlinePanel
by testing the archive, restore, and delete flows. In the MemoryInlinePanel test
suite, locate the existing setup-based cases and add assertions around the
archive/restore/remove button handlers to verify the matching memoryClient
methods are called with the current memory id, the expected changed and close
events are emitted, and error paths show the toast behavior when those actions
fail. Use the existing setup, memoryClient, and wrapper.emitted patterns to keep
the new tests consistent with the other action-flow cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8b53bb3b-35e0-466b-a5d0-aa801cbd8b73

📥 Commits

Reviewing files that changed from the base of the PR and between bcd624f and 4abc620.

📒 Files selected for processing (55)
  • src/main/presenter/memoryPresenter/index.ts
  • src/main/presenter/memoryPresenter/services/managementService.ts
  • src/main/presenter/memoryPresenter/services/rowMutations.ts
  • src/main/presenter/memoryPresenter/types.ts
  • src/main/presenter/sqlitePresenter/tables/agentMemory.ts
  • src/main/routes/index.ts
  • src/renderer/api/MemoryClient.ts
  • src/renderer/settings/components/MemoryConfigInlinePanel.vue
  • src/renderer/settings/components/MemoryConfigPanel.vue
  • src/renderer/settings/components/MemoryDiagnosticsPanel.vue
  • src/renderer/settings/components/MemoryEmptyState.vue
  • src/renderer/settings/components/MemoryHealthSection.vue
  • src/renderer/settings/components/MemoryInboxBar.vue
  • src/renderer/settings/components/MemoryInlinePanel.vue
  • src/renderer/settings/components/MemoryListView.vue
  • src/renderer/settings/components/MemoryManagerDialog.vue
  • src/renderer/settings/components/MemoryManagerPanel.vue
  • src/renderer/settings/components/MemoryPersonaPanel.vue
  • src/renderer/settings/components/MemorySettings.vue
  • src/renderer/settings/components/memoryRedesignUtils.ts
  • src/renderer/src/i18n/da-DK/settings.json
  • src/renderer/src/i18n/de-DE/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/es-ES/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/he-IL/settings.json
  • src/renderer/src/i18n/id-ID/settings.json
  • src/renderer/src/i18n/it-IT/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/ms-MY/settings.json
  • src/renderer/src/i18n/pl-PL/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/tr-TR/settings.json
  • src/renderer/src/i18n/vi-VN/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/shared/contracts/events/memory.events.ts
  • src/shared/contracts/routes.ts
  • src/shared/contracts/routes/memory.routes.ts
  • test/main/presenter/fakes/memoryFakes.ts
  • test/main/presenter/memoryPresenter.test.ts
  • test/main/presenter/memoryUpdate.test.ts
  • test/main/routes/memoryDto.test.ts
  • test/renderer/components/MemoryConfigInlinePanel.test.ts
  • test/renderer/components/MemoryConfigPanel.test.ts
  • test/renderer/components/MemoryDiagnosticsPanel.test.ts
  • test/renderer/components/MemoryHealthSection.test.ts
  • test/renderer/components/MemoryInlinePanel.test.ts
  • test/renderer/components/MemoryListView.test.ts
  • test/renderer/components/MemoryManagerDialog.test.ts
  • test/renderer/components/MemorySettings.test.ts
💤 Files with no reviewable changes (7)
  • src/renderer/settings/components/MemoryManagerDialog.vue
  • test/renderer/components/MemoryConfigPanel.test.ts
  • src/renderer/settings/components/MemoryManagerPanel.vue
  • test/renderer/components/MemoryManagerDialog.test.ts
  • src/renderer/settings/components/MemoryHealthSection.vue
  • test/renderer/components/MemoryHealthSection.test.ts
  • src/renderer/settings/components/MemoryConfigPanel.vue

Comment thread src/renderer/settings/components/MemoryDiagnosticsPanel.vue
Comment thread src/renderer/settings/components/MemoryListView.vue
Comment thread src/renderer/settings/components/MemorySettings.vue
Comment thread src/renderer/src/i18n/zh-HK/settings.json Outdated
Comment thread src/renderer/src/i18n/zh-TW/settings.json Outdated
@zerob13 zerob13 merged commit ccc1f0b into dev Jul 9, 2026
3 checks passed
@zhangmo8 zhangmo8 deleted the feat/memory-settings-ux-redesign branch July 9, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants