Skip to content

fix(buzz-acp): retry startup channel discovery on transient relay failure - #4775

Open
justanotherkevin wants to merge 1 commit into
block:mainfrom
justanotherkevin:fix/acp-retry-channel-discovery
Open

fix(buzz-acp): retry startup channel discovery on transient relay failure#4775
justanotherkevin wants to merge 1 commit into
block:mainfrom
justanotherkevin:fix/acp-retry-channel-discovery

Conversation

@justanotherkevin

Copy link
Copy Markdown

Summary

Related to #4538. Startup channel discovery (HarnessRelay::discover_channels())
makes plain REST POST /query calls with no retry — a single transient
failure crashes the entire harness process immediately, with no self-recovery,
unlike the WebSocket-connect path which already has bounded retry
(retry_initial_connect + STARTUP_CONNECT_BACKOFFS).

Observed in practice: a relay-side blip returned 404 on POST /query
alongside database error on two live subscriptions. The harness died
outright (no graceful shutdown sequence) and required a manual restart, even
though the relay had recovered within moments.

This does not address the separate silent-"0 channels" symptom being
investigated in #4538 (possible relay-side accessible-channel scope bug in
bridge.rs) — this only stops a transient discovery failure from being
unrecoverable. Posting for the maintainers to weigh in on whether it's the
right shape given the ongoing #4538 investigation.

Changes

  • crates/buzz-acp/src/relay.rs: new retry_channel_discovery(), reusing
    STARTUP_CONNECT_BACKOFFS/jittered_duration from retry_initial_connect
    but without its terminal-error short-circuit — is_terminal_connect_error
    classifies RelayError::Http as terminal, which is correct for the
    WS-connect call site but wrong here, since RelayError::Http is exactly
    the failure mode observed above.
  • crates/buzz-acp/src/lib.rs: startup call site now goes through the new
    retry wrapper before the existing anyhow error wrapping/? propagation
    (unchanged on final failure).
  • Two new unit tests mirroring the existing retry_initial_connect test
    coverage.

Test plan

  • cargo build -p buzz-acp
  • cargo test -p buzz-acp --lib relay:: — 82 passed (includes 2 new tests)
  • cargo fmt --check -p buzz-acp
  • cargo clippy -p buzz-acp --all-targets -- -D warnings
  • Diff scoped to exactly the two files above

…lure

Related to block#4538. HarnessRelay::discover_channels() made a plain REST
POST /query call with no retry, so a single transient relay failure
crashed the entire harness process with no self-recovery — unlike the
WebSocket-connect path, which already retries via retry_initial_connect
and STARTUP_CONNECT_BACKOFFS.

Add retry_channel_discovery(), reusing the same backoff ladder but
without retry_initial_connect's terminal-error short-circuit, since
is_terminal_connect_error classifies RelayError::Http as terminal
(correct for the WS-connect call site, wrong for REST query failures
like the 404 observed in practice).

Signed-off-by: Kevin Hu <hu.kevin.w@gmail.com>
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