Add musl import compatibility for Linux CLI#1601
Conversation
|
Codex review: needs changes before merge. Reviewed June 17, 2026, 2:13 PM ET / 18:13 UTC. Summary Reproducibility: Do we have a high-confidence way to reproduce the issue? Yes from source: the widened Linux test expects fd 200 to be closed, while the Musl branch skips the only close-from spawn action that closes arbitrary fds. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Land this source-compatibility slice only after adding a Musl-compatible descriptor-closing strategy while leaving release artifact and SQLite decisions to the broader static Linux issue. Do we have a high-confidence way to reproduce the issue? Do we have a high-confidence way to reproduce the issue? Yes from source: the widened Linux test expects fd 200 to be closed, while the Musl branch skips the only close-from spawn action that closes arbitrary fds. Is this the best way to solve the issue? Is this the best way to solve the issue? Not yet; the import shims are the right narrow direction, but the Musl spawn path needs an equivalent descriptor-closing strategy before the compatibility slice is merge-ready. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 05545feba362. Label changesLabel changes:
Label justifications:
Evidence reviewedSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Addressed the ClawSweeper fd-inheritance finding in
Validation:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Landed the repaired musl source-compatibility change in The replacement keeps your contributor credit and adds fail-closed descriptor handling plus regression coverage. This branch could not be updated because maintainer edits were disabled, so I recreated the patch locally. Thanks @Yuxin-Qiao. Enabling Allow edits by maintainers on future PRs lets us repair the original branch directly. |
Refs #1524
Summary
This is a first-stage source compatibility PR for building the CLI-facing code with Swift Static Linux SDK musl targets. It does not add or change release artifacts, and it does not claim to fully solve the static Linux release work in #1524.
Root Cause
The CLI and CLI-shared core sources currently assume non-Darwin C APIs come from the
GlibcSwift module. Swift Static Linux SDK musl targets expose libc through theMuslmodule instead, so#else import Glibcand qualified calls such asGlibc.exit,Glibc.signal, andGlibc.closeblock musl source compilation.SOCK_STREAMalso differs between Glibc and Musl, where the existingSOCK_STREAM.rawValueshape is Glibc-specific.Scope
CodexBarCLIand CLI-sharedCodexBarCoresource files.exit,signal, andclose.SOCK_STREAM.rawValuefor Glibc and usingSOCK_STREAMfor Musl.posix_spawn_file_actions_addclosefrom_npon Glibc, and adds a small Musl fallback that enumerates/proc/self/fdand adds explicit close actions for child process fd cleanup.Explicit Non-Goals
Validation
swiftformat <changed files>: passed; no final formatting changes.swiftlint --strict --cache-path /private/tmp/codexbar-1524-swiftlint.cache: passed, 0 violations.env HOME=/private/tmp/codexbar-1524/.home CLANG_MODULE_CACHE_PATH=/private/tmp/codexbar-1524/.clang-module-cache swift test --filter SpawnedProcessGroupTests: passed, 10 tests.env HOME=/private/tmp/codexbar-1524/.home CLANG_MODULE_CACHE_PATH=/private/tmp/codexbar-1524/.clang-module-cache swift test --filter AntigravityCLISessionTests: passed, 48 tests.env HOME=/private/tmp/codexbar-1524/.home CLANG_MODULE_CACHE_PATH=/private/tmp/codexbar-1524/.clang-module-cache swift test --filter CLIEntryTests: passed, 22 tests.env HOME=/private/tmp/codexbar-1524/.home CLANG_MODULE_CACHE_PATH=/private/tmp/codexbar-1524/.clang-module-cache swift test --filter CLIServeRouterTests: passed, 36 tests.env HOME=/private/tmp/codexbar-1524/.home CLANG_MODULE_CACHE_PATH=/private/tmp/codexbar-1524/.clang-module-cache swift test: built and ran, but failed on 5 existing environment/timing-sensitive issues outside this PR's touched code:CommandCodeUsageFetcherTests: 2 cancellation grace timing assertions.DeepSeekUsageFetcherTests: 1 optional summary cancellation timing assertion.CodexLoginRunnerTests: 1 detached child pipe drain assertion.GeminiStatusProbeAPITests: 1 fnm stdout timing assertion.Musl Verification
Locally verified with the Swift Static Linux SDK through Swift source compilation. This is not a complete static release artifact verification: the build now reaches the link stage and stops on the expected SQLite static-link blocker, which is outside this PR scope.
Installed/used locally:
~/Library/Developer/Toolchains/swift-6.2.1-RELEASE.xctoolchain(Apple Swift version 6.2.1 (swift-6.2.1-RELEASE)).swift-6.2.1-RELEASE_static-linux-0.0.1.Command:
env HOME=/private/tmp/codexbar-1524/.home \ CLANG_MODULE_CACHE_PATH=/private/tmp/codexbar-1524/.clang-module-cache \ ~/Library/Developer/Toolchains/swift-6.2.1-RELEASE.xctoolchain/usr/bin/swift \ build -c release --product CodexBarCLI \ --swift-sdk swift-6.2.1-RELEASE_static-linux-0.0.1Result:
That result confirms the Darwin/glibc-safe Musl source compatibility changes compile under the Swift Static Linux SDK until the known static SQLite dependency/linking work described in #1524, which remains intentionally out of scope here.