fix: detect wrong-platform binary in nao chat and show actionable error (#287)#577
fix: detect wrong-platform binary in nao chat and show actionable error (#287)#577Abhijitam01 wants to merge 3 commits intogetnao:mainfrom
Conversation
…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.
There was a problem hiding this comment.
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.
🚀 Preview Deployment
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.
There was a problem hiding this comment.
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.
|
@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.
There was a problem hiding this comment.
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=$? |
There was a problem hiding this comment.
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>
Summary
Fixes #287 —
nao chatfails on Windows with[WinError 193] %1 is not a valid Win32 applicationwhen the wrong-platform binary is shipped in the wheelThe 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.