Skip to content

fix(cli): fix remote generation polling hang after task completion#16764

Open
Swimburger wants to merge 1 commit into
mainfrom
devin/1782512508-fix-remote-gen-polling-hang
Open

fix(cli): fix remote generation polling hang after task completion#16764
Swimburger wants to merge 1 commit into
mainfrom
devin/1782512508-fix-remote-gen-polling-hang

Conversation

@Swimburger

@Swimburger Swimburger commented Jun 26, 2026

Copy link
Copy Markdown
Member

Description

Fixes an infinite polling hang in fern generate where the CLI never detects task completion despite the Fiddle coordinator correctly returning "_type": "finished" status.

Root Cause

The fiddle-sdk's TaskStatus._visit() method calls visitor functions but does not await async handler results. When processUpdate() called await remoteTask.status._visit({...}), the await resolved immediately (the _visit return value is not the handler's Promise), so #isFinished was never set before the polling loop checked it — causing infinite polling.

Changes Made

  • Replace _visit() with direct switch on status.type in RemoteTaskHandler.processUpdate() — this allows proper await of the async downloadFilesForTask call before setting #isFinished = true
  • Add S3 download timeoutstimeout: 60_000 (connection) + AbortSignal.timeout(5 min) (overall) on both downloadZipForTask and downloadAndExtractZipToDirectory to prevent indefinite hangs on slow/stalled downloads
  • Remove unused noop import, add assertNeverNoThrow for forward-compatible handling of unknown status types in the default case
-await remoteTask.status._visit<void | Promise<void>>({
-    notStarted: noop,
-    running: noop,
-    finished: async (finishedStatus) => {
-        // this async handler was never awaited by _visit()!
-        await downloadFilesForTask(...);
-        this.#isFinished = true; // set AFTER _visit() already returned
-    },
-    ...
-});
+const status = remoteTask.status;
+switch (status.type) {
+    case "finished": {
+        await downloadFilesForTask(...); // properly awaited now
+        this.#isFinished = true;         // set before returning
+        break;
+    }
+    ...
+}

Testing

  • TypeScript compilation passes (pnpm turbo run compile --filter @fern-api/remote-workspace-runner)
  • Biome lint passes
  • Unit tests pass (pnpm turbo run test --filter @fern-api/remote-workspace-runner)

Link to Devin session: https://app.devin.ai/sessions/ac52847fd52a4366b0f8e9125af51345
Requested by: @Swimburger


Open in Devin Review

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@Swimburger Swimburger self-assigned this Jun 26, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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