Skip to content

t1453: enforce pulse-wrapper utilization invariants#4198

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/t1453-pulse-utilization-invariants
Mar 12, 2026
Merged

t1453: enforce pulse-wrapper utilization invariants#4198
marcusquinn merged 1 commit intomainfrom
bugfix/t1453-pulse-utilization-invariants

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Mar 12, 2026

Summary

  • add deterministic post-pulse utilization enforcement in pulse-wrapper.sh that backfills pulse cycles until worker count reaches MAX_WORKERS or no runnable work remains
  • integrate launch-validation signals into wrapper enforcement by treating queued issues without live workers as failed launches that trigger immediate backfill
  • update /pulse command guidance to use the new check_worker_launch helper and document wrapper-backed fill-to-cap enforcement

Testing

  • shellcheck .agents/scripts/pulse-wrapper.sh
  • markdown-formatter check /Users/marcusquinn/Git/aidevops.bugfix-t1453-pulse-utilization-invariants/.agents/scripts/commands/pulse.md

Summary by CodeRabbit

  • New Features

    • Centralized worker launch validation with automatic enforcement of validation states.
    • Introduced automated backfill mechanism for queued items without active workers, with configurable cycle limits and grace periods.
  • Documentation

    • Updated validation and dispatch guidance to reflect new wrapper-driven validation semantics and backfill cycle enforcement.

@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 significantly enhances the pulse system's worker utilization by introducing robust enforcement mechanisms within pulse-wrapper.sh. It ensures that worker slots are consistently filled to capacity by automatically dispatching new tasks if the active worker count is below the maximum or if previously dispatched workers fail to launch. This change makes the system more efficient and reliable in processing tasks by maintaining optimal resource usage.

Highlights

  • Deterministic Utilization Enforcement: Added deterministic post-pulse utilization enforcement in pulse-wrapper.sh that backfills pulse cycles until the worker count reaches MAX_WORKERS or no runnable work remains.
  • Launch Validation Integration: Integrated launch-validation signals into wrapper enforcement by treating queued issues without live workers as failed launches that trigger immediate backfill.
  • Updated Command Guidance: Updated /pulse command guidance to utilize the new check_worker_launch helper and document wrapper-backed fill-to-cap enforcement.
Changelog
  • .agents/scripts/commands/pulse.md
    • Updated the "Launch validation is mandatory" section to reference t1452/t1453 and the new wrapper helper check_worker_launch.
    • Modified the "Fill-to-cap post-condition" section to include t1449/t1453 and explain the new pulse-wrapper.sh enforcement.
  • .agents/scripts/pulse-wrapper.sh
    • Introduced PULSE_BACKFILL_MAX_ATTEMPTS and PULSE_LAUNCH_GRACE_SECONDS environment variables with default values and validation.
    • Added count_active_workers function to determine the number of currently running worker processes.
    • Implemented get_max_workers_target to retrieve the target maximum worker count from a file.
    • Created count_runnable_candidates to identify available issues and PRs for dispatch.
    • Developed count_queued_without_worker to detect queued issues that lack an active worker process, signaling launch failures.
    • Added check_worker_launch function to validate if a worker process has successfully started and is not outputting CLI usage.
    • Implemented enforce_utilization_invariants to manage the backfill process, ensuring worker utilization targets are met.
    • Called enforce_utilization_invariants after run_pulse in the main function to activate the new enforcement logic.
Activity
  • No human activity has been recorded on this pull request yet.
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.

@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, 402 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Thu Mar 12 01:53:32 UTC 2026: Code review monitoring started
Thu Mar 12 01:53:32 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 402

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 402
  • VULNERABILITIES: 0

Generated on: Thu Mar 12 01:53:35 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

Walkthrough

Introduced centralized worker launch validation and utilization enforcement via pulse-wrapper.sh, replacing ad-hoc CLI output checks. Added utility functions for worker state inspection and backfill cycle management, with updated documentation reflecting the new validation framework.

Changes

Cohort / File(s) Summary
Pulse Workflow Documentation
.agents/scripts/commands/pulse.md
Updated validation task references from t1452 to t1452/t1453; replaced ad-hoc process checks with pulse-wrapper.sh-based validation; expanded post-condition text for Fill-to-cap to include bounded backfill enforcement and immediate re-dispatch on validation failure.
Pulse Wrapper Utilities & Configuration
.agents/scripts/pulse-wrapper.sh
Added new configuration parameters (PULSE_BACKFILL_MAX_ATTEMPTS, PULSE_LAUNCH_GRACE_SECONDS) with validation hooks. Introduced six utility functions for worker state management and backfill enforcement (count_active_workers, get_max_workers_target, count_runnable_candidates, count_queued_without_worker, check_worker_launch, enforce_utilization_invariants). Integrated enforce_utilization_invariants into main pulse workflow post-dispatch. ⚠️ Functions appear duplicated within the file.

Sequence Diagram

sequenceDiagram
    actor Dispatcher
    participant PulseWrapper as Pulse Wrapper<br/>(Main)
    participant PulseRunner as Pulse Runner<br/>(run_pulse)
    participant Validator as Validator<br/>(check_worker_launch)
    participant WorkerPool as Worker Pool
    participant BackfillLogic as Backfill Enforcement<br/>(enforce_utilization_invariants)

    Dispatcher->>PulseWrapper: Trigger pulse cycle
    PulseWrapper->>PulseRunner: run_pulse()
    PulseRunner->>WorkerPool: Dispatch worker tasks
    PulseRunner-->>PulseWrapper: Dispatch complete

    PulseWrapper->>Validator: check_worker_launch(issue, repo)
    Validator->>WorkerPool: Check for live process & CLI markers
    alt Validation Fails
        Validator-->>PulseWrapper: Launch invalid, trigger re-dispatch
        PulseWrapper->>PulseRunner: Re-dispatch same cycle
    else Validation Passes
        Validator-->>PulseWrapper: Launch valid
    end

    PulseWrapper->>BackfillLogic: enforce_utilization_invariants()
    BackfillLogic->>BackfillLogic: Count active workers vs max target
    BackfillLogic->>BackfillLogic: Count runnable candidates & queued work
    alt Backfill Needed
        BackfillLogic->>PulseRunner: run_pulse() (backfill cycle)
        loop Up to MAX_ATTEMPTS
            PulseRunner->>WorkerPool: Fill queued items without workers
        end
    end
    BackfillLogic-->>PulseWrapper: Invariants satisfied or stop flag set

    PulseWrapper-->>Dispatcher: Cycle complete
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • PR #4140 — Modifies pulse-wrapper.sh configuration and logging behavior; introduces wrapper-driven fallback semantics that overlap with the new configuration parameters and validation framework.
  • PR #4127 — Updates worker capacity and dispatch limits determination in pulse-wrapper.sh; the new enforce_utilization_invariants logic directly extends this max_workers/concurrency control pattern.
  • PR #2853 — Modifies pulse-wrapper.sh worker lifecycle and watchdog behavior; the new launch validation and backfill enforcement interact with worker process management at the code level.

Suggested labels

enhancement

Poem

🔄 Validation flows with wrappered grace,
Launch checks guard the worker's place,
Backfill cycles heed the call,
Utilization enforced through it all—
A pulse now measured, tuned, and true.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 't1453: enforce pulse-wrapper utilization invariants' directly matches the main objective of adding deterministic post-pulse utilization enforcement in pulse-wrapper.sh.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/t1453-pulse-utilization-invariants

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/scripts/pulse-wrapper.sh:
- Around line 1761-1765: The pgrep invocation in the while loop (inside
pulse-wrapper.sh where issue_num is read and total is incremented) uses `pgrep
-fal`, which is not portable between Linux and macOS; replace the call with a
portable check using only `pgrep -f "issue-${issue_num}|Issue #${issue_num}:"`
(remove `-a` and `-l`) so the script relies solely on the exit status to decide
whether to increment `total`, ensuring `issue_num`, the pgrep check, and the
total increment logic remain unchanged.
- Around line 1809-1817: The pgrep invocation using non-portable flags in the
condition around issue handling (the pgrep -fal "issue-${issue_number}|Issue
#${issue_number}:") should be changed to the POSIX-compatible form (use pgrep
-f) and any logic that relied on -l/-a output adjusted accordingly; also address
the ripgrep (rg) dependency used in the loop that checks files (rg -q '...') by
either documenting rg in project setup/dependencies or replacing rg with a
portable grep -E/grep -q equivalent, and apply the same pgrep fix to other
occurrences of pgrep -fal in pulse-wrapper.sh so behavior remains consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 770f42be-2e19-4c74-92a8-f4ce3b70ad33

📥 Commits

Reviewing files that changed from the base of the PR and between d73e317 and ad9afa9.

📒 Files selected for processing (2)
  • .agents/scripts/commands/pulse.md
  • .agents/scripts/pulse-wrapper.sh

Comment on lines +1761 to +1765
while IFS= read -r issue_num; do
[[ "$issue_num" =~ ^[0-9]+$ ]] || continue
if ! pgrep -fal "issue-${issue_num}|Issue #${issue_num}:" >/dev/null; then
total=$((total + 1))
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

pgrep -fal has portability issues between Linux and macOS.

The -a flag has different meanings:

  • Linux (GNU pgrep): -a, --list-full — shows full command line
  • macOS (BSD pgrep): -a — include process ancestors in match

Since output is discarded to /dev/null, only the exit code matters. The -l flag is also unnecessary here. For cross-platform reliability, use just -f:

🔧 Proposed fix for portability
 		while IFS= read -r issue_num; do
 			[[ "$issue_num" =~ ^[0-9]+$ ]] || continue
-			if ! pgrep -fal "issue-${issue_num}|Issue #${issue_num}:" >/dev/null; then
+			if ! pgrep -f "issue-${issue_num}|Issue #${issue_num}:" >/dev/null 2>&1; then
 				total=$((total + 1))
 			fi
 		done <<<"$queued_numbers"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/pulse-wrapper.sh around lines 1761 - 1765, The pgrep
invocation in the while loop (inside pulse-wrapper.sh where issue_num is read
and total is incremented) uses `pgrep -fal`, which is not portable between Linux
and macOS; replace the call with a portable check using only `pgrep -f
"issue-${issue_num}|Issue #${issue_num}:"` (remove `-a` and `-l`) so the script
relies solely on the exit status to decide whether to increment `total`,
ensuring `issue_num`, the pgrep check, and the total increment logic remain
unchanged.

Comment on lines +1809 to +1817
if pgrep -fal "issue-${issue_number}|Issue #${issue_number}:" >/dev/null; then
local candidate
for candidate in "${log_candidates[@]}"; do
if [[ -f "$candidate" ]] && rg -q '^opencode run \[message\.\.\]|^run opencode with a message|^Options:' "$candidate"; then
echo "[pulse-wrapper] Launch validation failed for issue #${issue_number} (${repo_slug}) — CLI usage output detected in ${candidate}" >>"$LOGFILE"
return 1
fi
done
return 0
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify if ripgrep (rg) is used elsewhere in the codebase or if there's a documented dependency

# Check for rg usage in shell scripts
echo "=== rg usage in .agents/scripts/ ==="
rg -l '\brg\b' .agents/scripts/*.sh 2>/dev/null || echo "No other rg usage found"

# Check if there's a dependency list
echo ""
echo "=== Checking for documented dependencies ==="
fd -t f -e md 'INSTALL|SETUP|DEPENDENCY|README' . --exec head -50 {} 2>/dev/null | grep -i 'ripgrep\|rg' || echo "No ripgrep dependency documented"

Repository: marcusquinn/aidevops

Length of output: 3487


🏁 Script executed:

#!/bin/bash

# 1. Check for ripgrep in dependency/setup files
echo "=== Ripgrep in dependency/setup files ==="
fd -t f \( -name 'setup.sh' -o -name '.tool-versions' -o -name 'Brewfile' -o -name 'requirements*.txt' -o -name 'package.json' -o -name 'Dockerfile' \) . --exec grep -l 'ripgrep\|rg' {} \; 2>/dev/null || echo "No explicit ripgrep in common dependency files found"

# 2. Check if README or INSTALL documents ripgrep as requirement
echo ""
echo "=== README/INSTALL mentioning ripgrep ==="
fd -t f \( -name 'README*' -o -name 'INSTALL*' -o -name 'SETUP*' \) . --exec grep -i 'ripgrep\|rg' {} + 2>/dev/null || echo "Not found in README/INSTALL"

# 3. Check pgrep usage pattern in .agents/scripts/
echo ""
echo "=== pgrep usage in .agents/scripts/ ==="
rg -n 'pgrep' .agents/scripts/*.sh | head -20

# 4. Read the actual lines 1809-1817 in pulse-wrapper.sh
echo ""
echo "=== Lines 1809-1817 in pulse-wrapper.sh ==="
sed -n '1809,1817p' .agents/scripts/pulse-wrapper.sh

Repository: marcusquinn/aidevops

Length of output: 2840


🏁 Script executed:

#!/bin/bash

# 1. Check for pgrep -fal specifically
echo "=== pgrep -fal usage in codebase ==="
rg 'pgrep.*-.*a.*l' .agents/scripts/*.sh

# 2. Check for any tools documentation
echo ""
echo "=== Tool requirements documentation ==="
cat .tool-versions 2>/dev/null || echo "No .tool-versions found"
echo ""
cat .github/workflows/*.yml 2>/dev/null | grep -A5 'ripgrep\|setup-' | head -20 || echo "No tool setup in workflows"

# 3. Check if there's any comment about tool dependencies in the scripts themselves
echo ""
echo "=== Tool requirement comments in pulse-wrapper.sh ==="
head -50 .agents/scripts/pulse-wrapper.sh | grep -i 'require\|depend\|need\|install'

# 4. Check what the -a and -l flags do (look at pgrep man page context or comments)
echo ""
echo "=== Context around pgrep usage in pulse-wrapper.sh ==="
sed -n '1800,1825p' .agents/scripts/pulse-wrapper.sh

Repository: marcusquinn/aidevops

Length of output: 3538


Remove non-portable pgrep flags and document or replace rg dependency.

Line 1809 uses pgrep -fal, where -a and -l are GNU/Linux-only extensions not available on macOS. Replace with POSIX-compatible pgrep -f.

Additionally, rg (ripgrep) is used here without any documented setup requirement. While ripgrep is a project pattern, the absence of any dependency documentation creates maintenance friction. Either add ripgrep to an explicit setup/dependency file, or use grep -E as a portable fallback.

Suggested fixes
 	while [[ "$elapsed" -lt "$grace_seconds" ]]; do
-		if pgrep -fal "issue-${issue_number}|Issue #${issue_number}:" >/dev/null; then
+		if pgrep -f "issue-${issue_number}|Issue #${issue_number}:" >/dev/null 2>&1; then
 			local candidate
 			for candidate in "${log_candidates[@]}"; do
-				if [[ -f "$candidate" ]] && rg -q '^opencode run \[message\.\.\]|^run opencode with a message|^Options:' "$candidate"; then
+				if [[ -f "$candidate" ]] && grep -Eq '^opencode run \[message\.\.\]|^run opencode with a message|^Options:' "$candidate"; then
 					echo "[pulse-wrapper] Launch validation failed for issue #${issue_number} (${repo_slug}) — CLI usage output detected in ${candidate}" >>"$LOGFILE"
 					return 1
 				fi

Note: pgrep -fal appears in at least one other location in pulse-wrapper.sh; same fix applies.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if pgrep -fal "issue-${issue_number}|Issue #${issue_number}:" >/dev/null; then
local candidate
for candidate in "${log_candidates[@]}"; do
if [[ -f "$candidate" ]] && rg -q '^opencode run \[message\.\.\]|^run opencode with a message|^Options:' "$candidate"; then
echo "[pulse-wrapper] Launch validation failed for issue #${issue_number} (${repo_slug}) — CLI usage output detected in ${candidate}" >>"$LOGFILE"
return 1
fi
done
return 0
if pgrep -f "issue-${issue_number}|Issue #${issue_number}:" >/dev/null 2>&1; then
local candidate
for candidate in "${log_candidates[@]}"; do
if [[ -f "$candidate" ]] && grep -Eq '^opencode run \[message\.\.\]|^run opencode with a message|^Options:' "$candidate"; then
echo "[pulse-wrapper] Launch validation failed for issue #${issue_number} (${repo_slug}) — CLI usage output detected in ${candidate}" >>"$LOGFILE"
return 1
fi
done
return 0
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/pulse-wrapper.sh around lines 1809 - 1817, The pgrep
invocation using non-portable flags in the condition around issue handling (the
pgrep -fal "issue-${issue_number}|Issue #${issue_number}:") should be changed to
the POSIX-compatible form (use pgrep -f) and any logic that relied on -l/-a
output adjusted accordingly; also address the ripgrep (rg) dependency used in
the loop that checks files (rg -q '...') by either documenting rg in project
setup/dependencies or replacing rg with a portable grep -E/grep -q equivalent,
and apply the same pgrep fix to other occurrences of pgrep -fal in
pulse-wrapper.sh so behavior remains consistent.

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 introduces a robust mechanism to enforce worker utilization by backfilling pulse cycles. It adds several helper functions to count active workers, runnable candidates, and detect failed launches. The logic is sound and well-encapsulated. The documentation is also updated to guide users on the new check_worker_launch helper. I've identified a couple of areas for improvement in the new helper functions where the gh command's default pagination limits could lead to incomplete data, potentially affecting the accuracy of the backfill logic. I've updated the suggestions to use the --paginate flag for comprehensive data retrieval.

Comment on lines +1721 to +1727
issue_json=$(gh issue list --repo "$slug" --state open --json assignees,labels --limit 100 2>/dev/null) || issue_json="[]"
local issue_count
issue_count=$(echo "$issue_json" | jq '[.[] | select((.assignees | length) == 0 and (.labels | map(.name) | index("status:blocked") | not))] | length' 2>/dev/null) || issue_count=0
[[ "$issue_count" =~ ^[0-9]+$ ]] || issue_count=0

local pr_json
pr_json=$(gh pr list --repo "$slug" --state open --json reviewDecision,statusCheckRollup --limit 100 2>/dev/null) || pr_json="[]"

Choose a reason for hiding this comment

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

medium

The gh CLI commands are limited to fetching 100 items by default. If a repository has more than 100 open issues or pull requests, this count of runnable candidates will be incomplete, potentially causing the backfill loop to terminate prematurely even when there is more work available. To ensure all items are retrieved, use the --paginate flag.

Suggested change
issue_json=$(gh issue list --repo "$slug" --state open --json assignees,labels --limit 100 2>/dev/null) || issue_json="[]"
local issue_count
issue_count=$(echo "$issue_json" | jq '[.[] | select((.assignees | length) == 0 and (.labels | map(.name) | index("status:blocked") | not))] | length' 2>/dev/null) || issue_count=0
[[ "$issue_count" =~ ^[0-9]+$ ]] || issue_count=0
local pr_json
pr_json=$(gh pr list --repo "$slug" --state open --json reviewDecision,statusCheckRollup --limit 100 2>/dev/null) || pr_json="[]"
issue_json=$(gh issue list --repo "$slug" --state open --json assignees,labels --paginate 2>/dev/null) || issue_json="[]"
local issue_count
issue_count=$(echo "$issue_json" | jq '[.[] | select((.assignees | length) == 0 and (.labels | map(.name) | index("status:blocked") | not))] | length' 2>/dev/null) || issue_count=0
[[ "$issue_count" =~ ^[0-9]+$ ]] || issue_count=0
local pr_json
pr_json=$(gh pr list --repo "$slug" --state open --json reviewDecision,statusCheckRollup --paginate 2>/dev/null) || pr_json="[]"
References
  1. When fetching a list of items from the GitHub API with the gh command, use the --paginate flag to ensure all items are retrieved, not just the first page.

while IFS= read -r slug; do
[[ -n "$slug" ]] || continue
local queued_numbers
queued_numbers=$(gh issue list --repo "$slug" --state open --label "status:queued" --json number --jq '.[].number' --limit 100 2>/dev/null) || queued_numbers=""

Choose a reason for hiding this comment

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

medium

The gh issue list command is limited to fetching 100 items by default. If a repository has more than 100 issues with the status:queued label, this function will not count all of them, leading to an inaccurate queued_without_worker count. This could prevent the backfill logic from triggering correctly for failed worker launches. To ensure all queued issues are checked, use the --paginate flag.

Suggested change
queued_numbers=$(gh issue list --repo "$slug" --state open --label "status:queued" --json number --jq '.[].number' --limit 100 2>/dev/null) || queued_numbers=""
queued_numbers=$(gh issue list --repo "$slug" --state open --label "status:queued" --json number --jq '.[].number' --paginate 2>/dev/null) || queued_numbers=""
References
  1. When fetching a list of items from the GitHub API with the gh command, use the --paginate flag to ensure all items are retrieved, not just the first page.

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