Skip to content

Comments

fix: Phase 3b2 and triage gh pr view fails from cron (missing --repo)#1490

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/cron-gh-repo-context
Feb 15, 2026
Merged

fix: Phase 3b2 and triage gh pr view fails from cron (missing --repo)#1490
marcusquinn merged 1 commit intomainfrom
bugfix/cron-gh-repo-context

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 15, 2026

Summary

  • gh pr view without --repo infers the repo from the current directory's git remote
  • Cron runs from $HOME which isn't a git repo, so all PR lookups return empty → "unreachable"
  • This blocked Phase 3b2 from running overnight — the 5 verify_failed tasks were never reset to deployed for re-verification
  • Fix: extract owner/repo slug from the PR URL itself and pass --repo to gh pr view
  • Also cancelled orphaned t1048.10 (no TODO.md entry, subtask of verify_failed t1048)

Summary by CodeRabbit

  • Bug Fixes

    • Improved PR state queries to work reliably in scheduled automation tasks and cron jobs.
  • Chores

    • Enhanced internal PR handling logic to better support repository-aware queries in all automation contexts.

gh pr view without --repo infers the repo from the current directory's
git remote. Cron runs from $HOME which isn't a git repo, so all PR
lookups fail with 'unreachable'. This blocked Phase 3b2 from running
overnight — the 5 verify_failed tasks were never reset to deployed.

Fix: extract owner/repo slug from the PR URL (which already contains it)
and pass --repo to gh pr view. Both Phase 3b2 and triage are fixed.
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue where GitHub CLI commands, specifically gh pr view, failed when executed within cron jobs due to the absence of a Git repository context. The changes ensure that the necessary repository information is explicitly provided to the gh command, thereby restoring the functionality of automated processes that rely on checking pull request statuses.

Highlights

  • Cron Compatibility for gh pr view: The gh pr view command previously failed when executed from cron jobs because it implicitly relied on the current directory being a Git repository to infer the --repo argument. Cron environments typically run from $HOME, which is not a Git repository, leading to 'unreachable' errors.
  • Phase 3b2 Blockage Resolution: The failure of gh pr view in cron blocked Phase 3b2, preventing verify_failed tasks from being reset for re-verification. This fix ensures these tasks can now be processed correctly.
  • Repository Slug Extraction: The script now extracts the owner/repo slug directly from the pull request URL using an updated regular expression. This allows the --repo argument to be explicitly passed to gh pr view, resolving the cron compatibility issue.
  • Orphaned Task Cancellation: An orphaned task, t1048.10, which was a subtask of verify_failed t1048 and had no corresponding entry in TODO.md, has been cancelled.
Changelog
  • .agents/scripts/supervisor/pulse.sh
    • Updated regular expressions to extract both the pull request number and the repository slug from GitHub PR URLs.
    • Modified gh pr view commands to explicitly include the --repo flag with the extracted repository slug, ensuring cron compatibility.
    • Added comments to clarify the purpose of the --repo flag for cron compatibility in both cmd_pulse and cmd_triage functions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

Walkthrough

The PR refactors GitHub PR URL parsing to extract repository slug alongside PR number, enabling repository-aware gh pr view queries with explicit --repo argument. This ensures correct PR lookups in cron contexts where repository context may be missing.

Changes

Cohort / File(s) Summary
PR URL Parsing and Repository-Aware Queries
.agents/scripts/supervisor/pulse.sh
Introduces regex-based parsing to extract repository slug (e.g., owner/repo) and PR number from GitHub URLs. Updates gh pr view invocations to include explicit --repo <repo_slug> argument, enabling correct PR state queries in cron contexts. Changes applied across Phase 3b2 reconciliation and triage-related code paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🔗 A URL now yields its treasured slug,
GitHub secrets no longer mug,
From github.com/owner/repo/pull/42
Extraction flows with pristine precision,
Cron tasks won't suffer indecision! 🚀

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: addressing gh pr view failures in cron contexts by adding missing --repo argument, which aligns perfectly with the changeset's primary objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/cron-gh-repo-context

No actionable comments were generated in the recent review. 🎉


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 16 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sun Feb 15 14:51:36 UTC 2026: Code review monitoring started
Sun Feb 15 14:51:37 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 16

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 16
  • VULNERABILITIES: 0

Generated on: Sun Feb 15 14:51:39 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

@marcusquinn marcusquinn merged commit 065d756 into main Feb 15, 2026
11 checks passed
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses an issue where gh pr view fails when executed from a cron job because it cannot infer the repository from the current directory. The fix correctly extracts the repository slug and PR number from the PR URL and passes the --repo flag to the GitHub CLI. The changes are consistent across the pulse and triage commands. I have provided a minor suggestion to improve the robustness of the URL parsing regex to handle optional trailing slashes or query parameters, which is a common edge case in URL handling.

pr_number="${BASH_REMATCH[1]}"
# Extract PR number and repo slug from URL
local pr_number="" pr_repo_slug=""
if [[ "$stale_pr" =~ github\.com/([^/]+/[^/]+)/pull/([0-9]+)$ ]]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The regex anchor $ is quite strict. If the PR URL contains a trailing slash or query parameters (e.g., from a browser copy-paste), this match will fail. Consider making the end of the regex more flexible to handle these common cases.

Suggested change
if [[ "$stale_pr" =~ github\.com/([^/]+/[^/]+)/pull/([0-9]+)$ ]]; then
if [[ "$stale_pr" =~ github\.com/([^/]+/[^/]+)/pull/([0-9]+)(/|\?|#|$) ]]; then

pr_num="${BASH_REMATCH[1]}"
# Extract PR number and repo slug from URL
local pr_num="" triage_repo_slug=""
if [[ "$tpr" =~ github\.com/([^/]+/[^/]+)/pull/([0-9]+)$ ]]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the change in cmd_pulse, the strict $ anchor might cause parsing failures for URLs with trailing slashes or parameters. Using a more permissive termination pattern would improve robustness.

Suggested change
if [[ "$tpr" =~ github\.com/([^/]+/[^/]+)/pull/([0-9]+)$ ]]; then
if [[ "$tpr" =~ github\.com/([^/]+/[^/]+)/pull/([0-9]+)(/|\?|#|$) ]]; then

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.

1 participant