Skip to content

Add opt-in SQLite path for static Linux CLI builds#1609

Merged
steipete merged 1 commit into
steipete:mainfrom
Yuxin-Qiao:codex/musl-static-sqlite-link
Jun 18, 2026
Merged

Add opt-in SQLite path for static Linux CLI builds#1609
steipete merged 1 commit into
steipete:mainfrom
Yuxin-Qiao:codex/musl-static-sqlite-link

Conversation

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Refs #1524

Second step of the musl CLI stack, now rebased as one commit on the landed #1620 source-compatibility base.

Summary

  • add an opt-in CODEXBAR_SQLITE3_LIB_DIR Package.swift build contract
  • pass that directory as a Linux-only linker search path for CodexBarCore and CodexBarCLI
  • keep default builds unchanged when the variable is unset, empty, or whitespace-only

The Swift Static Linux SDK does not ship libsqlite3.a, while SweetCookieKit links SQLite. Release callers can now provide a target-architecture static library without changing normal macOS or glibc builds.

No release workflow or artifact-matrix changes are included here; #1610 consumes this hook.

Verification

  • exact swift package dump-package assertions for unset, blank, and a configured path containing spaces
  • swift test --filter CLIEntryTests (22 tests)
  • make check
  • autoreview: clean, no actionable findings (0.87)
  • isolated Ubuntu 24.04 x86_64 build with checksummed Swift 6.2.1 static Linux SDK and SQLite 3.53.2 amalgamation
  • resulting CodexBarCLI: x86-64 static ELF; --help and config validate --format json both executed successfully

@clawsweeper

clawsweeper Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed June 18, 2026, 8:24 AM ET / 12:24 UTC.

Summary
The PR adds an opt-in CODEXBAR_SQLITE3_LIB_DIR manifest hook that applies a Linux-only SQLite linker search path to CodexBarCore and CodexBarCLI, plus an unreleased changelog entry.

Reproducibility: not applicable. as a bug reproduction; this PR adds an opt-in build-system capability. The linked issue and PR proof establish the need because current main lacks the static SQLite link-path hook after the musl source-compatibility prerequisite.

Review metrics: 3 noteworthy metrics.

  • Changed files: 2 files changed, +13/-2. The functional diff is small, but one file is Package.swift, which changes SwiftPM build behavior.
  • New build knob: 1 environment variable added. CODEXBAR_SQLITE3_LIB_DIR is the compatibility-sensitive contract maintainers need to accept.
  • Targets affected: 2 targets receive linker settings. Both the core library target and CLI executable target can pick up the caller-provided SQLite library directory on Linux.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #1524
Summary: This PR is the static SQLite link-path slice of the broader static-musl Linux CLI artifact work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Confirm the environment variable name and linker-search-path contract with the release workflow before merge.

Risk before merge

  • [P1] The PR adds a new Package.swift environment/toolchain contract, and VISION.md treats package and toolchain changes as needing maintainer sign-off.
  • [P1] When enabled, the Linux -L search path can change which SQLite library is linked, so release usage must point at the intended target-architecture trusted static library.
  • [P1] The follow-up release workflow PR depends on this hook, so landing order and retargeting need maintainer coordination.

Maintainer options:

  1. Accept The Build Contract
    Maintainers can explicitly own CODEXBAR_SQLITE3_LIB_DIR as the opt-in static SQLite bridge while preserving unchanged default builds.
  2. Defer SQLite Direction
    Pause this PR if maintainers prefer solving static SQLite in SweetCookieKit or entirely inside release CI without a CodexBar manifest environment variable.

Next step before merge

  • [P2] The remaining action is maintainer judgment over a new opt-in SwiftPM environment/linker contract and its role in the musl release stack; there is no narrow automation repair to queue.

Security
Cleared: No concrete security or supply-chain defect is visible in the small manifest-only build hook; enabling it still requires trusted release input.

Review details

Best possible solution:

Land this only if maintainers accept CODEXBAR_SQLITE3_LIB_DIR as the narrow static SQLite bridge and keep checksum plus smoke-test proof in the release workflow consumer.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction; this PR adds an opt-in build-system capability. The linked issue and PR proof establish the need because current main lacks the static SQLite link-path hook after the musl source-compatibility prerequisite.

Is this the best way to solve the issue?

Mostly yes, if maintainers accept the contract: the diff is a narrow CodexBar-side bridge that avoids vendoring SQLite. The alternative is to solve static SQLite in SweetCookieKit or release CI without a package-level environment variable.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d8ce86980772.

Label changes

Label justifications:

  • P2: This is a bounded Linux CLI build/release improvement with limited blast radius, not an urgent runtime regression.
  • merge-risk: 🚨 compatibility: The PR adds an opt-in SwiftPM linker-search-path contract that can change Linux link resolution when enabled.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides terminal-style after-fix proof for manifest cases, focused tests, make check, and an isolated Ubuntu static-musl CLI build with runtime smoke commands.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides terminal-style after-fix proof for manifest cases, focused tests, make check, and an isolated Ubuntu static-musl CLI build with runtime smoke commands.
Evidence reviewed

What I checked:

  • Repository policy read: AGENTS.md was read fully; its SwiftPM, release-flow, validation, and read-only review guidance shaped this review. (AGENTS.md:1, d8ce86980772)
  • Vision sign-off context: VISION.md says package, dependency, and toolchain changes need sign-off, which applies to a new Package.swift build contract. (VISION.md:9, d8ce86980772)
  • Current main lacks the hook: Current main only has the existing SweetCookieKit local-path environment option and no SQLite linker settings on the core or CLI targets. (Package.swift:5, d8ce86980772)
  • PR adds the build contract: The PR reads and trims CODEXBAR_SQLITE3_LIB_DIR, creates Linux-only unsafe linker flags, and attaches them to CodexBarCore and CodexBarCLI. (Package.swift:13, 5560ab5ef468)
  • Canonical issue context: The linked Linux CLI issue identifies SweetCookieKit's SQLite link dependency as the musl static-link blocker and describes using a caller-provided static SQLite library search path as the working bridge.
  • Prerequisite is on main: The musl source-compatibility prerequisite merged as current main, and its verification says the remaining link failure is the expected -lsqlite3 gap handled by this PR. (d8ce86980772)

Likely related people:

  • steipete: Current blame and history for Package.swift and release workflow files point to this handle, and the current musl source-compatibility prerequisite plus this PR head were authored by this handle. (role: recent package and release contributor; confidence: high; commits: 06fea2c897cc, d8ce86980772, 5560ab5ef468; files: Package.swift, .github/workflows/release-cli.yml, Sources/CodexBarCore/Host/Process/PosixSpawnFileActionsCloseFrom.swift)
  • Yuxin-Qiao: This handle co-authored the merged musl source-compatibility work and the current PR head, and authored the open release workflow consumer for the same static-musl stack. (role: related implementation contributor; confidence: medium; commits: d8ce86980772, 5560ab5ef468, 272807bcc1b6; files: Package.swift, .github/workflows/release-cli.yml, TestsLinux/AntigravityProcessLauncherLinuxTests.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Jun 18, 2026
@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 18, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@steipete
steipete force-pushed the codex/musl-static-sqlite-link branch from f89a6c7 to 064fec4 Compare June 18, 2026 11:17
@steipete
steipete changed the base branch from main to fix/musl-source-compat June 18, 2026 11:18
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

for descriptor in try self.descriptorsToClose(startingAt: minimumFileDescriptor) {
try self.check(posix_spawn_file_actions_addclose(&fileActions, descriptor))

P2 Badge Avoid snapshotting descriptors before musl spawns

On musl this fallback enumerates /proc/self/fd while preparing the file actions and then only closes that point-in-time list. In a multithreaded CLI run such as serve, any socket, pipe, or file opened by another task after this enumeration but before posix_spawn is not in the action list and is inherited by the helper, unlike the glibc addclosefrom_np path that closes the range in the child at spawn time; this can leak client/provider descriptors or keep unrelated pipes alive. Please close the full fd range or otherwise ensure newly opened descriptors are close-on-exec instead of relying on a snapshot.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@steipete
steipete force-pushed the codex/musl-static-sqlite-link branch from 064fec4 to 5560ab5 Compare June 18, 2026 12:13
@steipete
steipete changed the base branch from fix/musl-source-compat to main June 18, 2026 12:13
@steipete
steipete merged commit 016f3b9 into steipete:main Jun 18, 2026
4 of 7 checks passed
@Yuxin-Qiao
Yuxin-Qiao deleted the codex/musl-static-sqlite-link branch June 25, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants