Skip to content

docs: what a live codespace showed - #529

Merged
aojea merged 1 commit into
google:mainfrom
aojea:docs/codespaces-live-findings
Sep 27, 2026
Merged

aojea merged 1 commit into
google:mainfrom
aojea:docs/codespaces-live-findings

Conversation

@aojea

@aojea aojea commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #522, which was merged before this commit landed on the branch.

What a real codespace showed, folded into the guide and the reference:

  • Port visibility reverts to private on every codespace restart; sam-one warns again and you set it to public once more.
  • gh is not in the image, so the gh codespace ports visibility command in the hint runs on your own machine.
  • A sam-node that finds no router for about three minutes exits on purpose, so after a longer idle stop nodes are started again; they keep their identity and do not enroll twice.
  • GitHub's proxy sends Host: localhost:<port> and names the public host in X-Forwarded-Host, which the zero-config inference already reads; the reference says so.
  • .devcontainer/devcontainer-lock.json is committed without a final newline, which is how Codespaces rewrites it, so the checkout stays clean inside a codespace.

Port visibility reverts to private on every codespace restart, and sam-one
says so again; gh is not in the image, so the gh command in the hint runs on
your own machine; a sam-node that finds no router for about three minutes
exits on purpose, so nodes are started again after a longer stop, with the
identity they already hold. GitHub's proxy names the public host in
X-Forwarded-Host, which the zero-config inference already reads, so the
reference says so. The lock file loses its final newline: that is how
Codespaces writes it, and the checkout stays clean.
@aojea
aojea merged commit 9efb65a into google:main Sep 27, 2026
20 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation for GitHub Codespaces and the sam-one reference guide, detailing how sam-one infers the advertised WebSocket address behind HTTPS proxies and explaining node behavior during codespace idle stops. The review feedback suggests minor phrasing improvements to make the documentation clearer and more precise, such as clarifying the header combination for --external-url and refining colloquial language regarding mesh recovery and node restarts.

| `--bind-address` | `0.0.0.0` | Host to bind. |
| `--port` | `0` | TCP port. `0` picks a free one and prints it in the banner. |
| `--external-url` | | Public URL on which nodes reach this instance, for a reverse proxy or a hosted platform. Can also be set with `SAM_EXTERNAL_URL`. When omitted behind an HTTPS proxy (Cloud Run, Fly.io), `/info` infers the advertised `wss` address from the incoming `Host` / `X-Forwarded-Proto` headers automatically. |
| `--external-url` | | Public URL on which nodes reach this instance, for a reverse proxy or a hosted platform. Can also be set with `SAM_EXTERNAL_URL`. When omitted behind an HTTPS proxy (Cloud Run, Fly.io, a forwarded Codespaces port), `/info` infers the advertised `wss` address from the incoming `Host` or `X-Forwarded-Host` and `X-Forwarded-Proto` headers automatically. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The phrase 'incoming Host or X-Forwarded-Host and X-Forwarded-Proto headers' is slightly ambiguous. Clarifying this with parentheses makes it clear that X-Forwarded-Proto is always used alongside either host header.

Suggested change:

| `--external-url` | | Public URL on which nodes reach this instance, for a reverse proxy or a hosted platform. Can also be set with `SAM_EXTERNAL_URL`. When omitted behind an HTTPS proxy (Cloud Run, Fly.io, a forwarded Codespaces port), `/info` infers the advertised `wss` address from the incoming `Host` (or `X-Forwarded-Host`) and `X-Forwarded-Proto` headers automatically. |

Comment on lines +148 to +149
tokens, and enrolled devices reconnect on their own as long as the mesh is
back within about three minutes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The phrase 'is back' is a bit colloquial. Using 'comes back' or 'is restarted' is more precise and natural in this context.

Suggested change
tokens, and enrolled devices reconnect on their own as long as the mesh is
back within about three minutes.
tokens, and enrolled devices reconnect on their own as long as the mesh comes
back within about three minutes.

Comment on lines +168 to +170
for about three minutes exits on purpose, so after a longer stop you start
your nodes again (`sam-node run --daemonize`; they need no new
enrollment) or run them under a service manager that restarts them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The phrase 'you start your nodes again' is a bit passive/colloquial. It would be clearer and more direct to say 'you will need to restart your nodes' or 'you must restart your nodes'.

Suggested change:

  for about three minutes exits on purpose, so after a longer stop you will need to restart
  your nodes (`sam-node run --daemonize`; they need no new
  enrollment) or run them under a service manager that restarts them.

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.

1 participant