Skip to content

fix(daemon): make binary-staleness watchdog failures observable, add task-level test - #480

Merged
getappz merged 3 commits into
masterfrom
task/107-binary-staleness-watchdog-doesn-t-self-r
Aug 13, 2026
Merged

fix(daemon): make binary-staleness watchdog failures observable, add task-level test#480
getappz merged 3 commits into
masterfrom
task/107-binary-staleness-watchdog-doesn-t-self-r

Conversation

@getappz

@getappz getappz commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Item fix: gateway_execute args schema so callers can actually pass arguments #107: a live daemon kept running for 19+ minutes after cargo build/cargo install replaced its on-disk binary, missing ~19 BINARY_STALENESS_CHECK_INTERVAL checks, with no log line anywhere indicating whether the staleness watchdog task had even armed.
  • BinarySnapshot::is_stale()'s comparison logic already had unit coverage and reads correctly on inspection — the gap was observability: BinarySnapshot::capture() failing at startup and the watchdog silently no-op'ing was indistinguishable, from the log, from "armed and nothing's stale yet".
  • Split the polling loop out of spawn_binary_staleness_watchdog into daemon::wait_for_stale, giving the polling task itself test coverage (via a simulated tokio clock + a real on-disk file swap), not just is_stale()'s comparison logic in isolation.
  • spawn_binary_staleness_watchdog now logs explicitly on both the armed and disabled-at-startup paths, so a silent failure to arm shows up in daemon.log instead of looking identical to normal operation.

Test plan

  • cargo build --bin agentflare — clean build
  • cargo test --bin agentflare daemon:: — 4/4 pass, including the new wait_for_stale_polls_until_the_file_on_disk_changes regression test
  • cargo clippy --bin agentflare --tests --no-deps — no new warnings
  • Ran the built daemon locally and confirmed the new binary staleness watchdog armed for <path>, checking every 60s line prints at startup

…task-level test

Item #107: a live daemon kept running for 19+ minutes after its on-disk
binary was replaced, missing ~19 BINARY_STALENESS_CHECK_INTERVAL checks,
with no log line ever indicating whether the watchdog was armed. The
comparison logic in BinarySnapshot::is_stale() already had unit coverage
and reads correctly; what was missing was any signal, at the live-daemon
level, of whether the watchdog task ever armed in the first place --
capture() failing at startup and the watchdog silently no-op'ing was
indistinguishable from "armed, nothing stale yet".

Split the polling loop out of spawn_binary_staleness_watchdog into
daemon::wait_for_stale so it has its own test coverage independent of
is_stale()'s unit tests -- exercised here with a simulated tokio clock
covering multiple ticks and a real on-disk file swap. Also log explicitly
on both the armed and disabled-at-startup paths so a silent failure to
arm shows up in daemon.log instead of looking identical to normal
operation.

Agentflare-Agent: claude-code
Agentflare-Branch: task/107-binary-staleness-watchdog-doesn-t-self-r
Agentflare-Item: 107
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 18 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7b625ff7-7456-4611-963c-71997c13c677

📥 Commits

Reviewing files that changed from the base of the PR and between dd7e7db and 81e5ea6.

📒 Files selected for processing (4)
  • Cargo.toml
  • agentflare-workspace-hack/Cargo.toml
  • src/daemon.rs
  • src/dashboard/server.rs

Comment @coderabbitai help to get the list of available commands.

The new #[tokio::test(start_paused = true)] regression test in
src/daemon.rs pulled in tokio's test-util feature, changing the
workspace-wide feature union cargo hakari computes. Regenerate
agentflare-workspace-hack/Cargo.toml to match, which is what CI's
own cargo hakari generate --diff check enforces.

Agentflare-Agent: claude-code
Agentflare-Branch: task/107-binary-staleness-watchdog-doesn-t-self-r
Agentflare-Item: 107
@getappz
getappz enabled auto-merge (squash) August 13, 2026 13:00
@getappz
getappz merged commit 1a6e768 into master Aug 13, 2026
16 checks passed
@getappz
getappz deleted the task/107-binary-staleness-watchdog-doesn-t-self-r branch August 13, 2026 13:09
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