Skip to content

t1452: enforce pulse dispatch launch validation and CLI guardrails#4193

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/t1452-pulse-launch-validation
Mar 12, 2026
Merged

t1452: enforce pulse dispatch launch validation and CLI guardrails#4193
marcusquinn merged 1 commit intomainfrom
bugfix/t1452-pulse-launch-validation

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Mar 12, 2026

Summary

  • add mandatory post-dispatch launch validation in pulse guidance to verify process startup and detect CLI usage-output false starts
  • add explicit guardrail against unsupported raw opencode run flags (notably --max-iterations) when doing diagnostic dispatches
  • require immediate same-cycle correction plus issue annotation when launch validation fails

Root Cause Addressed

Recent pulse cycles showed false-positive dispatches where workers were considered launched but startup logs contained opencode run usage output. This caused slot waste and delayed throughput recovery.

Verification

  • markdown-formatter check .agents/scripts/commands/pulse.md
  • manual log analysis of current pulse cycle identified the invalid-launch pattern and informed this guardrail update

Closes #4192

Summary by CodeRabbit

  • Bug Fixes
    • Implemented mandatory launch validation following all dispatch operations to verify the worker process is active and functioning properly. If validation fails, the system automatically performs a relaunch, improving reliability of dispatch operations and ensuring accurate slot allocation and resource management.

@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 addresses the issue of false-positive dispatches in recent pulse cycles, where workers were incorrectly considered launched despite startup logs indicating opencode run usage output. By introducing mandatory post-dispatch launch validation and explicit guardrails against unsupported CLI flags, the changes aim to ensure accurate worker startup, prevent wasted processing slots, and improve overall throughput recovery.

Highlights

  • Mandatory Launch Validation: Implemented mandatory post-dispatch launch validation in pulse guidance to verify process startup and detect CLI usage-output false starts.
  • CLI Guardrails: Added explicit guardrails against unsupported raw opencode run flags, such as --max-iterations, when performing diagnostic dispatches.
  • Immediate Correction: Required immediate same-cycle correction and issue annotation when launch validation fails to prevent slot waste.
Changelog
  • .agents/scripts/commands/pulse.md
    • Added a new section detailing mandatory launch validation steps, including checking for process existence and absence of CLI usage output in logs.
    • Included instructions for immediate re-dispatch and issue annotation if launch validation fails.
    • Updated dispatch guidelines to explicitly warn against using unsupported opencode run flags like --max-iterations.
    • Added a new guideline emphasizing post-dispatch launch validation before counting a slot as filled.
Activity
  • Pull request created by marcusquinn.
  • No specific review comments or further activity mentioned in the provided context.
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 Mar 12, 2026

Walkthrough

The pull request adds post-dispatch validation instructions to the pulse agent documentation. After each worker dispatch, validation checks that the process is live and startup logs do not contain CLI usage output, triggering immediate relaunch via the headless helper if validation fails.

Changes

Cohort / File(s) Summary
Pulse Dispatch Validation Documentation
.agents/scripts/commands/pulse.md
Adds mandatory launch-validation block (+18 lines) to pulse dispatch instructions. Validation verifies worker process existence and inspects startup logs for CLI usage output. If validation fails, triggers immediate relaunch via headless helper and dispatches correction annotation. Applied to both provider/auth-failure and standard dispatch pathways.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested labels

bug

Poem

🚀 Pulse now validates with care,
No phantom workers floating in air—
If the launch is false, we'll know right away,
And fix it fast without delay! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 't1452: enforce pulse dispatch launch validation and CLI guardrails' directly addresses the main change: adding mandatory post-dispatch validation and guardrails for unsupported flags.
Linked Issues check ✅ Passed The PR implements all core requirements from #4192: adds post-dispatch launch validation, enforces helper-only dispatch, and includes immediate correction when validation fails.
Out of Scope Changes check ✅ Passed All changes are directly scoped to pulse dispatch validation and CLI guardrails. The modifications to .agents/scripts/commands/pulse.md align with the stated objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/t1452-pulse-launch-validation

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
Contributor

🔍 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:02:21 UTC 2026: Code review monitoring started
Thu Mar 12 01:02:21 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:02:23 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

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 updates the pulse.md documentation to enforce launch validation for dispatched workers. It adds a new mandatory validation step with a code snippet to check for running processes and invalid log output. It also adds guardrails against using unsupported flags with opencode run. The changes are clear and align with the goal of preventing false-positive dispatches. I have one suggestion to simplify a command in the documentation for better clarity.


```bash
# 1) Process exists (session-key must map to a live run)
pgrep -fal "issue-<number>|Issue #<number>:" >/dev/null

Choose a reason for hiding this comment

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

medium

The pgrep command can be simplified. The -a (show full command line) and -l (show process name) flags are used for display purposes, but since the output is redirected to /dev/null, they are unnecessary. Using only the -f flag is sufficient to check for the process's existence via its exit code and is more idiomatic.

Suggested change
pgrep -fal "issue-<number>|Issue #<number>:" >/dev/null
pgrep -f "issue-<number>|Issue #<number>:" >/dev/null

@sonarqubecloud
Copy link

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: 1

🤖 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/commands/pulse.md:
- Around line 563-575: The pulse script's current startup validation wrongly
inspects a /tmp log (LOG_PATH) that headless-runtime-helper.sh does not leave
behind; replace this ad-hoc file check with the helper's deterministic
launch-validation contract: call headless-runtime-helper.sh run (or its
dedicated validate/launch subcommand) and consume its explicit exit status or
emitted validation result/JSON rather than grepping LOG_PATH, then on failure
immediately re-dispatch via headless-runtime-helper.sh run and post the short
issue comment; update references in pulse to use the helper's validation output
(instead of LOG_PATH/rg) and adjust the relaunch logic to rely on the helper's
success/failure signal.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 75c20ceb-f75c-4c8c-bcac-5fb181e8bcaf

📥 Commits

Reviewing files that changed from the base of the PR and between 0d625a1 and 830bca5.

📒 Files selected for processing (1)
  • .agents/scripts/commands/pulse.md

Comment on lines +563 to +575
```bash
# 1) Process exists (session-key must map to a live run)
pgrep -fal "issue-<number>|Issue #<number>:" >/dev/null

# 2) Startup log is not CLI help/usage output
LOG_PATH="/tmp/pulse-<slug>-<number>.log"
if [[ -f "$LOG_PATH" ]] && rg -q '^opencode run \[message\.\.]|^run opencode with a message|^Options:' "$LOG_PATH"; then
echo "Invalid worker launch for #<number> (CLI usage output)"
# Relaunch immediately via helper (never leave this for next pulse)
fi
```

If validation fails, re-dispatch immediately via `headless-runtime-helper.sh run`, add a short issue comment noting the failed launch and correction, and continue filling slots.
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 | 🟠 Major

Use the helper’s real launch contract here, not an invented /tmp log file.

headless-runtime-helper.sh run does not write startup output to /tmp/pulse-<slug>-<number>.log; it captures to a temp file internally, validates activity, and deletes that file before returning. As written, this “mandatory” check will usually no-op on the log check and miss the exact usage-output false starts from #4192. Please move this to the deterministic helper/check path the issue calls for, or have the helper emit a launch-validation result that pulse can consume directly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/scripts/commands/pulse.md around lines 563 - 575, The pulse script's
current startup validation wrongly inspects a /tmp log (LOG_PATH) that
headless-runtime-helper.sh does not leave behind; replace this ad-hoc file check
with the helper's deterministic launch-validation contract: call
headless-runtime-helper.sh run (or its dedicated validate/launch subcommand) and
consume its explicit exit status or emitted validation result/JSON rather than
grepping LOG_PATH, then on failure immediately re-dispatch via
headless-runtime-helper.sh run and post the short issue comment; update
references in pulse to use the helper's validation output (instead of
LOG_PATH/rg) and adjust the relaunch logic to rely on the helper's
success/failure signal.

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.

t1452: Pulse should validate worker launch success and avoid unsupported CLI flags

1 participant