This repository was archived by the owner on Apr 14, 2026. It is now read-only.
add session import, export, and duplicate support#132
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d6e3b5130
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
1c49568 to
21b921d
Compare
…session_types - Remove session_db.rs and session_types.rs (no longer needed) - Route export/import/fork through goose ACP ext_method calls - Remove frontend importSession module (import handled via ACP) - Simplify exportSession to call backend export command - Extract command dispatch loop from manager.rs into command_dispatch.rs
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Category: new-feature
User Impact: Users can now import, export, duplicate, archive, and restore chat sessions in Goose2 with history that reliably reloads.
Problem: Goose2 was missing the import/export/duplicate workflow that existed in the older Goose app, and the first pass left several reliability gaps: imported or duplicated sessions could open empty, export/duplicate could fail on stale local IDs, and session history could accumulate ghost chats or confusing archived-state duplicates. Export also had poor UX because it silently wrote to a default location instead of asking where to save.
Solution: This PR adds direct SQLite-backed session import/export/duplicate support, keeps ACP-visible thread state in sync so restored history actually replays, and hardens the frontend session list against stale or locally cached session drift. It also adds a native save dialog for export and tightens chat/session lifecycle behavior so draft sessions do not create stray backend threads.
File changes
scripts/check-file-sizes.mjs
Raised file-size thresholds for the session and ACP files that legitimately grew as part of the feature work. The justifications now reflect the added backend/session-management responsibilities.
src-tauri/Cargo.lock
Records the rebased Rust dependency graph needed for the new SQLite and path-handling work. This keeps local and CI builds reproducible.
src-tauri/Cargo.toml
Adds the Rust dependency needed for direct SQLite session management. This is the foundation for the backend import/export/duplicate implementation.
src-tauri/capabilities/default.json
Expands Tauri permissions so the app can open the native save dialog during export. Without this, export would fail at runtime when asking the user where to save.
src-tauri/gen/schemas/capabilities.json
Refreshes the generated capabilities schema to match the new dialog permission. This keeps generated metadata aligned with the checked-in capability config.
src-tauri/src/commands/acp.rs
Adds ACP commands for session import, export, and duplicate, plus logic that resolves frontend-local session IDs to real backend session IDs before acting. It also exports in a Goose-compatible shape and routes reads through the new session DB helpers.
src-tauri/src/commands/system.rs
Adds a small text-file write command used by the native export save flow. This lets the frontend save JSON to a user-selected path through Tauri.
src-tauri/src/lib.rs
Registers the new Tauri commands so the frontend can call them. This wires the new export and session-management capabilities into the desktop app.
src-tauri/src/services/acp/manager.rs
Teaches the ACP manager how to resolve prepared frontend sessions back to real Goose session IDs. That prevents export and duplicate from failing when the UI is still holding a local draft-originated ID.
src-tauri/src/services/acp/manager/session_ops.rs
Exposes the prepared Goose session ID needed by the new resolve path. This is a small plumbing change to support the ACP manager lookup.
src-tauri/src/services/acp/mod.rs
Updates ACP service module wiring for the new manager/session behavior. This keeps the ACP layer compiling cleanly after the new session-resolution support.
src-tauri/src/services/mod.rs
Exports the new session database and session type modules. This is the root service registration needed for the direct SQLite workflow.
src-tauri/src/services/session_db.rs
Introduces the SQLite-backed session persistence layer for reading, writing, exporting, duplicating, and repairing sessions. It also backfills ACP-visible thread history from message rows so older broken imports can self-heal when loaded.
src-tauri/src/services/session_types.rs
Defines the typed import/export/session row structures used by the new SQLite layer. This keeps JSON parsing and DB serialization consistent across formats.
src/app/App.tsx
Adds the app-level toaster so session export can show success and failure feedback. This supports the new native export flow.
src/features/chat/stores/tests/chatSessionStore.test.ts
Adds regression coverage for stale sessions and the updated session list loading behavior. These tests protect the fixes for dead cards and cached session drift.
src/features/chat/stores/chatSessionStore.ts
Improves session loading so archived sessions and drafts are merged safely, stale active sessions are cleared, and cached duplicates are filtered out. This keeps the sidebar and history views aligned with the backend after import, duplicate, archive, and reload flows.
src/features/chat/ui/ChatView.tsx
Prevents
acpPrepareSessionfrom creating backend threads for drafts or while a send is already in progress. This is the main ghost-chat prevention fix.src/features/sessions/lib/exportSession.test.ts
Adds coverage for export filename generation and sanitization. This protects the new save-dialog export experience.
src/features/sessions/lib/exportSession.ts
Adds helpers for export filename generation, sanitization, and browser-download fallback. This keeps exported files user-friendly and safe across platforms.
src/features/sessions/lib/importSession.test.ts
Adds tests covering Goose2 and OG Goose import payload formats. This verifies compatibility with both the new app and the legacy app’s exports.
src/features/sessions/lib/importSession.ts
Adds import parsing and validation for Goose2 and OG Goose session payloads. This gives the frontend a single compatibility gate before calling the backend importer.
src/features/sessions/ui/SessionCard.tsx
Adds Export and Duplicate actions, restores archived-session actions, and moves those labels to shared translations. This is the main card-level UX entry point for the new feature.
src/features/sessions/ui/SessionHistoryView.tsx
Connects import, export, duplicate, archive, restore, stale-session recovery, and the native save dialog into the session history screen. It also refreshes from ACP instead of manually appending rows, which avoids empty or dead cards.
src/features/settings/ui/SettingsModal.tsx
Updates archived chat presentation so it no longer shows misleading message counts and stays consistent with the local archive model. This reduces confusion in settings after session lifecycle changes.
src/features/sidebar/ui/Sidebar.tsx
Hides archived sessions from the recents list so archive state is respected outside the history screen. This keeps the sidebar focused on active work.
src/shared/api/acp.ts
Adds the frontend ACP API wrappers for import, export, and duplicate. This is the main bridge between the session history UI and the new backend commands.
src/shared/api/system.ts
Adds the frontend wrapper for the new text-file write command. This is used by the export save-dialog flow in Tauri.
Reproduction Steps