Skip to content

fix(issue): auto-loop marks successful unit dispatch as failed when pauseAuto fires during runFinalize#6172

Open
jeremymcs wants to merge 3 commits into
mainfrom
issue/5715-auto-loop-marks-successful-unit-dispatch-1778892832
Open

fix(issue): auto-loop marks successful unit dispatch as failed when pauseAuto fires during runFinalize#6172
jeremymcs wants to merge 3 commits into
mainfrom
issue/5715-auto-loop-marks-successful-unit-dispatch-1778892832

Conversation

@jeremymcs
Copy link
Copy Markdown
Collaborator

@jeremymcs jeremymcs commented May 16, 2026

Summary

  • Finalize break reasons that represent pause/stop-after-success now exit as complete-and-break (not failed), verified by targeted workflow-kernel tests.

Verification

  • Completed in the repository worktree before push.

Related Issue

Repo

  • gsd-build/gsd-2

Branch

  • issue/5715-auto-loop-marks-successful-unit-dispatch-1778892832

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced workflow finalization behavior to handle pause and timeout conditions more comprehensively.
  • Tests

    • Added test coverage for additional finalization edge cases to ensure reliability.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Warning

Rate limit exceeded

@jeremymcs has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 9 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c7c3c6d-9185-43ce-b22a-9dc38d5925d5

📥 Commits

Reviewing files that changed from the base of the PR and between ca05b29 and cd952b4.

📒 Files selected for processing (1)
  • src/resources/extensions/gsd/auto/workflow-kernel.ts
📝 Walkthrough

Walkthrough

The PR updates decideFinalizeResult to recognize multiple finalize-pause and timeout reasons as candidates for the "complete-and-break" action mapping. Previously, only "step-wizard" triggered this behavior; now it includes post-verification, pre-verification, UAT pause, and timeout variants. A parameterized test validates the expanded condition across all covered reasons.

Changes

Finalize decision for pause/timeout handling

Layer / File(s) Summary
Expand complete-and-break condition for multiple finalize pause reasons
src/resources/extensions/gsd/auto/workflow-kernel.ts, src/resources/extensions/gsd/tests/workflow-kernel.test.ts
The decideFinalizeResult function expands its early-return condition to map action: "break" to { action: "complete-and-break" } for multiple finalize-pause and timeout reasons (post-verification-stopped, pre-verification-dispatched, UAT-pause, verification-pause, finalize pre/post timeout). A parameterized test validates the behavior across all pause/timeout reasons.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A break becomes complete, the pause is finally clear—
When finalize decides to rest, no need to shed a tear.
Multiple reasons now align in harmony and grace,
The test confirms each pause finds its rightful place!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 accurately describes the main fix: preventing successful dispatches from being marked as failed when pauseAuto fires during runFinalize.
Linked Issues check ✅ Passed The PR changes map break reasons for pause/stop-after-success scenarios to complete-and-break, directly addressing the issue of distinguishing pause signals from unit execution failures.
Out of Scope Changes check ✅ Passed All changes in workflow-kernel.ts and its test file are directly related to fixing the finalize decision logic for pause-in-finalize scenarios.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/5715-auto-loop-marks-successful-unit-dispatch-1778892832

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
Copy Markdown
Contributor

github-actions Bot commented May 16, 2026

🔴 PR Risk Report — CRITICAL

Files changed 2
Systems affected 1
Overall risk 🔴 CRITICAL

Affected Systems

Risk System
🔴 critical Auto Engine
File Breakdown
Risk File Systems
🔴 src/resources/extensions/gsd/auto/workflow-kernel.ts Auto Engine
src/resources/extensions/gsd/tests/workflow-kernel.test.ts (unclassified)

⚠️ 🔴 Critical risk — the following systems require verification before merge:

  • 🔴 Auto Engine: validate auto-mode trigger conditions and loop termination

⛔ This PR should not be merged without executing this follow-up prompt.

Ask your coding agent to verify before submitting:

Review this PR for risks in: Auto Engine. Verify:

1. validate auto-mode trigger conditions and loop termination

Before modifying any code, assess the scope of this fix:

- Identify the root cause, not just the reported symptom.
- Search the codebase for other call sites, similar patterns, or duplicated logic that may share the same bug.
- List affected tests, documentation, and any downstream consumers that depend on the current behavior.
- Flag any changes that extend beyond the immediate file or function.

Report findings first. Then propose a fix scoped to the actual root cause, and wait for confirmation before applying changes outside the originally reported location.

💡 Have a Codex subscription? Get an independent second opinion: codex review --adversarial

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
src/resources/extensions/gsd/auto/workflow-kernel.ts (1)

282-290: ⚡ Quick win

Consider refactoring to an array-based check for better maintainability.

The multi-line || chain makes it harder to add or remove pause reasons. Using an array with .includes() would improve readability and reduce the risk of typos.

♻️ Proposed refactor
+  const pauseAndTimeoutReasons = [
+    "step-wizard",
+    "post-verification-stopped",
+    "pre-verification-dispatched",
+    "uat-pause",
+    "verification-pause",
+    "finalize-pre-timeout",
+    "finalize-post-timeout",
+  ];
+
   if (input.action === "break") {
     const reason = input.reason ?? "unknown";
-    if (
-      reason === "step-wizard"
-      || reason === "post-verification-stopped"
-      || reason === "pre-verification-dispatched"
-      || reason === "uat-pause"
-      || reason === "verification-pause"
-      || reason === "finalize-pre-timeout"
-      || reason === "finalize-post-timeout"
-    ) {
+    if (pauseAndTimeoutReasons.includes(reason)) {
       return { action: "complete-and-break" };
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/resources/extensions/gsd/auto/workflow-kernel.ts` around lines 282 - 290,
Replace the long chained boolean check that compares the variable `reason`
against many literals with a single array lookup: define a constant array (e.g.,
`PAUSE_REASONS`) containing the strings "step-wizard",
"post-verification-stopped", "pre-verification-dispatched", "uat-pause",
"verification-pause", "finalize-pre-timeout", "finalize-post-timeout" and then
replace the if condition with `PAUSE_REASONS.includes(reason)` (or equivalent)
so adding/removing reasons is a one-line change and avoids the repetitive `||`
chain.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/resources/extensions/gsd/auto/workflow-kernel.ts`:
- Around line 282-290: Replace the long chained boolean check that compares the
variable `reason` against many literals with a single array lookup: define a
constant array (e.g., `PAUSE_REASONS`) containing the strings "step-wizard",
"post-verification-stopped", "pre-verification-dispatched", "uat-pause",
"verification-pause", "finalize-pre-timeout", "finalize-post-timeout" and then
replace the if condition with `PAUSE_REASONS.includes(reason)` (or equivalent)
so adding/removing reasons is a one-line change and avoids the repetitive `||`
chain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f02a51ee-7b90-4a2b-ba85-9ed9843ad91b

📥 Commits

Reviewing files that changed from the base of the PR and between 8906b64 and ca05b29.

📒 Files selected for processing (2)
  • src/resources/extensions/gsd/auto/workflow-kernel.ts
  • src/resources/extensions/gsd/tests/workflow-kernel.test.ts

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

jeremymcs commented May 16, 2026

Accepted — this comment requires code changes. Queuing fix...
🧰 Agent runningcodex is working on the fix...
Agent completed — verifying changes...
🎉 Resolved — addressed in commit da7b365.

1 similar comment
@jeremymcs
Copy link
Copy Markdown
Collaborator Author

jeremymcs commented May 16, 2026

Accepted — this comment requires code changes. Queuing fix...
🧰 Agent runningcodex is working on the fix...
Agent completed — verifying changes...
🎉 Resolved — addressed in commit da7b365.

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

🤖 Dispatched codex with the following prompt:

Agent prompt (click to expand)
You are acting as an autonomous PR babysitter for gsd-build/gsd-2 PR #6172.
PR URL: https://github.com/gsd-build/gsd-2/pull/6172
Base repository: gsd-build/gsd-2
Head repository: gsd-build/gsd-2
Head branch: issue/5715-auto-loop-marks-successful-unit-dispatch-1778892832
Head remote: origin
You are running inside an isolated app-owned worktree under ~/.patchdeck.
Make only targeted changes that resolve the approved tasks.
Do not wait for user input, confirmation, or approval at any point.
Do not rewrite unrelated files.
Use the available git tooling for inspection and verification only.
If dependencies are missing, install them using the repository's lockfile/package manager as needed inside this isolated worktree.
Leave file edits uncommitted; the babysitter app will handle Git finalization after your run.
GitHub follow-up replies and review-thread resolution will be handled by the babysitter after your run.
If a task is invalid after inspection, explain it in your final response and include the exact audit token.

Approved review-comment tasks:
1. [general_comment] coderabbitai[bot]
   file=n/a line=n/a
   sourceId=4464877068 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6172#issuecomment-4464877068
   replyKind=general_comment threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-issue-comment-4464877068
   <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

<details>
<summary>📝 Walkthrough</summary>

## Walkthrough

The PR updates `decideFinalizeResult` to recognize multiple finalize-pause and timeout reasons as candidates for the "complete-and-break" action mapping. Previously, only `"step-wizard"` triggered this behavior; now it includes post-verification, pre-verification, UAT pause, and timeout variants. A parameterized test validates the expanded condition across all covered reasons.

## Changes

**Finalize decision for pause/timeout handling**

| Layer / File(s) | Summary |
|---|---|
|**Expand complete-and-break condition for multiple finalize pause reasons** <br> `src/resources/extensions/gsd/auto/workflow-kernel.ts`, `src/resources/extensions/gsd/tests/workflow-kernel.test.ts`|The `decideFinalizeResult` function expands its early-return condition to map `action: "break"` to `{ action: "complete-and-break" }` for multiple finalize-pause and timeout reasons (post-verification-stopped, pre-verification-dispatched, UAT-pause, verification-pause, finalize pre/post timeout). A parameterized test validates the behavior across all pause/timeout reasons.|

## Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

## Poem

> 🐰 A break becomes complete, the pause is finally clear—  
> When finalize decides to rest, no need to shed a tear.  
> Multiple reasons now align in harmony and grace,  
> The test confirms each pause finds its rightful place!

</details>

<!-- walkthrough_end -->
<!-- pre_merge_checks_walkthrough_start -->

<details>
<summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary>

### ❌ Failed checks (1 warning)

|     Check name     | Status     | Explanation                                                                          | Resolution                                                                         |
| :----------------: | :--------- | :----------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- |
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |

<details>
<summary>✅ Passed checks (4 passed)</summary>

|         Check name         | Status   | Explanation                                                                                                                                                                                |
| :------------------------: | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|      Description Check     | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled.                                                                                                                                |
|         Title check        | ✅ Passed | The title accurately describes the main fix: preventing successful dispatches from being marked as failed when pauseAuto fires during runFinalize.                                         |
|     Linked Issues check    | ✅ Passed | The PR changes map break reasons for pause/stop-after-success scenarios to complete-and-break, directly addressing the issue of distinguishing pause signals from unit execution failures. |
| Out of Scope Changes check | ✅ Passed | All changes in workflow-kernel.ts and its test file are directly related to fixing the finalize decision logic for pause-in-finalize scenarios.                                            |

</details>

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

</details>

<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

<details>
<summary>📝 Generate docstrings</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> Create stacked PR
- [ ] <!-- {"checkboxId": "3e1879ae-f29b-4d0d-8e06-d12b7ba33d98"} --> Commit on current branch

</details>
<details>
<summary>🧪 Generate unit tests (beta)</summary>

- [ ] <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} -->   Create PR with unit tests
- [ ] <!-- {"checkboxId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} -->   Commit unit tests in branch `issue/5715-auto-loop-marks-successful-unit-dispatch-1778892832`

</details>

</details>

<!-- finishing_touch_checkbox_end -->
<!-- This is an auto-generated comment: all tool run failures by coderabbit.ai -->

> [!WARNING]
> There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
> 
> <details>
> <summary>🔧 ESLint</summary>
> 
> > If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
> 
> ESLint skipped: no ESLint configuration detected in root package.json. To enable, add `eslint` to devDependencies.
> 
> 
> 
> </details>

<!-- end of auto-generated comment: all tool run failures by coderabbit.ai -->
<!-- tips_start -->

---

Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=gsd-build/gsd-2&utm_content=6172)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>


<sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub>

<!-- tips_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKPR1AGxJcAZvAAeABRIDiQAlFxoeIQe+PjckMzOANbIDgwM0og+2B6Q2BjqkLRI3NQMsOjIPtpe9ADusGQ8UYgkAILRkH4U0sXYFPAYRJAUBQBiQ2ge8ABeJJCQBgByjgKUXABsAIwA7ABMiwYAqjYAMlywuLjciBwA9PdE6rDYAhpMzE+ItGAC2PAPLRvr99vduLkPPcdgcjsc2hQuCJesxZMwGMglgBlfADTKQARUDAVLghbAke4AVl220pYCiBDAsXiYCSFFSYHSmUQ2VyYAK6jAJUQZVwFTAe12AA4pQBOfZSgDMh0ASYQwZykXAEokkxLaLDY3DUbB3fjcMhGLGONmyDgGKAAYVgmFI1SmM3mkGdGFoM2G9nw2pIaGS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BIw/AiAI5kSqjGTLPUvngyYMujOf0euvACvgOivdPSuDPgehp0cNIhTQgUs6uburPIYbOGTUf2vqoLuuv3pbBdk90UMEhX8eUaV9N44tZ0wdZKA9ZTpDYwuTYfVcDhc/yLIShegxAnND02lTx/RYofxg0lZPZwP1ZO6+6qjOzrIfmC4socFEPVwXuhozuQ4MBLvrvWvbv+t4vnAnuiAlfTs3uMAPuvveTfvov/v0vyvKuxSlTEekN2gv8eQ5twfurIfNeyvCSbef1WJtUdksQmBzR3xUt01yuDfGuMeWvLPsfOuhoPU8g7M+h9xYcxl4c+9BMhJRNL0/Bb9nAr3Oe+ZyEoNsklJWNw6FhEW3LwV52jMLF45ZEMaQ82TGf7xFfUeVfceN8NfLO7udfEvnv2+jeTfehvvUSPfLfAfrfYfBoFZWIfAA/4gkOQ/EBHevxEAXeSvvjdiofciYesuf1sTejAYBjlBSBw+AmNOUS+TouY/O/BpD/niRgmBBiFhUAcs4GcsABSDb4eSoFJKMbAOVmHhxo0EKFctKkx26rRYAbSWEkCC+pSh3+5eT/sdw94d98uP6KdlfAxCP9yek9a4icUSAhBy+1kJSE6nEDZBhw70Z/qf0wowD8AQIFAT3214/pHuSXVHhP2mBA99+Q0botgLxKnFN+tRBgmiRU580bAJnPLpGGy6UgpQRhNAB4V2CKhaAsoeiPYRIAyDdgsoV7E9gYD7ASA+wWgFKBLybAGAlIWUNsFoCKg0AmwVQJoyyxmEGA2wB7LQAECvZNBioIxloLQBRdBoog2wIGTFLmCGASoTYBox8DixZQCAhgDlgEAqBXCL2GUDlmMKxClQmjWQU4MVDGFdgaAV7G5H2AWDKQ+Q6vO4UUGbApQuQ17JdgMCfFAi8RE2skU2bRF6AsRPQrhFuzlxNC4xZIhkR0IGATsfgoxO0FwDAQ1CxRPxOoGTwFBcAV2HLDUNGxtCOhD7JoQdiAA=== -->

<!-- internal state end -->
2. [review] coderabbitai[bot]
   file=n/a line=n/a
   sourceId=4302305821 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6172#pullrequestreview-4302305821
   replyKind=review threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-review-4302305821
   

<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>

<details>
<summary>src/resources/extensions/gsd/auto/workflow-kernel.ts (1)</summary><blockquote>

`282-290`: _⚡ Quick win_

**Consider refactoring to an array-based check for better maintainability.**

The multi-line `||` chain makes it harder to add or remove pause reasons. Using an array with `.includes()` would improve readability and reduce the risk of typos.




<details>
<summary>♻️ Proposed refactor</summary>

```diff
+  const pauseAndTimeoutReasons = [
+    "step-wizard",
+    "post-verification-stopped",
+    "pre-verification-dispatched",
+    "uat-pause",
+    "verification-pause",
+    "finalize-pre-timeout",
+    "finalize-post-timeout",
+  ];
+
   if (input.action === "break") {
     const reason = input.reason ?? "unknown";
-    if (
-      reason === "step-wizard"
-      || reason === "post-verification-stopped"
-      || reason === "pre-verification-dispatched"
-      || reason === "uat-pause"
-      || reason === "verification-pause"
-      || reason === "finalize-pre-timeout"
-      || reason === "finalize-post-timeout"
-    ) {
+    if (pauseAndTimeoutReasons.includes(reason)) {
       return { action: "complete-and-break" };
     }
```

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/resources/extensions/gsd/auto/workflow-kernel.ts` around lines 282 - 290,
Replace the long chained boolean check that compares the variable `reason`
against many literals with a single array lookup: define a constant array (e.g.,
`PAUSE_REASONS`) containing the strings "step-wizard",
"post-verification-stopped", "pre-verification-dispatched", "uat-pause",
"verification-pause", "finalize-pre-timeout", "finalize-post-timeout" and then
replace the if condition with `PAUSE_REASONS.includes(reason)` (or equivalent)
so adding/removing reasons is a one-line change and avoids the repetitive `||`
chain.
```

</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

```
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/resources/extensions/gsd/auto/workflow-kernel.ts`:
- Around line 282-290: Replace the long chained boolean check that compares the
variable `reason` against many literals with a single array lookup: define a
constant array (e.g., `PAUSE_REASONS`) containing the strings "step-wizard",
"post-verification-stopped", "pre-verification-dispatched", "uat-pause",
"verification-pause", "finalize-pre-timeout", "finalize-post-timeout" and then
replace the if condition with `PAUSE_REASONS.includes(reason)` (or equivalent)
so adding/removing reasons is a one-line change and avoids the repetitive `||`
chain.
```

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: defaults

**Review profile**: CHILL

**Plan**: Pro Plus

**Run ID**: `f02a51ee-7b90-4a2b-ba85-9ed9843ad91b`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 8906b64ad15ba780fc2ac7810f023aa02f9c883d and ca05b29f3e10d7fb6dd99eb3e4f17812a5ee9ddc.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `src/resources/extensions/gsd/auto/workflow-kernel.ts`
* `src/resources/extensions/gsd/tests/workflow-kernel.test.ts`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Approved status-check tasks:
None

Approved documentation tasks:
None

When done:
1) Run the relevant verification for your changes.
2) Leave any changed files in the worktree for the babysitter app to finalize.
3) For each feedback item you addressed or were blocked on, emit a summary block in the following format:
   FEEDBACK_SUMMARY_START <auditToken>
   <A concise 1-2 sentence summary of what you did or why you were blocked>
   FEEDBACK_SUMMARY_END
   Include one block per audit token. These summaries will be posted as follow-up comments on the PR.
4) If documentation tasks were assigned, emit exactly one docs summary block in the following format:
   DOCS_SUMMARY_START <changed|no_change>
   <A concise 1-2 sentence summary of the docs you updated, or why no docs changes were necessary after inspection>
   DOCS_SUMMARY_END

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

Addressed in commit da7b365 by the latest babysitter run.

Responding to comment by @coderabbitai[bot]:

Inspected the general CodeRabbit summary and warning content; it was mostly informational and did not introduce an additional required code change beyond the reviewed finalize-reason logic. No extra edits were needed for this token after validation.

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

Addressed in commit da7b365 by the latest babysitter run.

Responding to comment by @coderabbitai[bot]:

Refactored decideFinalizeResult to replace the multi-line chained reason checks with a single constant-backed lookup, making future reason additions/removals one-line changes while preserving behavior. Ran the targeted workflow-kernel test file and confirmed all tests pass.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Tip

For best results, initiate chat on the files or code changes.

@jeremymcs Thanks for the update! The constant-backed lookup approach is a clean improvement — centralizing the set of pause/finalize reasons into a single constant makes future additions or removals a one-line change and keeps the condition in decideFinalizeResult easy to scan. Glad all the workflow-kernel tests are passing with the refactor. ✅

(ノ◕ヮ◕)ノ*:・゚✧


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

⚠️ CI Alert

The babysitter pushed changes (commit da7b365), but CI/CD checks are still failing:

  • build: Check run failure (details)

Manual investigation may be required.

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

jeremymcs commented May 16, 2026

Accepted — this comment requires code changes. Queuing fix...
🧰 Agent runningcodex is working on the fix...
Agent completed — verifying changes...
🎉 Resolved — addressed in commit cd952b4.

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

🤖 Dispatched codex with the following prompt:

Agent prompt (click to expand)
You are acting as an autonomous PR babysitter for gsd-build/gsd-2 PR #6172.
PR URL: https://github.com/gsd-build/gsd-2/pull/6172
Base repository: gsd-build/gsd-2
Head repository: gsd-build/gsd-2
Head branch: issue/5715-auto-loop-marks-successful-unit-dispatch-1778892832
Head remote: origin
You are running inside an isolated app-owned worktree under ~/.patchdeck.
Make only targeted changes that resolve the approved tasks.
Do not wait for user input, confirmation, or approval at any point.
Do not rewrite unrelated files.
Use the available git tooling for inspection and verification only.
If dependencies are missing, install them using the repository's lockfile/package manager as needed inside this isolated worktree.
Leave file edits uncommitted; the babysitter app will handle Git finalization after your run.
GitHub follow-up replies and review-thread resolution will be handled by the babysitter after your run.
If a task is invalid after inspection, explain it in your final response and include the exact audit token.

Approved review-comment tasks:
1. [general_comment] jeremymcs
   file=n/a line=n/a
   sourceId=4464910754 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6172#issuecomment-4464910754
   replyKind=general_comment threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-issue-comment-4464910754
   ## ⚠️ CI Alert

The babysitter pushed changes (commit `da7b365`), but CI/CD checks are still failing:

- **build**: Check run failure ([details](https://github.com/gsd-build/gsd-2/actions/runs/25948611461/job/76281913056))

Manual investigation may be required.

Approved status-check tasks:
None

Approved documentation tasks:
None

When done:
1) Run the relevant verification for your changes.
2) Leave any changed files in the worktree for the babysitter app to finalize.
3) For each feedback item you addressed or were blocked on, emit a summary block in the following format:
   FEEDBACK_SUMMARY_START <auditToken>
   <A concise 1-2 sentence summary of what you did or why you were blocked>
   FEEDBACK_SUMMARY_END
   Include one block per audit token. These summaries will be posted as follow-up comments on the PR.
4) If documentation tasks were assigned, emit exactly one docs summary block in the following format:
   DOCS_SUMMARY_START <changed|no_change>
   <A concise 1-2 sentence summary of the docs you updated, or why no docs changes were necessary after inspection>
   DOCS_SUMMARY_END

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

Addressed in commit cd952b4 by the latest babysitter run.

Responding to comment by @jeremymcs:

⚠️ CI Alert

Reproduced the failing build check locally and fixed a TypeScript type mismatch in workflow-kernel.ts by adding a narrow type guard for finalize break reasons. Re-ran npm run build, which now succeeds.

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.

auto-loop marks successful unit dispatch as failed when pauseAuto fires during runFinalize

1 participant