Skip to content

ci(review): keep Claude Code Review subagents in the foreground - #329

Merged
Jamie-BitFlight merged 3 commits into
mainfrom
claude/review-foreground-subagents
Oct 6, 2026
Merged

Jamie-BitFlight merged 3 commits into
mainfrom
claude/review-foreground-subagents

Conversation

@Jamie-BitFlight

@Jamie-BitFlight Jamie-BitFlight commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #313 and #325. With show_full_output on (#325), the first review run that used it (PR #328, run 37478584859, job 112320461611) shows why no review comment has ever been posted.

Observation (from the job log)

  • Turn 1: the model launched an Agent (Haiku, "Check PR eligibility"). The tool call had no run_in_background field, yet the harness started it in the background (subagent_stats: requested: unset 1, started_in_background: 1). The tool result was Async agent launched successfully ... You will be notified automatically when it completes.
  • Turn 2: the model wrote "Waiting for the eligibility check to finish before proceeding." and ended its turn (stop_reason: end_turn, num_turns: 2, 3.5 s API time, permission_denials: []).
  • The job then reported No buffered inline comments and finished green, with no review posted.

In a headless run, ending the turn ends the job, and the background subagent never reports back. The earlier green runs on #312 (2 turns, 4.7 s, output hidden) look like the same pattern, but that is an inference.

Change

Two levers on the review step:

  1. env: CLAUDE_CODE_DISABLE_BACKGROUND_TASKS: '1' (primary). The variable is present in the Claude Code 2.1.291 binary used by the run, along with the message "Background agents cannot be started in this session right now. Run the agent without run_in_background."
  2. --append-system-prompt "Run every subagent in the foreground ..." in claude_args (backup). It extends the claude_code preset and does not replace it.

Evidence and limits

  • Independent review: the claim matches the log (turn 1 background launch, turn 2 waiting text, end_turn, no eligibility verdict). The reviewer called the prompt line the weaker lever and recommended the environment variable, which is why it was added.
  • PyYAML parse: env and claude_args are well-formed; shlex.split keeps the quoted prompt as one argument. claude --help lists --append-system-prompt. The workflow linter and YAML check pass.
  • Unverified: that a step-level env: reaches the CLI process under the action's subprocess handling; that the variable turns an unset-flag call into a foreground one rather than only refusing background launches; that the model obeys the appended prompt; and the code-review plugin's own eligibility rules (not read).
  • This PR's own review run is skipped by the action's workflow validation, because the file differs from main. The effect shows on the next PR to main after this merges. Check subagent_stats.started_in_background == 0 in that log.

Not addressed

  • A guard that warns when a review job ends in two turns with nothing posted would catch silent green failures. It would live in scripts/, not in the workflow; not part of this change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K5rAHJfvZyEEaUQghV7hCQ

claude added 2 commits October 6, 2026 14:28
The review's first turn launched a background eligibility subagent, then
ended its turn waiting for it. Ending the turn ends the headless job, so
no review ran (run 37478584859, job 112320461611).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5rAHJfvZyEEaUQghV7hCQ
The failing run left run_in_background unset and the harness still started
the subagent in the background, so a prompt instruction alone is the weaker
lever. Set CLAUDE_CODE_DISABLE_BACKGROUND_TASKS and keep the prompt line.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5rAHJfvZyEEaUQghV7hCQ
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 91d95ff4-1eb9-4487-bf38-0d028715a299
  • Autopilot · 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

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

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Benchmark Results

🔴 Regression detected — threshold: 30%

scan-clean

Metric Base Compare Change
files_per_second 204.7 files/s 210.1 files/s ✅ +2.7%
scan_max_ms 5153.6 ms 4834.7 ms ✅ -6.2%
scan_mean_ms 4891.0 ms 4763.7 ms ✅ -2.6%
scan_min_ms 4721.6 ms 4694.1 ms ✅ -0.6%

scan-violations

Metric Base Compare Change
files_per_second 119.3 files/s 122.2 files/s ✅ +2.4%
scan_max_ms 1706.8 ms 1677.0 ms ✅ -1.7%
scan_mean_ms 1685.2 ms 1644.9 ms ✅ -2.4%
scan_min_ms 1673.4 ms 1608.3 ms ✅ -3.9%

fix-violations

Metric Base Compare Change
fix_files_per_second 302.3 files/s 299.6 files/s ➡️ -0.9%
fix_max_ms 670.3 ms 692.4 ms ➡️ +3.3%
fix_mean_ms 664.9 ms 671.0 ms ➡️ +0.9%
fix_min_ms 655.5 ms 650.0 ms ✅ -0.8%

cpu

Metric Base Compare Change
cpu_clean_mean_ms 0.6 ms 0.6 ms ➡️ +1.2%
cpu_fix_mean_ms 1.6 ms 1.6 ms ✅ -1.0%
cpu_violations_mean_ms 0.6 ms 0.6 ms ➡️ +0.9%

import

Metric Base Compare Change
import_package_max_ms 205.9 ms 347.6 ms 🔴 +68.9%
import_package_mean_ms 157.7 ms 208.5 ms 🔴 +32.1%
import_package_min_ms 133.2 ms 137.2 ms ➡️ +3.0%
import_rules_max_ms 244.7 ms 397.5 ms 🔴 +62.5%
import_rules_mean_ms 228.8 ms 283.0 ms ➡️ +23.7%
import_rules_min_ms 220.4 ms 225.2 ms ➡️ +2.2%

View benchmark history

Updated 2026-10-06 14:58 UTC

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

📊 Test Coverage Report

Coverage: 88.85%

📥 Coverage XML available as artifact: coverage-xml

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Jamie-BitFlight
Jamie-BitFlight merged commit 9bfa557 into main Oct 6, 2026
28 checks passed
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.

2 participants