Skip to content

Commit 0bf1ec9

Browse files
committed
fix: document loopback agent exposure
Make the measured loopback client and relay path explicit for agents.\nDocument same-tree pairing, readiness fields, bounded URL verification, and safe STOP conditions while correcting the CLI help guidance.
1 parent 5367fa4 commit 0bf1ec9

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

  • .agents/skills/portal-tunnel-cli
  • plugins/portal-deploy/skills/portal-expose

.agents/skills/portal-tunnel-cli/SKILL.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: How the portal-tunnel client CLI (cmd/portal-tunnel) is structured
55

66
# portal-tunnel client CLI
77

8-
Entrypoint `cmd/portal-tunnel/main.go`. Subcommands are dispatched by the repo's own `utils.RunCommands` (std `flag` package, NOT cobra/urfave). Commands: `expose`, `agent {run,dashboard,stop,restart}`, `list`, `update`, `version`, `help`. Flags are defined in code (`main.go`, `agent.go`); `--help` prints usage + examples but does NOT enumerate flags read the source for the authoritative list.
8+
Entrypoint `cmd/portal-tunnel/main.go`. Subcommands are dispatched by the repo's own `utils.RunCommands` (std `flag` package, NOT cobra/urfave). Commands: `expose`, `agent {run,dashboard,stop,restart}`, `list`, `update`, `version`, `help`. Flags are defined in code (`main.go`, `agent.go`); current `main` help prints usage + examples but does not enumerate flags. PR #352 proposes adding the registered flag list (`FlagSet.PrintDefaults`) and a loopback help example; until it merges, read the source for the authoritative list.
99

1010
## expose (main.go ~85-110)
1111
Publishes a local service. Key flags (many have env fallbacks, shown in `ENV`):
@@ -34,6 +34,7 @@ portal expose --serve ./site --name my-app
3434
portal expose --http-route /api=http://127.0.0.1:3001 --http-route /=http://127.0.0.1:5173
3535
portal expose 3000 --udp --udp-addr 127.0.0.1:5353
3636
portal expose 3000 --relays https://portal.example.com --discovery=false
37+
portal expose 127.0.0.1:8080 --identity-path /home/user/.config/portal/identity.json --relays https://127.0.0.1:<api-port> --discovery=false # loopback relay from the same checkout/release
3738
portal expose 3000 --multi-hop-depth 3
3839
```
3940

plugins/portal-deploy/skills/portal-expose/SKILL.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ Do not call the result permanent when the local machine, app process, or foregro
100100

101101
If Portal-specific friction materially affected the task, report one sanitized sentence (command, expected versus actual). Do not initiate GitHub feedback handling, write feedback files, or query extra relays unless the user explicitly requests that follow-up.
102102

103+
## Loopback Relay Variant
104+
105+
Use this variant only when the user asks to expose through a relay running on this machine. The relay must already be running; the client never starts one. Do not consult or fall back to the public registry in this mode.
106+
107+
- Run the client and the relay from the same Portal checkout or release. This pairing is for local development and test harnesses only; production users expose through their relay's public deployment. A mixed pair (for example an installed release against a worktree relay) can register hostnames the relay's SNI router never matches, and the tunnel stalls while the client retries silently.
108+
- Point the client only at the relay's admin port: `portal expose <loopback-target> --name <name> --identity-path <absolute-path-outside-repo> --relays https://127.0.0.1:<api-port> --discovery=false`. When port 443 is unavailable, start the same-tree relay on unprivileged ports (`relay-server --api-port <api-port> --sni-port <sni-port>`); the emitted URL then carries the SNI port.
109+
- Treat the tunnel as ready only when the log prints the line starting `service ready at` carrying `public_url`. Listener or added-relay `https://` URLs in the same output describe relay listeners, not tenant readiness.
110+
- Verify the emitted `public_url` itself with one bounded request. `*.localhost` often resolves to `::1` first, so use `curl -sk --ipv4 --connect-timeout 5 --max-time 15 -o /dev/null -w '%{http_code}' <public-url>` and accept the app's real status (401 or 403 means reachable and protected).
111+
- Stop and report instead of improvising when a required fact is missing: no relay admin URL or port, no identity path outside the repository, or no `service ready at` line within a bounded wait. Do not substitute registry relays or start extra relays to unblock the run.
112+
103113
## Failure Rules
104114

105115
- Local app unhealthy: stop before exposing it and report the failing check.

0 commit comments

Comments
 (0)