Skip to content

Apps open when they should: one definition of ready, no waiting on dead ports - #11

Merged
MyOwnDataCenter merged 3 commits into
mainfrom
fix/app-launch-reliability
Nov 15, 2026
Merged

MyOwnDataCenter merged 3 commits into
mainfrom
fix/app-launch-reliability

Conversation

@MyOwnDataCenter

Copy link
Copy Markdown
Owner

What this changes

Pressing Open on an installed app now either opens it or says why it can't, instead of waiting three minutes on "Starting…". No features added, no redesign. Not merged: waiting for approval.

Confirmed bugs and root causes

# Bug Root cause Status
1 Open sits on "Starting… Ns" for a running app (AdGuard Home) Two causes. Listing: AdGuard Home moves its web page off port 3000 after its setup, so the forwarded port goes dead. Launcher: every non-answer from apps.probe was treated as "still starting" for up to 180 s. Reproduced with the real AdGuard Home binary. Launcher fixed here; listing fixed in MyOwnDataCenter/app-store#4
1b apps.probe reports an app that speaks https itself as unreachable The probe always used plain http, while the gateway uses https for those apps (web.https) Reproduced in a test, fixed here. No store app uses web.https today, so this was latent
2 Brave fails to launch Brave/Chrome (Neko): WebRTC ports never opened in the firewall. Brave (HTTPS): before 0.9.13, app ports served a certificate from a different authority than the one devices can trust, which Safari refuses for the stream's WebSocket. Listing fixed in app-store#4. Certificate already fixed in 0.9.13 and left alone. Neither reproduced with real containers
3 App address / protocol mismatch Confirmed for one kind of app: one that holds its own port (host network, e.g. Home Assistant) speaks plain http there, but appUrl built https://host:<that port> when https was needed Reproduced (EPROTO), fixed here. Apps behind a gateway were already correct and are unchanged
4 "Running" doesn't say whether the web page works Running only means the containers run; nothing reported web readiness Fixed here
5 Regression coverage Issues #1, #2, #6, #8 were already closed and are untouched New tests added for this change only

What changed

  • omarchyd/apps.mjs
    • readinessOf() is the single definition every screen follows: ready, starting, unreachable, stopped, gateway-down, no-web.
    • Any answer below 500 counts as ready (redirects, 401, 403, 404).
    • "Starting" lasts only for 120 s after the app was last started; after that, a running app that doesn't answer is unreachable, with the reason.
    • apps.probe asks over https when the app speaks https, reports the container state, and reopens a missing gateway.
  • web/src/openApp.ts, AppSheet.tsx, Store.tsx, Desktop.tsx
    • Open waits only while starting. Otherwise it explains and offers Try again / Open anyway.
    • The app sheet shows "Web page: Ready / Starting up… / Not answering" next to Running.
  • web/src/appUrl.ts (moved out of data.ts so it can be tested): apps holding their own port open through their view gateway when https is needed.
  • Release: version 0.9.16 and its What's New entry.

Tests

  • test/app-launch.test.mjs (12 tests): the readiness table, plus apps.probe against a running omarchyd. Covers the AdGuard first-run redirect, a dead port going from starting to unreachable, restart resetting the wait, 401/404/503, stopped, an https upstream, and the page through the gateway over http and https with sign-in.
  • test/app-url.test.mjs (4 tests): the address for each kind of app, on http and https.
  • Each fix was broken on purpose to confirm a test fails.

Results

  • npm run typecheck: clean. npm run build: builds.
  • npm test: 166 pass, 0 fail, run three times (150 before this branch).
  • The phone app sheet was checked in headless Chrome against a real omarchyd with a dead web port.

Not verified (needs a real server)

  • No container engine was available, so no real app containers ran. AdGuard Home was reproduced with its real binary, not in its container.
  • Brave and Chrome streaming, including on mobile Safari, was not exercised.
  • The test server could not be queried from here, so its live probe answer for AdGuard Home was not captured.
  • Reverse proxies and Cloudflare Tunnel: apps are opened on their own ports, which a tunnel to the web app does not carry. That is how it is designed, not something this change alters.

Security

  • No TLS, sign-in or gateway check is relaxed.
  • The probe's https request skips certificate checks only to 127.0.0.1, as the gateway already does for the same apps.
  • "Open anyway" links to the same address Open uses, behind the same sign-in.
  • Apps holding their own port now go through a signed-in gateway when opened over https; over http they open as before.

Generated by Claude Code

weisguyenterprise and others added 3 commits November 15, 2026 08:03
…tps is needed

appUrl built https://host:<app port> whenever the web app was on https or the
app needs a secure page. For an app on the host network that holds its own
port (Home Assistant on 8123), that port speaks only the app's plain http, so
the address could never load (reproduced: EPROTO). Such apps now open at their
view gateway port, which answers https behind the sign-in. Apps behind a
gateway are unchanged.

appUrl moves to web/src/appUrl.ts (no imports) so it can be tested.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_011b9fuB8ePE7DYtvvqNj1s2
…b ports

An app could show Running while Open said "still starting" for three minutes
and then landed on a dead page. Running only meant its containers run; the
launcher treated every non-answer as "still starting".

- omarchyd: readinessOf() gives one answer every screen follows: ready,
  starting, unreachable, stopped, gateway-down, no-web. "starting" only lasts
  for a grace period after the app was last started (120 s); after that a
  running app that doesn't answer is "unreachable", with the reason.
- apps.probe asks the app the way its gateway does: over https when the
  listing says the app speaks https itself (it used to look dead), and reopens
  a missing gateway.
- Web app: Open waits only while "starting". Otherwise it says what is wrong
  and offers Try again / Open anyway. The app sheet shows the web page's state
  next to Running. The desktop's slow-load message uses the same wording.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_011b9fuB8ePE7DYtvvqNj1s2
@MyOwnDataCenter
MyOwnDataCenter merged commit fa89e02 into main Nov 15, 2026
1 check passed
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