Skip to content

fix(worktree-reaper): gate on ignored files, record ignored paths before removal (#6734) - #6748

Merged
dezren39 merged 1 commit into
mainfrom
fallback/6734-reaper-ignored
Nov 7, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fallback/6734-reaper-ignored

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes #6734.

Problem

The worktree-reaper's CLEAN gate never enumerated ignored files (git status without --ignored), so a worktree whose only non-tracked content was ignored files classified as clean and was reaped — git worktree remove deleted the ignored content with the tree, unrecorded in the run record — even though ignored content is exactly what the PUSHED proof cannot cover. Verified in triage: status_entries() returned ([], []) for an ignored-only synthetic worktree.

Change (infra/worktree-reaper/)

  • status_entries() now also returns the ignored list (porcelain !! via --ignored=matching; git lists an ignored directory itself when the directory matches a rule, individual ignored files otherwise).
  • New config allowlist ignored_dirt_prefixes / ignored_dirt_files (defaults + config.json: prefixes target/, node_modules/ — reproducible build output; files none), matched by ignored_allowlisted() on whole path segments (build output lives at crate roots, e.g. pkgs/id/target/) and basename.
  • CLEAN gate (evaluate) and the pre-removal re-verification (reap) both fail closed on any ignored path beyond the allowlist. Before removal, reap_tree records every ignored path present in ignored_paths in the run record.
  • The module docstring's CLEAN description and the README gate table state the ignored-files rule explicitly.

Tests

python3 tests/test_worktree_reaper.py — 14 tests OK on the laptop worktree, including new test_05_ignored_gate (status-level: ignored-only tree enumerates as ([], [], ["local-state.db"]); ignored-only tree kept dirty; allowlisted-untracked + unlisted-ignored tree kept; allowlisted target/ tree reaped with ignored_paths naming the target paths in the decision record) and test_ignored_allowlisted unit coverage; the pre-existing reap matrix passes unchanged.

🤖 Filed by repo-queue-worker Lane T in fallback mode (queue backend down 2026-11-06/07); the issue was the task.


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

@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 03:42
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6ebff2e7-5cc8-4508-b112-0d451763c6ea
Commits

Reviewing files that changed from the base of the PR and between 7e903f6 and 953bf96.

Files selected for processing: 4

  • infra/worktree-reaper/README.md
  • infra/worktree-reaper/bin/worktree_reaper.py
  • infra/worktree-reaper/config.json
  • infra/worktree-reaper/tests/test_worktree_reaper.py
  • 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 7, 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-07T03:44:34.789631Z 953bf96 PR opened
ℹ️ 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 09a11e9 into main Nov 7, 2026
3 checks passed
@dezren39
dezren39 deleted the fallback/6734-reaper-ignored branch November 7, 2026 03:44
@dezren39

dezren39 commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

🤖 Agent note · duplicate-PR salvage check (lane code-x)

  • Agent: queue worker (repo-worker-code), lane code-x — FALLBACK MODE
  • Session / ID: cron repo-queue-worker-shift-x run 2026-11-06 20:39 CST; fallback worker id repo-worker-code-x

Duplicate check per protocol: my lane implemented #6734 in parallel (PR #6749, branch queue/fb-6734-reaper-ignored-gate) after claiming the issue in fallback mode — lane code-t's fix claim and mine crossed (their triage release and fix work interleaved with my claim under lane clock skew; their PR #6748 is canonical: it merged first and closed #6734).

I diffed my implementation against the merged 953bf96 before closing #6749:

  • Same shape throughout: status_entries() returns the ignored list via --ignored=matching, both the CLEAN gate and the reap-time re-verification fail closed on unlisted ignored paths, and ignored paths are recorded on the record before removal (here: ignored_paths; mine used a different key name for the same data).
  • Allowlist matching: here prefixes match on whole path segments, which covers build output at any depth (pkgs/id/target/) — the same cases my component-name matching covered, including the exact-segment edge (target_notes.txt does not match).
  • Only delta: my config seed also named __pycache__ and .direnv. That is a seed-list judgment difference, not an acceptance gap — under this PR's config those paths fail closed (safe direction), and the config can be extended if a real tree needs it. Nothing unique to salvage.
  • My tests duplicated the same three gate scenarios; the merged suite (14 tests) covers them.

Closing PR #6749 as superseded by this PR; no follow-up needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant