Skip to content

chore(bun): migrate checks and scripts to bun runtime - #5606

Closed
KooshaPari wants to merge 160 commits into
cheaper-inference:release/v3.8.44from
KooshaPari:koosha/bun-migration-clean
Closed

KooshaPari wants to merge 160 commits into
cheaper-inference:release/v3.8.44from
KooshaPari:koosha/bun-migration-clean

Conversation

@KooshaPari

Copy link
Copy Markdown
Contributor

Scope

  • Migrate selected CLI/build scripts from node+tsx to bun.
  • Restores missing runtime files for bun check commands.
  • Adds i18n fallback message used by sidebar gamification group.

Notes

  • �un run check:pack-artifact still fails in this branch because
    ext build requires missing dashboard root layouts in this repo state (known fork issue).
  • �un run check:provider-consistency, check:known-symbols, check:route-guard-membership, check:compression-budget, check:pack-policy are passing.

KooshaPari and others added 30 commits May 2, 2026 05:32
…el family (#1)

- Add 'invalid argument' to MODEL_UNAVAILABLE_FRAGMENTS so Antigravity 400
  errors on claude-opus-4-6-thinking trigger automatic fallback to
  claude-opus-4-6 or claude-opus-4-5-20251101
- Add NVIDIA Minimax model family for cross-model fallback when minimax-m2.7
  or minimax-m2.5 returns model-unavailable errors (404 Function not found)
* chore: add trufflehog ignore file [skip ci]

* chore: add trufflehog secrets scanning config [skip ci]
* chore(OmniRoute): add packageManager field

* chore(OmniRoute): add packageManager field

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(tsconfig): enable strict mode in OmniRoute

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(tsconfig): enable strict mode in OmniRoute

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(tsconfig): enable strict mode in OmniRoute

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(tsconfig): enable strict mode and related flags in OmniRoute

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(tsconfig): enable strict mode and related flags in OmniRoute

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(tsconfig): enable strict mode in OmniRoute

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(tsconfig): enable strict mode in OmniRoute

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore(OmniRoute): add benchmarks and test scaffolding

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* docs(omniroute): add sladge badge evidence

Co-authored-by: Codex <noreply@openai.com>

* fix(omniroute): align benchmark tests with correct test runner

Convert benchmarks.test.ts from Vitest globals to node:test/assert API so
it runs correctly under node --test (used by both test:unit and test:benchmarks).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore: add missing governance files

* chore: pin trufflehog action to SHA

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Codex <noreply@openai.com>
Conflict resolution: accepted upstream version for all conflicting files.
Local agent-specific customizations in .agents/workflows/ and i18n docs
were removed in favor of upstream's evolved versions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Resolved conflicts by accepting origin/main version for:
- README.md, package.json (fork-specific content)
- src/lib/benchmarks.ts, tsconfig.json (deleted per upstream)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds cancel-in-progress concurrency groups to:
- build-fork.yml
- claude.yml
- docker-publish.yml
- electron-release.yml
- lock-released-branch.yml
- npm-publish.yml

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Replace ubuntu-latest with ubuntu-24.04 across all jobs
- Upgrade actions/checkout@v4 → v6 in opencode-plugin-ci.yml and opencode-provider-ci.yml
- Upgrade actions/setup-node@v4 → v6 in opencode-plugin-ci.yml
- Replace ubuntu-latest with ubuntu-24.04 across all jobs
- Upgrade actions/checkout@v4 → v6 in opencode-plugin-ci.yml and opencode-provider-ci.yml
- Upgrade actions/setup-node@v4 → v6 in opencode-plugin-ci.yml
- Replace ubuntu-latest with ubuntu-24.04 across all jobs
- Upgrade actions/checkout@v4 → v6 in opencode-plugin-ci.yml and opencode-provider-ci.yml
- Upgrade actions/setup-node@v4 → v6 in opencode-plugin-ci.yml
- Replace ubuntu-latest with ubuntu-24.04 across all jobs
- Upgrade actions/checkout@v4 → v6 in opencode-plugin-ci.yml and opencode-provider-ci.yml
- Upgrade actions/setup-node@v4 → v6 in opencode-plugin-ci.yml
- Replace ubuntu-latest with ubuntu-24.04 across all jobs
- Upgrade actions/checkout@v4 → v6 in opencode-plugin-ci.yml and opencode-provider-ci.yml
- Upgrade actions/setup-node@v4 → v6 in opencode-plugin-ci.yml
- Replace ubuntu-latest with ubuntu-24.04 across all jobs
- Upgrade actions/checkout@v4 → v6 in opencode-plugin-ci.yml and opencode-provider-ci.yml
- Upgrade actions/setup-node@v4 → v6 in opencode-plugin-ci.yml
- Replace ubuntu-latest with ubuntu-24.04 across all jobs
- Upgrade actions/checkout@v4 → v6 in opencode-plugin-ci.yml and opencode-provider-ci.yml
- Upgrade actions/setup-node@v4 → v6 in opencode-plugin-ci.yml
- Replace ubuntu-latest with ubuntu-24.04 across all jobs
- Upgrade actions/checkout@v4 → v6 in opencode-plugin-ci.yml and opencode-provider-ci.yml
- Upgrade actions/setup-node@v4 → v6 in opencode-plugin-ci.yml
- Replace ubuntu-latest with ubuntu-24.04 across all jobs
- Upgrade actions/checkout@v4 → v6 in opencode-plugin-ci.yml and opencode-provider-ci.yml
- Upgrade actions/setup-node@v4 → v6 in opencode-plugin-ci.yml
ubuntu-latest is ambiguous and may advance to ubuntu-26.04 in future
runners, causing unexpected breakage. Pin explicitly to ubuntu-24.04.
The Claude Code workflow had no top-level permissions: block. Add
minimal scoped permissions (read on contents/pull-requests/issues,
write on id-token/actions) matching what the job actually needs.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add upstream remote: diegosouzapw/OmniRoute (latest: v3.8.8)
- Create UPSTREAM_SYNC.md: protocol for tracking + cherry-picking upstream fixes
- Create docs/ADR-001-canonical-routing.md: decision to make OmniRoute the canonical
  routing project, rebuilt around bifrost + cliproxy

Cluster convergence plan: phenoAI/phenoRouterMonitor/Tokn/helios-router are archive
candidates pending migration into OmniRoute workspace. Source repos remain intact.

Completes STEP 10 of phenotype-registry RATIONALIZATION_PLAN.md.
Scaffold the bifrost-consuming routing core per ADR-001:
- src/domain/router/port.ts: RouterPort interface, RouteRequest/Response/Error
  types, RouterConfig with provider priority + tier overrides, DEFAULT_ROUTER_CONFIG
- src/lib/adapters/bifrostAdapter.ts: wraps bifrost OpenAI-compat HTTP gateway;
  x-provider header injection, bearer auth, fallback across priority list,
  fitnessTier overrides, listAvailableProviders + listModels
- src/lib/adapters/fakeRouterAdapter.ts: in-memory RouterPort for unit tests
  with preconfigured queue + introspectable call log
- tests/unit/bifrost-routing-core.test.ts: 20 TDD tests, all green (no live gateway)

Refs: ADR-001, feat/bifrost-routing-core

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…MCP walkthrough, fallback demo, architecture) (#11)
KooshaPari and others added 16 commits June 30, 2026 02:37
- Restore root package.json from upstream + add packageManager: bun@1.3.11
- Restore root tsconfig.json from upstream with Bun compatibility (types: ["bun-types"], target: ESNext)
- Update open-sse/package.json with packageManager field and bun-types devDependency
- Remove bun.lock from .gitignore to track lockfile for reproducible installs
- Run bun install to generate bun.lock (3,764 packages, 0 core logic changes)
Drops the \`node --import tsx\` loader for the provider-reference generator script.
Drops \`node --import tsx\` for the runtime-version check script.
Drops \`node --import tsx\` for the known-symbols allow-list check.
Drops \`node --import tsx\` for the compression-budget check script.
…-native

Drops \`node --import tsx\` for the route-guard-membership check script.
@KooshaPari
KooshaPari requested a review from diegosouzapw as a code owner June 30, 2026 10:20

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several repository hygiene and configuration updates, including a migration to the Bun runtime, the addition of a new desktop shell spike in desktop-electrobun, and the integration of the bifrost Go gateway as a Tier-1 router layer. Key issues identified in the review include invalid Docker image tags (caddy:2-latest and redis:7-latest) in the scaling deployment configuration, an unsupported --no-install flag used with bunx in the Git hooks, and a typo in the Electrobun webview method name (executeJavascript instead of executeJavaScript) that silences custom renderer URL configuration. Additionally, improvements were suggested to add a safe fallback for $GIT_DIR in the commit message hook and to replace npx with bunx in the Justfile to align with the Bun migration.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.


services:
loadbalancer:
image: caddy:2-latest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The image tag caddy:2-latest is not a valid tag on Docker Hub. Attempting to pull this image will fail with a "manifest not found" error, breaking the deployment. The correct tag should be caddy:2 or caddy:2-alpine.

    image: caddy:2

- omniroute-net

redis:
image: redis:7-latest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The image tag redis:7-latest is not a valid tag on Docker Hub. Attempting to pull this image will fail with a "manifest not found" error, breaking the deployment. The correct tag should be redis:7 or redis:7-alpine.

    image: redis:7

Comment thread .husky/pre-commit
Comment on lines +13 to +17
if command -v bunx >/dev/null 2>&1 && bunx --no-install lefthook --version >/dev/null 2>&1; then
echo "→ lefthook pre-commit (DEBT-002 fixed)"
bunx lefthook run pre-commit
exit $?
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The bunx command does not support the --no-install flag. Passing --no-install to bunx will cause it to fail with a package not found error, preventing the hook from running. Since lefthook is a local dependency, you can check for its presence directly in node_modules/.bin/ which is much faster and more reliable.

if [ -f node_modules/.bin/lefthook ]; then
  echo "→ lefthook pre-commit (DEBT-002 fixed)"
  bunx lefthook run pre-commit
  exit $?
fi

Comment thread .husky/pre-push
Comment on lines +9 to 13
if command -v bunx >/dev/null 2>&1 && bunx --no-install lefthook --version >/dev/null 2>&1; then
echo "→ lefthook pre-push (DEBT-002 fixed)"
bunx lefthook run pre-push
exit $?
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The bunx command does not support the --no-install flag. Passing --no-install to bunx will cause it to fail with a package not found error, preventing the hook from running. Since lefthook is a local dependency, you can check for its presence directly in node_modules/.bin/ which is much faster and more reliable.

if [ -f node_modules/.bin/lefthook ]; then
  echo "→ lefthook pre-push (DEBT-002 fixed)"
  bunx lefthook run pre-push
  exit $?
fi

Comment on lines +61 to +65
win.webview.executeJavascript(`window.__RENDERER_URL__ = ${JSON.stringify(DEV_URL)};`);
} catch {
/* webview not ready yet — fallback page uses its baked-in default */
}
return win;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

There is a typo in the method name. It uses executeJavascript (lowercase s) instead of executeJavaScript (capital S). Since Electrobun's API uses executeJavaScript (as also referenced in the comment on line 115), this call will throw an error. Because of the try-catch block, the error is silently swallowed, causing the custom RENDERER_URL configured in .env to be silently ignored.

  try {
    win.webview.executeJavaScript(`window.__RENDERER_URL__ = ${JSON.stringify(DEV_URL)};`);
  } catch {
    /* webview not ready yet — fallback page uses its baked-in default */
  }

# (which is where git stores the in-progress commit message regardless of how
# it was provided). Either path is reliable for `git commit -m "..."`.

msg_file="${1:-$GIT_DIR/COMMIT_EDITMSG}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

If $GIT_DIR is not set or is empty (which is common when running hooks manually or in certain environments), $GIT_DIR/COMMIT_EDITMSG will resolve to /COMMIT_EDITMSG (an absolute path to the root directory), causing the script to fail to find the commit message file. Using ${GIT_DIR:-.git}/COMMIT_EDITMSG provides a safe fallback to the default .git directory.

msg_file="${1:-${GIT_DIR:-.git}/COMMIT_EDITMSG}"

Comment thread Justfile
Comment on lines +36 to +37
fmt:
npx --yes prettier --write .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Since the project is migrating to the Bun runtime, we should use bunx instead of npx for formatting to align with the rest of the migration and improve performance.

fmt:
    bunx prettier --write .

Comment thread Justfile
Comment on lines +40 to +41
typecheck:
npx tsc --noEmit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Since the project is migrating to the Bun runtime, we should use bunx instead of npx for type-checking to align with the rest of the migration and improve performance.

typecheck:
    bunx tsc --noEmit

@KooshaPari

Copy link
Copy Markdown
Contributor Author

Update: branch contains 11 bun-migration commits including provider-consistency/known-symbols/route-guard-membership/compression-budget/pack-policy + i18n fix. All migrated checks pass except �un run check:pack-artifact due Next.js dashboard root-layout errors (expected with current dash layout drop), so this remains the only functional blocker in PR for green checks.

@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.8.43 June 30, 2026 10:38
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for driving the Bun migration, @KooshaPari. Holding this for now — adopting Bun as a sanctioned runtime is a project-level strategic decision (CLAUDE.md currently pins Node.js ≥22, and no CI workflow installs Bun yet), so it needs an explicit green-light before any Bun-invoking script lands.

Separately, this PR can't merge as-is even once Bun is approved — the branch (off a very old base, ~148 drift commits) carries collateral regressions that would break the release:

  • Version downgrade: package.json 3.8.43→3.8.38 and open-sse/package.json 3.8.43→3.8.37
  • "private": true added to package.json → would block npm publish (breaks the release pipeline)
  • scripts/dev/tls-options.mjs + scripts/build/runtime-env.mjs removed from the npm files[] → re-introduces the ENOENT boot crash fixed in fix(cli): restore dist/tls-options.mjs to npm tarball (#5452) #5503
  • dompurify removed from dependencies; safe-regex removed from open-sse (both are CLAUDE.md secure-by-default libs)
  • check:pack-artifact failing (acknowledged in the PR)

If/when we sanction Bun, the clean path is: rebase only the script-swap commits onto the current release/v3.8.43 tip (drop the 'restore missing files' commits entirely), keep the version/deps/files[] intact, and add an oven-sh/setup-bun step to CI first. Happy to help land it that way once the runtime decision is made.

@diegosouzapw diegosouzapw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @KooshaPari. The narrow bun-script migration is welcome, but as submitted this PR is ~2,283 files / 160 commits and bundles a lot that can't go in as one change:

  • deletes ~1,092 docs/i18n/ files and removes 15+ workflow files (including the quality-gate / quality-extended / docs-sync-strict / i18n / nightly jobs) and guts ci.yml — that would remove the CI quality gates;
  • removes the cursor provider (src/lib/oauth/providers/cursor.ts + open-sse/utils/cursorChecksum.ts) with no replacement;
  • widens bun into build:cli and check:pack-artifact / check:pack-policy, which are explicitly off-limits per CLAUDE.md, and bumps the pinned bun 1.3.10 → 1.3.11, without the required byte-identical validation;
  • .husky/pre-push fallback becomes exit 0 (silently skips the gate if lefthook isn't installed);
  • several commits carry Co-authored-by: Claude …@anthropic.com / Codex …@openai.com trailers, which we can't accept upstream (Rule #16).

Could you re-open this as a narrow PR against release/v3.8.43 containing only the already-allow-listed script switches — gen:provider-reference, bench:compression, check:compression-budget, check:provider-consistency, check:known-symbols — with a byte-identical-output note for each (node --import tsx vs bun)? The CI / i18n / provider-removal / governance changes each deserve their own scoped PR reviewed on its own merits, and I'm happy to review those separately.

@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.43 to release/v3.8.44 July 2, 2026 16:18
@KooshaPari

Copy link
Copy Markdown
Contributor Author

Closing: runaway PR (>100 files changed or >5000 deletions). Too large to safely review/merge.

@KooshaPari KooshaPari closed this Jul 2, 2026
@KooshaPari
KooshaPari deleted the koosha/bun-migration-clean branch August 13, 2026 06:54
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