Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Binary prerelease

# Every commit on main that passed Verify PR becomes a GitHub prerelease carrying the five single binaries,
# titled with the time it was created (2026-11-01T10:30:00Z), tag 20261101T103000Z-<short sha> (git tags
# cannot hold ":"; the sha keeps parallel runs apart). Prereleases are never "latest", so the in-app update
# notice and `v*` releases are unaffected.
on:
workflow_run:
workflows: [Verify PR]
types: [completed]
branches: [main]
workflow_dispatch:

# One group per commit: a shared group keeps only one pending run, so a burst of merges would drop commits.
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_sha || github.sha }}
cancel-in-progress: false

permissions:
contents: write

jobs:
prerelease:
# A manual run publishes main only: from another branch it would ship that branch's unverified code.
if: (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push')
runs-on: ubuntu-latest
env:
SHA: ${{ github.event.workflow_run.head_sha || github.sha }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
ref: ${{ env.SHA }}
# npm ci runs dependency install scripts: keep the write token out of .git/config (gh reads GH_TOKEN).
persist-credentials: false

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version-file: .nvmrc
cache: npm

- run: npm ci
- run: npm run build
- name: Build the release binaries
run: sh scripts/build-release-binaries.sh
- run: npm run smoke -- --binary release/ompweb-linux-x64/ompweb

- name: Publish the prerelease
env:
GH_TOKEN: ${{ github.token }}
run: |
now=$(date -u +%s)
title=$(date -u -d "@$now" +%Y-%m-%dT%H:%M:%SZ)
tag=$(date -u -d "@$now" +%Y%m%dT%H%M%SZ)-$(git rev-parse --short=10 "$SHA")
subject=$(git log -1 --format=%s "$SHA")
# A draft first, so a failed upload never leaves a published prerelease missing archives.
gh release create "$tag" release/ompweb-*.tar.gz release/ompweb-*.zip \

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: release/ompweb-*.tar.gz release/ompweb-*.zip — you're publishing a prerelease by glob. If the build step is ever reordered, the archives are missing, or someone renames a target, this hands gh literal asterisks and a release that either fails late or ships with filenames that look like shell incantations. It couples the publish step to an unverified naming convention with no guardrail.

🩹 The Fix: Verify the archives exist before touching the release, so a renamed or missing target can't sneak in or get shipped:

sh
shas=(release/ompweb-.tar.gz release/ompweb-.zip)
for f in "${shas[@]}"; do [ -e "$f" ] || { echo "missing $f" >&2; exit 1; }; done
gh release create "$tag" "${shas[@]}" --repo "$GITHUB_REPOSITORY" --target "$SHA" --draft --prerelease --title "$title" --notes "..."

📏 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.

Not changing this. scripts/build-release-binaries.sh runs with set -eu, so a target that fails to build fails the job before this step. An unmatched glob reaches gh as a literal path, and gh release create stops on a missing asset file, before a release or tag exists. Either way the job fails before anything is published.

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 publish step still globs release/ompweb-*.tar.gz/.zip with no existence guard, coupling the release to an unverified naming convention. If build-release-binaries.sh renames or fails to produce an archive, gh release create either errors out or silently ships a partial release.

🩹 The Fix: Add a guard before publishing, e.g.

Suggested change
gh release create "$tag" release/ompweb-*.tar.gz release/ompweb-*.zip \
test "$(ls release/ompweb-*.tar.gz release/ompweb-*.zip 2>/dev/null | wc -l)" -eq 6

or verify each expected archive exists explicitly.

📏 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.

Same point as the earlier thread, so I'm not changing this. A build that produces no archive can't reach this step: build-release-binaries.sh runs with set -eu, so any target that fails stops the job first. A renamed target still matches ompweb-* and ships under its new name, so nothing is dropped. The suggested count is also wrong: there are 5 archives (4 .tar.gz and 1 .zip), not 6.

--repo "$GITHUB_REPOSITORY" --target "$SHA" --draft --prerelease --title "$title" \
--notes "Binaries built from $GITHUB_REPOSITORY@$SHA ($subject). Not a release: no npm package, no update notice."
gh release edit "$tag" --repo "$GITHUB_REPOSITORY" --draft=false
9 changes: 1 addition & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,8 @@ jobs:
- run: npm run build
- run: npm run smoke

# Bun cross-compiles all five from here (scripts/build-binary.ts), from the client built above:
# release/ompweb-<os>-<arch>.tar.gz, .zip for Windows. The x64 targets name -baseline (no AVX2 needed): in Bun 1.4.4
# that is the default x64 runtime too (the same bytes), and naming it keeps a later Bun from shipping a -modern one.
# They keep the plain ompweb-<os>-x64 names.
- name: Build the release binaries
run: |
for target in bun-linux-x64-baseline bun-linux-arm64 bun-darwin-x64-baseline bun-darwin-arm64 bun-windows-x64-baseline; do
npx bun scripts/build-binary.ts --target "$target"
done
run: sh scripts/build-release-binaries.sh
- run: npm run smoke -- --binary release/ompweb-linux-x64/ompweb

- name: Create draft GitHub Release
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ scripts/
tailwind-plugin.ts bun-plugin-tailwind minus Tailwind's color-mix() polyfill (Bun 1.4.4 drops repeated @supports rules); build and dev
smoke.ts `npm run smoke`: starts the built server (or `--binary <path>`) and `ompweb host` with a throwaway HOME; checks the SPA, an asset, the API, a session listed through the daemon and SSE
build-binary.ts `npm run build:binary`: compiles server/binary.ts (NODE_ENV define, no .env/bunfig autoload) into release/ompweb-<os>-<arch>/ beside dist/, public/, the KaTeX files, the session-edit extension and the licenses; archives it
build-release-binaries.sh the five release targets (one list), run by publish.yml and prerelease.yml (a prerelease per verified `main` commit, titled by build time; one concurrency group per commit, so no commit's run is dropped)
licenses.ts the release's `licenses/`: license files of every npm package the server and client bundles hold (Bun.build metafiles; build-client.ts writes build/client-packages.json) and `bun-LICENSE-<version>.md`, the vendored license of the embedded Bun runtime. Bumping Bun: vendor its LICENSE.md for the new version, or build-binary.ts stops

dist/ build output (git-ignored, shipped in the package); the production server reads index.html and assets from here
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f
- **Run sessions on other machines from one ompweb.** Link a machine (for example a MacBook) with **Settings → Hosts → Add host**, then run `ompweb host login --url <server url>` (the token is read from stdin) and `ompweb host` there. The remote machine keeps its own `omp`, agent directory and credentials; ompweb routes. The sidebar groups sessions by host, the new-session screen has a host picker, and chat, history, notifications and resume work on every host. If the link drops, the run continues on the remote machine and the chat shows an offline banner until the host reconnects. Agents can pass `host` to `new_session` (it defaults to the agent's own host), which asks for confirmation on a remote host unless the host allows it; an agent on a remote host always asks before it starts or messages a session on this machine. Explorer, Git, worktrees and the skills, plugins, agents and MCP settings are not available on remote hosts yet.
- **Restarting or redeploying ompweb no longer interrupts a run on this machine.** "This machine" now runs through a local `ompweb host` daemon, installed as a second service (`ompweb-host`) by `ompweb systemd install`, `ompweb launchd install` and the Windows tray install. The daemon keeps the omp processes; a restarted web server adopts them, with no resume prompt, and the dialogs and browser tool calls omp was waiting on come back. The daemon is required: until it is installed and linked, "This machine" shows offline (with a banner showing the install command) and new sessions there cannot start. An `ompweb` run in a terminal or with npx installs no service: keep `ompweb host` running in a second terminal. Restarting the daemon still ends runs, and `ompweb systemd restart` leaves it alone. If the web server comes back on another port, the daemon follows it. A `npm run dev` server does not take over the daemon. "This machine" can be renamed in **Settings → Hosts**.
- **ompweb as a single binary, with no Node or npm.** Each release now also carries `ompweb-linux-x64`, `ompweb-linux-arm64`, `ompweb-darwin-x64`, `ompweb-darwin-arm64` (`.tar.gz`) and `ompweb-windows-x64` (`.zip`): one `ompweb` program with the web files beside it. It takes the same options and environment variables as the npm `ompweb`, and runs the daemon too (`ompweb host`). It has no tray, service installers or in-app update: the README's "Single binary" section shows the service units, and Settings → System links the release page when an update is out. Build one with `npm run build:binary`.
- **Binary prereleases from `main`.** Each commit on `main` that passes CI is published as a GitHub prerelease titled with its build time in ISO 8601 UTC (for example `2026-11-01T10:30:00Z`; tag `20261101T103000Z-<short sha>`) with the five single-binary archives. Prereleases are never marked latest, publish no npm package and trigger no update notice.

### Fixes & Improvements

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ ompweb as one compiled program with the files it serves beside it:
`ompweb-darwin-arm64.tar.gz` and `ompweb-windows-x64.zip`. It needs no Node, npm
or Bun; only omp must be installed. The x64 builds use Bun's baseline runtime, so
they also run on CPUs without AVX2. Each archive carries the licenses of what it
bundles in `licenses/`.
bundles in `licenses/`. Every commit on `main` that passes CI is also published as a
[prerelease](https://github.com/kahme247/ompweb/releases) named after the time it was
built (for example `2026-11-01T10:30:00Z`), with the same five archives.

```bash
tar -xzf ompweb-linux-x64.tar.gz -C ~/.local/share # unpacks ompweb-linux-x64/
Expand Down
10 changes: 10 additions & 0 deletions scripts/build-release-binaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# The five binaries every release and prerelease ships (after `npm run build`), into release/:
# release/ompweb-<os>-<arch>.tar.gz, .zip for Windows. Bun cross-compiles all of them from one machine.
# The x64 targets name -baseline (no AVX2 needed): in Bun 1.4.4 that is the default x64 runtime too (the
# same bytes), and naming it keeps a later Bun from shipping a -modern one. They keep the plain
# ompweb-<os>-x64 names.
set -eu
for target in bun-linux-x64-baseline bun-linux-arm64 bun-darwin-x64-baseline bun-darwin-arm64 bun-windows-x64-baseline; do
npx bun scripts/build-binary.ts --target "$target"
done
Loading