Skip to content

fix(issue): auto-mode: session_start hook wipes markDepthVerified, causing discuss-milestone infinite loop (regression of #4973)#6171

Open
jeremymcs wants to merge 1 commit into
mainfrom
issue/5945-auto-mode-session-start-hook-wipes-markd-1778892809
Open

fix(issue): auto-mode: session_start hook wipes markDepthVerified, causing discuss-milestone infinite loop (regression of #4973)#6171
jeremymcs wants to merge 1 commit into
mainfrom
issue/5945-auto-mode-session-start-hook-wipes-markd-1778892809

Conversation

@jeremymcs
Copy link
Copy Markdown
Collaborator

@jeremymcs jeremymcs commented May 16, 2026

Summary

  • Preserved auto-mode depth-gate state by preventing session hook resets in auto sessions and verified with focused depth-gate regression tests.

Verification

  • Completed in the repository worktree before push.

Related Issue

Repo

  • gsd-build/gsd-2

Branch

  • issue/5945-auto-mode-session-start-hook-wipes-markd-1778892809

Summary by CodeRabbit

  • Bug Fixes
    • Improved session state management during startup and switching operations to consistently preserve verification state in automatic session scenarios.

Review Change Stack

…using discuss-milestone infinite loop (regression of #4973)
@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: e0eb9692-d37c-44dc-8529-4f846dba0c92

📥 Commits

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

📒 Files selected for processing (1)
  • src/resources/extensions/gsd/bootstrap/register-hooks.ts

📝 Walkthrough

Walkthrough

Preserves auto-mode write-gate depth verification across session lifecycle by caching isAutoActive() and conditionally skipping state resets in session_start and session_switch handlers, while reusing the cached value for UI-widget initialization logic.

Changes

Auto-mode session initialization

Layer / File(s) Summary
Conditional write-gate preservation in session lifecycle
src/resources/extensions/gsd/bootstrap/register-hooks.ts
session_start caches autoActive and skips resetWriteGateState when true to preserve pre-marked depth verification. session_switch similarly caches autoActive to conditionally skip both resetWriteGateState and clearDiscussionFlowState when auto-active. UI-widget reinitialization is keyed off the same cached autoActive value instead of re-calling isAutoActive().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A session hook once wiped the gate,
Auto-mode trapped in looping fate.
Now autoActive takes the reins,
Preserving state through session lanes.
Depth once marked now safely stays—
The loop is fixed in cleaner ways! 🎉

🚥 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 change: fixing a regression where auto-mode session_start hook wipes markDepthVerified, causing an infinite loop.
Linked Issues check ✅ Passed Code changes preserve depth-gate state by conditionally skipping resetWriteGateState() and clearDiscussionFlowState() in auto-active sessions, directly addressing issue #5945's recommended fix (option 2).
Out of Scope Changes check ✅ Passed All changes in register-hooks.ts are scoped to fixing the session hook behavior for auto-mode depth verification, with no unrelated modifications.

✏️ 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/5945-auto-mode-session-start-hook-wipes-markd-1778892809

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

🟠 PR Risk Report — HIGH

Files changed 1
Systems affected 2
Overall risk 🟠 HIGH

Affected Systems

Risk System
🟠 high GSD Workflow
🟢 low Loader/Bootstrap
File Breakdown
Risk File Systems
🟠 src/resources/extensions/gsd/bootstrap/register-hooks.ts GSD Workflow, Loader/Bootstrap

⚠️ 🟠 High risk — the following systems require verification before merge:

  • 🟠 GSD Workflow: verify GSD workflow state transitions end-to-end

⛔ 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: GSD Workflow. Verify:

1. verify GSD workflow state transitions end-to-end

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

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-mode: session_start hook wipes markDepthVerified, causing discuss-milestone infinite loop (regression of #4973)

1 participant