Skip to content

fix(generator-cli): consume FAI NDJSON heartbeat stream in AutoVersionStep - #17639

Open
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1788444104-autoversion-fai-ndjson-stream
Open

fix(generator-cli): consume FAI NDJSON heartbeat stream in AutoVersionStep#17639
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1788444104-autoversion-fai-ndjson-stream

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Description

Linear ticket: Refs (none)

Client half of fern-api/fern-platform#14449. AutoVersionStep.analyzeViaFaiService now sends Accept: application/x-ndjson to POST /sdks/analyze-commit-diff so FAI can stream heartbeat lines while a multi-minute analysis of a large SDK diff runs, instead of sitting silent past the ALB idle timeout (the 504s that motivated fern-api/fern-platform#14376).

Behavior is negotiated on the response Content-Type, so a FAI deployment that has not picked up the server change (or any non-streaming proxy) still works via the existing response.json() path.

Changes Made

  • AutoVersionStep.ts: add Accept header; when the response is application/x-ndjson, readFaiAnalyzeStream reads response.body line by line:
    {"type":"heartbeat"}                 -> ignored
    {"type":"result","result":{...}}     -> returned, then validated by isFaiAnalyzeResponse as before
    {"type":"error","status":413,...}    -> throw (HTTP status is already 200 by then)
    stream ends w/o result               -> throw
    
    Throwing keeps the existing PATCH fallback in the caller.
  • Tests: ndjsonResponse helper that splits the stream across arbitrary chunk boundaries; new cases for heartbeats-then-result, in-band error, and truncated stream; assert the Accept header on the existing plain-JSON test.
  • changes/unreleased/autoversion-fai-ndjson-stream.yml (fix).
  • Updated README.md generator (not applicable)

Testing

  • Unit tests added/updated — auto-version-step.execute.test.ts: 44 passed
  • pnpm turbo run compile --filter @fern-api/generator-cli clean; biome check clean
  • Manual testing against a deployed FAI with the server PR — pending that deploy

Rollout: FAI PR deploys first (harmless either way, since the header is opt-in on both sides); generators pick this up on their next version bump/Docker rebuild once the catalog pin is updated.

Link to Devin session: https://app.devin.ai/sessions/7e579645945144bd8566e4a37d79ae66
Open in Devin Desktop: https://app.devin.ai/desktop/session/7e579645945144bd8566e4a37d79ae66?variant=devin


Devin Review

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 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

@nitpickybot nitpickybot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI Review Summary

Adds NDJSON streaming support to AutoVersionStep's FAI call with a content-type negotiated fallback to plain JSON. Logic is mostly sound; a couple of robustness nits around CRLF/\r handling and unknown event types being fatal.

  • 🟡 1 warning(s)
  • 🔵 2 suggestion(s)

To request another review, comment /ai-review on this pull request.

Comment thread packages/generator-cli/src/pipeline/steps/AutoVersionStep.ts Outdated
Comment thread packages/generator-cli/src/pipeline/steps/AutoVersionStep.ts Outdated
Comment thread packages/generator-cli/src/pipeline/steps/AutoVersionStep.ts

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment thread packages/generator-cli/src/pipeline/steps/AutoVersionStep.ts
willkendall01 and others added 2 commits September 3, 2026 14:04
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…empty result

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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