Skip to content

fix: start a fresh session on /switch instead of resuming the old one (v0.1.11)#15

Merged
t2tx merged 1 commit into
mainfrom
fix/switch-resume
Jun 16, 2026
Merged

fix: start a fresh session on /switch instead of resuming the old one (v0.1.11)#15
t2tx merged 1 commit into
mainfrom
fix/switch-resume

Conversation

@t2tx

@t2tx t2tx commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Bug

/switch and /switch - used killSession, which kills the process but keeps the SessionManager entry (including the stored session id). On the next message, ensure() would try to --resume that session id in the new working directory — but it belongs to the old directory, so Claude exits with code 1 and never responds (most visible in channels: after /switch, the bot goes silent).

Fix

Use clearSession instead, so the stored session id is forgotten and a fresh session starts in the new directory. Continuing a conversation across working directories is meaningless anyway.

  • commands.ts: cmdSwitch (switch / revert-to-default) now uses clearSession
  • Wording Session resumesA fresh session starts
  • Test updated to expect clearSession
  • version 0.1.10 → 0.1.11

Verification

Reproduced and fixed on the GitLab sibling repo (v0.1.7), verified on Iris-dev: after /switch, follow-up messages now get a response; the code=1 respawn loop is gone (confirmed in logs). pnpm verify green (87 tests).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Version bumped to 0.1.11
  • Bug Fixes

    • Fixed /switch - command to properly clear the session state, ensuring a fresh session initializes on the next message instead of resuming from a previous session state

/switch and /switch - used killSession, which kills the process but
keeps the SessionManager entry (including the stored session id). On the
next message, ensure() would try to --resume that session id in the NEW
working directory — but it belongs to the OLD directory, so Claude exits
with code 1 and never responds (most visible in channels).

Use clearSession instead so the stored session id is forgotten and a
fresh session starts in the new directory. Continuing a conversation
across working directories is meaningless anyway.

- commands.ts: cmdSwitch (switch / revert-to-default) now clearSession
- wording "Session resumes" → "A fresh session starts"
- test updated to expect clearSession
- version 0.1.10 → 0.1.11

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

In cmdSwitch, both the /switch - (revert) and /switch <target> (forward) branches now call ctx.manager.clearSession instead of ctx.manager.killSession to forget the stored session ID when changing working directories. Response messages are updated accordingly, and the /switch - test is aligned to mock and assert clearSession. The package version is bumped to 0.1.11.

Changes

cmdSwitch clearSession behavior change

Layer / File(s) Summary
clearSession in cmdSwitch and updated tests
src/commands.ts, src/commands.test.ts
Both /switch - and /switch <arg> branches now call clearSession instead of killSession; response text updated to indicate a fresh session starts on the next message; /switch - test replaces killSession mock with clearSession mock and asserts sessionCleared.
Package version bump
package.json
Version incremented from 0.1.10 to 0.1.11.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

  • t2tx/iris#13: Introduced the original /switch command implementation with killSession; this PR directly refines that session-lifecycle behavior by replacing killSession with clearSession.
🚥 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 summarizes the primary change: replacing killSession with clearSession to start fresh sessions on /switch, directly addressing the bug fix described in the PR objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 fix/switch-resume

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

@t2tx t2tx merged commit 8a2569a into main Jun 16, 2026
4 of 5 checks passed
@t2tx t2tx deleted the fix/switch-resume branch June 16, 2026 07:27
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.

1 participant