Skip to content

Conversation

@sheikhlimon
Copy link
Contributor

@sheikhlimon sheikhlimon commented Nov 9, 2025

Summary

When a session is deleted (e.g., from the sessions list), the user might still have the session ID in their URL. Instead of showing a fatal error, we:

  1. Detect when initialization fails due to a missing session (404/Session not found)
  2. Clear the problematic session ID from the URL
  3. Retry initialization without a session ID to create a fresh session
  4. Only show a fatal error if the retry also fails

This prevents users from getting stuck on "Agent init failure: [object Object]" which is a "Session not found" error when they try to access deleted session.

When sessions are deleted, we maintain a Set of deleted session IDs to avoid repeatedly trying to access them. This prevents "Agent init failure: [object Object]" which can also be multiple 404 errors and provides a smoother user experience.

Key behaviors:

  • Skip resume attempts for known deleted sessions
  • Clear deleted sessions from URL parameters when detected
  • Mark sessions as deleted when resume attempts fail with 404
  • Reset tracking when user starts a new chat session

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Documentation
  • Performance improvement
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Related Issues

Relates to #5637

- Add simple deleted session tracking in useAgent.ts to avoid repeated
API calls
- Implement graceful session recovery in pair.tsx when encountering 404
errors
- Clear problematic session IDs from URL when detected as deleted
- Prevent users from getting stuck on "Session not found" errors
- Maintain a Set of deleted session IDs to skip future attempts
- Reset deleted session tracking when starting new chat sessions

Signed-off-by: sheikhlimon <[email protected]>
@sheikhlimon sheikhlimon force-pushed the fix/session-deletion-error branch from 9ecf8c8 to 7a02b0f Compare November 9, 2025 17:48
@DOsinga DOsinga merged commit e8c895b into block:main Nov 10, 2025
15 checks passed
Rodriguespn pushed a commit to Rodriguespn/goose that referenced this pull request Nov 10, 2025
Rodriguespn pushed a commit to Rodriguespn/goose that referenced this pull request Nov 10, 2025
tiensi added a commit to tiensi/goose that referenced this pull request Nov 11, 2025
* main: (83 commits)
  silence copilot on minor text issues (block#5665)
  fix: disallow runaway subagent chains (block#5659)
  chore: remove usage of non-existent env var for log dir (block#5658)
  clarify agent instructions (block#5655)
  feat: add check-everything for unified style checks (block#5650)
  Show errors on failure (block#5643)
  custom instructions for copilot reviews (block#5646)
  fix: prevent repeated 404 errors when accessing deleted sessions (block#5644)
  Flake.nix corrected main (block#5600)
  fix: goose recipe list can return duplicated entries (block#5645)
  fix: bedrock creds refresh (block#5599)
  Fix Claude Code provider to default to Auto mode (block#5638) (block#5642)
  Scheduler cleanup (block#5571)
  Better search paths and handling of CLI providers (block#5554)
  docs: description required for "Add Extension" in cli - phase 2 (block#5635)
  Remove some logging (block#5631)
  Use session IDs as task IDs for subagents instead of UUIDs (block#5398)
  Fix the naming (block#5628)
  fix: default tetrate model is broken, replace with haiku-4.5 (block#5535) (block#5587)
  Fetch less and use the right SHA (block#5621)
  ...
michaelneale added a commit that referenced this pull request Nov 11, 2025
* main:
  silence copilot on minor text issues (#5665)
  fix: disallow runaway subagent chains (#5659)
  chore: remove usage of non-existent env var for log dir (#5658)
  clarify agent instructions (#5655)
  feat: add check-everything for unified style checks (#5650)
  Show errors on failure (#5643)
  custom instructions for copilot reviews (#5646)
  fix: prevent repeated 404 errors when accessing deleted sessions (#5644)
  Flake.nix corrected main (#5600)
  fix: goose recipe list can return duplicated entries (#5645)
  fix: bedrock creds refresh (#5599)
Rodriguespn pushed a commit to Rodriguespn/goose that referenced this pull request Nov 12, 2025
@sheikhlimon sheikhlimon deleted the fix/session-deletion-error branch November 13, 2025 08:16
Surendhar-N-D pushed a commit to Surendhar-N-D/goose that referenced this pull request Nov 17, 2025
arul-cc pushed a commit to arul-cc/goose that referenced this pull request Nov 17, 2025
BlairAllan pushed a commit to BlairAllan/goose that referenced this pull request Nov 29, 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