Skip to content

fix: start --serve honours the manifest ui: section#167

Merged
ArthurBernard merged 1 commit into
developfrom
fix/start-serve-manifest-ui
Jul 5, 2026
Merged

fix: start --serve honours the manifest ui: section#167
ArthurBernard merged 1 commit into
developfrom
fix/start-serve-manifest-ui

Conversation

@ArthurBernard

Copy link
Copy Markdown
Owner

Summary

trading-bot dashboard resolves its web settings from the manifest's ui: section (host/port/token), with CLI flags/env overriding — set once in the config, serve the same way every launch. trading-bot start --serve (the daemon path) ignored config.ui entirely: --serve-host always defaulted to 127.0.0.1, --serve-port to 8000, --serve-token to None, regardless of what the manifest declared. A manifest configured with ui: {host: 0.0.0.0, port: 8000, token: ...} would silently serve on loopback with no auth when launched via start --serve instead of dashboard — this bit the maintainer in production (dashboard unreachable over the tailnet after switching to start --serve).

  • --serve-host / --serve-port / --serve-token in start now default to None and resolve against config.ui.host / .port / .token after loading the config — the same precedence as dashboard (explicit flag, or TRADING_BOT_UI_TOKEN env for the token, wins; otherwise the manifest).
  • The non-loopback-without-token refusal (still enforced in _run_daemon) now evaluates the resolved values, so it applies whether the unsafe combination came from a flag or from the manifest.
  • A bare AppConfig() (no --config) keeps today's behaviour: loopback :8000, no auth — UIConfig's own defaults already match.
  • read_only intentionally stays out of scope: it doesn't apply to the control daemon.

Test plan

  • python -m pytest — 1177 passed (includes 4 new tests: manifest flow-through + non-loopback-with-token accepted, explicit flag override, no-config/no-flags unchanged default, non-loopback-without-token refusal)
  • ruff check trading_bot/ — clean
  • ruff format --check trading_bot/ — clean
  • mypy trading_bot/ — clean

🤖 Generated with Claude Code

…oken)

`start --serve` (the daemon path) ignored config.ui entirely, always
defaulting --serve-host/--serve-port/--serve-token to loopback :8000 with
no auth even when the manifest declared a ui: section — unlike `dashboard`,
which already resolves host/port/token from ui: with flags/env overriding.
A manifest configured for `dashboard` silently served on loopback with no
token when launched via `start --serve` instead.

Mirror `dashboard`'s resolution: the three options default to None and
resolve against config.ui.* after loading the config, with the same
non-loopback-without-token refusal (still enforced in _run_daemon) applying
to the resolved values. A bare AppConfig() (no --config) keeps today's
loopback :8000, no-auth default.
@ArthurBernard ArthurBernard merged commit 3f30f4c into develop Jul 5, 2026
3 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.

1 participant