Skip to content

Auto-retry on Kanban connection errors and user-facing errors#192

Open
vdimarco wants to merge 2 commits into
mainfrom
gatewayz-code/fix-retry-task-connection-error-ldg7ab
Open

Auto-retry on Kanban connection errors and user-facing errors#192
vdimarco wants to merge 2 commits into
mainfrom
gatewayz-code/fix-retry-task-connection-error-ldg7ab

Conversation

@vdimarco

@vdimarco vdimarco commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds automatic retry when Kanban screens encounter connection errors (web and mobile).
  • Introduces user-facing errors for retry actions to provide clearer feedback when retries fail.
  • Maintains and ensures New Task creation remains accessible during error states.
  • Updates end-to-end tests to cover new retry scenarios.

Changes

UI / Kanban components

  • KanbanBoardMobile (apps/www/src/components/kanban/kanban-board-mobile.tsx)

    • Implement auto-retry: if an error occurs, automatically refetch after 3 seconds.
    • Update error UI to indicate automatic retry is in progress: "Failed to load tasks. Retrying automatically...".
    • Ensure a New Task drawer is rendered so the New Task button remains functional during errors.
    • Retain manual Retry button for immediate retry.
  • KanbanBoard (apps/www/src/components/kanban/kanban-board.tsx)

    • Implement auto-retry on connection errors with a 3-second interval.
    • Import and display a Retry button (with RefreshCw icon) alongside New Task button when an error occurs.
    • Update error message to indicate automatic retry and provide a manual Retry option.
    • Render KanbanNewTaskDialog in error state to preserve New Task functionality.

Backend / server actions

  • retry-git-checkpoint.ts (apps/www/src/server-actions/retry-git-checkpoint.ts)

    • On failed status update, throw a UserFacingError with a friendlier message:
      "Unable to retry git checkpoint - the task may already be in progress. Please refresh the page.".
  • retry-thread.ts (apps/www/src/server-actions/retry-thread.ts)

    • If the thread retry cannot proceed, throw a UserFacingError with a friendlier message:
      "Unable to retry task - it may already be in progress or was retried by another action. Please refresh the page.".

Tests

  • e2e tests (apps/www/src/server-lib/e2e.test.ts)
    • Added test: retry thread fails when thread is already in progress.
    • Verifies that retryThreadAction resolves to an error with the new user-facing message and that thread status remains unchanged (e.g., still booting).

Why

  • Improves resilience of the Kanban retry UX by automatically retrying transient connection errors.
  • Provides clearer, user-facing error messages when retry actions cannot proceed, reducing confusion.
  • Keeps task creation accessible even during error states.
  • Aligns server-side error handling with user-facing expectations and tests for end-to-end reliability.

Testing plan

  • Run Kanban web UI and Kanban mobile screens with intermittent connection errors to observe automatic retries after ~3 seconds.
  • Trigger manual Retry in error state and ensure it retries correctly.
  • Verify New Task button opens the drawer/dialog during error states.
  • End-to-end: run the new test for retry-thread when a thread is already in progress and ensure the proper user-facing error is returned and statuses remain unchanged.

Notes

  • No database migrations required.
  • No external dependencies added. All changes are self-contained within existing components and server actions.

🌿 Generated by Terry


ℹ️ Tag @terragon-labs to ask questions and address PR feedback

📎 Task: https://terragon-www-production.up.railway.app/task/be2f2496-a901-416d-9591-3ebb12362e75

Greptile Overview

Greptile Summary

This PR enhances the Kanban board UX by adding automatic retry functionality for connection errors and improving error messaging for retry actions.

Key Changes:

  • Auto-retry mechanism: Both web and mobile Kanban boards now automatically refetch after 3 seconds when encountering connection errors
  • Improved error messaging: Updated UI to inform users that automatic retry is in progress
  • User-facing error handling: retry-git-checkpoint.ts and retry-thread.ts now throw UserFacingError with clear messages when retry actions fail due to tasks already being in progress
  • Maintained functionality: New Task button remains accessible during error states by ensuring the drawer/dialog components are rendered
  • Test coverage: Added e2e test verifying retry behavior when thread is in booting state

Implementation Quality:

  • Clean implementation using React useEffect with proper cleanup
  • Consistent error handling across both mobile and desktop views
  • Proper use of UserFacingError to distinguish user-facing errors from system errors
  • Test coverage validates the error handling behavior

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • All changes are well-implemented with proper error handling, cleanup functions, and test coverage. The auto-retry mechanism uses standard React patterns, error messages are clear and user-friendly, and the changes maintain existing functionality
  • No files require special attention

Important Files Changed

Filename Overview
apps/www/src/components/kanban/kanban-board-mobile.tsx Added auto-retry useEffect hook, updated error UI message, and rendered KanbanNewTaskDrawer in error state
apps/www/src/components/kanban/kanban-board.tsx Added auto-retry useEffect, RefreshCw import, Retry button, updated error message, and rendered KanbanNewTaskDialog in error state
apps/www/src/server-actions/retry-git-checkpoint.ts Changed from generic Error to UserFacingError with descriptive message when status update fails
apps/www/src/server-actions/retry-thread.ts Changed from early return to throwing UserFacingError when status update fails
apps/www/src/server-lib/e2e.test.ts Added test for retry thread failure when thread is already in progress (booting state)

Sequence Diagram

sequenceDiagram
    participant User
    participant KanbanBoard
    participant useInfiniteThreadList
    participant Backend
    participant RetryAction

    Note over User,RetryAction: Normal Load Flow
    User->>KanbanBoard: View Kanban board
    KanbanBoard->>useInfiniteThreadList: Fetch thread list
    useInfiniteThreadList->>Backend: GET threads
    Backend-->>useInfiniteThreadList: Return threads
    useInfiniteThreadList-->>KanbanBoard: Display threads

    Note over User,RetryAction: Connection Error & Auto-Retry Flow
    User->>KanbanBoard: View Kanban board
    KanbanBoard->>useInfiniteThreadList: Fetch thread list
    useInfiniteThreadList->>Backend: GET threads
    Backend--xKanbanBoard: Connection error (isError=true)
    
    Note over KanbanBoard: Show error UI with message:<br/>"Retrying automatically..."
    Note over KanbanBoard: useEffect triggers setTimeout(3000ms)
    
    KanbanBoard->>KanbanBoard: Wait 3 seconds
    KanbanBoard->>useInfiniteThreadList: refetch()
    useInfiniteThreadList->>Backend: GET threads (retry)
    Backend-->>useInfiniteThreadList: Return threads
    useInfiniteThreadList-->>KanbanBoard: Display threads

    Note over User,RetryAction: Manual Retry Flow
    Backend--xKanbanBoard: Connection error (isError=true)
    User->>KanbanBoard: Click Retry button
    KanbanBoard->>useInfiniteThreadList: refetch()
    useInfiniteThreadList->>Backend: GET threads
    Backend-->>useInfiniteThreadList: Return threads
    useInfiniteThreadList-->>KanbanBoard: Display threads

    Note over User,RetryAction: Retry Action Error Flow
    User->>KanbanBoard: Click retry on task
    KanbanBoard->>RetryAction: retryThread(threadId)
    RetryAction->>RetryAction: updateThreadChatWithTransition()
    
    alt Thread already in progress
        RetryAction-->>RetryAction: didUpdateStatus = false
        RetryAction--xKanbanBoard: UserFacingError:<br/>"Unable to retry task -<br/>may already be in progress"
        KanbanBoard-->>User: Show error message
    else Thread can be retried
        RetryAction->>RetryAction: ensureThreadChatHasUserMessage()
        RetryAction->>Backend: startAgentMessage()
        RetryAction-->>KanbanBoard: Success
        KanbanBoard-->>User: Task retrying
    end
Loading

vdimarco and others added 2 commits February 4, 2026 02:01
…gress

- Added E2E test to verify retryThread fails with UserFacingError if thread is already in progress
- Covered the case where thread status is 'booting' and retryThreadAction is called
- Ensured retryGitCheckpoint and retryThread actions now throw UserFacingError with clear user messages on concurrent retry attempts

Co-authored-by: gatewayz-ai-inbox[bot] <gatewayz-ai-inbox[bot]@users.noreply.github.com>
- Implement automatic retry mechanism on connection errors in both mobile and desktop Kanban boards.
- Update error UI messages to inform users about automatic retry.
- Add retry buttons alongside new task buttons for manual retry.
- Ensure new task drawers/dialogs remain functional when error state is shown.

Co-authored-by: gatewayz-ai-inbox[bot] <gatewayz-ai-inbox[bot]@users.noreply.github.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Feb 4, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@vdimarco has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gatewayz-code/fix-retry-task-connection-error-ldg7ab

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines +411 to +418
useEffect(() => {
if (isError) {
const timer = setTimeout(() => {
refetch();
}, 3000);
return () => clearTimeout(timer);
}
}, [isError, refetch]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: A useEffect hook creates a persistent 3-second retry loop on query failure, lacking a maximum attempt limit, exponential backoff, or a way for the user to cancel.
Severity: MEDIUM

Suggested Fix

Implement a maximum retry limit within the component's state to prevent indefinite loops. Introduce an exponential backoff strategy for the retry delay instead of a fixed 3-second timeout. Consider adding a UI element that allows the user to manually cancel the retry attempts.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: apps/www/src/components/kanban/kanban-board-mobile.tsx#L411-L418

Potential issue: The `useEffect` hook designed to automatically retry a failed query
will trigger a refetch every 3 seconds as long as the `isError` state is true. This
implementation lacks an exponential backoff strategy, a maximum retry limit, or a
circuit breaker. For users on unstable networks where the query consistently fails, this
will result in continuous, indefinite network requests every 3 seconds, potentially
degrading app performance and increasing server load. There is no mechanism for the user
to manually stop these retry attempts.

Did we get this right? 👍 / 👎 to inform future reviews.

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.

1 participant