Repository navigation
fix(session-continuation): recover image history and settled turns - #2168
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Local Agent conversation continuation can fail in two related ways reported on Windows: historical images reach exact native transfer as filesystem references, and a completed Force Send turn repeatedly fails to recover its native user anchor, blocking later queued requests even after restart.
Agent image paths in
agent_messagesare valid persisted data. The authoritative frontend reader incorrectly used the display projection, bypassing existing strict image embedding and dropping the producing user event's durable turn identity. Restart recovery also removed only the accepted user from its pre-turn prefix, leaving that turn's generated output behind. An irreparable completed anchor mismatch was then treated as indefinitely retryable.Solution
agent_load_messages. Reuse the effective compacted native frame and strict image resolver, embedding retained images and restoringturnIntentIdfrom session-scoped producing events by durable message ID. Display reads keep their existing behavior.Both fixes restore the same local conversation continuation contract. Historical recovery is read-only; no database cleanup, schema migration, or dependency changes are required.
Potential risks
Verification
AtomicUsize::fetch_updatecall atsrc-tauri/crates/search/src/code/commands/text_search.rs:27, which the CI toolchain now deprecates. Verified the identical call exists in basedevelopcommit5ec548d09; this PR does not modify that file. This prevents a green workspace Clippy result and does not establish that all remaining Rust targets pass.Passed on the final committed source:
pnpm exec vitest run --config config/vitest.config.ts src/engines/SessionCore/hooks/session/__tests__/useQueueDispatch.intervention.test.ts src/engines/SessionCore/conversations/localConversationContinuation.test.ts src/engines/SessionCore/conversations/localConversationSettledTail.test.ts src/engines/SessionCore/sync/adapters/__tests__/createRustAgentAdapter.authoritative.test.ts src/api/tauri/rpc/schemas/__tests__/agentSessionMessages.test.ts— 5 files, 153 tests passed.cargo test --manifest-path src-tauri/Cargo.toml -p agent_core native_transfer --lib -- --test-threads=1— 4 tests passed using the shared local Cargo target directory.agent_coretest binary withfoundation::persistence::db_helpers::messages:: --test-threads=1— 32 existing persistence/history tests passed.pnpm typecheck:fast, changed-file ESLint with--max-warnings 0,pnpm check:test-placement, andpnpm check:queue-authority— passed.git diff --name-only -z | node scripts/ci/check-changed-file-length.cjs— passed for changed production TypeScript files.rustfmt --edition 2021 --check --config skip_children=trueon changed Rust files — passed. The normal commit hook also passed lint-staged formatting/lint checks, TypeScript validation, andcargo clippy --lib --message-format=short -p agent_core.git diff --check origin/develop...HEAD— passed. Fetcheddevelopagain before publication; the branch is based on its latest commit5ec548d09. Reviewed all 17 changed files for scope and accidental sensitive/generated content.No UI layout or controls change, so screenshots would not substantiate this fix; behavior is verified at persistence, recovery, and queue boundaries. Windows live reproduction, provider end-to-end execution, and CPU/RSS measurements were not run. No full-suite claim is made.