Skip to content

feat: run omp-web on Bun instead of Next.js - #344

Merged
andrebrait merged 81 commits into
ompweb-dev:mainfrom
andrebrait:feat/bun-runtime
Nov 1, 2026
Merged

andrebrait merged 81 commits into
ompweb-dev:mainfrom
andrebrait:feat/bun-runtime

Conversation

@andrebrait

@andrebrait andrebrait commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #342 (which is stacked on #339). Until those merge, the diff below also shows their commits. Review the commits after 8e639641.

Summary

omp-web now runs on Bun instead of Next.js. Users see no change: URLs, ports, environment variables, the password gate, the event stream, file access rules, the notification store and the update commands all behave as before.

Why: Next blocks the next step for remote hosts, moving the host link onto a WebSocket, because a Next route cannot accept the upgrade. It also truncates proxied bodies over 10 MB, loads the startup code and the routes as separate module copies, and carries build traps. omp itself is a Bun program, and Bun covers most of what we installed separately.

  • Server: server/ serves the API, the static client and the SPA fallback from one Bun.serve. Route handlers stay at app/api/**/route.ts and use plain Web Request/Response; server/routes.ts mounts them, and a test fails when a route file and the table disagree. proxy.ts runs as the gate in front of every route, checked against the path the route actually matched.
  • Client: app/index.html and app/client.tsx are built by Bun's bundler (scripts/build-client.ts, Tailwind 4 via bun-plugin-tailwind, self-hosted fonts). next/dynamic and next/navigation are replaced by lib/dynamic.tsx and lib/navigation.ts.
  • Bun built-ins replace dependencies: bun:sqlite replaces node:sqlite (existing stores open unchanged), Bun.Image replaces sharp for thumbnails, and Bun's fetch handles HTTP(S)_PROXY/NO_PROXY, so undici and lib/http-dispatcher.ts are gone.
  • Distribution: the npm package bun (pinned to 1.4.4) is a dependency, so npm i -g and npx bring Bun along. The Node launcher bin/omp-web.js resolves that binary, including the @oven/bun-<os>-<arch> fallback when install scripts are disabled, and runs the server under it. ompweb host, the tray, the service helpers and the in-app update worker stay on Node; on Windows that keeps bun.exe free while npm replaces it.
  • Single binary: each release also attaches ompweb-<os>-<arch> archives (linux-x64/arm64, darwin-x64/arm64 .tar.gz, windows-x64 .zip): one program compiled with bun build --compile (npm run build:binary, scripts/build-binary.ts, NODE_ENV defined as production) and the static files beside it. The x64 builds use Bun's baseline runtime, so CPUs without AVX2 run them. server/binary.ts runs the web server in its own process with the launcher's flags, password and bind checks (now shared in checkLaunchSecurity), plus ompweb host (the daemon CLI moved to lib/hosts/host-cli.ts so both entries share it) and ompweb hash-password. It serves from its own directory (OMP_WEB_PACKAGE_DIR overrides), including node_modules/katex and the session-edit extension omp loads. Each archive carries licenses/: the license files of every npm package bundled into the program or dist/ (from Bun.build's metafiles) and Bun's own license. It has no tray, service installers or in-app update: Settings and the update toast link the release page, omp's "Update now" is hidden, and in-app update requests answer 409. The README lists the systemd units to write by hand.
  • Dev: npm run dev is one command with hot reload; the "never run next build during dev" trap is gone.
  • Tests: the suite runs under bun test --parallel without jiti. CI adds a smoke test of the built server and of a packed install (with and without install scripts), and parses the Windows PowerShell scripts. The smoke now also starts ompweb host, checks that a session lists through it and that omp gets the install's session-edit extension (a stand-in omp records its arguments); on Linux and Windows it also runs against the compiled binary (npm run smoke -- --binary), which proves the production define.

Behaviour notes

  • Restart ompweb once if you run it from a terminal. The in-app update to this release is applied by the launcher that is already running, and that old launcher restarts the server with Next, which the update just removed, so the server does not come back. Start ompweb (or npx @kahme247/ompweb) again once; later updates restart normally. systemd, launchd and the tray start the new launcher and are not affected.
  • Bun closes idle connections after about 10 s, and also cuts a request whose handler is still working by then. An authenticated API request runs without that limit, and the limit returns once its handler answers, so idle keep-alive sockets are still closed. Streams (the event stream, the login SSE, clone, search, bash-output and file downloads) keep it off; the host link does so only after its bearer check. Unauthenticated stalled sockets are always closed.
  • Login redirects use relative Location headers, and the origin check and the session cookie's Secure flag honour X-Forwarded-Proto, so a TLS-terminating proxy keeps working.
  • The request body limit is Bun's default of 128 MiB, above the largest handler limit (101 MB uploads).
  • An unknown page URL such as /does-not-exist now gets the app (sidebar plus the new-session view) with status 200, where Next answered 404 with its bare "This page could not be found." page. Unknown file paths (/foo/bar.txt) still get a 404.
  • The CSS keeps color-mix() as written, without Tailwind's solid-colour fallback (Bun's CSS bundler dropped some of the @supports overrides, which left solid accent squares and focus rings). Every browser Next targeted (Chrome 111, Safari 16.4) supports color-mix(); an older browser now gets no colour for those declarations instead of a full-strength one.
  • OMP_WEB_DEV_ORIGIN is removed; the client version variables are renamed to OMP_WEB_PUBLIC_* (build-time only).
  • The skills.sh search now gives up after 10 s and falls back to the skills find CLI, instead of waiting on a stalled skills.sh.

Not verified here

  • macOS runs (CI covers Windows; macOS needs a manual packed-install smoke). The linux-arm64 and darwin binaries were cross-compiled but not run (the darwin ones carry Bun's ad-hoc code signature); the Windows binary smoke runs in CI for the first time with this PR.
  • The Nix build: nix/package.nix uses the npm @oven/bun binary with autoPatchelfHook on Linux, and npmDepsHash must be refreshed on a machine with Nix.

Testing

  • npm run typecheck && npm run lint && npm test: 2003 pass, 12 skip, 0 fail.
  • npm run build && npm run smoke, against the repo and against a packed global install, with and without install scripts.
  • A real Node ompweb host daemon links to the Bun server and stays linked through an idle gap.
  • npm run build:binary for all five targets, and npm run smoke -- --binary release/ompweb-linux-x64/ompweb: the binary serves the SPA, /api/hosts, the KaTeX files and the manifest from its own directory with any cwd, its ompweb host links, /api/sessions lists a fixture session through it, and omp is started with the extension from the release directory. A binary compiled without the define fails the session step.
  • Headless browser: sidebar, ?session= deep links, styled math, fonts and all Settings tabs render; the theme color is set before first paint.

Design: docs/specs/2026-10-30-bun-runtime-design.md. Plan: docs/plans/2026-10-30-bun-runtime.md.

Closes #346.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 354 files, which is 254 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

Usage-priced reviews support at most 300 files.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a012aa25-f69d-48f7-a0f5-54be57b11a50
Commits

Reviewing files that changed from the base of the PR and between 1f9bc8e and a51025b.

Files ignored due to path filters: 8
  • app/fonts/geist-latin-wght-normal.woff2 is excluded by !**/*.woff2
  • app/fonts/jetbrains-mono-latin-wght-normal.woff2 is excluded by !**/*.woff2
  • app/fonts/noto-sans-mono-cyrillic-wght-normal.woff2 is excluded by !**/*.woff2
  • app/fonts/noto-sans-mono-latin-wght-normal.woff2 is excluded by !**/*.woff2
  • app/fonts/source-serif-4-latin-wght-normal.woff2 is excluded by !**/*.woff2
  • package-lock.json is excluded by !**/package-lock.json
  • public/favicon.ico is excluded by !**/*.ico
  • public/icon.svg is excluded by !**/*.svg
Files selected for processing: 354
  • .github/workflows/publish.yml
  • .github/workflows/verify-pr.yml
  • .gitignore
  • AGENTS.md
  • CHANGELOG.md
  • CONTRIBUTING.md
  • DESIGN.md
  • README.ja.md
  • README.md
  • README.zh-CN.md
  • app/api/agent/[id]/bash-output/route.ts
  • app/api/agent/[id]/route.ts
  • app/api/agent/new/route.ts
  • app/api/agents/route.ts
  • app/api/app-update/notes/route.ts
  • app/api/app-update/route.ts
  • app/api/auth/accounts/[provider]/route.ts
  • app/api/auth/all-providers/route.ts
  • app/api/auth/api-key/[provider]/route.ts
  • app/api/auth/login/[provider]/route.ts
  • app/api/auth/providers/route.ts
  • app/api/cwd/browse/route.ts
  • app/api/cwd/validate/route.ts
  • app/api/default-cwd/route.ts
  • app/api/events/route.ts
  • app/api/file-index/route.ts
  • app/api/files/[...path]/route.ts
  • app/api/git/diff/route.ts
  • app/api/git/status/route.ts
  • app/api/github-repo/route.ts
  • app/api/home/route.ts
  • app/api/hosts/link/blob/[reqId]/route.ts
  • app/api/hosts/link/route.ts
  • app/api/hosts/route.ts
  • app/api/manifest/route.ts
  • app/api/mcp/route.ts
  • app/api/media/[hash]/route.ts
  • app/api/model-roles/route.ts
  • app/api/models-config/catalog/route.ts
  • app/api/models-config/route.ts
  • app/api/models-config/test/route.ts
  • app/api/models/route.ts
  • app/api/notifications/devices/route.ts
  • app/api/notifications/history/route.ts
  • app/api/notifications/presence/route.ts
  • app/api/notifications/test/route.ts
  • app/api/omp-settings/route.ts
  • app/api/omp-update/route.ts
  • app/api/omp-version/route.ts
  • app/api/plugins/route.ts
  • app/api/projects/clone/route.ts
  • app/api/projects/route.ts
  • app/api/provider-usage/route.ts
  • app/api/providers/enable/route.ts
  • app/api/sessions/[id]/archive/route.ts
  • app/api/sessions/[id]/auto-name/route.ts
  • app/api/sessions/[id]/context/route.ts
  • app/api/sessions/[id]/entries/[entryId]/thinking/route.ts
  • app/api/sessions/[id]/export/route.ts
  • app/api/sessions/[id]/route.ts
  • app/api/sessions/[id]/state/route.ts
  • app/api/sessions/[id]/subagents/[subagentId]/route.ts
  • app/api/sessions/[id]/subagents/route.ts
  • app/api/sessions/archive/route.ts
  • app/api/sessions/import/route.ts
  • app/api/sessions/route.ts
  • app/api/sessions/search/route.ts
  • app/api/skills/check/route.ts
  • app/api/skills/install/route.ts
  • app/api/skills/route.ts
  • app/api/skills/search/route.ts
  • app/api/skills/update/route.ts
  • app/api/stt/[jobId]/audio/route.ts
  • app/api/stt/[jobId]/route.ts
  • app/api/stt/route.ts
  • app/api/usage/route.ts
  • app/api/web-auth/session/route.ts
  • app/api/web-settings/route.ts
  • app/api/windows-service/route.ts
  • app/api/worktrees/route.ts
  • app/boot.ts
  • app/client.test.mjs
  • app/client.tsx
  • app/fonts/Geist-OFL.txt
  • app/fonts/JetBrainsMono-OFL.txt
  • app/fonts/NotoSansMono-OFL.txt
  • app/fonts/SourceSerif4-OFL.txt
  • app/global-error.tsx
  • app/globals.css
  • app/index.html
  • app/layout.tsx
  • app/login/page.tsx
  • bin/bun-runtime.js
  • bin/bun-runtime.test.mjs
  • bin/linux-tray.js
  • bin/linux-tray.test.mjs
  • bin/network-addresses.js
  • bin/node-version-gate.test.mjs
  • bin/omp-web-hash-password.test.mjs
  • bin/omp-web-host.js
  • bin/omp-web-host.test.mjs
  • bin/omp-web-options.js
  • bin/omp-web-password-hash.js
  • bin/omp-web-security.test.mjs
  • bin/omp-web-systemd.js
  • bin/omp-web-systemd.test.mjs
  • bin/omp-web-tray.js
  • bin/omp-web-update-worker.test.mjs
  • bin/omp-web.js
  • bunfig.toml
  • components/AppErrorBoundary.tsx
  • components/AppShell-provider-usage.test.mjs
  • components/AppShell.tsx
  • components/AppUpdateDialog.tsx
  • components/ArchiveBrowser.test.mjs
  • components/ChatInput.btw.test.mjs
  • components/ChatInput.clipboard-image.test.mjs
  • components/ChatInput.navigation.test.mjs
  • components/ChatInput.queue-attachments.test.mjs
  • components/ChatInput.slow.test.mjs
  • components/ChatInput.test.mjs
  • components/ChatInput.tsx
  • components/ChatMinimap.test.mjs
  • components/ChatWindow.activity.test.mjs
  • components/ChatWindow.tsx
  • components/CommandPaletteMount.tsx
  • components/ComposerPanels.test.mjs
  • components/ExtensionDialog.ask.test.mjs
  • components/ExtensionDialog.mobile.test.mjs
  • components/ExtensionDialog.prompt-style.test.mjs
  • components/ExtensionDialog.test.mjs
  • components/ExtensionDialog.tsx
  • components/FileExplorer.test.mjs
  • components/FileViewer.markdown-links.test.mjs
  • components/FileViewer.tsx
  • components/HostsConfig.test.mjs
  • components/ImageLightbox.test.mjs
  • components/ImageLightbox.tsx
  • components/IosFocusZoomGuard.test.mjs
  • components/IosFocusZoomGuard.tsx
  • components/LocalDaemonBanner.test.mjs
  • components/LoginForm.test.mjs
  • components/LoginForm.tsx
  • components/MarkdownBody.agent-links.test.mjs
  • components/MarkdownBody.file-links.test.mjs
  • components/MarkdownBody.test.mjs
  • components/McpConfig.test.mjs
  • components/MermaidBlock.test.mjs
  • components/MessageView.test.mjs
  • components/ModelsConfig.test.mjs
  • components/NotificationBell.test.mjs
  • components/NotificationList.test.mjs
  • components/OmpRuntimeVersion.test.mjs
  • components/ProviderUsageBar.test.mjs
  • components/RouteLoadingFallback.test.mjs
  • components/RouteLoadingFallback.tsx
  • components/SessionSidebar-chrome.tsx
  • components/SessionSidebar-helpers.test.mjs
  • components/SessionSidebar.navigation.test.mjs
  • components/SettingsConfig.tsx
  • components/SettingsConfig.updates.test.mjs
  • components/SettingsTabs.test.mjs
  • components/SkillDiagnostics.test.mjs
  • components/SubagentTranscriptDialog.test.mjs
  • components/TabBar.test.mjs
  • components/TodoList.test.mjs
  • components/UpdateToast.test.mjs
  • components/UpdateToast.tsx
  • components/UsageConfig.test.mjs
  • components/ui/toast.click.test.mjs
  • components/ui/toast.swipe.test.mjs
  • components/ui/toast.test.mjs
  • docs/plans/2026-10-30-bun-runtime.md
  • docs/specs/2026-10-30-bun-runtime-design.md
  • eslint.config.mjs
  • flake.nix
  • hooks/__fixtures__/toast-stub.mjs
  • hooks/useAgentSession-sync.test.mjs
  • hooks/useAgentSession.rpc.test.mjs
  • hooks/useBtw.test.mjs
  • hooks/useDictation.behavior.test.mjs
  • hooks/useDictation.migration.test.mjs
  • hooks/useFontSize.test.mjs
  • hooks/useMobileSidebarGestures.test.mjs
  • hooks/useNavigationHistory.test.mjs
  • hooks/useRecentRunsLimit.test.mjs
  • hooks/useSidebarHistory.test.mjs
  • hooks/useSidebarHistory.ts
  • hooks/useTheme.test.mjs
  • hooks/useTheme.ts
  • hooks/useTouchTargets.test.mjs
  • hooks/useUiScale.test.mjs
  • hooks/useWordPrediction.test.mjs
  • instrumentation.node.ts
  • instrumentation.ts
  • lib/agent-skill-diagnostics-route.test.mjs
  • lib/agent-tools.test.mjs
  • lib/api-contract.test.mjs
  • lib/api-utils.ts
  • lib/auth-accounts-route.test.mjs
  • lib/btw.test.mjs
  • lib/chat-fork.test.mjs
  • lib/chat-transcript-plan.test.mjs
  • lib/directory-browser.ts
  • lib/draft-store.test.mjs
  • lib/dynamic.tsx
  • lib/event-stream-hub.test.mjs
  • lib/event-stream-hub.ts
  • lib/event-stream.ts
  • lib/file-access.test.mjs
  • lib/file-index-route.test.mjs
  • lib/file-links.test.mjs
  • lib/file-links.ts
  • lib/file-paths.test.mjs
  • lib/frontmatter.test.mjs
  • lib/git-changes.test.mjs
  • lib/git-clone.test.mjs
  • lib/github-repo.test.mjs
  • lib/hosts/daemon.test.mjs
  • lib/hosts/host-cli.ts
  • lib/hosts/hosts-route.test.mjs
  • lib/hosts/hub.test.mjs
  • lib/hosts/hub.ts
  • lib/hosts/link-driver.test-helper.mjs
  • lib/hosts/link-integration.test.mjs
  • lib/hosts/local-bootstrap.test.mjs
  • lib/hosts/local-host.ts
  • lib/hosts/no-direct-local.test.mjs
  • lib/hosts/pending-requests.test.mjs
  • lib/hosts/registry.test.mjs
  • lib/hosts/session-index.test.mjs
  • lib/hosts/session-index.ts
  • lib/hosts/session-ops.test.mjs
  • lib/http-dispatcher.ts
  • lib/i18n/locales/en.json
  • lib/i18n/locales/ja.json
  • lib/i18n/locales/zh-CN.json
  • lib/instrumentation-crash-policy.test.mjs
  • lib/manifest-route.test.mjs
  • lib/markdown-katex-css.test.mjs
  • lib/markdown.ts
  • lib/media-cache.ts
  • lib/media-route.test.mjs
  • lib/message-overflow.test.mjs
  • lib/model-catalog.test.mjs
  • lib/navigation.test.mjs
  • lib/navigation.ts
  • lib/notification-events.test.mjs
  • lib/notification-history-route.test.mjs
  • lib/notification-history.test.mjs
  • lib/notification-hub.test.mjs
  • lib/notification-store.test.mjs
  • lib/notification-store.ts
  • lib/npm-update.test.mjs
  • lib/npm-update.ts
  • lib/omp-web-options.test.mjs
  • lib/omp/agent-env-policy.ts
  • lib/omp/agent-env.test.mjs
  • lib/omp/agents-service.test.mjs
  • lib/omp/archive.test.mjs
  • lib/omp/mcp-config.test.mjs
  • lib/omp/models-config.test.mjs
  • lib/omp/omp-cli.test.mjs
  • lib/omp/omp-cli.ts
  • lib/omp/rpc-frame.test.mjs
  • lib/omp/rpc-process-runtime.test.mjs
  • lib/omp/session-archive.test.mjs
  • lib/omp/session-edit.native.test.mjs
  • lib/omp/session-edit.test.mjs
  • lib/omp/session-files.ts
  • lib/omp/settings-config.test.mjs
  • lib/omp/updates.test.mjs
  • lib/omp/win32-spawn.test.mjs
  • lib/paths.test.mjs
  • lib/project-command-env.test.mjs
  • lib/project-command-env.ts
  • lib/project-ordering.test.mjs
  • lib/project-registry.test.mjs
  • lib/provider-accounts.test.mjs
  • lib/provider-usage.test.mjs
  • lib/reconcile-guard.test.mjs
  • lib/request-security.test.mjs
  • lib/request-security.ts
  • lib/rpc-manager.test.mjs
  • lib/rpc-manager.ts
  • lib/security-headers.test.mjs
  • lib/self-update.test.mjs
  • lib/self-update.ts
  • lib/session-reader.test.mjs
  • lib/session-resume.test.mjs
  • lib/session-resume.ts
  • lib/session-routes.test.mjs
  • lib/session-search.test.mjs
  • lib/session-title.test.mjs
  • lib/sidebar-history-bridge.ts
  • lib/skill-diagnostics.test.mjs
  • lib/skill-lock.test.mjs
  • lib/skill-updates.test.mjs
  • lib/skills-service.test.mjs
  • lib/speech-sanitizer.test.mjs
  • lib/stt-jobs.ts
  • lib/stt-omp-gateway.test.mjs
  • lib/stt-route.test.mjs
  • lib/stt.ts
  • lib/subagent-history.test.mjs
  • lib/subagent-types.test.mjs
  • lib/syntax-highlight.ts
  • lib/table-chart.test.mjs
  • lib/thinking-levels.test.mjs
  • lib/tool-preset-preference.test.mjs
  • lib/transcript.test.mjs
  • lib/update-policy.test.mjs
  • lib/usage-db.test.mjs
  • lib/usage-db.ts
  • lib/usage-rates.test.mjs
  • lib/usage-service.test.mjs
  • lib/web-auth.test.mjs
  • lib/web-password-hash.test.mjs
  • lib/web-password-hash.ts
  • lib/web-settings.test.mjs
  • lib/web-settings.ts
  • lib/windows-service.test.mjs
  • lib/windows-service.ts
  • lib/workspace-memory.test.mjs
  • lib/worktree.test.mjs
  • next.config.ts
  • nix/package.nix
  • package.json
  • postcss.config.mjs
  • proxy.ts
  • scripts/build-binary.ts
  • scripts/build-client.ts
  • scripts/bun-LICENSE-1.4.4.md
  • scripts/licenses.ts
  • scripts/smoke.ts
  • scripts/tailwind-plugin.test.ts
  • scripts/tailwind-plugin.ts
  • scripts/windows/omp-web-service.ps1
  • scripts/windows/omp-web-tray.ps1
  • server/app.test.ts
  • server/app.ts
  • server/binary.ts
  • server/client-env.ts
  • server/dev.test.ts
  • server/dev.ts
  • server/http.test.ts
  • server/http.ts
  • server/main.ts
  • server/routes.test.ts
  • server/routes.ts
  • tests/mock-builtin.mjs
  • tests/package-files.test.mjs
  • tests/setup-dom.mjs
  • tsconfig.json

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

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@kilo-code-bot

kilo-code-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Code Review Roast 🔥

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. The incremental change just bumps the channel buffer to fit image-prompt echoes and teaches RpcProcess to recover cleanly if a resync cuts a chunk sequence mid-frame. The tests prove both cases. Sensible, minimal, and correctly handled.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (6 files)
  • AGENTS.md
  • docs/specs/2026-10-28-remote-hosts-design.md
  • lib/hosts/daemon.test.mjs
  • lib/hosts/link-protocol.ts
  • lib/omp/rpc-process.ts
  • lib/omp/rpc-process.test.mjs
Previous Review Summaries (8 snapshots, latest commit ebabe2c)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit ebabe2c)

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. The incremental change is a one-line security fix: Traefik sends wss as the X-Forwarded-Proto value on WebSocket upgrades, and the previous forwarded === "https" check would have fallen through to the raw request.url protocol (http:) — which would have flipped the session cookie's Secure flag off behind a TLS-terminating proxy. The fix treats wss as https:, and the two new test assertions cover both the honest-origin and the mismatched-origin cases.

📊 Overall: Like a seatbelt that actually clicks — small, unglamorous, and exactly what stops you from flying through the windshield.

Files Reviewed (2 files)
  • lib/request-security.ts - 0 issues
  • lib/request-security.test.mjs - 0 issues

Previous review (commit c3fdac2)

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. The incremental change is a documentation-only addition to README.md about macOS 15 local network permission — nothing to roast here.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (1 file)
  • README.md

Previous review (commit 51e40f4)

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. The incremental changes fix the provider usage header scrolling behavior and simplify self-update path resolution without introducing new issues.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (4 files)
  • CHANGELOG.md
  • app/globals.css
  • components/ProviderUsageBar.tsx
  • lib/self-update.ts

Previous review (commit e4452c2)

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. The incremental changes fix the provider usage header scrolling behavior and simplify self-update path resolution without introducing new issues.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (4 files)
  • CHANGELOG.md
  • app/globals.css
  • components/ProviderUsageBar.tsx
  • lib/self-update.ts

Previous review (commit 1325c4c)

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. The incremental changes add binary support, tighten port validation, refactor launcher security checks, and harden the static file serving without introducing new issues.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (45 files)
  • .github/workflows/publish.yml
  • .github/workflows/verify-pr.yml
  • .gitignore
  • AGENTS.md
  • CHANGELOG.md
  • README.ja.md
  • README.md
  • README.zh-CN.md
  • app/api/app-update/route.ts
  • app/api/omp-update/route.ts
  • app/client.test.mjs
  • bin/network-addresses.js
  • bin/omp-web-host.js
  • bin/omp-web-options.js
  • bin/omp-web-security.test.mjs
  • bin/omp-web.js
  • components/AppShell.tsx
  • components/AppUpdateDialog.tsx
  • components/SettingsConfig.tsx
  • components/SettingsConfig.updates.test.mjs
  • components/UpdateToast.test.mjs
  • components/UpdateToast.tsx
  • docs/plans/2026-10-30-bun-runtime.md
  • eslint.config.mjs
  • lib/api-contract.test.mjs
  • lib/hosts/host-cli.ts
  • lib/hosts/local-host.ts
  • lib/hosts/no-direct-local.test.mjs
  • lib/i18n/locales/en.json
  • lib/i18n/locales/ja.json
  • lib/i18n/locales/zh-CN.json
  • lib/omp-web-options.test.mjs
  • lib/self-update.ts
  • lib/update-policy.test.mjs
  • package.json
  • scripts/build-binary.ts
  • scripts/build-client.ts
  • scripts/bun-LICENSE-1.4.4.md
  • scripts/licenses.ts
  • scripts/smoke.ts
  • server/app.ts
  • server/binary.ts
  • server/http.test.ts
  • server/http.ts
  • server/main.ts

Previous review (commit e31e085)

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. All three previous findings — the realpathSync loop, the unguarded db.close(true), and the misleading UNGATED comment — are fixed, and the new static-shell work (app/index.html, RouteLoadingFallback.tsx, LoginForm's initialPassword prop, the tailwind-plugin.ts color-mix polyfill strip) is correct, tested, and documented. I checked the password carry-over timing, the inline script's /login guard, the regex's greedy-match safety, and the realBases cache's retry-on-missing behavior. Everything holds up.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (10 files)
  • app/client.tsx
  • app/globals.css
  • app/index.html
  • components/LoginForm.tsx
  • components/RouteLoadingFallback.tsx
  • lib/usage-db.ts
  • proxy.ts
  • scripts/build-client.ts
  • scripts/tailwind-plugin.ts
  • server/http.ts

Previous review (commit bbfd70e)

Verdict: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
🚨 critical 0
⚠️ warning 0
💡 suggestion 1
🤏 nitpick 2
Issue Details (click to expand)
File Line Roast
server/http.ts 96 realpathSync(base) called on every loop iteration in serveFile
lib/usage-db.ts 152 db.close(true) not wrapped in try/catch, masking migration errors
proxy.ts 21 UNGATED regex comment claims anchoring but assets/ is a prefix match

🏆 Best part: The test suite passes — 1985 pass, 0 fail. I'm almost disappointed; I had my flamethrower warmed up and everything.

💀 Worst part: db.close(true) unguarded in the migration error path — one close failure and the real error vanishes into the void.

📊 Overall: Like a first pancake — the shape is mostly right, but it needs one more pass on the griddle.

Fix these issues in Kilo Cloud

Files Reviewed (3 files)
  • server/http.ts - 1 issue
  • lib/usage-db.ts - 1 issue
  • proxy.ts - 1 issue

Previous review (commit 260ffda)

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (1 files)
  • proxy.ts

Reviewed by free · Input: 29.9K · Output: 2.2K · Cached: 263.4K

Comment thread server/http.ts Outdated
let stat: Stats;
try {
// statSync and Bun.file follow symlinks: serve a link only when its target stays inside the (real) base.
if (!realpathSync(file).startsWith(realpathSync(base) + path.sep)) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔥 The Roast: realpathSync(base) inside the serveFile loop is like asking for directions to the same restaurant every time you pass a landmark. base never changes during the loop, so you're hitting the filesystem for the same resolved path on every iteration. Not going to melt the server, but it's unnecessary syscalls on every file request.

🩹 The Fix: Hoist const realBase = realpathSync(base) out of the for loop, then compare against realBase + path.sep inside.

📏 Severity: nitpick

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 60ac7a9.

Comment thread lib/usage-db.ts Outdated
db.exec("PRAGMA journal_mode = WAL;");
db.exec("PRAGMA busy_timeout = 5000;");
db.exec("PRAGMA synchronous = NORMAL;");
try {
migrateUsageDatabase(db);
} catch (err) {
db.close();
db.close(true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔥 The Roast: db.close(true) in the migration catch block with no try/catch is like burning down the restaurant to kill a cockroach, then forgetting why you're homeless. If closing the database throws, you've just masked the original migration error — the very thing you were trying to report.

🩹 The Fix: Wrap db.close(true) in its own try/catch so the migration error propagates regardless.

📏 Severity: suggestion

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 60ac7a9.

Comment thread proxy.ts
// below or beside them skips the gate. /api/hosts/link and its blob/ subpath
// authenticate the host's bearer token themselves before they read any body
// (lib/hosts/hub.ts).
export const UNGATED = /^\/(?:assets\/|(?:favicon\.ico|icon\.svg|icon\.png|icon-192\.png|badge-96\.png|sw\.js)$|api\/hosts\/link(?:\/|$))/;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔥 The Roast: The comment says "The file names are exact (anchored), so no path below or beside them skips the gate" — but assets/ is conspicuously unanchored. /assets/anything still walks right through. You locked every window but left the front door open with a "please rob me" sign.

🩹 The Fix: Either anchor assets/ in the regex or update the comment to admit assets/ is intentionally a prefix match.

📏 Severity: nitpick

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 60ac7a9.

@andrebrait

Copy link
Copy Markdown
Collaborator Author

Multi-model review (8 models) and follow-up fixes

Eight independent reviewers ran the same adversarial review on 260ffda6: Fable 5.1, Opus 5.5, Sonnet 5.5, GPT-6.1 Sol, Grok 4.7, Haiku 5.5, GPT-6 Luna and GPT-6 Astra. Every finding below was fixed on this branch and re-reviewed. Each is marked as probed (reproduced against a running server) or code-read.

What held up

  • Password gate and origin check: they hold against raw-path tricks (.., %2e%2e, mixed encodings, double slashes), and a cross-origin POST is refused (probed by every reviewer).
  • Storage: existing node:sqlite stores open under bun:sqlite, and the busy-retry and rollback paths are right (probed).
  • Thumbnails: Bun.Image keeps EXIF orientation and refuses decompression bombs (probed).
  • Cleanup: the event stream cleans up when the client aborts, and SIGTERM exits cleanly (probed).
  • Tests: the jiti → bun test migration weakened no assertion (code-read, with mutation runs).

Findings and fixes

Behaviour vs Next

  • First update from a Next release: started from a terminal, the old launcher cannot restart the new server. The CHANGELOG now asks for one manual restart (code-read).
  • Trailing slashes: URLs with a trailing slash 308-redirect again, after the gate (probed).
  • /index.html: no longer serves the raw template (probed).
  • Static files: answer only GET and HEAD (probed).
  • API compression: API responses are no longer gzipped, as under Next. Gzip had made a 41 MB session load 2–4× slower (probed with a benchmark).
  • Idle timeout: Bun's timeout is lifted only while an authenticated API handler runs, and only streams keep it lifted after the response starts (probed).

Security

  • Symlinks: static serving no longer follows a symlink out of dist/ or public/ (probed).
  • Ungated names: the file names exempt from the password gate are matched exactly, so /icon.svg/foo is gated (probed).
  • Gzip negotiation: gzip;q=0 is honoured, and Vary is appended instead of replaced (probed).

Packaging and licences

  • Fonts: the font OFL licences ship with the npm package (probed with npm pack).
  • Binary archives: they carry every bundled package's licence and Bun's licence (probed).

Dev

  • Proxy: dev pages work with HTTP_PROXY set (probed).
  • Signals: SIGHUP stops the dev child (probed).
  • Stylesheet order: the stylesheet loads before the pre-paint scripts (probed).

Visual parity (audited separately against the Next build: screenshots, layout shift and first paint)

  • Colours: Bun 1.4.4 drops a repeated @supports block, which lost the color-mix() colours (workspace chip, focus rings). A small Tailwind plugin wrapper fixes it, and a build test pins it.
  • Fonts: the size-adjusted fallback faces from next/font are restored, so layout shift during font load matches Next.
  • Loading: the loading skeleton and the sign-in form paint from static HTML. They appear at about 0.6 s on Slow 4G, against Next's 1.2–1.5 s.

Tests

  • Source-text tests are removed or replaced by rendering and behaviour tests.

Not verified

  • macOS and arm64 runs.
  • The Nix build: npmDepsHash needs refreshing on a machine with Nix.

`npm test` is now `bun test --parallel --timeout 30000`. Tests load TS and
tsconfig paths natively, so jiti, the strip-types flags and
syncBuiltinESMExports are gone from the suite.

Baseline before the switch (node --test, 8691e96): 1974 tests, 1962 pass,
0 fail, 12 skip.
After: 1962 reported tests across the same 206 files, 1950 pass, 0 fail,
12 skip. Bun reports the 12 nested t.test() subtests inside their parent
test, so the count is 12 lower; a failing subtest still fails its parent.

- jiti codemod: createJiti and jiti.import become dynamic imports;
  moduleCache:false becomes ?fresh=N imports.
- Builtin mocks go through tests/mock-builtin.mjs (mock.module); Bun's
  mock.restore() does not undo mock.module, so the helper re-registers the
  real exports in t.after.
- tests/setup-dom.mjs drops its teardown and adds the DOM globals the tests
  name; Testing Library is imported dynamically after it.
- bin/*.js tests spawn node; TS child scripts run on Bun.
- isExecutableFile (omp-web-systemd) and isExecutable (linux-tray) call
  accessSync in try/catch: Bun's accessSync returns null, not undefined.
Bun's fs.watch drops an event that arrives within ~2 ms of the previous one, so a rapid second save never reached the file viewer. Re-stat once 50 ms after the last event (cleared on unsubscribe) and report a deletion once.
…ted dev pages

Bun's router matches the raw request path while proxy() and the handlers read the normalized request.url, so /api/files/../../assets/x/<path> reached the files handler with no cookie and no origin check. Each route now re-matches the normalized path (URLPattern) after the gate and takes its params from it, else 404.

Also: login redirects use a relative Location (Bun's request.url is always http://); Bun's default 128 MiB maxRequestBodySize replaces MAX_SAFE_INTEGER; the SPA fallback gets the index no-cache rule; /api is a 404, not the SPA; dev pages fetch the HTML import from /__omp_dev_index so they pass the gate and renderIndex, with blob: scripts allowed for HMR; dev.ts re-runs itself once with the OMP_WEB_PUBLIC_* values Bun inlines from its startup environment.
…ct-hooks

register() installs the SIGINT/SIGTERM exits before its first await. The launcher logs and retries every second when Bun cannot be resolved for an update restart instead of spinning. eslint-plugin-react-hooks is pinned to 7.0.1: 7.1 reports 19 new errors in existing components.
hooks/useDictation.ts imports isSttAfter from lib/stt.ts, which also held
readSttConfig. Bun's dev bundle does not tree-shake, so it shipped
process.env.OMP_WEB_STT_{ENDPOINT,KEY,MODEL} to the browser. readSttConfig
and SttConfig move to the server-only lib/stt-jobs.ts; lib/stt.ts keeps
only what the browser shares.
npm run smoke [-- --package <dir>] starts the launcher on a free port with a
throwaway HOME and checks: no process.env in the shipped dist/ JS, the SPA
(200, id="root", no-cache), a hashed asset (immutable, gzip), /api/hosts
JSON, /api/events open past Bun's 10 s idle default, and a clean stop.
verify-pr runs it on the repo and on a packed global install (ubuntu and
windows); publish runs it after the build; release:check ends with it.

package.json files ship app/api, server, dist, proxy.ts,
instrumentation.node.ts and tsconfig.json instead of .next.

Windows CI parses omp-web-service.ps1 and omp-web-tray.ps1 with the
PowerShell parser, replacing the source-text regex test in
lib/windows-service.test.mjs.

Nix: the fonts patch is gone; the build and the launcher use the npm
@oven/bun-<os>-<arch> binary (pinned 1.4.4; nixpkgs has at most 1.4.2),
patched with autoPatchelf on Linux, with bun's postinstall skipped. The
devShell gains bun. Unverified: nix is not installed here, so npmDepsHash
still needs refreshing with `nix build .#default` on a machine with nix.
Next server-rendered the sign-in form on /login; the Bun SPA showed an empty
page there until its bundle ran (about 3.1 s on Slow 4G). app/index.html now
carries LoginForm's first render in a <template>, and the /login inline
script swaps it in for the skeleton, so the form paints with the HTML and
CSS (about 0.6 s). createRoot replaces it on mount. A test keeps the static
copy identical to what LoginForm renders first.

Until the bundle runs, the script stops Enter from submitting the static
form (a native submit would reload /login and drop ?next=), and client.tsx
hands a password typed into it to LoginForm, so nothing typed is lost.
bin/omp-web-host.js now only loads it through jiti, so a compiled binary
can import the same CLI without jiti.
…tion start

checkLaunchSecurity (bin/omp-web-options.js), openInBrowser
(bin/network-addresses.js) and startProduction (server/app.ts) move out of
bin/omp-web.js and server/main.ts unchanged, so a second entry can run
them. The bind refusal test now runs the launcher instead of reading its
source.
npm run build:binary [-- --target bun-<os>-<arch>] compiles server/binary.ts
with the NODE_ENV=production define into release/ompweb-<os>-<arch>/, next
to dist/, public/, the KaTeX CSS and fonts, the session-edit extension and
the licenses, and archives it (.tar.gz; .zip for Windows). The binary runs
the web server in-process with the launcher's flags, password and bind
checks, plus ompweb host and ompweb hash-password, and serves from its own
directory unless OMP_WEB_PACKAGE_DIR names another.

npm run smoke now also starts ompweb host and checks that /api/sessions lists
a fixture session through it; --binary <path> runs the same steps against a
compiled binary.
In a compiled run (Bun.isStandaloneExecutable) /api/app-update reports
installMethod "binary", selfUpdateSupported false and the release page as
the update target, which Settings shows under a download message instead
of "run this command". Preparing an app or omp in-app update answers 409
there: the update worker needs Node and an npm install, and started on the
binary it would be a second ompweb. The binary smoke checks both.
…4 binary on PRs

publish.yml cross-compiles linux-x64/arm64, darwin-x64/arm64 and
windows-x64, smokes the linux-x64 binary with its own daemon, and uploads
the archives to the draft release before the npm publish. verify-pr.yml
builds the linux-x64 binary and runs npm run smoke -- --binary on it.
… CHANGELOG)

The binary's tray and service-installer refusals now point at the README
section by URL, since the release does not ship the README.
The cached real path went stale when a static directory was swapped while
the server ran (a link moved to a new release), and every file under the
new target answered 404. realpathSync per request costs about a
microsecond.
`ompweb -p abc` (or PORT=abc) printed a Node error naming NaN from the
npm launcher and a minified stack trace from the binary. parseLaunchOptions
now reports the bad port, and both entries print one line and exit 2.
Imports app/client.tsx on /login with a typed static field and checks the
rendered LoginForm's value; removing initialPassword={typedPassword} fails
it.
The omp update check now answers selfUpdateSupported (false in the compiled
binary, whose in-app updates answer 409), and Settings → System shows the
Update now button only when it is true. The omp update command and its
Copy button stay.
The ompweb update toast and Settings → System showed the release URL as a
command, with Copy ("Command copied") and, in the toast, "Update and
restart". For installMethod "binary" both now show it as a link that
opens in a new tab, with neither button. The toast body moved into
components/UpdateToast.tsx, shared with the omp update toast, whose Update
now button now also needs selfUpdateSupported.
They moved there from AppShell.tsx in f94afd1, which left this source-text
check failing.
…ributes

The archives carried only ompweb's, the fonts' and KaTeX's licenses, while
the binary embeds Bun (JavaScriptCore and WebKit are LGPL-2) and ~40 npm
packages (web-push is MPL-2.0, jszip MIT or GPL-3.0), and dist/ bundles
~160 more. Both builds now take Bun.build's metafile: build-client.ts
records the client's packages in build/client-packages.json, and
build-binary.ts copies every bundled package's LICENSE/NOTICE/COPYING
files into licenses/<name>@<version>/, adds Bun's license (vendored as
scripts/bun-LICENSE-1.4.4.md, required for the running Bun's version)
and writes licenses/README.md listing each package's declared license.
…indows binary

Bun's default x64 runtime needs AVX2, so the linux, darwin and windows
x64 binaries crashed on older CPUs (and darwin-x64 under Rosetta 2).
publish.yml now builds the -baseline targets, which build-binary.ts names
without the suffix, so the archive names stay ompweb-<os>-x64.

Both workflows run scripts/build-binary.ts after their npm run build
instead of npm run build:binary, which rebuilt the client per target.
verify-pr.yml smokes the binary on Windows too (ompweb.exe). On Windows
build-binary.ts archives with System32's bsdtar, since a Git Bash GNU tar
on PATH makes no zip and reads D:\ as a remote host.
A stand-in omp now answers the version and update checks and records the
arguments of every run. The smoke opens the fixture session and asserts
that omp got --extension with this install's own
lib/omp/session-edit-extension.mjs, which in the binary only resolves
through local-host.ts's fallback: without it omp gets
/$bunfs/omp/session-edit-extension.mjs, and the step fails. The host now
links as online, and the binary step also checks that the omp update check
answers selfUpdateSupported false.
… and archive notes

CHANGELOG: browsers older than Safari 16.2 or Chrome 111 lose the
color-mix() colours, which Next's targets left out too. server/app.ts says
that no test reaches handle()'s throw path (dispatch already turns a throw
into a 500). The README and publish.yml no longer claim the x64 binaries
run under Rosetta 2, which nobody checked. The plan's Bun built-ins table
gains the metafile row and the Windows bsdtar note.
2e66a50 said Bun's default x64 runtime needs AVX2. For Bun 1.4.4 it does
not: @oven/bun-{linux,darwin,windows}-x64 and their -baseline packages are
the same bytes, and the compiled binaries match. Naming -baseline keeps a
later Bun from shipping its -modern runtime instead.
Its plugin writes Tailwind's CSS (preflight included) into dist/, but the
metafile never names tailwindcss, so licenses/ left it out.
lib/api-contract.test.mjs no longer greps components/UpdateToast.tsx for
four string keys; components/UpdateToast.test.mjs renders the versions and
the Copy label, and now clicks Copy and checks the clipboard and the
"Command copied" toast (dropping that toast fails it).
@andrebrait
andrebrait merged commit d4b1f54 into ompweb-dev:main Nov 1, 2026
4 of 5 checks passed
andrebrait added a commit that referenced this pull request Nov 1, 2026
…isolate RPC ids (#363)

Three Codex findings in the code from #339, #342 and #344. npm start now sets OMP_WEB_PORT/OMP_WEB_HOSTNAME from the bound address, so the local daemon links. Archiving a remote session is refused (501 remote_unavailable; the menu item is disabled), because the archive browser could not restore it. Each RpcProcess uses its own request id prefix, so an adopted child's late answer to the previous server cannot settle a new command; regression test included.
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.

Proposal: replace Next.js with Bun (Bun.serve + Bun bundler)

1 participant