Repository navigation
Conversation
…land as they complete (#13081)
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
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.
Refs #13081 — the broker-side half of the fix; the heal-side rule change is named below and does not live in this repo.
Root cause, as confirmed in code
The only heal rule that restarts
fleet serve secrets-brokeron a health verdict is the sandbox prelude's (broker process ≥120s old + /health not reportingserving:true→ kill). It never looks atrefreshing. A first refresh takes longer than that fixed patience — onebws secret getper secret (~221), 8 in flight — so the kill lands mid-refresh, the next start begins the refresh from zero, and the broker can starve indefinitely (observed 2026-11-23 07:54–07:56Z; left alone, the same refresh completed and health went green).The repo-owned half of the defect: the broker gave a heal no way to apply the rule this issue prescribes ("do not restart while
refreshing:truewith refresh progress underway"). Installs were batch-atomic — fetched values sat in a worker-local map until every fetch joined — so for the entire first refresh /health reportedsecrets: 0, with no progress signal at all. A slow-but-healthy refresh and a wedged one were indistinguishable.What this PR changes (fleet-queue,
secrets_broker.rsonly)Stategains arefresh_progressrecord{started_unix, fetched, total}, opened when the authoritative list lands, advanced once per completed fetch (either outcome — a completed fetch is forward motion), and closed when the refresh ends./healthpublishes it as an object in flight,nullwhen idle.install_refreshis unchanged and still owns eviction against the authoritative list and the all-fetches-failed → keep-whole-cache rule; the early landing changes only when a value becomes visible, never what installs./health'ssecretscount now climbs during a first refresh, and early secrets are servable while siblings still fetch.servingstill waits for a completed refresh.refreshingwith advancingrefresh_progress.fetched(or a climbingsecretscount); size a first-refresh patience window to the vault (refresh_progress.total× per-call latency ÷ 8); restart is for absent, not-refreshing-and-not-serving, or no-progress-past-the-window.What remains outside this repo
The prelude's kill rule itself (
~/tools/init-ensure.sh, sandbox-local, not versioned here) needs the matching change: consultrefreshing/refresh_progressbefore killing a not-serving broker, with the vault-sized patience above. Flagged on the issue; this PR gives that rule the signal it needs.Evidence
cargo test -p fleet-queue --lib --features secrets-broker— 143 passed, 0 failed (sandbox, local rustup 1.99.0 toolchain cargo; the module is feature-gated, so the feature flag is required to see its tests at all).secrets_brokermodule suite: 26 passed, 0 failed, including 3 new tests, each naming its oracle:health_publishes_refresh_progress_only_while_refreshing— progress object with exact fetched/total in flight;nullwhen idle.fetched_secrets_are_visible_before_the_first_refresh_completes— a landed fetch is in the cache and counted on /health mid-first-refresh;servingstays false; an unreached name still gets the not-loaded 503.refresh_progress_counts_completions_and_stops_at_the_end— the count advances per completion and the record closes with the refresh (a frozen count is the wedged signal).rustfmt --checkclean. No new build warnings (the 2 warnings in the test build are pre-existing:merge_intent.rsunused-mut,home.rsdead code). Clippy not run locally — CI is the first clippy pass.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.