Skip to content

trace: drop portless route, announce http://127.0.0.1:<port> - #565

Merged
lroolle merged 1 commit into
mainfrom
chore/trace-drop-portless
Aug 19, 2026
Merged

trace: drop portless route, announce http://127.0.0.1:<port>#565
lroolle merged 1 commit into
mainfrom
chore/trace-drop-portless

Conversation

@lroolle

@lroolle lroolle commented Aug 19, 2026

Copy link
Copy Markdown
Member

Closes #564

cctrace 0.41 dropped portless support (and its env PORT honoring). deva follows:

  • _trace_portless_url / DEVA_TRACE_PORTLESS removed; _trace_resolve_ui_url = DEVA_TRACE_URL else http://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).
  • 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.
  • Announced, opened, and exported (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 ./.cctrace to ~/.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=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.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 19, 2026 07:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread agents/dsh.sh Outdated
# 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread agents/dsh.sh Outdated
Comment on lines +213 to +214
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 &

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_URL or a loopback URL with the published port.
  • Add a dsh boot wrapper that ensures dsh 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.

Comment thread README.md Outdated
deva.sh opencode
deva.sh pi
deva.sh dsh
deva.sh dsh # boots the dsh web UI on http://127.0.0.1:3080
Comment thread agents/shared_auth.sh
Comment on lines 276 to 279
_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}}"
}
Comment thread docs/quick-start.md Outdated
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
Comment thread agents/dsh.sh Outdated
Comment on lines +178 to +180
const tmp = file + '.deva-seed';
fs.writeFileSync(tmp, JSON.stringify(state, null, 2));
fs.renameSync(tmp, file);
Comment thread agents/dsh.sh Outdated
Comment on lines +50 to +55
# 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>
Copilot AI review requested due to automatic review settings August 19, 2026 09:05
@lroolle
lroolle force-pushed the chore/trace-drop-portless branch from f5960ce to d43d0ec Compare August 19, 2026 09:05
@lroolle lroolle changed the title trace: drop portless route, announce http://localhost:<port> trace: drop portless route, announce http://127.0.0.1:<port> Aug 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@lroolle
lroolle merged commit 88b5e11 into main Aug 19, 2026
5 checks passed
@lroolle
lroolle deleted the chore/trace-drop-portless branch August 19, 2026 09:13
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.

trace: drop portless route, announce http://localhost:<port>

2 participants