Skip to content

Release 0.3.8#1356

Merged
Wirasm merged 4 commits intomainfrom
dev
Apr 22, 2026
Merged

Release 0.3.8#1356
Wirasm merged 4 commits intomainfrom
dev

Conversation

@Wirasm
Copy link
Copy Markdown
Collaborator

@Wirasm Wirasm commented Apr 22, 2026

Release 0.3.8

Hotfix for v0.3.7 — restore working compiled binaries. v0.3.7 was tagged but never shipped any working assets: two distinct bugs (Pi SDK's module-init package.json read, and Bun --bytecode producing broken output for this project's module graph) made every compiled archon binary crash at startup. The v0.3.7 GitHub Release was deleted immediately (the tag remains for history); v0.3.8 is the first release with working archon-{darwin,linux}-{arm64,x64} and archon-windows-x64.exe binaries since v0.3.6. Homebrew and install.sh were never updated to v0.3.7, so users were not exposed to the broken state.

Fixed

  • Compiled archon binaries no longer crash at startup when the Pi provider is bundled. @mariozechner/pi-coding-agent/dist/config.js runs readFileSync(getPackageJsonPath(), 'utf-8') at module top-level, which inside a compiled binary resolves to dirname(process.execPath) + '/package.json' — a path that doesn't exist next to /usr/local/bin/archon, making every archon command (including archon version) crash with ENOENT before it ran. The Pi SDK and all Pi-dependent helper modules are now dynamically imported inside PiProvider.sendQuery(). A regression test (provider-lazy-load.test.ts) walks the same registerCommunityProviders() + getAgentProvider('pi') path the CLI and server take and asserts neither SDK package was resolved. Claude and Codex providers keep their static import style — their SDKs have no equivalent module-init side effect. (fix(providers/pi): lazy-load Pi SDK to unbreak compiled archon binary #1355)
  • Release binary compile no longer silently produces broken bytecode. scripts/build-binaries.sh dropped the --bytecode flag: Bun 1.3.11's bytecode step failed with Failed to generate bytecode for ./cli.js against the 0.3.7 module graph and fell through to producing a binary that crashed at module instantiation with "Expected CommonJS module to have a function wrapper". Windows was already excluded; this removes the flag everywhere. Release parity preserved via --minify. (fix(build): drop --bytecode from compiled-binary build #1354)

Merging this PR releases 0.3.8 to main.

Wirasm and others added 4 commits April 22, 2026 13:58
Bun 1.3.11's bytecode generation produces broken output for our
module graph ("TypeError: Expected CommonJS module to have a function
wrapper" at runtime, reproduces natively on darwin-arm64 too). The
compile already fails with "Failed to generate bytecode for ./cli.js"
and proceeds without it, but the resulting binary still crashes at
module instantiation.

Only --minify remains. Binary size is unchanged in practice
(bytecode was being skipped after the error anyway), but now the
build succeeds cleanly and the binary runs.

Surfaced while building the v0.3.7 release.
…failure recovery

Two gaps caused the v0.3.7 release to ship an empty GitHub Release and break
install.sh for all users for ~30 min. Both are now handled in the skill:

1. Step 1.5 — mandatory pre-flight `bun build --compile` smoke test before
   any user-visible step (version bump, PR, tag). Compiles the native target
   only (~15-30s), runs `archon version`, greps the output for runtime-error
   markers, aborts if anything fails. This would have caught both v0.3.7
   bugs (the --bytecode flag producing broken bytecode, and the Pi SDK's
   readFileSync of a path only present in node_modules) before the tag
   was ever pushed. Escape hatch: fix the underlying bug on a feature
   branch and re-run /release — no workaround to "just skip".

2. Step 10 now detects deterministic CI failure (two reruns with same
   error) and jumps to a new "Recovery: deterministic release CI failure"
   section instead of looping until timeout. Recovery documents:
     - Delete the empty GitHub Release (keep the tag — immutability)
       so releases/latest falls back to the prior working version and
       install.sh stops 404-ing within seconds.
     - Diagnose via `gh run view --log-failed`, with a cheat-sheet of
       common failure modes (bundler bytecode, module-init crashes,
       Windows timeouts).
     - Cut the NEXT patch version with the fix — never reuse the broken
       tag, never force-push, never upload binaries built from a
       different SHA onto the original release.
     - CHANGELOG note template that references the broken prior version
       so the audit trail is clear for anyone inspecting tags later.

Also added two Important Rules:
  - Never skip Step 1.5. The ~30s cost keeps failure modes local.
  - If Step 1.5 fails, abort the release. No "skip and hope CI passes."

Skill grows from 389 → 548 lines. No changes to Steps 2–9, 11, 12.
…#1355)

* fix(providers/pi): lazy-load Pi SDK to unbreak compiled archon binary

Pi's @mariozechner/pi-coding-agent/dist/config.js runs
`readFileSync(getPackageJsonPath(), 'utf-8')` at module top level. Inside
a compiled archon binary `getPackageJsonPath()` resolves to
`dirname(process.execPath) + '/package.json'`, which doesn't exist next
to `/usr/local/bin/archon` — so archon crashes with ENOENT at startup
before any command runs. v0.3.7's release binary build appeared to
compile clean (CI fell over first on an unrelated --bytecode issue) but
even the fixed-bytecode binary fails the same way locally.

Convert all Pi SDK value imports and Pi-dependent helper imports to
dynamic imports inside `PiProvider.sendQuery()`. Type-only imports stay
static (erased by TS). Effect: registering the Pi provider and creating
an instance no longer loads Pi's SDK — load happens only when a Pi
workflow actually runs. Claude and Codex providers keep their static
import style (their SDKs have no module-init side effects that fail in
a binary); see the file header comment in provider.ts for why Pi is the
deliberate outlier.

Class constructors (AuthStorage, ModelRegistry, SettingsManager) are
accessed via `piCodingAgent.X` rather than destructured to keep
eslint's naming-convention rule happy without a disable.

Add a regression test (provider-lazy-load.test.ts) that mocks
@mariozechner/pi-coding-agent and @mariozechner/pi-ai, walks the same
registerCommunityProviders() → getAgentProvider('pi') path the CLI and
server take, and asserts neither SDK module was loaded. Runs in its own
`bun test` invocation (mock.module is process-wide).

Verified locally: `bun build --compile --minify --target=bun-darwin-arm64`
produces a binary whose `archon version` runs cleanly and reports
Build: binary, where previously every command crashed at boot.

* address review: changelog, docstring, type tighten, Theme type-only import

From the multi-agent review on #1355:

- Add CHANGELOG.md entries under [Unreleased] ### Fixed for this PR's Pi
  lazy-load fix and the --bytecode removal from #1354 — both user-visible
  fixes (compiled binary unusable without them).
- Rewrite the test-header docstring in provider-lazy-load.test.ts to
  describe counter-based detection instead of "mocks throw" (contradicted
  the actual code directly below it).
- Tighten `lookupPiModel`'s first parameter from `unknown` to a local
  `GetModelFn` alias, moving the runtime-string cast to the single call
  site with a pointer to the docblock.
- Update the class docblock on `PiProvider` — "v1 capabilities are all
  false" was stale; PI_CAPABILITIES has seven flags set to true.
- `ui-context-stub.ts` imports `Theme` as a non-type value even though
  every usage is in a type position. Fold it into the existing
  `import type {…}` block so a future runtime-class `Theme` in Pi can't
  reintroduce an eager module load via this sibling.

No behavior change. Type-check, lint, format, tests, and a local
darwin-arm64 compile + version smoke all clean.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 84f01242-e677-4a67-9185-89494c7e676d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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 and usage tips.

@Wirasm Wirasm merged commit 8697508 into main Apr 22, 2026
9 of 11 checks passed
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.

1 participant