Skip to content

feat(cli): serve --bind to choose the listen address (port of nerdsane#537) - #36

Merged
rita-aga merged 2 commits into
mainfrom
claude/serve-bind
Oct 21, 2026
Merged

rita-aga merged 2 commits into
mainfrom
claude/serve-bind

Conversation

@rita-aga

@rita-aga rita-aga commented Oct 20, 2026 •

Copy link
Copy Markdown

Port of nerdsane/temper 118bb6f (nerdsane#537, 19 Oct): temper serve --bind <ip> chooses the listen address. The default stays 0.0.0.0.

What it does

  • --bind 127.0.0.1 (or TEMPER_BIND_ADDR, when the flag is absent) makes the server listen on loopback only. The precedence matches the storage and actor-runtime options.
  • Only 0.0.0.0 and 127.0.0.1 are accepted. Temper's own callers (the Observe UI proxy, WASM self-calls, the blob endpoint, the Discord transport) reach the API at 127.0.0.1, and a host name is refused.
  • Observe UI and the auto-started local sandbox follow the chosen address.
  • The option resolvers moved to serve/options.rs and the Observe UI start to serve/observe_ui.rs, so main.rs and serve/mod.rs stay under the readability limit.

Port notes

It merged into arni-labs main (c8f92d3) with two conflicts in serve/mod.rs, both resolved to keep arni-labs' code:

  • The router keeps the Turso Sync copy wrapper (sync_copy::answer_after_copy) and binds SocketAddr::from((bind, port)).
  • The state-timer re-arm (rearm_state_timers, ADR-0056) still runs before serving. The banner prints the chosen address.

Merge after tonight's kernel binary is cut, so the roll's contents stay as reviewed.

Checks

  • GitHub CI.
  • End to end (to follow in a comment): temper serve with no flag, with --bind 127.0.0.1, with TEMPER_BIND_ADDR=127.0.0.1, and with a bad value. Each time, read what is listening with lsof.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The kernel-only requirement in previous finding 1 still needs to be satisfied before merging.

Fix All in Claude CodeFindings

  1. P2 Agent code extends outside temperpaw ▶
Fix with agent prompt
### Issue 1
os-apps/temper-agent/sandbox/local_sandbox.py:138-141
Adding `--host` extends the agent sandbox in this repository. The repository guide says kernel code belongs here and app and agent logic belongs in temperpaw. Put this helper change in temperpaw and connect the CLI to that maintained helper. This repository requirement must be satisfied before merging.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds temper serve --bind and TEMPER_BIND_ADDR, while keeping the default address unchanged.

  • Temper can keep its API and local helpers on loopback.
  • Serve keeps storage and runtime settings in a separate options module.

No new findings were accepted. The merge bases differ, so the full PR diff was reviewed as changes since the last review.

Reviews (2) · Last reviewed commit: "Merge arni-labs/main (client spans and l..." · Reviewed by Greptile

…ed: 0.0.0.0) (nerdsane#537)

* refactor(cli): split serve option resolvers and the Observe UI spawn into modules

main.rs and serve/mod.rs sit just under the 1000-line readability ratchet;
the --bind option would push both over it. Move the flag/env resolvers to
serve/options.rs and the Observe UI spawn to serve/observe_ui.rs. No
behavior change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(cli): serve --bind to choose the listen address (default unchanged: 0.0.0.0)

`temper serve` always bound 0.0.0.0, so a single-user server reached
through an SSH tunnel or a local proxy had to be fenced off with firewall
rules. --bind <ip> picks the address; TEMPER_BIND_ADDR selects it when
the flag is not given, with the same precedence the storage and
actor-runtime options use.

Only 0.0.0.0 and 127.0.0.1 are accepted: Temper's own components (the
Observe UI proxy, WASM host self-calls, the blob endpoint, the Discord
transport) reach the API at http://127.0.0.1:{port}, so any other address
would bind a server those callers cannot reach; a host name is refused
rather than resolved. The Observe UI port probe and dev server and the
auto-started local sandbox follow the chosen address, so --bind 127.0.0.1
leaves no listener on 0.0.0.0.

Opt-in and backward compatible: without the flag or the variable nothing
changes, and the startup line still names the address that was bound.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 118bb6f)

Ported from nerdsane/temper to arni-labs/temper. Two conflicts in serve/mod.rs: kept
arni-labs' Turso Sync copy wrapper around the router and the state-timer re-arm
before serving, with the listener and its banner on the chosen address.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment on lines +138 to +141
parser.add_argument(
"--host", type=str, default="0.0.0.0",
help="Address to bind (default: 0.0.0.0; 127.0.0.1 for loopback only)"
)

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 Agent code extends outside temperpaw

Adding --host extends the agent sandbox in this repository. The repository guide says kernel code belongs here and app and agent logic belongs in temperpaw. Put this helper change in temperpaw and connect the CLI to that maintained helper. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: os-apps/temper-agent/sandbox/local_sandbox.py
Line: 138-141

Comment:
**Agent code extends outside temperpaw**

Adding `--host` extends the agent sandbox in this repository. The repository guide says kernel code belongs here and app and agent logic belongs in temperpaw. Put this helper change in temperpaw and connect the CLI to that maintained helper. This repository requirement must be satisfied before merging.

**Context Used:** CLAUDE.md ([source](https://github.com/arni-labs/temper/blob/main/CLAUDE.md))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex Fix in Cursor

@rita-aga

Copy link
Copy Markdown
Author

End-to-end check, 21 Oct 00:05 UTC, debug build of ed90da4 on macOS (port 37461, --no-observe, each run in a fresh directory). "Listening" is read with lsof; "LAN" is a request to the Mac's en0 address (192.168.1.190).

Run Listening Banner 127.0.0.1 /healthz LAN /healthz
no flag *:37461 http://0.0.0.0:37461 200 200
--bind 127.0.0.1 127.0.0.1:37461 http://127.0.0.1:37461 200 refused
TEMPER_BIND_ADDR=127.0.0.1 127.0.0.1:37461 http://127.0.0.1:37461 200 refused
env 127.0.0.1 plus --bind 0.0.0.0 *:37461 (the flag wins) http://0.0.0.0:37461 200 200
--bind 192.168.1.5 none; exits 1
TEMPER_BIND_ADDR=localhost none; exits 1

The two refused runs print, in order: Error: --bind must be 0.0.0.0 (all interfaces) or 127.0.0.1 (loopback only); got "192.168.1.5" and Error: TEMPER_BIND_ADDR must be 0.0.0.0 (all interfaces) or 127.0.0.1 (loopback only); got "localhost".

@rita-aga
rita-aga merged commit a7fa238 into main Oct 21, 2026
12 checks passed
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.

2 participants