Skip to content

fix(issue): auto startup never invokes stale_crash_lock auto-fix despite fixable:true marker#6244

Merged
jeremymcs merged 3 commits into
mainfrom
issue/5666-auto-startup-never-invokes-stale-crash-l-1778944509
May 16, 2026
Merged

fix(issue): auto startup never invokes stale_crash_lock auto-fix despite fixable:true marker#6244
jeremymcs merged 3 commits into
mainfrom
issue/5666-auto-startup-never-invokes-stale-crash-l-1778944509

Conversation

@jeremymcs
Copy link
Copy Markdown
Collaborator

@jeremymcs jeremymcs commented May 16, 2026

Summary

  • Fixed stale crash-lock auto-healing at auto bootstrap and aligned remote dead-PID lock handling with stale-lock cleanup, with focused regression tests passing.

Bugs Addressed

  • Auto startup does not auto-fix stale crash lock
  • Remote session check leaves stale dead-PID lock in place

Verification

  • Completed in the repository worktree before push.

Related Issue

Repo

  • gsd-build/gsd-2

Branch

  • issue/5666-auto-startup-never-invokes-stale-crash-l-1778944509

Summary by CodeRabbit

  • Bug Fixes

    • Improved crash recovery: automatically detects and clears stale session/startup locks when the associated process is no longer running, and notifies the user when a stale lock is removed.
  • Tests

    • Added and expanded tests to verify stale session-lock cleanup and that lock-clearing occurs before acquiring a new session.

Review Change Stack

jeremymcs added 2 commits May 16, 2026 10:16
bootstrap now auto-clears stale dead-PID crash lock state before session lock acquisition.
remote session check now clears stale dead-PID lock state instead of leaving it behind.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b1ad5e53-436d-4d36-9f52-4635e3fc72e4

📥 Commits

Reviewing files that changed from the base of the PR and between 8461a39 and 987307d.

📒 Files selected for processing (1)
  • src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts

📝 Walkthrough

Walkthrough

Adds startup stale-crash-lock probing/clearing to bootstrapAutoSession, simplifies checkRemoteAutoSession to clear stale crash locks without mutating worker state, and adds tests verifying stale-lock cleanup and ordering before session lock acquisition.

Changes

Stale Crash Lock Auto-Fix in Bootstrap and Remote Session Checks

Layer / File(s) Summary
Bootstrap stale crash lock detection and clearing
src/resources/extensions/gsd/auto-start.ts
bootstrapAutoSession imports isLockProcessAlive and adds a startup step that reads an existing crash lock, clears it with a UI notification if the recorded PID is dead, then proceeds to acquire the session lock.
Remote session stale lock clearing simplification
src/resources/extensions/gsd/auto.ts
checkRemoteAutoSession removes markWorkerStoppingByPid import/usage and now clears the crash lock via clearLock() when the recorded PID is not alive, returning { running: false } without mutating worker state.
Test coverage for stale lock detection
src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts, src/resources/extensions/gsd/tests/start-auto-detached.test.ts
Adds an integration test validating checkRemoteAutoSession clears stale remote locks and extends bootstrap tests to assert stale-crash lock read/clear happen before session lock acquisition.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • gsd-build/gsd-2#6201: Adjusts stale crash-lock handling in checkRemoteAutoSession; this PR reverses/changes markWorkerStoppingByPid usage in that path.
  • gsd-build/gsd-2#6057: Overlaps on stale crash/auto lock cleanup flow and DB-worker stopping semantics related to clearing stale locks.
  • gsd-build/gsd-2#5889: Related changes to stale worker/crash-lock detection and clearing in auto-session recovery paths.

Poem

"I’m a rabbit in the code that hops at dawn,
Clearing ghostly PIDs so startups aren’t drawn. 🐇
Bootstrap checks, remote cleans, locks undone —
Hop, hop, the dead-process race is won.
Now auto starts sing with a brighter sun."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% 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 directly and accurately summarizes the primary fix: auto startup now invokes stale crash-lock auto-fix that was previously skipped despite being marked as fixable.
Linked Issues check ✅ Passed The PR fully addresses all coding requirements from issue #5666: adds pre-bootstrap stale-lock check in bootstrapAutoSession [auto-start.ts], modifies checkRemoteAutoSession to clear stale dead-PID locks [auto.ts], and includes comprehensive regression tests [test files].
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue requirements: stale crash-lock auto-fix during bootstrap, dead-PID lock cleanup in remote checks, and corresponding regression tests; no unrelated modifications present.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/5666-auto-startup-never-invokes-stale-crash-l-1778944509

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.

🔧 ESLint

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.


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 4
Systems affected 1
Overall risk 🔴 CRITICAL

Affected Systems

Risk System
🔴 critical Auto Engine
File Breakdown
Risk File Systems
🔴 src/resources/extensions/gsd/auto-start.ts Auto Engine
🔴 src/resources/extensions/gsd/auto.ts Auto Engine
src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts (unclassified)
src/resources/extensions/gsd/tests/start-auto-detached.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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts`:
- Around line 44-45: The test uses a hard-coded PID (99999) in setWorkerPid
which may be a real process on some systems; replace this with a PID proven to
be dead by probing for ESRCH first: write a small helper in the test that
attempts process.kill(candidatePid, 0) (or equivalent) in a loop until it throws
ESRCH (or use try/catch to detect ESRCH), then call setWorkerPid(workerId,
deadPid) and expireWorker(workerId) using that deadPid; reference the existing
functions setWorkerPid and expireWorker when making the replacement so the test
no longer relies on a possibly live static PID.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 550f01d1-188f-4172-8d7b-ac4c1f923af0

📥 Commits

Reviewing files that changed from the base of the PR and between 6c9a50f and 8461a39.

📒 Files selected for processing (4)
  • src/resources/extensions/gsd/auto-start.ts
  • src/resources/extensions/gsd/auto.ts
  • src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts
  • src/resources/extensions/gsd/tests/start-auto-detached.test.ts

Comment thread src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts Outdated
@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 #6244.
PR URL: https://github.com/gsd-build/gsd-2/pull/6244
Base repository: gsd-build/gsd-2
Head repository: gsd-build/gsd-2
Head branch: issue/5666-auto-startup-never-invokes-stale-crash-l-1778944509
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=4467240670 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6244#issuecomment-4467240670
   replyKind=general_comment threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-issue-comment-4467240670
   <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

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

## Walkthrough

The PR fixes issue `#5666` by adding proactive stale auto-mode crash lock detection and clearing in two places: during bootstrap startup (`bootstrapAutoSession`) before acquiring the session lock, and in remote session state checks (`checkRemoteAutoSession`) when a remote worker process is detected as dead. A new test and bootstrap test assertions validate both code paths.

## Changes

**Stale Crash Lock Auto-Fix in Bootstrap and Remote Session Checks**

| Layer / File(s) | Summary |
|---|---|
| **Bootstrap stale crash lock detection and clearing** <br> `src/resources/extensions/gsd/auto-start.ts` | `bootstrapAutoSession` imports `isLockProcessAlive` and adds a startup step that reads an existing crash lock, checks whether its process is still alive, clears it with user notification if not, and continues to session lock acquisition. |
| **Remote session stale lock clearing simplification** <br> `src/resources/extensions/gsd/auto.ts` | `checkRemoteAutoSession` removes the `markWorkerStoppingByPid` import and call, instead directly clearing the crash lock via `clearLock()` when the recorded PID is detected as dead, without mutating worker stopping state. |
| **Test coverage for stale lock detection** <br> `src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts`, `src/resources/extensions/gsd/tests/start-auto-detached.test.ts` | New test validates `checkRemoteAutoSession` clears stale remote locks; bootstrap test extends ordering assertions to verify stale-crash lock read/clear occurs before session lock acquisition. |

## Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

## Possibly related PRs

- [gsd-build/gsd-2#6201](https://github.com/gsd-build/gsd-2/pull/6201): Both PRs modify the GSD stale/crash lock cleanup flow in the same areas (notably `src/resources/extensions/gsd/auto.ts`'s `checkRemoteAutoSession` and lock-state handling in `crash-recovery`/session-lock paths), with this PR adjusting/undoing `markWorkerStoppingByPid` usage while adding `isLockProcessAlive`-driven stale lock clearing.
- [gsd-build/gsd-2#5889](https://github.com/gsd-build/gsd-2/pull/5889): Both PRs adjust the gsd stale-crash/lock cleanup flow—this PR adds PID-alive checks to clear stale crash locks, while the retrieved PR refactors stale DB-worker cleanup via `clearStaleWorkerLock`/crash-recovery paths—so they overlap directly on how stale worker/crash locks are cleared and recovered.
- [gsd-build/gsd-2#5720](https://github.com/gsd-build/gsd-2/pull/5720): Both PRs add/adjust logic that detects stale worker/session locks by checking whether the recorded PID is no longer alive and then clears the corresponding lock state (this PR in `bootstrapAutoSession`/`checkRemoteAutoSession`, retrieved PR via `removeStaleSessionLock` + stale-worker drift repair).

## Poem

> A lock left behind by a dead process ghost,  
> Now cleared at startup—no more startup cost!  🐰✨  
> Bootstrap and remote both probe and repair,  
> Stale pids begone, the way is laid bare.

</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 16.67% 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 PR title accurately describes the main fix: auto startup now invokes stale crash lock auto-fix as intended by the fixable:true marker.                                                                                 |
|     Linked Issues check    | ✅ Passed | The PR implements all requirements from issue `#5666`: bootstrapAutoSession checks and clears stale crash locks before session lock acquisition, and checkRemoteAutoSession now clears stale locks when detecting dead PIDs. |
| Out of Scope Changes check | ✅ Passed | All changes are directly aligned with the issue requirements: crash lock cleanup in auto-start.ts, remote session lock handling in auto.ts, and focused regression tests.                                                  |

</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/5666-auto-startup-never-invokes-stale-crash-l-1778944509`

</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=6244)! 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+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrIPR1AGxJcAZvAAeABRIDiQAlFxoePj2uM642NyQ5FJ88BgS+ADW0rFoXgD6DFSIsAUe+AxZOARgfv6QSojc6iSQ9SpeHLgU2G3MzjkUBgByjgKUXABsAEwALHMGAKo2ADJcsLi43IgcAPR7ROqw2AIaTMyHiLRgAtjwHrRXNzN73NgeHnuzC8uIk5ARBQSMxZMwGIgDABlfDYCgMNoCKgYBiwLghPp7ACsU1xYCitUQcQoCW4YBSlDA6UyOUQYCJ+RIYGKaFKYA8YAAjAB2bkADgAnAssQAGAVuZykXCQJGYVFcAbpaFxBK7fjcMgGADCwOodHQnEgMxFMymYBFWK5U2gnKxHE5Uw4WKxAC0jFDHAMXBwDFAAIK0WjINDtAL2GIEmICfD4XBEqhJBheZzIBleRglWDsypZYMYej5eBEDDIYHMWNtJRoG5WACSABFIBUqpBYJhaB50kRIAB3Y55LzZltJkiYRIaX2QWsojzYJrtSrYf70YFEYGIRDwfBYGhE5C4NvS7is5DN/IeWQT/2B9f/fc9qPYIhqyN5EmJZKxmqEepdgdtFlSibHMABp0HzSAywrexpE3bdGFgURqmTCQ/zTStRxrBtgJbdIeA8NAESvSAADVKHgPwGGoLcsA1CgfHwCg2HoPCDzaYFuHwTcCBcXtGKyHoSEREgGOBHgl1gYitQqO8UA3PpIDMHFcQnAwLEgAB5YRRHEKRkB8CgWCbdIchY+TpAMAAxQzmEU5THUnABREs4UrSoeLADjGJoegACJ0KKTNyhzXzIC9Uz0H0gJOm8Ho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QcwYIhERt4ZcpgAoEgFiGTq0BOQJAKYNxTQDzAZgAgLENyEnHmkGAnhAsQRCJC2BVmOTQ6t9RFDcgZgLY2YN9TmBCQRQUwLEAwBFCYYGAcwNADaR8BDifA94kUP4RCKCgLQL4s0iKDPG695xJAGYBOKDp8gJgFKNRnnQgB34SAtdSgA3QjwV0IIjtCCZGAKDHhGkTdPUOhP6QHwDALhdcQPX5Z0A/Q2FUunijoB911A8cE5LgC8IigwJQhZCahP+DoSaA8E7fpgiAA== -->

<!-- internal state end -->
2. [general_comment] github-actions[bot]
   file=n/a line=n/a
   sourceId=4467240810 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6244#issuecomment-4467240810
   replyKind=general_comment threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-issue-comment-4467240810
   ## 🔴 PR Risk Report — CRITICAL

| | |
|---|---|
| **Files changed** | 4 |
| **Systems affected** | 1 |
| **Overall risk** | 🔴 CRITICAL |

### Affected Systems

| Risk | System |
|------|--------|
| 🔴 critical | Auto Engine |

<details>
<summary>File Breakdown</summary>

| Risk | File | Systems |
|------|------|---------|
| 🔴 | `src/resources/extensions/gsd/auto-start.ts` | Auto Engine |
| 🔴 | `src/resources/extensions/gsd/auto.ts` | Auto Engine |
| ⚪ | `src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts` | *(unclassified)* |
| ⚪ | `src/resources/extensions/gsd/tests/start-auto-detached.test.ts` | *(unclassified)* |

</details>

> ⚠️ **🔴 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`
3. [review_comment] coderabbitai[bot]
   file=src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts line=45
   sourceId=3253001793 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6244#discussion_r3253001793
   replyKind=review_thread threadId=PRRT_kwDORj5hb86CkRe7 threadResolved=false
   auditToken=codefactory-feedback:gh-review-comment-3253001793
   _⚠️ Potential issue_ | _🟡 Minor_ | _⚡ Quick win_

**Avoid hard-coding a potentially live PID in the stale-lock test.**

Line 44 uses `99999`, which can be valid/alive on some systems and make this test flaky. Probe for an `ESRCH` PID first, then use that PID.

 

<details>
<summary>Proposed fix</summary>

```diff
+function findDeadPidCandidate(): number {
+  const candidates = [99_999, 199_999, 299_999, 399_999];
+  for (const pid of candidates) {
+    try {
+      process.kill(pid, 0);
+    } catch (err) {
+      if ((err as NodeJS.ErrnoException).code === "ESRCH") return pid;
+    }
+  }
+  throw new Error("Could not find a dead PID candidate for stale-lock test");
+}
+
 test("checkRemoteAutoSession clears stale lock state when lock PID is dead", (t) => {
   const base = makeBase();
   t.after(() => cleanup(base));
@@
-  setWorkerPid(workerId, 99999);
+  setWorkerPid(workerId, findDeadPidCandidate());
   expireWorker(workerId);
```
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **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.

```suggestion
function findDeadPidCandidate(): number {
  const candidates = [99_999, 199_999, 299_999, 399_999];
  for (const pid of candidates) {
    try {
      process.kill(pid, 0);
    } catch (err) {
      if ((err as NodeJS.ErrnoException).code === "ESRCH") return pid;
    }
  }
  throw new Error("Could not find a dead PID candidate for stale-lock test");
}

test("checkRemoteAutoSession clears stale lock state when lock PID is dead", (t) => {
  const base = makeBase();
  t.after(() => cleanup(base));

  setWorkerPid(workerId, findDeadPidCandidate());
  expireWorker(workerId);
```

</details>

<!-- suggestion_end -->

<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/tests/auto-remote-session-lock-cleanup.test.ts`
around lines 44 - 45, The test uses a hard-coded PID (99999) in setWorkerPid
which may be a real process on some systems; replace this with a PID proven to
be dead by probing for ESRCH first: write a small helper in the test that
attempts process.kill(candidatePid, 0) (or equivalent) in a loop until it throws
ESRCH (or use try/catch to detect ESRCH), then call setWorkerPid(workerId,
deadPid) and expireWorker(workerId) using that deadPid; reference the existing
functions setWorkerPid and expireWorker when making the replacement so the test
no longer relies on a possibly live static PID.
```

</details>

<!-- fingerprinting:phantom:poseidon:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->
4. [review] coderabbitai[bot]
   file=n/a line=n/a
   sourceId=4303818769 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6244#pullrequestreview-4303818769
   replyKind=review threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-review-4303818769
   **Actionable comments posted: 1**

<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.

Inline comments:
In `@src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts`:
- Around line 44-45: The test uses a hard-coded PID (99999) in setWorkerPid
which may be a real process on some systems; replace this with a PID proven to
be dead by probing for ESRCH first: write a small helper in the test that
attempts process.kill(candidatePid, 0) (or equivalent) in a loop until it throws
ESRCH (or use try/catch to detect ESRCH), then call setWorkerPid(workerId,
deadPid) and expireWorker(workerId) using that deadPid; reference the existing
functions setWorkerPid and expireWorker when making the replacement so the test
no longer relies on a possibly live static PID.
```

</details>

<details>
<summary>🪄 Autofix (Beta)</summary>

Fix all unresolved CodeRabbit comments on this PR:

- [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended)
- [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes

</details>

---

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

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

**Configuration used**: defaults

**Review profile**: CHILL

**Plan**: Pro Plus

**Run ID**: `550f01d1-188f-4172-8d7b-ac4c1f923af0`

</details>

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

Reviewing files that changed from the base of the PR and between 6c9a50fd0e66fada150feb48787e98fabaa72e14 and 8461a39d509ace18d0a1aac8a9dbdc7bbcfdf476.

</details>

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

* `src/resources/extensions/gsd/auto-start.ts`
* `src/resources/extensions/gsd/auto.ts`
* `src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts`
* `src/resources/extensions/gsd/tests/start-auto-detached.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 987307d by the latest babysitter run.

Responding to comment by @coderabbitai[bot]:

Inspected this item and found the actionable part was stale-lock test robustness; I updated the stale PID test to use an ESRCH-proven dead PID and validated the related tests pass.

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

Addressed in commit 987307d by the latest babysitter run.

Responding to comment by @github-actions[bot]:

🔴 PR Risk Report — CRITICAL

Performed targeted Auto Engine verification for the touched risk areas by running stale-lock cleanup and auto-start/bootstrap guard tests; both suites passed, including checks around startup trigger ordering and safe continuation behavior.

@jeremymcs
Copy link
Copy Markdown
Collaborator Author

Addressed in commit 987307d by the latest babysitter run.

Responding to comment by @coderabbitai[bot]:
Actionable comments posted: 1

Validated the single inline finding and applied a minimal fix in the specified test file only, then ran focused test verification to confirm behavior remains correct.

@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 confirming! The fix in commit 987307d for the test file inline finding looks good, and it's great that the focused verification suite passed cleanly. Appreciate the thorough follow-through on the bootstrap ordering and stale-lock cleanup checks. 🐇✨


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

🤖 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 #6244.
PR URL: https://github.com/gsd-build/gsd-2/pull/6244
Base repository: gsd-build/gsd-2
Head repository: gsd-build/gsd-2
Head branch: issue/5666-auto-startup-never-invokes-stale-crash-l-1778944509
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. [review_comment] coderabbitai[bot]
   file=src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts line=45
   sourceId=3253022641 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6244#discussion_r3253022641
   replyKind=review_thread threadId=PRRT_kwDORj5hb86CkRe7 threadResolved=true
   auditToken=codefactory-feedback:gh-review-comment-3253022641
   `@jeremymcs`, thanks for the update! The `findDeadPidCandidate` approach — probing with `process.kill(pid, 0)` and catching `ESRCH` — is exactly the right pattern here. This eliminates the flakiness risk on systems where PID 99999 could be live. ✅



🐰 ʕ•ᴥ•ʔ 🎉

<!-- <review_comment_addressed> -->

---

<!-- This is an auto-generated comment: tweet message by coderabbit.ai -->

If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Replaced%20hard-coded%20PID%20with%20an%20ESRCH-probing%20helper%20to%20avoid%20flaky%20tests%20from%20live%20PID%20collisions%20%E2%80%94%20more%20robust%20test%20isolation.%20Try%20%40coderabbitai%20%F0%9F%9A%80%F0%9F%9B%A0%EF%B8%8F&url=https%3A%2F%2Fgithub.com%2Fgsd-build%2Fgsd-2%2Fpull%2F6244%23discussion_r3253001793)?

Thank you for using CodeRabbit!

<!-- end of auto-generated comment: tweet message by coderabbit.ai -->



<!-- This is an auto-generated reply by CodeRabbit -->
2. [general_comment] coderabbitai[bot]
   file=n/a line=n/a
   sourceId=4467290025 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6244#issuecomment-4467290025
   replyKind=general_comment threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-issue-comment-4467290025
   <!-- This is an auto-generated reply by CodeRabbit -->
> [!TIP]
> For best results, initiate chat on the files or code changes.

`@jeremymcs` Thanks for confirming! The fix in commit `987307d` for the test file inline finding looks good, and it's great that the focused verification suite passed cleanly. Appreciate the thorough follow-through on the bootstrap ordering and stale-lock cleanup checks. 🐇✨

<!-- <review_comment_addressed> -->

---

<!-- This is an auto-generated comment: tweet message by coderabbit.ai -->

If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Addressed%20a%20single%20inline%20test%20finding%20after%20%40coderabbitai%20review%E2%80%94applied%20a%20minimal%20test-only%20fix%20and%20ran%20focused%20verifications%20to%20confirm%20behavior%20unchanged.%20Try%20%40coderabbitai%20%E2%9C%85&url=https%3A%2F%2Fgithub.com%2Fgsd-build%2Fgsd-2%2Fpull%2F6244)?

Thank you for using CodeRabbit!

<!-- end of auto-generated comment: tweet message by coderabbit.ai -->



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 987307d by the latest babysitter run.

Responding to comment by @coderabbitai[bot]:

Validated the previously acknowledged test-only fix is present in the branch and re-ran the focused stale-lock cleanup test to confirm behavior remains correct. Verification passed cleanly with no additional code changes required.

@jeremymcs jeremymcs merged commit 4168d3b into main May 16, 2026
10 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.

auto startup never invokes stale_crash_lock auto-fix despite fixable:true marker

1 participant