fix(chat): preserve Gemini CLI history sessions on reopen
When reopening a Gemini CLI history session, session/load fails with "Authentication required" and the fallback session/new overwrites the DB external_id with a new session ID that has no corresponding file, causing all historical messages to disappear. - Skip session/new when session/load returns "Authentication required" - Add Gemini to the parser fallback so stale external_ids recover via folder_path + started_at matching - Guard externalIdSavedRef for existing conversations to prevent session/new from overwriting the persisted external_id - Only update conversation status on disconnect when user has sent a message, avoiding spurious "completed" flips on pure history views Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -844,6 +844,12 @@ async fn run_connection(
|
||||
// Only emit a visible error for unexpected failures;
|
||||
// "Method not found" is expected for agents that don't
|
||||
// support session resume (e.g. Cline).
|
||||
// "Authentication required" is expected for agents whose
|
||||
// credentials have expired (e.g. Gemini CLI) — skip
|
||||
// session/new too since it will also fail.
|
||||
if err_str.contains("Authentication required") {
|
||||
return Ok(());
|
||||
}
|
||||
if !err_str.contains("Method not found") {
|
||||
crate::web::event_bridge::emit_event(
|
||||
&emitter_clone,
|
||||
|
||||
Reference in New Issue
Block a user