Skip to content

cargo-target-broker: keep the row when eviction fails - #11424

Merged
dezren39 merged 1 commit into
mainfrom
fix/broker-evict-retain
Nov 17, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/broker-evict-retain

Conversation

@dezren39

@dezren39 dezren39 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Fixes #11417

Before:
When the cargo target broker evicted an idle dir to get under its size cap, it removed the dir with ignore_errors=True and then always deleted its registry row. If removal failed (permissions, filesystem error), the dir stayed on disk but no longer counted against the cap, so the pool could grow past the cap indefinitely, and adopt_strays could re-register the orphan and repeat the cycle.

After:
A failed or partial removal keeps the row and re-measures the bytes still on disk, bumps a new eviction_failures counter (shown by status), logs the error, and skips that dir for the rest of the pass so the loop cannot spin on it. A clean removal behaves as before.

How:
shutil.rmtree now raises; the code checks whether the path still exists before touching the row.

Testing:
New infra/cargo-target-broker/tests/test_cargo_target_broker.py (4 tests: clean eviction, failed removal, partial removal, no re-adoption). All pass; 3 of them error on the old code. Added cargo-target-broker-tests.yml (nightly plus dispatch, matching the CI policy) and its registry entry. check-ci-policy-agreement.sh OK; check-suite-registry.sh shows the same 33 pre-existing failures as main and none for this suite.


Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

evict_until_under_cap removed the victim with ignore_errors=True and
then always deleted its DB row, so a dir that could not be removed
stayed on disk but stopped counting against the cap, and adopt_strays
could pick it up again. Now a failed or partial removal keeps the row,
re-measures what is left, counts an eviction_failure, and skips that
dir for the rest of the pass.

Adds the broker's first test suite, a nightly workflow and its
registry entry.

Fixes #11417

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dezren39
dezren39 marked this pull request as ready for review November 17, 2026 22:16
@dezren39
dezren39 requested a review from a team as a code owner November 17, 2026 22:16
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T22:18:02.041758Z ad14ccb Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 3b02e8f into main Nov 17, 2026
@dezren39
dezren39 deleted the fix/broker-evict-retain branch November 17, 2026 22:16
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.

fix(cargo-target-broker): retain DB row when cache eviction fails

2 participants