Skip to content

feat: add retry and new session buttons to disconnect error screen#8313

Open
jeffa-block wants to merge 1 commit intoblock:mainfrom
jeffa-block:jeffa/improve-disconnect-error-screen
Open

feat: add retry and new session buttons to disconnect error screen#8313
jeffa-block wants to merge 1 commit intoblock:mainfrom
jeffa-block:jeffa/improve-disconnect-error-screen

Conversation

@jeffa-block
Copy link
Copy Markdown
Contributor

Replace the single "Go home" button on the disconnect error screen with:

  • Retry connection — clears error state, re-triggers session load via retryCount in the effect deps
  • New session — clearer label for the existing navigation
  • Session ID — copyable for bug reports and session recovery

Fixes #8311 (PR 2 of 2)

Changes

  • useChatStream.ts: add retrySessionLoad() callback using retryCount state in session load effect deps (+11/-2)
  • BaseChat.tsx: replace error screen with retry + new session buttons + session ID display (+22/-10)

Testing

Manual — BaseChat has no existing test coverage and is tightly coupled to useChatStream internals. If reviewers want unit tests, happy to extract a <SessionErrorScreen> component as a follow-up.

  1. Trigger "Lost connection to server" error (kill goosed mid-session)
  2. Click "Retry connection" → loading state → session resumes (if server is back) or error reappears
  3. Click "New session" → navigates to hub
  4. Session ID is visible and selectable

Replace the single 'Go home' button on the Failed to Load Session
screen with:
- 'Retry connection' — clears the error and re-triggers session load
- 'New session' — navigates to hub to start fresh
- Session ID display (selectable) for context recovery

The retry works by adding a retryCount state to useChatStream that
is included in the session load effect's dependency array. Incrementing
it re-runs the effect, which calls resumeAgent again.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d3400ecee

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +1063 to +1066
const retrySessionLoad = useCallback(() => {
dispatch({ type: 'SET_SESSION_LOAD_ERROR', payload: undefined });
dispatch({ type: 'SET_CHAT_STATE', payload: ChatState.LoadingConversation });
setRetryCount((c) => c + 1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Invalidate cached session before retrying load

retrySessionLoad() only bumps retryCount, but it never clears resultsCache for this sessionId. In the common disconnect case (session already loaded once), the load effect immediately returns cached data (resultsCache.get(sessionId)) and skips resumeAgent, so "Retry connection" does not actually retry the backend connection and can falsely recover the UI while the server is still down.

Useful? React with 👍 / 👎.

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.

fix: improve disconnect recovery UX — don't show onboarding to existing users

1 participant