Skip to content

fix(relay): warn when BUZZ_RELAY_URL is set but RELAY_URL is not - #7929

Draft
Yyunozor wants to merge 2 commits into
block:mainfrom
Yyunozor:fix/relay-url-misnamed-env-warn
Draft

Yyunozor wants to merge 2 commits into
block:mainfrom
Yyunozor:fix/relay-url-misnamed-env-warn

Conversation

@Yyunozor

@Yyunozor Yyunozor commented Sep 27, 2026 •

Copy link
Copy Markdown

Summary

The relay reads only RELAY_URL, but BUZZ_RELAY_URL is the name agents use (buzz-acp, docs/remote-agents.md, .env.example). When an operator sets BUZZ_RELAY_URL for the relay, relay_url falls back to ws://localhost:3000, the community is bound to that host, and every real request returns 404 (#6764).

This adds one startup warning when BUZZ_RELAY_URL is set and RELAY_URL is not, following the inert_env_vars pattern (a pure helper with an injected env lookup). It also fixes the startup error in main.rs, which named BUZZ_RELAY_URL while printing the value of RELAY_URL.

No alias is added (option 2 in the issue): that changes behaviour and is the maintainers' call.

Related issue

Fixes #6764. Thanks to @morven-ai for the diagnosis. They offered a PR for option 1, so I'm happy to close this one if they prefer to send theirs. main is merged in after #7793 and #7933 landed (a test helper was added next to ours; both are kept).

Testing

cargo fmt --all -- --check
cargo clippy -p buzz-relay --all-targets -- -D warnings
cargo test -p buzz-relay --lib config -- --test-threads=1

87 passed, 2 ignored (Postgres). Two tests drive the real Config::from_env() path with captured logs. --test-threads=1 is needed for an existing env race in this module, and config::tests is in no CI selector today.

Manual run of the release binary with BUZZ_RELAY_URL set and RELAY_URL unset: the warning appears once, then the process stops at key load (no key configured). With RELAY_URL set: no warning. An end-to-end run on a full local relay is still to do, so this stays a draft until then.

The relay reads only RELAY_URL (config.rs); BUZZ_RELAY_URL is the
agent-side connection target used by buzz-acp, docs/remote-agents.md,
and .env.example. Most relay-facing variables are BUZZ_-prefixed, so
an operator setting BUZZ_RELAY_URL for the relay too is a reasonable
mistake: relay_url then silently falls back to ws://localhost:3000,
the deployment community is provisioned bound to that host, and every
real request 404s with no signal beyond the startup log line for
relay_url.

Warn once at startup when this mismatch is detected, following the
existing inert_env_vars pattern: a pure helper takes an injected env
lookup, covered by four unit tests over the input space plus two
tests that drive the real Config::from_env() path with captured
tracing output (one per direction: warns, stays quiet).

Also fixes the startup error at main.rs that names BUZZ_RELAY_URL
when the value it prints (config.relay_url) actually comes from
RELAY_URL, sending an operator debugging a failed boot to the wrong
variable.

Fixes block#6764

Signed-off-by: Yyunozor <yyunozor@icloud.com>
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is b37e477211313a94344a31aea4b180ed4effe0b8...46733ec798dfb6ab2f1888c079db641cd2ae3932.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review 46733ec798dfb6ab2f1888c079db641cd2ae3932 to authorize a new review.
Any previous review applies only to its recorded range.

…rl-misnamed-env-warn

Signed-off-by: Yyunozor <yyunozor@icloud.com>

# Conflicts:
#	crates/buzz-relay/src/config.rs

This branch has not been deployed

No deployments
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.

BUZZ_RELAY_URL is silently ignored; relay binds the community to localhost:3000 and 404s every request

1 participant