Repository navigation
feat(queue): standing issue↔queue coverage reconciliation (#7016) - #7697
Conversation
Nothing reconciled the open-issue set against fleet-queue coverage, so issues filed outside a creator run never got a queue item and no lane ever dispositioned them. The 2026-11-07 import of 23 such issues was a one-off; this is the standing version. - broker: new read-only POST /coverage verb. Given the open-issue set the caller just enumerated, it answers per issue whether a LIVE task (queued/claimed/parked/blocked) holds its repo-health dedupe key in the named queue. A done task is not coverage, and neither is a task in another queue (Drew's doctrine, 2026-11-07). - scripts/fleet/queue-reconcile/: check_coverage.py enumerates open issues via `gh api --paginate`, asks the broker for the diff, and (with --import) enqueues a triage packet per uncovered issue through the sanctioned CLI path, dedupe-keyed so re-runs are idempotent. Observe-only by default, matching the sweeper's revalidator rollout. A fetch or broker failure exits 3 and names the repo in an ERRORS section — it never reports as "0 uncovered". - systemd units (hourly :41, persistent) plus a registry row. - AGENTS.md: the file-and-enqueue rule for issues filed outside a creator run. Also fixes a pre-existing compile error in validate.rs: FLEET_REPOS is declared [&str; 10] but holds 9 entries, so the fleet-queue lib test target does not build at main with --all-features. CI does not build this crate, so the defect was invisible there. One-character fix. Tests: cargo test -p fleet-queue --all-features — 100 lib + 2 integration pass, incl. 4 new parser cases and 2 proptest properties (canonical keys round-trip for every class and dispatch suffix; another repo's key never matches). python3 -I test_check_coverage.py — 6 pass, offline via --fixture and a stub fleet binary. Closes #7016
|
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 8 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: ❌ FailedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1356769ad
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let marker = format!(":{repo}:issue:"); | ||
| let start = key.find(&marker)? + marker.len(); |
There was a problem hiding this comment.
Recognize legacy repository aliases when matching coverage
For renamed pilot repos, existing live tasks can still carry dedupe keys using developing-today/opencode, developing-today/openchamber, or dezren39/nix, as documented in validate.rs:13-15. This exact marker search only recognizes the current repository name supplied by the reconciliation script, despite the preceding comment promising alias support. Those tasks are therefore reported as uncovered, and import mode creates duplicate triage work under a different dedupe key rather than recognizing the existing live task. Normalize the known aliases or match all equivalent names before declaring an issue uncovered.
AGENTS.md reference: AGENTS.md:L74-L78
Useful? React with 👍 / 👎.
| out = subprocess.run( | ||
| [fleet, "queue", "enqueue", str(tmp), "--queue", queue], | ||
| capture_output=True, | ||
| text=True, | ||
| timeout=120, |
There was a problem hiding this comment.
Reuse the selected broker connection for imports
When --import is combined with --broker-url or --token-file, coverage uses those options, but this enqueue subprocess receives neither setting. The fleet client independently resolves its broker from REPO_QUEUE_BROKER_URL, its local configuration, or the session proxy, and independently loads its token (pkgs/fleet/crates/fleet-queue/src/client.rs:68-103). Consequently, a run can report successful imports into a different broker while the inspected broker remains uncovered, or fail authentication despite the supplied token being valid. Pass the selected broker URL and token-file path to the child through REPO_QUEUE_BROKER_URL and REPO_QUEUE_TOKEN_FILE.
Useful? React with 👍 / 👎.
| tmp = Path(os.environ.get("TMPDIR", "/tmp")) / f"coverage-{packet['payload']['issue']['number']}.json" | ||
| tmp.write_text(json.dumps(packet)) |
There was a problem hiding this comment.
Allocate a unique temporary file for each enqueue
When an ad-hoc import overlaps the scheduled import or another manual invocation, both processes use the same temporary pathname for a given issue number. One can overwrite the other's packet before its fleet subprocess reads it, or delete the file during cleanup. For equal issue numbers in different repositories, the subprocess can consequently read the other repository's packet while retaining its original --queue argument; broker validation does not check repository-to-queue correspondence, so this can enqueue work into the wrong pilot queue. Allocate a unique temporary file per enqueue rather than sharing a deterministic pathname.
AGENTS.md reference: AGENTS.md:L75-L77
Useful? React with 👍 / 👎.
| timeout=120, | ||
| ) | ||
| finally: |
There was a problem hiding this comment.
Handle enqueue subprocess exceptions before continuing
If an enqueue exceeds 120 seconds or the fleet executable cannot launch, subprocess.run raises TimeoutExpired or OSError rather than returning a nonzero exit code. The finally only removes the temporary file, so the exception escapes through main, skipping all remaining issues and repositories as well as report generation, leaving the previous latest.md in place. The timeout is reachable during a slow broker response because the fleet client's direct transport permits a 300-second read (pkgs/fleet/crates/fleet-queue/src/client.rs:108). Catch these exceptions and return a failed enqueue result so the existing error aggregation and reporting path can execute.
Useful? React with 👍 / 👎.
) - match legacy repo-name aliases (developing-today/opencode, developing-today/openchamber, dezren39/nix) when deciding coverage, so a live task under an old name is not reported uncovered and re-imported under a new dedupe key; - pass the selected broker URL and token file through REPO_QUEUE_BROKER_URL / REPO_QUEUE_TOKEN_FILE to the enqueue child, so imports cannot land in a different broker than the one inspected; - use a unique temp packet per enqueue, so overlapping runs cannot overwrite or delete each other's packet (or enqueue another repo's packet into the wrong queue); - treat an enqueue launch failure or timeout as a failed enqueue instead of escaping main and skipping the remaining issues and the report.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…e-coverage-reconciliation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Closes #7016
Problem
Nothing reconciles the open-issue set against fleet-queue coverage. Issues enter the queue only when a creator-class lane files them (file + enqueue in the same pass); anything filed another way — a work lane filing a blocker mid-task, an audit lane, by hand, or predating the queue (epics) — silently never gets a queue item, so no lane ever dispositions it. The 2026-11-07 reconciliation found 23 such issues across the four repos; that day's import was a one-off.
What this adds
Broker — read-only
POST /coverage. Given the open-issue set the caller just enumerated, it answers per issue whether a live task (queued/claimed/parked/blocked) holds its repo-health dedupe key in the named queue. Per Drew's doctrine (2026-11-07): adonetask is not coverage (done means triage or a landed slice, not a resolved issue), and neither is a task in a*-shadowqueue. It never writes tasks or events.scripts/fleet/queue-reconcile/— the scheduled job:gh api --paginate(PRs filtered out; a partial page would read as coverage that does not exist),--import, enqueues a triage packet per uncovered issue through the sanctioned CLI path, dedupe-keyedrepo-health:v1:triage:<repo>:issue:<n>so re-runs are idempotent by construction,systemd units (hourly at :41,
Persistent) + a row indoc/fleet-schedule-registry.mdper the same-pass rule.AGENTS.md: the file-and-enqueue rule for issues filed outside a creator run.Acceptance
queue-coverage-reconcile.timer, hourly, persistent./coverage(it needs a rebuild + restart). Verified end-to-end today: GitHub enumeration succeeds, the broker answersunknown command /coverage, and the script exits 3 with the repo named rather than reporting a false zero. Once the broker is redeployed the timer's first cycle produces the real number in~/.local/state/queue-reconcile/latest.md.AGENTS.md.Unrelated fix included
validate.rs:FLEET_REPOSis declared[&str; 10]but holds 9 entries, so thefleet-queuelib test target does not compile atmainwith--all-features. CI does not build this crate, so the defect was invisible there. One-character fix; it blocks the test target this change needs.Tests
New coverage: 4 parser cases + 2
proptestproperties on the dedupe-key parser (canonical keys round-trip for every class and dispatch suffix; another repo's key never matches), and 6 offline script tests (observe imports nothing, import enqueues exactly the uncovered set, full coverage imports nothing, fetch failure is an error not a zero, packet shape, report written).The packet the script builds validates against the live broker:
repo-queue validate→packet valid (repo-task/v1).Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.