Skip to content

fix: surface memory logs in the chunk console#240

Open
nikazzio wants to merge 5 commits into
mainfrom
fix/memory-console-logs
Open

fix: surface memory logs in the chunk console#240
nikazzio wants to merge 5 commits into
mainfrom
fix/memory-console-logs

Conversation

@nikazzio
Copy link
Copy Markdown
Owner

@nikazzio nikazzio commented Jun 6, 2026

What

  • add frontend operation logs for phrase memory save/search flows
  • add a dedicated Memory scope filter in the console
  • attach chunk-scoped failure/success reasons so the current chunk can explain why Save to memory finds nothing

Verification

  • rtk npm test
  • rtk npm run lint

nikazzio and others added 5 commits June 6, 2026 13:42
…ntion help

- Replace per-model token breakdown with per-operation scope breakdown
  (Translation/Refine/Format stages + Audit/Coherence), each showing
  its model and cache hit rate — removes invoke double-counting
- Move similarity threshold slider from pipeline config to MemoryTab
  header, below the match buttons, so users can adjust and re-search
  without leaving the chunk panel
- Separate phrase count row from save button with a divider — two
  distinct functions now visually distinct
- Add cache retention section to help: explains gpt-5.4 extended (24h)
  vs mini/nano in-memory (5-10 min) TTL and why Refine shows 0% cache

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the structured operation log system to better surface Phrase Memory activity in the UI console and adds richer usage summaries (global + per-chunk) based on operation logs, including a new Chunk “Summary” tab and a dedicated “Memory” scope.

Changes:

  • Add memory as a first-class operation-log scope and emit detailed logs for phrase-memory extract/search/save flows.
  • Introduce operation-log–based usage summarization (global + per-chunk) and new UI surfaces (Chunk Summary tab, scope breakdown cards).
  • UI/UX adjustments: memory tab controls (threshold slider, rerun confirm), tooltip behavior for disabled icon buttons, and export dialog portaling.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/utils/pipelineLogging.ts Adds stageName into stage-end log metadata to support later summarization.
src/utils/operationLogStats.ts Adds global/chunk usage summary builders and supporting types/helpers.
src/utils/operationLogStats.test.ts Adds tests covering new global/chunk summary behavior.
src/stores/uiStore.ts Adds new chunk drawer tab (summary) and changes default chunk tab.
src/stores/operationLogStore.ts Adds memory to OperationLogScope.
src/services/phraseMemoryService.ts Adds operation logging across memory extraction/search/save flows.
src/hooks/useSaveToMemory.ts Adds chunk-scoped reasons when “Save to memory” skips chunks / completes/fails.
src/hooks/usePhraseMemoryAutoSearch.ts Merges exact (chunk-id) memory matches with vector matches; adds logging.
src/hooks/usePhraseMemoryAutoSearch.test.ts Updates tests for exact-match merge behavior.
src/components/ui/IconButton.tsx Wraps button to allow tooltips to work even when disabled.
src/components/pipeline/SettingsTabPanel.tsx Removes threshold config wiring from settings panel.
src/components/pipeline/PipelineConfig.tsx Removes threshold prop plumbing to settings panel.
src/components/pipeline/PhraseMemoryConfig.tsx Removes threshold slider UI from config panel.
src/components/pipeline/PhraseMemoryConfig.test.tsx Updates tests to match removed threshold UI.
src/components/help/HelpGuide.tsx Adds cache retention help section.
src/components/document/OperationsTab.tsx Adds Memory scope icon/filter/group labeling.
src/components/document/MemoryTab.tsx Adds threshold slider, memory count display, rerun confirm, UI refresh behavior.
src/components/document/InsightsDrawer.tsx Adds Chunk Summary tab and replaces stats computation with log-based summaries.
src/components/document/ExportDialog.tsx Switches to createPortal and raises z-index for overlay.
src/i18n/en.json Adds strings for summary tab, chunk summary, memory UX, and Memory scope.
src/i18n/it.json Adds strings for summary tab, chunk summary, memory UX, and Memory scope.
src-tauri/src/vector/embedding.rs Adds “replace existing chunk memory” delete step before insert.
src-tauri/.gitignore Ignores *.glossa-backup.
.gitignore Ignores *.glossa-backup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +748 to 752
{usageSummary.scopeBreakdown.length > 0 && (
<div className="mt-3 space-y-1">
{Array.from(modelNames).map((name) => (
<div key={name} className="text-[10px] text-editorial-muted/70 font-mono truncate">{name}</div>
{usageSummary.scopeBreakdown.map((entry) => (
<ScopeBreakdownCard key={entry.scope} entry={entry} />
))}
Comment on lines 88 to 95
if (savedCount === 0) {
if (previousCount && previousCount > 0) {
toast.message(t('memory.nothingToSave'));
return;
}
toast.message(t('memory.nothingToSave'));
return;
}
Comment thread src/i18n/it.json
Comment on lines 787 to 790
"insightsTabAudit": "Audit",
"insightsTabSummary": "Riepilogo",
"insightsTabStats": "Riepilogo",
"insightsTabCoherence": "Coerenza",
Comment on lines +814 to +818
if (!currentChunk || !chunkSummary) {
return (
<div id={panelId} role="tabpanel" aria-labelledby={labelledBy} className="px-6 py-8 text-sm text-editorial-muted">
{t('document.insightsAuditEmpty')}
</div>
Comment on lines +446 to +450
let replaced_rows = conn
.execute(
"DELETE FROM phrase_memory WHERE chunk_id = ?1 AND project_id = ?2",
rusqlite::params![&chunk_id, &project_id],
)
});

const texts = chunks.map((c) => c.text);
const embeddings = await fetchEmbeddings(texts, embeddingModel);
Comment on lines 318 to 324
const raw = await invoke<RawPhraseMatch[]>('vec_search_phrase_memory', {
workspaceId,
queryEmbedding: embedding,
threshold: similarityToDistanceThreshold(threshold),
maxResults,
});
result.set(chunks[i].id, raw.map(toPhraseMatch));
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