trace: drop portless route, announce http://127.0.0.1:<port> - #565
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5960ce313
ℹ️ 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".
| # this wrapper itself -- here the port is an unexpanded variable.) | ||
| _dsh_web_ours() { pgrep -f "dsh web --port ${1}" >/dev/null 2>&1; } | ||
|
|
||
| if [ "${DEVA_DSH_WEB:-1}" = "1" ]; then |
There was a problem hiding this comment.
Forward the documented dsh disable switches
When users invoke the documented DEVA_DSH_WEB=0 deva.sh dsh form, this test runs inside the container, but setup_dsh_web never adds the host value to DOCKER_ARGS; the dry-run still publishes port 3080 and the wrapper sees the default 1, so it starts the service anyway. DEVA_DSH_WORKSPACE_AUTO=0 has the same problem at the workspace-seeding guard. Forward both settings into the container (and avoid reserving a web port when the service is disabled).
Useful? React with 👍 / 👎.
| if [ -n "${DEVA_DSH_PROXY_PORT:-}" ] && ! _dsh_port_open "$DEVA_DSH_PROXY_PORT"; then | ||
| setsid nohup socat "TCP-LISTEN:${DEVA_DSH_PROXY_PORT},fork,reuseaddr" "TCP:127.0.0.1:${dsh_web_port}" </dev/null >>"$web_log" 2>&1 & |
There was a problem hiding this comment.
Verify the proxy sidecar before announcing the UI
On a reused container where port 3081 is already occupied, this guard silently treats the unrelated listener as the proxy and skips socat; similarly, a newly launched socat is never checked for bind/startup failure. The subsequent announcement tests only whether dsh web is running, so it can advertise a URL whose Docker mapping reaches another service or a closed port. Confirm that the listener belongs to the managed sidecar and is forwarding successfully before announcing the UI, otherwise report the collision.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR removes deva’s “portless” trace URL support (aligning with cctrace’s removal of that route) and updates trace UI URL resolution, while also introducing a substantial new managed-boot flow for deva.sh dsh (web service ensure, host port publishing/sidecar bridging, and workspace auto-registration) with accompanying docs/tests.
Changes:
- Drop portless trace route support and simplify trace UI URL resolution to
DEVA_TRACE_URLor a loopback URL with the published port. - Add a
dshboot wrapper that ensuresdsh web, publishes a host-loopback URL (or pins a per-container port under--host-net), and auto-seeds the workspace registry. - Update documentation and wiring tests to reflect the new dsh behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/test-dsh-auth.sh | Extends wiring tests to cover dsh web publish/sidecar/host-net behavior and passthrough args. |
| README.md | Updates “Common Commands” list to mention the dsh web UI URL. |
| docs/quick-start.md | Updates quick-start agent list to mention dsh web UI and workspace auto-add. |
| docs/authentication.md | Adds detailed dsh behavior documentation (web ensure, port mapping, workspace seeding, plugin notes) and a testing-auth section. |
| CHANGELOG.md | Notes removal of portless trace route and DEVA_TRACE_PORTLESS. |
| agents/shared_auth.sh | Removes portless routing logic and simplifies trace UI URL resolution. |
| agents/dsh.sh | Implements managed dsh web boot, port selection/publishing logic, socat sidecar, and workspace registry seeding wrapper. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| deva.sh opencode | ||
| deva.sh pi | ||
| deva.sh dsh | ||
| deva.sh dsh # boots the dsh web UI on http://127.0.0.1:3080 |
| _trace_resolve_ui_url() { | ||
| local port="$1" | ||
| local routed="" | ||
| routed=$(_trace_portless_url "$port") || routed="" | ||
| printf '%s' "${DEVA_TRACE_URL:-${routed:-http://127.0.0.1:${port}}}" | ||
| printf '%s' "${DEVA_TRACE_URL:-http://localhost:${port}}" | ||
| } |
| deva.sh opencode | ||
| deva.sh pi | ||
| deva.sh dsh | ||
| deva.sh dsh # web UI on http://127.0.0.1:3080; repo auto-added as workspace |
| const tmp = file + '.deva-seed'; | ||
| fs.writeFileSync(tmp, JSON.stringify(state, null, 2)); | ||
| fs.renameSync(tmp, file); |
| # Every dsh run ensures the web service (official recommendation; | ||
| # bare `dsh` does not even start: `--profile <name> is required`). | ||
| # Bare `deva.sh dsh` follows the service log; args after -- run | ||
| # that dsh invocation in the foreground with the service ensured | ||
| # behind it. DEVA_DSH_WEB=0 skips the service entirely. | ||
| setup_dsh_web "${remaining_args[@]+"${remaining_args[@]}"}" |
cctrace 0.41 dropped portless (and its env PORT honoring); the named https://cctrace.localhost URL is gone. deva follows: - _trace_portless_url and DEVA_TRACE_PORTLESS removed. - _trace_resolve_ui_url = DEVA_TRACE_URL, else http://127.0.0.1:<port> (127.0.0.1, not localhost: the publish is -p 127.0.0.1:<port>:9317, IPv4 loopback only). - Host-side env PORT honoring removed too: it existed only for the portless router, and a stray PORT in the shell hijacked which host port the trace UI published on. deva always probes from 9317. Verified: bash -n; hermetic dry-runs (DEVA_NO_DOCKER=1, scratch HOME): PORT=5555 in the env still publishes -p 127.0.0.1:9317:9317 and exports DEVA_TRACE_UI_URL=http://127.0.0.1:9317; DEVA_TRACE_URL override wins; --host-net gives no -p and the pinned-port loopback URL. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
f5960ce to
d43d0ec
Compare
Closes #564
cctrace 0.41 dropped portless support (and its env
PORThonoring). deva follows:_trace_portless_url/DEVA_TRACE_PORTLESSremoved;_trace_resolve_ui_url=DEVA_TRACE_URLelsehttp://127.0.0.1:<port>— 127.0.0.1 rather than localhost because the publish is-p 127.0.0.1:<port>:9317(IPv4 loopback only; review point from Copilot).PORThonoring removed too: it existed only for the portless router, and a strayPORTin the shell hijacked which host port the trace UI published on. deva always probes from 9317.DEVA_TRACE_UI_URL) otherwise unchanged; the statusline trace chip renders from it as-is.Rebased onto main as a single commit — the earlier revision was stacked on #562 (dsh web), which is why the diff carried dsh changes. That work stays in #562.
Out of scope, to follow separately: the cctrace pin is still 0.40.0; cctrace ≥0.41 also moved traces from
./.cctraceto~/.local/share/cctrace/(unmounted in the container), so the pin bump needs data-dir wiring first.Verified:
bash -n; hermetic dry-runs (DEVA_NO_DOCKER=1, scratch HOME):PORT=5555in the env still publishes-p 127.0.0.1:9317:9317and exportsDEVA_TRACE_UI_URL=http://127.0.0.1:9317;DEVA_TRACE_URLoverride wins;--host-netgives no-pand the pinned-port loopback URL.🤖 Generated with Claude Code