Repository navigation
feat: support Linux ARM64 auto-detection, default to BELUGA, and sanitize Swagger UI dummy inputs - #22
Closed
iceblue03 wants to merge 1 commit into
Closed
feat: support Linux ARM64 auto-detection, default to BELUGA, and sanitize Swagger UI dummy inputs#22iceblue03 wants to merge 1 commit into
iceblue03 wants to merge 1 commit into
Conversation
…tize Swagger UI dummy inputs
- engine: inspect platform.machine() to prioritize ARM64 binaries on Linux ARM64
- engine: filter out dummy cookie values (e.g. 'string', 'null') before passing CLI args
- engine/api: update default image model to BELUGA and add sanitization fallback
- api: sanitize Swagger UI default placeholder ('string') in request models to None
iceblue03
marked this pull request as ready for review
October 17, 2026 16:32
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.
Summary
This Draft PR enables
FlowEngineto automatically detect host CPU architecture (aarch64/arm64) to pick ARM64 binaries, switches the default image model toBELUGA, and adds input sanitization for dummy values generated by Swagger UI (such as"cookies": "string"and"model": "string").Motivation & Problem Statement
In
engine.py,_find_binarypreviously only inspectedplatform.system()and unconditionally searched forflow-linuxregardless of whether the system was running x86_64 or ARM64. On ARM64 Linux systems (e.g. Raspberry Pi, AWS Graviton), executing the bundled x86_64flow-linuxfailed withExec format error.When testing
/v1/generate/imagevia the FastAPI Swagger UI (/docs), Swagger pre-populates optional string fields with the placeholder"string". Passing"cookies": "string"caused the underlying Go binary to fail withopen string: no such file or directoryand returned an unhandled 502 error to the user.Upstream Flow backend currently accepts
BELUGAconsistently, whereas legacynarwhalrequests frequently yield empty frames.Detailed Changes
flow_agent/engine.py:_find_binary: Readsplatform.machine(). If on Linux ARM64 (aarch64,arm64), it prioritizesflow-linux-arm64andflow-arm64before falling back toflow-linux._is_valid_cookie_arg()helper to strip dummy values ("string","null", empty string) before appending the--cookiesCLI argument.generate_image: Updated defaultmodeltobelugaand auto-sanitizes legacy/placeholder values tobeluga.flow_agent/api.py:FlowImageRequest&ImageGenerationRequest:modelfield to"beluga".@field_validator("model", mode="before")to sanitize placeholders or unsupported models to"beluga".@field_validator("cookies", mode="before")to transform Swagger placeholders intoNone.AI Disclosure
Hardware & Verification Details
Test Environment
Linux 6.18.50+rpt-rpi-v8 #1 SMP PREEMPT aarch64 GNU/LinuxPython 3.13.5Verification Results
aarch64, verified thatFlowEngine._find_binarycorrectly resolvesflow-linux-arm64when present, or native ARM64flow-linux./v1/generate/imagewith payload:{ "prompt": "beach", "aspect": "1:1", "count": 1, "model": "narwhal", "all_accounts": false, "cookies": "string" }open string: no such file or directory/ empty frame).status: succeeded, rendered high-resolution image in 37.1s).