You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(hosts): three Codex findings in the hosts, daemon and Bun PRs - #363
Codex found these while reviewing #360. The code came from #339, #342 and #344, so the fixes land here, one commit each.
npm start never linked the local daemon.server/main.ts did not set OMP_WEB_PORT/OMP_WEB_HOSTNAME, so local-bootstrap.ts skipped writing host.json and "This machine" stayed offline. Now startProduction sets them from the address the server is actually bound to, for every entry point.
Archiving a remote session made it unrestorable. The Archived Sessions browser lists and restores this machine's archive only. The archive route now answers 501 remote_unavailable for a remote session, and the sidebar disables Archive with the usual "Not available on remote hosts yet" title.
A late reply could settle an adopted process's command. An adopted RpcProcess restarted its request ids at w1, so the previous server's late get_state answer settled the new get_state with stale data. Ids now carry a random per-process prefix.
Verification
Regression test for 3: fails before the fix (stale data), passes after.
Fix 1, run with a throwaway HOME: before, bun server/main.ts logged "local daemon link skipped"; after, it writes host.json with the bound port.
bun test lib/omp lib/hosts plus the session-route and sidebar tests: 342 pass. tsc and eslint are clean.
The in-session review's two fixes are folded in: a vacuous-pass guard in the test, and the bound port instead of the requested one.
Summary by CodeRabbit
Bug Fixes
Archiving is now unavailable for sessions hosted on another machine, with the option disabled in the menu and a clear response if an archive is attempted. Local session archiving is unchanged.
Local server links are now configured from the server’s listen address, including when started through different launch methods.
Documentation
Clarified which features are limited to the machine running ompweb. Chat, session history, notifications, and starting sessions remain available on all hosts; directory browsing, archiving, and several settings remain local-only.
startProduction now sets OMP_WEB_PORT/OMP_WEB_HOSTNAME from its listen address before register(), so server/main.ts writes the daemon's host.json like the launcher and the binary. Found by Codex on #360.
…r can restore them
The Archived Sessions browser lists and restores this machine's archive only, so a remote session archived on its host vanished with no way back. The route answers 501 remote_unavailable and the sidebar disables Archive with the usual 'Not available on remote hosts yet' title. Found by Codex on #360.
An adopted child can still answer the previous server's commands. Ids restarted at w1, so a late get_state answer settled the new process's get_state with stale data; the command-type check only covered a different type. Ids now carry a random per-process prefix. Found by Codex on #360.
Remote session archiving is now blocked in the sidebar and API. RPC command IDs include a per-process UUID prefix. Production startup sets web port and hostname from the listen address, and related documentation and local-link messaging were updated.
The archive API returns HTTP 501 with remote_unavailable for non-local sessions. The sidebar disables archiving for remote sessions and shows an unavailable-remote tooltip. The documentation describes remote-host limitations.
RPC command IDs now use a per-process UUID prefix. A runtime test checks that a stale response from a previous process does not settle the current request.
startProduction sets OMP_WEB_PORT and OMP_WEB_HOSTNAME from its listen address before registering services. The binary no longer sets these values before importing the app. The local-link message and documentation were updated.
The archive restrictions, RPC correlation changes, and startup environment setup have no established merge-blocking defect. IPv6-only listener compatibility remains unverified; merge after normal checks.
Pre-merge checks: 5
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly identifies the pull request as a fix for three review findings across hosts, daemon, and Bun-related changes. It matches the main changes in the changeset.
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 7 files. (2 skipped: 2 unsupported.)
Finishing Touches
Generate unit tests (beta)
Create a new PR
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.
A rabbit checks the archive door, Remote sessions wait outside once more. Fresh command IDs hop in line, The listening port and host align. A carrot rests beside the sign.
The reason will be displayed to describe this comment to others. Learn more.
Additional comments: 1
server/app.ts-190-190: 1
190-190: Minor · Potential issue · Low value
Unverified finding
We couldn't verify this from the code. It is shown for review, not as a verified issue.
Publishing an IPv6 wildcard listen hostname to localLinkUrl may make it choose 127.0.0.1 even when the bound listener does not accept IPv4 connections.
The required local daemon cannot connect to the running web server.
This can occur when: Production starts with hostname :: on a platform or socket configuration with an IPv6-only listener.
Review info
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: 814f59b1-c10d-4ac6-91a0-3dd1c40e3658
Commits
Reviewing files that changed from the base of the PR and between d4b1f54 and 78bcdba.
Files selected for processing: 9
AGENTS.md
README.md
app/api/sessions/[id]/archive/route.ts
components/SessionSidebar-rows.tsx
lib/hosts/local-bootstrap.ts
lib/omp/rpc-process-runtime.test.mjs
lib/omp/rpc-process.ts
server/app.ts
server/binary.ts
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
Source excerpt: The queue panel renders omp's snapshot only: `get_state.queuedMessages` on load/reconcile/stream open and live `queue_update` frames.
CodeRabbit inference engine (AGENTS.md)
Files:
components/SessionSidebar-rows.tsx
Source excerpt: Tool-result images never reach the browser as base64.
CodeRabbit inference engine (AGENTS.md)
Files:
components/SessionSidebar-rows.tsx
Applicability reference: AGENTS.md: # omp-web - Development Notes **Link = two HTTP legs, both dialled by the daemon** (`/api/hosts/link`): `GET` is the downlink (long-lived NDJSON, main → daemon), `POST` the uplink (batch...
Source excerpt: Client code (`components/`, `hooks/`) must not call `AbortSignal.timeout`, `AbortSignal.any` or `Promise.withResolvers` — older mobile browsers throw and the whole tree shows the "unexpected error" screen.
CodeRabbit inference engine (AGENTS.md)
Files:
components/SessionSidebar-rows.tsx
Source excerpt: Bun's router matches the **raw** path, while `request.url` is normalized (`..`
CodeRabbit inference engine (AGENTS.md)
Files:
server/app.ts
server/binary.ts
Source excerpt: omp-web never imports `@oh-my-pi/*` or `@earendil-works/*` packages, even though the server now runs on Bun: live work goes through the installed `omp` child.
CodeRabbit inference engine (AGENTS.md)
Files:
README.md
lib/hosts/local-bootstrap.ts
server/app.ts
lib/omp/rpc-process-runtime.test.mjs
server/binary.ts
app/api/sessions/[id]/archive/route.ts
lib/omp/rpc-process.ts
AGENTS.md
components/SessionSidebar-rows.tsx
Source excerpt: Warm-paper (light) / warm-ember (dark) palettes; every text/background pair is WCAG AA-verified (measured ratios noted in `globals.css` comments).
CodeRabbit inference engine (AGENTS.md)
Files:
components/SessionSidebar-rows.tsx
Source excerpt: Browser code must not import `next/*`: use `lib/dynamic.tsx` and `lib/navigation.ts`.
CodeRabbit inference engine (AGENTS.md)
Files:
app/api/sessions/[id]/archive/route.ts
Source excerpt: **A failed op never runs later.**
CodeRabbit inference engine (AGENTS.md)
Files:
lib/hosts/local-bootstrap.ts
lib/omp/rpc-process-runtime.test.mjs
lib/omp/rpc-process.ts
Source excerpt: `components/ui/` holds the shared primitives (built on `@base-ui/react`): `primitives.tsx` (Dialog/Tooltip/Collapsible), `field.tsx` (form fields + ConfirmDialog), `toast.tsx` (`toast.success/error/info`, mounted in AppShell...
@coderabbitai On the unverified server/app.ts:190 note (IPv6 wildcard → 127.0.0.1): I'm leaving it. This PR doesn't change that mapping. It lives in localLinkUrl (lib/hosts/local-bootstrap.ts:12), and the launcher and the binary already passed the same :: hostname before this change. This PR only makes npm start pass it too. :: binds dual-stack by default on Linux, macOS and Windows, so the daemon reaches it on 127.0.0.1. An IPv6-only listener needs a non-default socket setting that ompweb never sets.
For best results, initiate chat on the files or code changes.
Analysis chain
Script executed:
#!/bin/bash
ast-grep outline server/app.ts lib/hosts/local-bootstrap.ts server/binary.ts
printf'\n--- Production listener ---\n'
sed -n '120,215p' server/app.ts
printf'\n--- Local link URL ---\n'
sed -n '1,100p' lib/hosts/local-bootstrap.ts
printf'\n--- Binary hostname handling ---\n'
rg -n -C4 'hostname|OMP_WEB_HOSTNAME|OMP_WEB_PORT' server/binary.ts
printf'\n--- Socket settings and launcher environment ---\n'
rg -n -C3 'ipv6Only|IPV6_V6ONLY|OMP_WEB_HOSTNAME'.printf'\n--- Relevant PR diff ---\n'
gh pr diff 363 --repo kahme247/ompweb -- 'server/app.ts''server/binary.ts''lib/hosts/local-bootstrap.ts'
Length of output: 39721
Script executed:
#!/bin/bashset -euo pipefail
gh api repos/kahme247/ompweb/pulls/363/files --paginate --jq '.[] | select(.filename == "server/app.ts" or .filename == "server/binary.ts" or .filename == "lib/hosts/local-bootstrap.ts") | {filename, patch}'
Length of output: 2870
@andrebrait Agreed. I checked the source and PR diff. The wildcard mapping in localLinkUrl is unchanged, and Bun.serve has no IPv6-only option set. This PR centralizes the environment setup in startProduction, so npm start uses the existing daemon-link behavior.
My note did not establish a regression in this PR. I withdraw it. No change is needed for that note.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Codex found these while reviewing #360. The code came from #339, #342 and #344, so the fixes land here, one commit each.
npm startnever linked the local daemon.server/main.tsdid not setOMP_WEB_PORT/OMP_WEB_HOSTNAME, solocal-bootstrap.tsskipped writinghost.jsonand "This machine" stayed offline. NowstartProductionsets them from the address the server is actually bound to, for every entry point.remote_unavailablefor a remote session, and the sidebar disables Archive with the usual "Not available on remote hosts yet" title.RpcProcessrestarted its request ids atw1, so the previous server's lateget_stateanswer settled the newget_statewith stale data. Ids now carry a random per-process prefix.Verification
bun server/main.tslogged "local daemon link skipped"; after, it writeshost.jsonwith the bound port.bun test lib/omp lib/hostsplus the session-route and sidebar tests: 342 pass.tscand eslint are clean.Summary by CodeRabbit
Bug Fixes
Documentation