Skip to content

fix: detect wrong-platform binary in nao chat and show actionable error (#287)#577

Open
Abhijitam01 wants to merge 3 commits intogetnao:mainfrom
Abhijitam01:AbhijitamSylus/win-binary-support
Open

fix: detect wrong-platform binary in nao chat and show actionable error (#287)#577
Abhijitam01 wants to merge 3 commits intogetnao:mainfrom
Abhijitam01:AbhijitamSylus/win-binary-support

Conversation

@Abhijitam01
Copy link
Copy Markdown

@Abhijitam01 Abhijitam01 commented Apr 8, 2026

Summary

Fixes #287nao chat fails on Windows with [WinError 193] %1 is not a valid Win32 application when the wrong-platform binary is shipped in the wheel

The root cause (Linux binary shipped in the Windows wheel) was already fixed in CI since v0.1.4 — the per-platform build matrix makes cross-contamination impossible. This PR adds the guardrails so if it ever happens again, users get an actionable error and CI catches it before release.

…or (getnao#287)

Users who got the wrong platform wheel (e.g. Linux ELF on Windows) saw a
cryptic WinError 193. Now get_server_binary_path() checks magic bytes
(ELF/PE/Mach-O) against sys.platform and exits with a clear message
pointing to `pip install --force-reinstall nao-core`.

Also adds a CI smoke test that runs the built binary on each platform
runner before packaging, catching cross-platform contamination early.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/publish.yml">

<violation number="1" location=".github/workflows/publish.yml:103">
P2: Smoke test failures are masked by `|| echo`, so the step succeeds even if the binary cannot execute, letting invalid wheels be published.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread .github/workflows/publish.yml
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🚀 Preview Deployment

URL https://pr-577-ea0c05a.preview.getnao.io
Commit ea0c05a

⚠️ No LLM API keys configured - you'll see the API key setup flow when trying to chat.


Preview will be automatically removed when this PR is closed.

The || echo pattern silently swallowed binary execution failures,
letting invalid wheels get published. Now the smoke test checks for
exit codes 126/127 (OS cannot load binary) and fails the build.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/publish.yml">

<violation number="1" location=".github/workflows/publish.yml:103">
P2: Smoke-test status capture is bypassed on non-zero execution, so custom wrong-platform diagnostics may never run.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread .github/workflows/publish.yml Outdated
@Abhijitam01
Copy link
Copy Markdown
Author

@Bl3f please review this

Initialize STATUS=0 and use `|| STATUS=$?` so non-zero exit codes
from --help don't abort the step before the platform check runs.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/publish.yml">

<violation number="1" location=".github/workflows/publish.yml:108">
P1: Smoke test now ignores non-126/127 execution failures, so broken binaries can pass and be published.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

else
chmod +x ./nao_core/bin/nao-chat-server
STATUS=0
./nao_core/bin/nao-chat-server --help || STATUS=$?
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 11, 2026

Choose a reason for hiding this comment

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

P1: Smoke test now ignores non-126/127 execution failures, so broken binaries can pass and be published.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/publish.yml, line 108:

<comment>Smoke test now ignores non-126/127 execution failures, so broken binaries can pass and be published.</comment>

<file context>
@@ -100,12 +100,12 @@ jobs:
-                    ./nao_core/bin/nao-chat-server --help
-                    STATUS=$?
+                    STATUS=0
+                    ./nao_core/bin/nao-chat-server --help || STATUS=$?
                   fi
                   # Exit codes 126 (cannot execute) and 127 (not found) mean the OS
</file context>
Fix with Cubic

@Abhijitam01 Abhijitam01 changed the title fix: detect wrong-platform binary in nao chat and show actionable err… fix: detect wrong-platform binary in nao chat and show actionable error (#287) Apr 11, 2026
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.

nao chat fails on Windows — Linux binary shipped with no Windows equivalent

1 participant