feat(buzz-waker): connection loop, real WakeEffects, daemon binary - #20
Merged
Merged
Conversation
added 2 commits
August 11, 2026 07:10
Adds the pieces the daemon needed and previously lacked: presence_feed.rs (one authenticated subscription per watched agent, doubling as the liveness heartbeat since presence is a global, non-queryable kind:20001 republished on an interval), effects.rs (RealWakeEffects — presence, heartbeat, and confirm-author-not-known-agent are real; provider deploy is the one deliberately unimplemented seam, every real attempt currently ends in DeployFailed), wake_loop.rs (reconnect/backoff, feed pumping, wake attempts spawned on their own tasks so the loop keeps answering relay pings during a liveness proof), and main.rs (env-var config, JSON tracing, SIGTERM/ctrl_c shutdown, one loop pair per configured agent). Known simplification, not closed here: "known agent" is this daemon's own configured watch list, not the full managed-agent roster the desktop sees. Closes once bundle ingestion exists. Still open: bundle transport and the provider deploy wire protocol (currently Tauri-desktop-only code). Scoped out deliberately. Signed-off-by: Sprite <noreply@sprites.dev>
…ision, local filter enforcement Addresses three P2 findings from Alex's review of b177b42: - presence_feed.rs: treat a relay CLOSED frame on the presence subscription as a reconnect/failure path instead of the ignored catch-all, so the tap doesn't sit permanently unsubscribed on a still-open socket. - presence_feed.rs: verify locally that a delivered event is kind:20001 and authored by the watched agent before folding it into cached presence — signature verification alone doesn't prove the relay respected this subscription's filter. - main.rs: supervise watch tasks for early exit (corrupt cursor, panic) during normal operation, not just after shutdown, and fail the daemon rather than run silently degraded with an unwatched agent. Pulled the presence classification logic into a pure presence_frame function, matching relay_feed.rs's existing feed_frame pattern, and added unit tests for it. Signed-off-by: Sprite <noreply@sprites.dev>
Addresses Alex's round-3 P2 finding: FeedStep::ChannelLiveClosed only logged the closure. A relay can close one per-channel live subscription for rate limiting, eviction, or transient authorization state while the socket and membership watch stay healthy. Left alone, nothing reopens that channel until an unrelated reconnect or membership change, while idle checkpoints keep advancing the coverage watermark — mentions in that channel go silently missing with no later replay. Retries the one subscription immediately, using the same connection's since floor. Only falls back to the ordinary reconnect ladder if the re-subscribe call itself fails. Signed-off-by: Junchao Yan <yjc801@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the connection loop, real
WakeEffects, and the daemon binary — the pieces the buzz-waker daemon needed and previously lacked. Stacks on #18 (agent-waker-backfill), since the backlog walk is the last piece of the event feed underneath this.What's here
presence_feed.rs— one authenticated subscription per watched agent. Presence turned out to be simpler than expected: it's a global, non-queryable relay event (kind 20001), not something you can query after the fact, so the daemon keeps a live tap and caches the latest status. Anonlinerepublish on an interval doubles as the heartbeat signal the wake attempt state machine already wants — one subscription now feeds both.effects.rs—RealWakeEffects, a real (non-test) implementation of theWakeEffectstrait. Presence, heartbeat, and confirm-author-not-known-agent are real and working.start_managed_agent(the actual provider deploy) is the one deliberately unimplemented seam — every real wake attempt today ends inDeployFailed, logged clearly as such.wake_loop.rs— the connection loop that was completely missing: reconnect/backoff, feed pumping, wake attempts spawned on their own tasks so the loop keeps answering the relay's pings during the ~100s+ a liveness proof can take.main.rs— env-var config (matches every other daemon in this repo, no clap), JSON tracing, SIGTERM/ctrl_c shutdown viaCancellationToken, one loop pair (mention feed + presence tap) per configured agent.Known simplification
This daemon's "known agent" baseline is just its own configured watch list, not the app's full managed-agent roster (desktop has more visibility than this daemon does). Documented as a gap in code comments; closes once bundle ingestion exists.
Still open, deliberately scoped out
desktop/src-tauri/src/managed_agents/backend.rs), needs reimplementing here.Both are real architectural calls; landing a working, tested connection loop first and building deploy on top of a process that already runs.
Test plan
cargo test -p buzz-waker— 157/157 passing (153 lib + 4 main binary)cargo clippy -p buzz-waker --all-targets— cleancargo fmt -p buzz-waker --check— cleanjust ci(full workspace) — not yet run; will report before requesting review🤖 Generated with Claude Code