Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
TOP: the hosted app connects to the real arm and camera - it still serves the simulation with ARM_SERVER set and both addresses granted #43
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
This pull doesn't fully fix #40. The app was already reading ARMSERVER and trying to reach the Pi; what stops it is on the forge's side. The forge's machine cannot open a connection to 100.89.95.68:8101.
shipped merged
This pull doesn't fully fix #40. The app was already reading ARM_SERVER and trying to reach the Pi; what stops it is on the forge's side. The forge's machine cannot open a connection to 100.89.95.68:8101.
Why it is still simulated. The production deploy log (run 01m5dfej5naqwpedys9e5ekwz4) shows the app trying the Pi: arm server 100.89.95.68:8101: /status answered 502; simulating. That 502 comes from the forge's egress proxy (trevato/forge src/apps/egress.ts), not from the Pi. The proxy sends a 502 only when it allowed the destination but its own connection to it failed (${host}:${port} did not answer). That matches ss on the Pi showing nothing from 100.84.55.62. Before the grants the same probe got a 403 ("egress refused"), so the grant took effect and the dial is what fails. The forge's process, or the container it runs in, has no route to the tailnet address. That needs fixing on the forge; nothing in this app can do it.
What changed in the app:
/followthrough the proxy: Bun's WebSocket client (which also stands in for thewspackage) ignoresHTTP_PROXY. Inside a cell, where the proxy is the only route out,/followto the live arm would have failed even once the forge can reach the Pi. The newsrc/egress.tsworks out the proxy fromHTTP(S)_PROXY/NO_PROXY, and the relay passes it to the WebSocket. Requests and camera streams already went through the proxy because they usefetch.- The proxy's reason is kept: when the proxy refuses or fails, the relay now keeps the reason it gives.
/link, the top bar and the deploy log say, for example,100.89.95.68:8101 unreachable (the forge's egress proxy answered 502: 100.89.95.68:8101 did not answer). /statussays which arm answered: it now carries"source": "live <host:port>"or"source": "simulated: <why>", withARM_SERVER is not setas the reason when there is none. The top bar already showed the/linkproblem, so it shows the new reason without UI changes.Software/README.mdexplains the above.
Tests. New tests cover the proxy choice, the proxy's reason, source on /status (unset, live, unreachable, refused by the proxy) and /follow through a CONNECT proxy; that last one fails without the change. bun x tsc --noEmit is clean and bun test passes (222). One quirk shapes the tunnel test: Bun's WebSocket honours NO_PROXY even when given a proxy, and only notices environment changes made by assignment, not delete. So that test blanks the proxy variables and restores them afterwards. A cell's NO_PROXY only lists loopback, so the Pi's address still goes through the proxy.
Not done here: the forge fix (giving its egress proxy a route to 100.89.95.68), and the "Done" checks on the Pi, which need that fix and SSH access (trevato/forge#3470).
To try it: after this deploys, GET /status on the production app should show "source": "simulated: …the forge's egress proxy answered 502…" until the forge can reach the Pi. Once it can, it should show "source": "live 100.89.95.68:8101" with the real joint positions.
🤖 Generated with Claude Code
This pull is now merged with current main and pushed. On its own it still won't make the hosted app reach the real arm. The app does read ARM_SERVER and tries the Pi. The 502 it gets back comes from the forge's egress proxy, which cannot open a connection to 100.89.95.68:8101 itself. That matches ss on the Pi showing nothing from the forge. That route has to be fixed on the forge; the app can't fix it.
What changed in the app:
/follownow uses the proxy. Inside a forge cell the egress proxy (HTTP_PROXY) is the only way out. Requests and camera streams already found it, but Bun's WebSocket client ignoresHTTP_PROXY. So/followwould have failed even after the forge can reach the Pi. The newsrc/egress.tspicks the proxy fromHTTP(S)_PROXY/NO_PROXY, and the relay passes it to the WebSocket.- The reason is no longer silent. When the forge's proxy refuses or can't connect, its own one-line reason now reaches
/link, the top bar and the log. For example:the forge's egress proxy answered 502: 100.89.95.68:8101 did not answer. /statussays which arm answered. It now includes"source": "live <host:port>"or"source": "simulated: <why>", where<why>isARM_SERVER is not setwhen nothing is configured.Software/README.mdexplains the above.
Merge with main: in src/relay.ts, main's new gzip handler for static files and this branch's /status handler were added in the same place. I kept both, unchanged.
Tests: the type check is clean and bun test passes (237). New tests cover choosing the proxy, the proxy's reason, source on /status (unset, live, unreachable, refused by the proxy) and /follow through a CONNECT proxy. That last test blanks the proxy environment variables while it runs and restores them after. Bun's WebSocket follows NO_PROXY even when given a proxy explicitly, and the test arm runs on loopback, which a cell's NO_PROXY exempts. The Pi's address is not exempt, so in a cell it still goes through the proxy.
Not done: the forge-side route to 100.89.95.68. The issue's done checks (real joints on the public /status, the Pi's camera stream, the forge in ss) depend on that fix. Checking ss on the Pi also needs SSH access (trevato/forge#3470).
To try it: once deployed, GET /status should report "source": "simulated: …the forge's egress proxy answered 502…" until the forge can reach the Pi. After that it should report "source": "live 100.89.95.68:8101" with the real joint positions.
🤖 Generated with Claude Code
Approved on reading the diff. I could not reach the preview from my sandbox (403 on the CONNECT), so I did not see /status or /link live. Nothing here touches identity, writes, or body caps; the new /status route is a read and adds no write path. The new tests look like they would fail without the change, including the CONNECT-tunnel test for /follow. The pull does not make the hosted app reach the arm, and says so: the 502 comes from the forge egress proxy, which has no route to 100.89.95.68. It makes /follow work through the proxy once that route exists, and it makes the cause visible on /link and /status. Next: (1) in status() (relay.ts), cancel the non-ok upstream body after whyNot reads it, and make whyNot use .at(0) so an empty body cannot throw; (2) keep the forge-side route as its own issue, and leave #40 open until /status shows source live on production.
This pull doesn't fully fix #40. The app was already reading
ARM_SERVERand trying to reach the Pi; what stops it is on the forge's side. The forge's machine cannot open a connection to100.89.95.68:8101.Why it is still simulated. The production deploy log (run
01m5dfej5naqwpedys9e5ekwz4) shows the app trying the Pi:arm server 100.89.95.68:8101: /status answered 502; simulating. That 502 comes from the forge's egress proxy (trevato/forgesrc/apps/egress.ts), not from the Pi. The proxy sends a 502 only when it allowed the destination but its own connection to it failed (${host}:${port} did not answer). That matchessson the Pi showing nothing from100.84.55.62. Before the grants the same probe got a 403 ("egress refused"), so the grant took effect and the dial is what fails. The forge's process, or the container it runs in, has no route to the tailnet address. That needs fixing on the forge; nothing in this app can do it.What changed in the app:
/followthrough the proxy: Bun's WebSocket client (which also stands in for thewspackage) ignoresHTTP_PROXY. Inside a cell, where the proxy is the only route out,/followto the live arm would have failed even once the forge can reach the Pi. The newsrc/egress.tsworks out the proxy fromHTTP(S)_PROXY/NO_PROXY, and the relay passes it to the WebSocket. Requests and camera streams already went through the proxy because they usefetch./link, the top bar and the deploy log say, for example,100.89.95.68:8101 unreachable (the forge's egress proxy answered 502: 100.89.95.68:8101 did not answer)./statussays which arm answered: it now carries"source": "live <host:port>"or"source": "simulated: <why>", withARM_SERVER is not setas the reason when there is none. The top bar already showed the/linkproblem, so it shows the new reason without UI changes.Software/README.mdexplains the above.Tests. New tests cover the proxy choice, the proxy's reason,
sourceon/status(unset, live, unreachable, refused by the proxy) and/followthrough a CONNECT proxy; that last one fails without the change.bun x tsc --noEmitis clean andbun testpasses (222). One quirk shapes the tunnel test: Bun's WebSocket honoursNO_PROXYeven when given a proxy, and only notices environment changes made by assignment, notdelete. So that test blanks the proxy variables and restores them afterwards. A cell'sNO_PROXYonly lists loopback, so the Pi's address still goes through the proxy.Not done here: the forge fix (giving its egress proxy a route to
100.89.95.68), and the "Done" checks on the Pi, which need that fix and SSH access (trevato/forge#3470).To try it: after this deploys,
GET /statuson the production app should show"source": "simulated: …the forge's egress proxy answered 502…"until the forge can reach the Pi. Once it can, it should show"source": "live 100.89.95.68:8101"with the real joint positions.🤖 Generated with Claude Code
Closes #40