Fix keepalive detection repo resolution for gate replay - #26
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
Automated Status SummaryHead SHA: 2cff0d0
Coverage Overview
Coverage Trend
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
|
@codex fix comment |
There was a problem hiding this comment.
Pull request overview
This PR enhances the keepalive detection mechanism by adding robust repository coordinate resolution with multiple fallback sources to prevent 404 errors in workflow_run contexts where context.repo may not be available.
- Implements a multi-tier fallback chain to resolve owner/repo from context.repo, GITHUB_REPOSITORY environment variable, and comment HTML URL
- Adds early validation and graceful exit when repository coordinates cannot be resolved
- Improves error handling with a new 'missing-repo' reason code
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Resolve repository coordinates with robust fallbacks to avoid 404s in workflow_run | ||
| const repoEnv = String(env.GITHUB_REPOSITORY || '').split('/'); | ||
| let owner = context?.repo?.owner || repoEnv[0] || ''; | ||
| let repo = context?.repo?.repo || repoEnv[1] || ''; | ||
| if ((!owner || !repo) && comment?.html_url) { | ||
| const match = comment.html_url.match(/github\.com\/(.+?)\/(.+?)\//); | ||
| if (match) { | ||
| owner = owner || match[1]; | ||
| repo = repo || match[2]; | ||
| } | ||
| } | ||
| if (!owner || !repo) { | ||
| outputs.reason = 'missing-repo'; | ||
| core.info('Keepalive dispatch skipped: unable to resolve repository owner/name for PR lookup.'); | ||
| return finalise(false); | ||
| } |
There was a problem hiding this comment.
The new repository resolution fallback logic (lines 252-267) lacks test coverage. Consider adding test cases that verify the fallback chain works correctly when context.repo is missing, when GITHUB_REPOSITORY is needed, and when parsing from comment.html_url is required. This is especially important since the PR aims to fix issues in workflow_run contexts.
| let owner = context?.repo?.owner || repoEnv[0] || ''; | ||
| let repo = context?.repo?.repo || repoEnv[1] || ''; |
There was a problem hiding this comment.
The fallback logic uses || operator which treats empty strings as falsy. However, if context?.repo?.owner or context?.repo?.repo exist but are empty strings, the fallback to repoEnv won't trigger. Consider using nullish coalescing with explicit empty string checks, or ensure that context.repo properties are always either valid strings or undefined/null, never empty strings.
|
Summary
Testing
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@codex fix comments |
|
Summary
Testing
|
… systems The opener cron selects work by `priority:high|normal|low` label. The weekly repo-review's design-vs-impl pass selects by traced gap. Issues created manually with `enhancement` or `feature` labels but no `priority:*` label fall into a hole: neither system sees them. Worked example surfaced 2026-05-07: Inv-Man-Intake #25, #26, #27 were created 2026-03-01 with `enhancement` + `milestone:B-extraction-queue-images` only. 71 days later, no activity, no agent ever picked them up. New `scripts/repo_review_backlog_scan.py`: - Scans all active repos via `gh issue list` - Surfaces issues with `enhancement` OR `feature` label that: - have NO `priority:*` label (opener would already see them) - have NO `agent:*` label (an agent owns it) - have NO dependabot / sync* / process-eval label (other automations) - have NOT been updated in the past `--stale-days` days (default 7) - Sorts oldest-stale-first; writes JSON to --out Coordinator runs the scan after the final evaluator pass and feeds the result to the notify step. The desktop file now includes a "Backlog needing your attention" section listing each stale item with the exact three `gh issue edit/close` commands to promote / deprioritize / close it. macOS notification subtitle shows both queue and backlog counts. Goal: an enhancement issue sits unaddressed for at most 1-2 weekly cycles before the human surfaces it. Smoke-test against current state: found 4 items in Inv-Man-Intake (#27, #26, #25 at 71 days; #10 at 14 days) — exactly the pattern the user's report identified. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…mans The 2026-05-10 feedback: surfacing every unaddressed enhancement issue for human triage is heavier than necessary. The system should label the clear-cut cases itself and only ask for human input when the issue shape is ambiguous. Two-tier classification in `repo_review_backlog_scan.py`: **auto-labelable** — leaf enhancement issues. Heuristic priority: - has `milestone:*` label → `priority:normal` (declared planned work) - created >90 days ago without milestone → `priority:low` (likely stale) - otherwise → `priority:normal` (default) With `--apply` (the cron default), the scanner calls `gh issue edit --add-label priority:X` for each leaf. The opener picks them up on its next pass. **needs-human** — surfaced for decision, not auto-labeled: - title contains epic/tracker/umbrella/roadmap/rollup/parent issue - has `epic`/`umbrella`/`tracker`/`meta`/`parent`/`needs-triage`/`discussion` - has any `blocked*` label - body has ≥2 task-checkbox lines mentioning #NNN (umbrella tracking children) - body has a "Children: #..." or "Child issues: #..." declaration Validated against the user's worked example: #25/#26/#27 → leaf (auto-label `priority:normal`); #10 → umbrella detected via 4 child checkboxes (surface for human); #7 → umbrella detected via "epic" in title. Matches the user's stated preference exactly. The desktop reminder now renders two backlog subsections: - **Auto-labeled this week (N items) — FYI, no action required**: brief one-line summary per item with applied priority. - **Backlog needing your decision (M items)**: full three-command resolution block per item (promote / deprioritize / close). macOS notification text now distinguishes the cases: clean weeks with auto-labels only show "no action required"; weeks with needs-human items show "decisions needed". Coordinator now passes `--apply` to the scanner so the cron actually mutates labels (dry-run is still the default when running the scanner standalone for testing). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
No description provided.