Skip to content

fix(release): keep the musl adapter's bootstrap noise off stderr - #2678

Merged
namastex888 merged 10 commits into
mainfrom
fix/musl-adapter-stderr
Jul 26, 2026
Merged

namastex888 merged 10 commits into
mainfrom
fix/musl-adapter-stderr

Conversation

@automagik-genie

@automagik-genie automagik-genie commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

The last platform standing

Run 30217058060 (v5.260726.8): with the runner-env fixes live, glibc, linux-arm64, and darwin dogfood all passed — musl was the only failure, on exactly the class this closes.

The dogfood capability probe fails on any stderr byte. Two bootstrap sources inside scripts/run-musl-dogfood.sh violate that before the candidate binary ever runs:

  1. docker run --pull=always re-resolves the manifest on every invocation and writes pull progress to stderr — the workflow's pre-pull step can never help. The image ref is digest-pinned, so pull-if-missing already guarantees exact bytes; the flag added nothing but the failure. Dropped (test updated to pin its absence).
  2. apk add --no-cache fetches the package index over the network and can emit warnings to stderr. Only the candidate's stderr is meaningful to the probe — bootstrap output is now fully silenced, with set -e still aborting on real apk failure.

Main-first because the dogfood job executes the adapter from the main checkout; dev twin follows immediately so its merge fires the (hopefully fully green) release.

Validation: bun test scripts/run-musl-dogfood.test.ts 3 pass, bash -n clean.

Summary by CodeRabbit

  • Bug Fixes

    • Improved MCP database access by automatically repairing compatible, outdated schemas before read-only operations.
    • Added fail-closed handling for missing databases, future schema versions, and unrecoverable validation errors.
    • Reduced Alpine capability-probe noise by suppressing package-install output and avoiding repeated image pulls.
  • Tests

    • Added coverage for schema repair, database binding support, and safe failure scenarios.
  • Chores

    • Updated the Genie plugin and package version to 5.260726.7.

automagik-genie and others added 5 commits July 26, 2026 15:52
…tor fails closed

A database stamped by an earlier build within user_version = 1 lacks the
additive nullable columns that ensureSchema backfills only on write-path
opens. The MCP server opens read-only and validates the complete current
schema, so a pure-MCP consumer — the post-update Codex plugin, whose
first contact with a repo is genie mcp — fail-closes with
project-database-unavailable forever, until some CLI command happens to
run the backfill. This is the second stacked defect behind the release
outage: the Codex native dogfood updates N to T and immediately checks
genie_board through MCP, so every platform fails at the sentinel stage.

Reproduced offline against run 30214153213 artifacts: N (5.260720.10)
creates the DB, T (5.260726.4) CLI reads it fine (write open migrates),
T MCP fail-closes; one T CLI touch and T MCP works.

Fix: genie mcp now opens through openReadonlyDbHealingStaleSchema — when
(and only when) a successful readonly open validates stale, run the same
idempotent openDb write-path open every CLI command already performs,
then reopen readonly through the full hardened binding path. An absent
DB never reaches the write open (no-create contract preserved); foreign,
future, or malformed databases are refused by openDb's typed guards and
still fail closed — proven by regression tests including a durable-heal
check, the databaseBinding target form, and a user_version=99 refusal.
fix(mcp): self-heal an additive-lag schema before the readonly validator fails closed
The dogfood capability probe fails on any stderr byte. Two bootstrap
sources inside the adapter violated that before the candidate ever ran:

- docker run --pull=always re-resolves the digest-pinned manifest on
  EVERY invocation and writes pull progress to stderr — the workflow's
  pre-pull could never help. The pin is a digest, so pull-if-missing
  already guarantees exact bytes; drop the flag.
- apk add fetches the package index over the network and can emit
  warnings to stderr; only the candidate binary's stderr is meaningful
  to the probe, so silence the bootstrap entirely (set -e still aborts
  on real apk failure).

Run 30217058060: glibc, linux-arm64, and darwin dogfood all passed with
the runner-env fixes; musl was the sole survivor, failing on exactly the
pull-progress stderr.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@automagik-genie, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dbd091b8-1231-4815-b1ea-795ead8e9b19

📥 Commits

Reviewing files that changed from the base of the PR and between 816e95d and fce9a65.

📒 Files selected for processing (2)
  • src/lib/v5/mcp-tools.test.ts
  • src/lib/v5/mcp-tools.ts
📝 Walkthrough

Walkthrough

Changes

Genie updates

Layer / File(s) Summary
Release version alignment
.claude-plugin/marketplace.json, package.json, plugins/genie/..., plugins/hermes-genie/plugin.yaml
All Genie package and plugin version fields are updated from 5.260726.5 to 5.260726.7.
Musl dogfood stderr handling
scripts/run-musl-dogfood.sh, scripts/run-musl-dogfood.test.ts
Docker execution no longer forces image pulls, Alpine package installation suppresses stdout and stderr, and the test verifies the updated arguments.
Readonly MCP schema healing
src/lib/v5/mcp-tools.ts, src/lib/v5/mcp-tools.test.ts, src/term-commands/mcp.ts
Readonly database opening heals stale additive schemas through openDb, validates the reopened handle, fails closed for unsupported databases, and is wired into the MCP server loop.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: namastex888

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the musl adapter stderr fix, which is a key part of the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/musl-adapter-stderr

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

namastex888
namastex888 previously approved these changes Jul 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59b228a1a1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/run-musl-dogfood.sh Resolved
Comment thread src/lib/v5/mcp-tools.ts Resolved
…e open

Review finding on the additive-lag self-heal: between closing the
validated readonly handle and openDb's writable open, nothing pinned the
path's identity — a racing substitution could route ensureSchema's DDL
into a swapped file or symlink target, detected only after the write by
the hardened reopen. Revalidate the exact ProjectDatabaseBinding at the
last moment before the write open; the post-heal reopen still re-verifies
binding and opened handle before any tool observes a healed database.

Regression test pins the class: a binding whose database was substituted
after capture is refused (null) and the substituted file is left
untouched by any write-path open.
…filesystems

The rm-and-recreate substitution let ext4 recycle the freed inode for
the replacement file, so the binding identity legitimately matched again
and the heal proceeded — the test passed on APFS (which never reuses
inode numbers immediately) and failed on Linux CI. Create the substitute
while the original still exists (guaranteed distinct inode), then rename
it over the original: the realistic atomic-swap shape, deterministic on
every filesystem.
@namastex888
namastex888 merged commit b2d9c3b into main Jul 26, 2026
28 checks passed
@automagik-genie
automagik-genie deleted the fix/musl-adapter-stderr branch September 25, 2026 04:50
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.

2 participants