M2.2.5#57
Conversation
chatpanel is now mounted to DOM
…ections node not found text if it is a broken connection, instead of showing the link with throw a warning
Built a lightweight, local heuristic that evaluates every incoming user message for correction signals
There was a problem hiding this comment.
Code Review
This pull request introduces a memory correction and amendment pipeline, allowing users to manually force memory extraction and amend existing pending changesets. It adds backend modules for detecting correction signals and managing amendments, along with UI updates like persistent icon rails, a chat history panel, and visual badges for amended items. The review highlights several critical issues in the correction and amendment logic, including comparing plain text against raw JSON strings, querying the wrong previous message in the database, bypassing the contradiction scan during pipeline execution, discarding metadata fields during candidate serialization, and a redundant negation check formatting the same word twice.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…ponding test suite
…, file export, and rate limiting
…ets based on similarity matching
|
/gemini review --depth=exhaustive --include-dependencies |
There was a problem hiding this comment.
Code Review
This pull request introduces a memory correction and amendment pipeline, allowing users to correct previous extractions through explicit phrases, negations, or contradictions. It adds a forced memory extraction command, persistent sidebar icon rails, a decoupled chat panel, and a new WikiLinkBadge component to handle broken node links. Key feedback includes resolving a compilation error on stable Rust by replacing the unstable is_multiple_of method with the modulo operator, fixing a database query in should_extract_correction to correctly fetch the previous message using an offset, wrapping resolveLlmConfig in useCallback to avoid unnecessary re-renders, and optimizing WikiLinkBadge to prevent a flood of redundant getAllNodes() IPC calls on mount.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
… changesets with Jaccard-based similarity matching
|
/gemini review --depth=exhaustive --include-dependencies |
There was a problem hiding this comment.
Code Review
This pull request introduces a memory correction and amendment pipeline to the backend, allowing the system to detect correction signals in user messages and update pending changesets in-place. It also adds a force-extraction command and corresponding UI controls, introduces persistent icon rails for sidebar navigation, and enhances the WikiLinkBadge component to validate node connections. The reviewer feedback highlights several critical issues, including potential cross-session data contamination due to missing session filters in database queries, a cache-clearing regression in the frontend node service, a potential runtime panic from unsafe UTF-8 string slicing, and non-deterministic database ordering.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review --depth=exhaustive --include-dependencies |
There was a problem hiding this comment.
Code Review
This pull request introduces a memory correction and amendment pipeline to detect correction signals in user messages and update pending changesets in-place. It also adds a manual memory extraction command, replaces sidebar toggles with persistent icon rails, and enhances the UI to display amended badges and validate wiki-link node existence. The review feedback focuses on improving the Rust implementation in amendment.rs by simplifying JSON manipulation in stamp_amended using as_object_mut(), replacing manual timestamp decomposition with the chrono crate, and removing a redundant SQL assignment.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Body: Replaced as_object() + new Map allocation + clone-all-entries with a single as_object_mut() + in-place insert Call site: Removed .map_err(...) error handling, now just stamp_amended(&mut candidate_data, ...) This eliminates an unnecessary heap allocation, O(n) key/value cloning, and error-handling boilerplate for a condition that can never occur.
…is_leap) with a compact 32-line implementation using Howard Hinnant's civil-date algorithm. Key improvements:
Eliminated is_leap helper — no longer needed; leap year math is handled implicitly by the era-based algorithm
O(1) date calculation — the old code iterated year-by-year from 1970 (loop { year += 1 }) and month-by-month; the new algorithm computes the result directly via integer arithmetic
…DATE query in amendment.rs:255-257. Setting a column to its own value has no effect and just adds noise to the query.
|
/gemini review --depth=exhaustive --include-dependencies |
There was a problem hiding this comment.
Code Review
This pull request introduces a memory correction and amendment pipeline to the memory agent, allowing the system to detect correction signals in user messages and update pending changesets in-place. It also adds a manual memory extraction button, persistent icon rails for sidebar navigation, and a WikiLinkBadge component to handle broken node connections. Feedback on these changes highlights a layout issue where the (amended) badge in the diff panel renders on a new line instead of inline, and suggests architectural improvements to avoid duplicate CorrectionSignal detection and to replace the complex custom ISO timestamp generator with the standard chrono crate.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Refactored chrono_now_iso: Simplified the function in amendment.rs to utilize chrono::Utc::now(), replacing the custom time decomposition arithmetic.
|
/gemini review --depth=exhaustive --include-dependencies |
There was a problem hiding this comment.
Code Review
This pull request introduces a memory correction and amendment pipeline in the backend, along with a manual force-extraction command. On the frontend, it decouples the chat panel, introduces persistent left and right icon rails for switching views, adds a manual extraction button, and implements a WikiLinkBadge to handle broken node connections gracefully. Feedback on these changes highlights a performance issue with ChatPanel's background node fetching when hidden, a potential UI bug when interpolating React.ReactNode directly into string templates within WikiLinkBadge, and a performance concern regarding the O(N * M) complexity of the backend negation scan algorithm.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
ChatPanel.tsx
to accept an optional visible?: boolean prop (defaulting to true).
Guarded useEffect: Guarded the node refresh effect in
ChatPanel.tsx
to skip cache clearing and database querying if visible is false. Added visible to the dependency array.
Propagated State: Passed visible={viewMode === "chat"} from
App.tsx
to the mounted <ChatPanel> component.
…inkBadge in
markdownUtils.tsx
that extracts a clean, concatenated string representation from a React.ReactNode (handling strings, numbers, arrays, and recursively traversing nested React elements).
Replaced Interpolations: Substituted ${children} with ${labelText} inside all tooltip titles and modal alert template strings to prevent [object Object] rendering.
Build a HashSet containing the words from the previous_message (ignoring non-alphanumerics and stopwords). Tokenize the message_lower and iterate to find occurrences of the negation words "not" and "no". Perform an $O(1)$ lookup in the HashSet for the adjacent subsequent word.
|
/gemini review --depth=exhaustive --include-dependencies |
There was a problem hiding this comment.
Code Review
This pull request introduces a memory correction and amendment pipeline, allowing the system to detect correction signals in user messages and update pending changesets in-place. It also adds a manual memory extraction command, replaces the floating sidebar toggles with persistent left and right icon rails, and enhances wikilink rendering with broken link detection. The review feedback highlights a compilation-breaking type mismatch in a test helper where DbState is used instead of AppState, and points out an unnecessary cache clearing call in the chat panel's visibility effect that degrades performance.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review --depth=exhaustive --include-dependencies |
There was a problem hiding this comment.
Code Review
This pull request introduces a correction-based memory extraction pipeline and refactors the UI sidebar layout. On the backend, new modules for detecting correction signals and amending pending changesets in-place have been added, alongside a manual force-extraction command. On the frontend, persistent icon rails have been introduced to switch between panels, and a shared context has been added to validate wiki-link badges. The review feedback highlights opportunities to prevent redundant API fetches by distinguishing between loading and unprovided context states in the wiki-link badge, and to optimize database performance by checking the message count threshold early in the correction trigger evaluation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
markdownUtils.tsx:169 to undefined (representing "no provider present") instead of null. Refactored useEffect Guard: Updated the guard inside WikiLinkBadge's mount check
trigger.rs:119-165 to query and check message_count as the first operation in should_extract_correction. Early Exit: If message_count < 3, the function immediately short-circuits and returns Ok(None). This avoids executing the heavier SQLite queries for the previous message, pending changeset items, and any negation/phrase scanning logic.
|
/gemini review --depth=exhaustive --include-dependencies |
There was a problem hiding this comment.
Code Review
This pull request introduces a memory correction and amendment pipeline, allowing users to correct previous memory extractions and amend changesets in-place. It also adds a manual force extraction option, refactors the UI to use persistent icon rails with a new chat history panel, and improves WikiLink rendering with broken connection detection. The review feedback highlights critical issues: a potential race condition in amend_or_create_changeset that can be resolved by starting the transaction earlier, a logical bug where correction signals are bypassed if the standard debounce gate is open, and a UI bug in WikiLinkBadge where checking existingNodeIds !== undefined instead of truthiness causes a permanent loading state when the context is null.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…SQLite Connection::transaction() at the very beginning of the amend_or_create_changeset function. Propagated Transaction Reference: Passed &tx (which derefs to &Connection) to find_pending_changeset(&tx, ...) and load_pending_items(&tx, ...). Simplified Flow: Removed the nested transaction blocks for creating fresh changesets (path 2a) and updating pending changesets (path 2b). All operations (reading the database for a pending changeset, building the changeset, persisting it, or updating matching changeset items) now run inside a single transaction and are fully atomic.
…eve the latest user message and scan it for a CorrectionSignal, regardless of the value returned by should_extract. Atomic/Isolated Flow: If a CorrectionSignal is detected, ready is set to true and the signal is correctly captured and propagated to the amendment pipeline.
…ail.tsx:277 to pass existingNodeIds directly to the ExistingNodesContext.Provider (removing the legacy ?? null default logic).
M2.2.5 — Pending Changeset Correction & Amendment — Commit Plan
Roadmap alignment (
Concepts/MindVault_Roadmap_v08.md§M2.2.5):The debounce gate (≥ 6 messages + 2-minute cooldown) is the right call for general extraction — you don't want to hit the LLM on every message. But it's too blunt to handle corrections well. This milestone layers three complementary approaches (correction detection, changeset amendment, manual trigger) to differentiate MindVault's memory UX and ensure pending changesets remain clean and accurate before the user ever sees them.
M2.2.5 sits directly between the shipped M2.2 (Memory Diff Panel) and M2.3 (Embedding Engine). It does not require embeddings and operates entirely on the existing Jaccard/rule-based pipeline.
What already exists in the repo (grounding):
core/src/memory_agent/trigger.rs(should_extract,mark_extraction_complete)core/src/lib.rs(execute_memory_extraction_pipeline,memory_extract_if_ready)core/src/memory_agent/persistence.rs(persist_changeset,list_pending_changesets,list_changeset_items)core/src/memory_agent/changeset.rs(build_changeset)PendingChangesetfrom candidates using Jaccard similarity matching against existing nodes.db/migrations/0001_schema_v1.sqlL130–143changeset_itemstable withproposed_data,existing_data,similarity,status, andsort_ordercolumns.ui/components/ChatPanel.tsxL580extractMemoryIfReady()call after every assistant response. Layer 1 needs a parallel path for correction-triggered extractions.ui/services/memoryAgent.ts(extractMemory,extractMemoryIfReady)memory_extractandmemory_extract_if_readycommands.ui/App.tsxui/components/DiffPanel.tsx,DiffPanel/DiffRow.tsx(amended)badge here.core/src/ipc_types.rs+ui/types/generated/Changeset,ChangesetItem,ChangesetCommitInput.Current Status
The Memory Agent (M2.1) and Diff Panel (M2.2) are fully shipped. Background extraction runs on a debounced trigger after ≥ 6 new messages with a 2-minute cooldown. M2.2.5 adds intelligence to handle correction scenarios that the fixed debounce gate misses.
(amended)badge rendering + comprehensive E2E test coverageImplementation Plan — Commits (Specific)
Commit 1 — Correction Signal Detector (Backend) (
core/src/memory_agent/)Goal: Build a lightweight, local heuristic that evaluates every incoming user message for correction signals. No LLM calls — pure pattern matching. This is the foundation that Commit 2 uses to decide whether to bypass the debounce gate.
Files to create/modify:
core/src/memory_agent/correction.rs:CorrectionSignalenum:detect_correction_signal:CORRECTION_PHRASESlist:CorrectionSignal::ExplicitPhraseon first match.previous_messageis provided, check if the current message contains explicit negation patterns targeting a value from the previous message:"not <WORD>"or"no, <WORD>"where<WORD>appears in the previous message."it's <VALUE>, not <VALUE>"— detects replacement patterns.CorrectionSignal::Negationwith the negated fragment.pending_proposed_data(JSON strings). For each, extract thetitleandsummaryfields. Check if the current message contradicts any of those values:"not <extracted_value>"or"<extracted_value> is wrong", flag it.CorrectionSignal::ChangesetContradictionwith the contradicted field name.core/src/memory_agent/mod.rs:pub mod correction;and re-export:Verify:
cargo testcompiles. Unit tests for phrase detection, negation scanning, and contradiction detection all pass (tests included incorrection.rs#[cfg(test)]module).Commit 2 — Correction-Triggered Extraction (Backend) (
core/src/memory_agent/trigger.rs,core/src/lib.rs)Goal: Wire the correction signal detector into the message processing pipeline so that when a correction is detected, the debounce gate is bypassed and a targeted extraction fires immediately.
Files to create/modify:
core/src/memory_agent/trigger.rs:previous_message) fromsession_messages.changeset_itemswith status'pending'and extract theirproposed_datacolumn values.correction::has_correction_signal(message, previous_message, &pending_data).current_message_count >= 3, returntrue.false.mod.rs:core/src/lib.rs(memory_extract_if_readyfunction):should_extract()check (which may returnfalsedue to debounce), add a second path:fetch_latest_user_message(conn, session_id) -> Result<Option<String>, String>that queries the most recent user-role message content fromsession_messages.ui/ipc.ts(if needed):memoryExtractIfReadyIPC command already returnsOption<Changeset>which handles both the standard and correction-triggered paths transparently.Verify:
cargo testcompiles. When a correction phrase is present in the latest message,memory_extract_if_readyreturns a changeset even though the standard debounce gate would have blocked it.Commit 3 — Pending Changeset Amendment Engine (Backend) (
core/src/memory_agent/)Goal: When a correction-triggered extraction produces new candidates that overlap with items in an existing pending changeset, amend the existing changeset items in-place rather than creating a duplicate changeset. This keeps the Diff Panel clean.
Files to create/modify:
core/src/memory_agent/amendment.rs:changesets WHERE session_id = ?1 AND status = 'pending' ORDER BY created_at DESC LIMIT 1.build_changeset → persist_changesetpath. Return(new_changeset_id, false).a. Load all pending
changeset_itemsfor that changeset.b. For each new candidate, compute Jaccard similarity against each existing pending item's
proposed_data(title + summary).c. If similarity > 50% (same candidate, corrected values), update the existing
changeset_itemsrow in-place:"amended": trueinto theproposed_dataJSON.d. If no match is found (genuinely new candidate), insert as a new
changeset_itemsrow into the existing changeset and incrementchangesets.item_count.e. Return
(existing_changeset_id, true).amended_atmetadata into theproposed_dataJSON payload (ISO timestamp) so the Diff Panel can render the(amended)badge without a schema migration:core/src/lib.rs(execute_memory_extraction_pipeline):is_correction: bool(defaultfalse).is_correction == true, callamendment::amend_or_create_changeset()instead of the standardbuild_changeset → persist_changesetpath.is_correctionflag through frommemory_extract_if_readywhen the correction path was taken.core/src/memory_agent/mod.rs:pub mod amendment;and re-export:Verify:
cargo testcompiles. When a correction-triggered extraction fires and a pending changeset already exists, the existing items are updated in-place rather than duplicated.Commit 4 — Manual "Extract Now" Trigger (Frontend + Backend) (
ui/components/ChatPanel.tsx,core/src/lib.rs)Goal: Add a small button in the chat input toolbar that lets the user force an extraction on demand, bypassing the debounce gate entirely. This serves as a safety net and escape hatch for edge cases the automatic detector misses.
Files to create/modify:
core/src/lib.rs:memory_extract_force:memory_extract_forcein the Tauri command handler list.ui/ipc.ts:ui/services/memoryAgent.ts:ui/components/ChatPanel.tsx:extractMemoryForcefrom../services/memoryAgent.const [isExtracting, setIsExtracting] = useState(false);ui/App.css(or relevant CSS file):.extract-now-btn:Verify: Clicking the ✨ button in the chat toolbar triggers an immediate extraction regardless of debounce state. The pending proposals badge updates. The button shows ⏳ while extraction is in progress and disables during active sends.
Commit 5 — Diff Panel Amendment Badge & Integration Tests (
ui/components/DiffPanel/,core/tests/)Goal: Surface amended changeset items with a visible
(amended)badge in the Diff Panel so the user knows a correction was self-applied. Write comprehensive integration tests for the entire correction → amendment → display pipeline.Files to create/modify:
ui/components/DiffPanel/DiffRow.tsx:_amendedmetadata fromitem.proposedData:(amended)badge next to the item type badge whenisAmendedis true:ui/style/components/DiffPanel.css:.diff-amended-badge:core/tests/correction_amendment.rs:test_detect_explicit_correction_phrase(): Feed messages containing "actually," "wait," "I meant" — assertCorrectionSignal::ExplicitPhraseis returned.test_detect_negation_of_previous_message(): Feed a previous message "My favorite color is blue" and current message "not blue, it's green" — assertCorrectionSignal::Negationis detected.test_detect_changeset_contradiction(): Create a pending changeset withproposed_data: {"title": "Blue Theme"}, feed message "actually it should be green theme" — assertCorrectionSignal::ChangesetContradiction.test_no_false_positive_on_neutral_message(): Feed neutral messages like "tell me about rust" — assert no correction signal is detected.test_should_extract_correction_bypasses_debounce(): Set up a session with a correction message whereshould_extract()returns false (debounce active), butshould_extract_correction()returns true.test_amend_existing_changeset_in_place(): Create a pending changeset with an item, runamend_or_create_changesetwith a corrected candidate. Assert the originalchangeset_itemsrow was updated in-place, not duplicated. Verify_amendedmetadata is present inproposed_data.test_amend_creates_new_when_no_pending_exists(): Runamend_or_create_changesetwith no prior pending changeset. Assert a new changeset is created normally.test_amend_appends_genuinely_new_candidate(): Create a pending changeset with item A, run amendment with unrelated candidate B. Assert B is inserted as a new row anditem_countis incremented.test_force_extract_minimum_message_threshold(): Callmemory_extract_forcewith fewer than 3 messages. Assert it returns an error.Verify:
cargo test --test correction_amendmentpasses all test suites. Diff Panel renders(amended)badges correctly on items that were updated in-place.Ordering and Dependencies
The correction signal detector is a pure function with no external dependencies, making it the natural starting point. Commits 2 and 3 build on it sequentially. The manual trigger (Commit 4) is independent of the correction heuristic and can be developed in parallel. The badge and tests (Commit 5) finalize the feature.
What M2.2.5 does NOT include (deferred)
amended_atcolumnproposed_dataJSON columnKey Files Touched (Summary)
core/src/memory_agent/correction.rscore/src/memory_agent/amendment.rs_amendedJSON metadata injection.core/src/memory_agent/mod.rscorrectionandamendmentmodules.core/src/memory_agent/trigger.rsshould_extract_correction()— correction-aware gate bypass evaluation.core/src/lib.rsmemory_extract_if_ready, addmemory_extract_forcecommand, addfetch_latest_user_messagehelper.core/tests/correction_amendment.rsui/ipc.tsmemoryExtractForceIPC wrapper.ui/services/memoryAgent.tsextractMemoryForceservice wrapper.ui/components/ChatPanel.tsxui/components/DiffPanel/DiffRow.tsx_amendedmetadata fromproposed_dataand render(amended)badge.ui/style/components/DiffPanel.css.diff-amended-badgestyling (amber glassmorphic pill).ui/App.css.extract-now-btnstyling for manual trigger button.