Open
Conversation
94d2fe1 to
12decce
Compare
12decce to
9223724
Compare
9223724 to
88b4e96
Compare
88b4e96 to
65ab1a8
Compare
chore: cleaner
65ab1a8 to
2422d8a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ph_code_sse_streaming_cloud_runs.mp4
Cloud task log viewing used polling (500ms when viewing, 60s if in background) which was inefficient, had dedup complexity, and couldn't stream status changes in realtime. Also it was kinda bad.
We also had missing comms when a remote sandbox was torn down before the terminal status event arrived, which resulted in ph-code to nevel learn about the run being completed and always show a broken "in progress" state which was not the reflection of the real one.
Added a ton of tests just to make sure this is robust and covers some edge cases.
Diid a lot of manual testing, would appreciate a couple of eyes testing this as well please 🙏🏻
(PostHog/posthog#53754)
Changes
CloudTaskServicefrom polling to SSE streaming with bootstrap (fetch history + open SSE withstart=latest), exponential backoff reconnect, andhandleStreamCompletionthat checks actual run status on any stream errorid,event, and multi-linedatafieldsTaskRunStatus,TERMINAL_STATUSES, andisTerminalStatus()to@shared/typeswatchCloudTaskto passapiHost/teamIddirectly, addedretryCloudTaskWatch, andhandleCloudTaskUpdatenow handles SSE error events (moved the auth concern to the renderer which already has the auth state, keeping the main-process service simpler)cloudStatusfrom session store (updated via SSE) instead of waiting for API task refetch"started"→"queued"to match BE API