Auto-retry on Kanban connection errors and user-facing errors#192
Auto-retry on Kanban connection errors and user-facing errors#192vdimarco wants to merge 2 commits into
Conversation
…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>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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)
Comment |
| useEffect(() => { | ||
| if (isError) { | ||
| const timer = setTimeout(() => { | ||
| refetch(); | ||
| }, 3000); | ||
| return () => clearTimeout(timer); | ||
| } | ||
| }, [isError, refetch]); |
There was a problem hiding this comment.
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.
Summary
Changes
UI / Kanban components
KanbanBoardMobile (apps/www/src/components/kanban/kanban-board-mobile.tsx)
KanbanBoard (apps/www/src/components/kanban/kanban-board.tsx)
Backend / server actions
retry-git-checkpoint.ts (apps/www/src/server-actions/retry-git-checkpoint.ts)
"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)
"Unable to retry task - it may already be in progress or was retried by another action. Please refresh the page.".
Tests
Why
Testing plan
Notes
🌿 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:
retry-git-checkpoint.tsandretry-thread.tsnow throwUserFacingErrorwith clear messages when retry actions fail due to tasks already being in progressImplementation Quality:
UserFacingErrorto distinguish user-facing errors from system errorsConfidence Score: 5/5
Important Files Changed
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