Skip to content

fix(hosts): three Codex findings in the hosts, daemon and Bun PRs - #363

Merged
andrebrait merged 3 commits into
ompweb-dev:mainfrom
andrebrait:fix/codex-host-findings
Nov 1, 2026
Merged

andrebrait merged 3 commits into
ompweb-dev:mainfrom
andrebrait:fix/codex-host-findings

Conversation

@andrebrait

@andrebrait andrebrait commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Codex found these while reviewing #360. The code came from #339, #342 and #344, so the fixes land here, one commit each.

  1. 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.
  2. 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.
  3. 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.
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

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.

Changes: Remote session archiving

Layer / File(s) Summary
Remote archive restrictions
app/api/sessions/[id]/archive/route.ts, components/SessionSidebar-rows.tsx, AGENTS.md, README.md
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 correlation

Layer / File(s) Summary
Per-process command IDs
lib/omp/rpc-process.ts, lib/omp/rpc-process-runtime.test.mjs
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.

Local-link bootstrap

Layer / File(s) Summary
Listen address environment setup
server/app.ts, server/binary.ts, lib/hosts/local-bootstrap.ts, AGENTS.md
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.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: kahme247

Merge Risk: Minimal · up to 78bcd

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: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

Share

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.

@kilo-code-bot

kilo-code-bot Bot commented Nov 1, 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.

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

Files Reviewed (9 files)
  • 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

Reviewed by free · Input: 38.7K · Output: 1.2K · Cached: 175.7K

@coderabbitai
coderabbitai Bot requested a review from kahme247 November 1, 2026 18:49

@coderabbitai coderabbitai 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.

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.

Review details
Context from checks skipped due to timeout: 3
  • GitHub Check: CodeRabbit
  • GitHub Check: Verify (ubuntu-latest)
  • GitHub Check: Verify (windows-latest)
Additional context used
Code guidelines: 3
AGENTS.md — auto-discovered
docs/specs/2026-10-28-remote-hosts-design.md — auto-discovered
docs/specs/2026-10-29-local-daemon-design.md — auto-discovered
Path-based instructions: 11
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...

CodeRabbit inference engine (docs/specs/2026-10-28-remote-hosts-design.md)

Files:

  • lib/hosts/local-bootstrap.ts
Applicability reference: AGENTS.md: # omp-web - Development Notes Source excerpt: **The local daemon is required.**

CodeRabbit inference engine (docs/specs/2026-10-29-local-daemon-design.md)

Files:

  • lib/hosts/local-bootstrap.ts
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...

CodeRabbit inference engine (AGENTS.md)

Files:

  • components/SessionSidebar-rows.tsx

@andrebrait

Copy link
Copy Markdown
Collaborator Author

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

@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Tip

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/bash
set -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.

You are interacting with an AI system.

@andrebrait

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T19:02:09.130450Z 78bcdba Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 78bcdba58e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@andrebrait
andrebrait merged commit 81fd01c into ompweb-dev:main Nov 1, 2026
5 checks passed
@andrebrait
andrebrait deleted the fix/codex-host-findings branch November 1, 2026 19:03
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