Skip to content

fix(cloud-agent): handle stream churn#1949

Merged
tatoalo merged 3 commits intomainfrom
chore/cloud-agent/handle-stream-churn
Apr 30, 2026
Merged

fix(cloud-agent): handle stream churn#1949
tatoalo merged 3 commits intomainfrom
chore/cloud-agent/handle-stream-churn

Conversation

@tatoalo
Copy link
Copy Markdown
Contributor

@tatoalo tatoalo commented Apr 30, 2026

Problem

cloud task streams can churn when a live stream emits keepalives and then disconnects, or when the client loses access to task status/log endpoints.
keepalives were resetting the reconnect attempt counter, and 401/403/404 status or log responses were treated like generic transient failures as showni in slack thread logs

Changes

  • move the reconnect-attempt reset so only non-keepalive SSE events mark the stream as healthy
  • fail the cloud task watcher on 401, 403, or 404 responses from status and persisted-log fetches, using the same user-facing stream error details as the SSE path.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 30, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/code/src/main/services/cloud-task/service.test.ts:602-668
**Parameterise over all three guarded status codes**

`shouldFailWatcherForFetchStatus` guards against 401, 403, and 404, but both new tests only exercise 403. 401 (expired token) and 404 (run deleted) are distinct failure modes that are easy to miss if the function is ever changed.

The two tests also share exactly the same assertion shape and could be collapsed into an `it.each` table, matching the project's preference for parameterised tests.

Reviews (1): Last reviewed commit: "fix(cloud-agent): handle stream churn" | Re-trigger Greptile

Comment thread apps/code/src/main/services/cloud-task/service.test.ts Outdated
@tatoalo tatoalo self-assigned this Apr 30, 2026
@tatoalo tatoalo requested a review from a team April 30, 2026 09:16
@tatoalo tatoalo merged commit a96e54b into main Apr 30, 2026
15 checks passed
@tatoalo tatoalo deleted the chore/cloud-agent/handle-stream-churn branch April 30, 2026 10:27
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