fix(refetch): task sse terminal event removed and auto-refetch behaviour disabled#4167
fix(refetch): task sse terminal event removed and auto-refetch behaviour disabled#4167icecrasher321 wants to merge 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview The mothership SSE endpoint subscribes via Reviewed by Cursor Bugbot for commit b28b2a3. Configure here. |
Greptile SummaryThis PR simplifies the task event pub/sub system by replacing granular Confidence Score: 5/5Safe to merge — the simplification is consistent across all publishers and the single subscriber, and the refetchType:'none' fix correctly addresses the DB-write race condition. All callers of the old publishStatusChanged API are updated, tests cover the new behaviour, and the intentional asymmetry between finalize (refetchType:'none') and stop (refetchType:'active') is correctly implemented. No P0/P1 findings. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Browser (use-chat.ts)
participant API as API Route
participant PubSub as taskPubSub (Redis)
participant SSE as SSE Endpoint
participant RQ as React Query Cache
Note over Client,RQ: Normal stream completion (finalize)
Client->>RQ: invalidateTaskHistory('none') stale, no refetch
Client->>RQ: invalidateTaskList()
API->>PubSub: publishTaskListChanged({workspaceId})
PubSub-->>SSE: task:status_changed event
SSE-->>Client: task_status {}
Client->>RQ: invalidateQueries(taskKeys.lists())
Note over Client,RQ: Manual stop (stopChat)
Client->>API: POST /api/copilot/chat/stop
API->>PubSub: publishTaskListChanged({workspaceId})
API-->>Client: 200 OK
Client->>RQ: invalidateChatQueries() - invalidateTaskHistory('active') + invalidateTaskList()
PubSub-->>SSE: task:status_changed event
SSE-->>Client: task_status {}
Client->>RQ: invalidateQueries(taskKeys.lists())
Reviews (1): Last reviewed commit: "simplify event" | Re-trigger Greptile |
Summary
Far less likely case of db write failing is considered acceptable to not auto-refetch stale state pre persistence.
Type of Change
Testing
Tested manually
Checklist