Skip to content

Conversation

@zanesq
Copy link
Collaborator

@zanesq zanesq commented Jul 22, 2025

Some users report seeing a failed chat history screen. This improves the loading to not fail if there are corrupt sessions with missing metadata. Also added a check to hide any failure to load insights on home if the insights eventually load which avoids showing the error message after they

Problem: The session list endpoint was failing completely when encountering corrupted session files, showing "Failed to fetch" errors in the browser console and preventing any sessions from loading.

Root Cause: The get_valid_sorted_sessions function in /crates/goose/src/session/info.rs used filter_map with early returns that would cause the entire endpoint to fail when session metadata couldn't be read. loaded.

Solution:

Replaced filter_map with explicit error handling using a for loop
Added graceful fallback for file modification time retrieval
Added comprehensive logging for corrupted sessions with count tracking
Sessions with corrupted metadata are now skipped gracefully while valid sessions continue to load
Fixed a clippy warning in the session routes by replacing an if-chain with a match statement
Key Changes:

Modified get_valid_sorted_sessions to handle corrupted sessions individually rather than failing completely
Added warning logs that track individual corrupted sessions and total count
Ensured the endpoint remains functional even with partial corruption

Screenshot 2025-07-22 at 10 10 18 AM

@zanesq zanesq changed the title Improve session history resiliancy Improve session history loading resiliency Jul 22, 2025
"Warning: Session {} has negative accumulated_total_tokens: {}",
session.id, tokens
);
match tokens.cmp(&0) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed clippy warning

@zanesq zanesq requested a review from DOsinga July 22, 2025 21:07
zanesq added 2 commits July 23, 2025 12:55
…ry-resiliancy

* 'main' of github.com:block/goose:
  fix: loading shared sessions (#3607)
  docs: use installer component for tutorial, add updating extensions section (#3608)
  fix: show token alert popover during agent responses and agent failure cases (#3536)
  reuse the cancellation token in the agent level (#3599)
  Docs: Move MongoDB tutorial to MCP section (#3602)
  docs: desktop recipe format (#3594)
  Fix model display name not being updated immediately after leaving settings (#3587)
  Added option to summarize the chat when an error is triggered (#3598)
  Remove mcp_macros and unused types (#3581)
  fix: add fallback id to messages if none provided (#3584)
  feat: migrate ErrorData from internal mcp crates to rmcp version (#3586)
@zanesq zanesq merged commit 74140ad into main Jul 23, 2025
8 checks passed
@zanesq zanesq deleted the zane/session-history-resiliancy branch July 23, 2025 20:04
taylorkmho added a commit that referenced this pull request Jul 23, 2025
* main:
  feat: subagent turn count, simple agent loop (#3597)
  feat: subagent independent extension manager (#3596)
  Improve session history loading resiliency (#3588)
  Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
  fix: chat sidebar layout overlapping content occasionally (#3590)
  fix: loading shared sessions (#3607)
  docs: use installer component for tutorial, add updating extensions section (#3608)
  fix: show token alert popover during agent responses and agent failure cases (#3536)
  reuse the cancellation token in the agent level (#3599)
  Docs: Move MongoDB tutorial to MCP section (#3602)
  docs: desktop recipe format (#3594)
  Fix model display name not being updated immediately after leaving settings (#3587)
  Added option to summarize the chat when an error is triggered (#3598)
  Remove mcp_macros and unused types (#3581)
  fix: add fallback id to messages if none provided (#3584)
  feat: migrate ErrorData from internal mcp crates to rmcp version (#3586)
  fix: adjust subrecipe description to allow running tests (#3585)
  Scenario tests (#3430)
  feat: migrate JsonRpcMessage/Request/Response/Error/Notification from internal mcp crates to rmcp versions (#3564)
  Restore recipe parameters functionality (#3530)
lifeizhou-ap added a commit that referenced this pull request Jul 24, 2025
* main: (28 commits)
  fix: multi-tool calls in streamed openai-compatible responses (#3609)
  feat: subagent turn count, simple agent loop (#3597)
  feat: subagent independent extension manager (#3596)
  Improve session history loading resiliency (#3588)
  Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
  fix: chat sidebar layout overlapping content occasionally (#3590)
  fix: loading shared sessions (#3607)
  docs: use installer component for tutorial, add updating extensions section (#3608)
  fix: show token alert popover during agent responses and agent failure cases (#3536)
  reuse the cancellation token in the agent level (#3599)
  Docs: Move MongoDB tutorial to MCP section (#3602)
  docs: desktop recipe format (#3594)
  Fix model display name not being updated immediately after leaving settings (#3587)
  Added option to summarize the chat when an error is triggered (#3598)
  Remove mcp_macros and unused types (#3581)
  fix: add fallback id to messages if none provided (#3584)
  feat: migrate ErrorData from internal mcp crates to rmcp version (#3586)
  fix: adjust subrecipe description to allow running tests (#3585)
  Scenario tests (#3430)
  feat: migrate JsonRpcMessage/Request/Response/Error/Notification from internal mcp crates to rmcp versions (#3564)
  ...
michaelneale added a commit that referenced this pull request Jul 24, 2025
* main:
  Goose security updates (#3579)
  fix: multi-tool calls in streamed openai-compatible responses (#3609)
  feat: subagent turn count, simple agent loop (#3597)
  feat: subagent independent extension manager (#3596)
  Improve session history loading resiliency (#3588)
  Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
  fix: chat sidebar layout overlapping content occasionally (#3590)
  fix: loading shared sessions (#3607)
  docs: use installer component for tutorial, add updating extensions section (#3608)
  fix: show token alert popover during agent responses and agent failure cases (#3536)
  reuse the cancellation token in the agent level (#3599)
  Docs: Move MongoDB tutorial to MCP section (#3602)
katzdave added a commit that referenced this pull request Jul 24, 2025
* 'main' of github.com:block/goose:
  Adds the `WaitingForUserInput` state (#3620)
  docs: update extensions library (#3612)
  Fixing grants path (#3632)
  docs: June 2024 Community All-Stars Spotlight (#3631)
  grant program (#3630)
  Lifei/sub recipe desktop temp (#3576)
  docs: local LLMs context size tip (#3454)
  fix: Handle non-default base path for OpenAI compatible model fetching (#3566)
  Goose security updates (#3579)
  fix: multi-tool calls in streamed openai-compatible responses (#3609)
  feat: subagent turn count, simple agent loop (#3597)
  feat: subagent independent extension manager (#3596)
  Improve session history loading resiliency (#3588)
  Added logging and changed default route case to not redirect to home when there is an invalid route (#3610)
  fix: chat sidebar layout overlapping content occasionally (#3590)
  fix: loading shared sessions (#3607)
atarantino pushed a commit to atarantino/goose that referenced this pull request Aug 5, 2025
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