# NousResearch/hermes-agent · Prevent session switching during active agent turns

## Open now

- 0 issues, 2 PRs open on GitHub.
- PR #112138: fix(cli): refuse /branch mid-turn — an in-flight run flushes onto the branch
- PR #112531: fix(session): keep in-flight turn writes on the parent across /branch

These issues and fixes address a race condition where using /branch (and related session commands) mid-turn causes in-flight messages or writes to flush onto the wrong session. The work focuses on refusing or guarding session switches while a turn is still running.

## TL;DR

- 4 member(s): 0 open issue(s), 1 closed issue(s), 2 open PR(s), 1 merged PR(s), 0 PR(s) closed without merging.
- A fix was merged to main in PR #113210. Verify it addresses your case.
- **Recommended:** read PR #113210 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-113210`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.50`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #112137: /branch mid-turn races the in-flight agent run: remaining messages flush onto the branched session

## Prior & competing PRs

- **#113210: fix(cli): /branch, /resume and /sessions <id> refuse to switch sessions mid-turn (#112137, salvage #112138, #112930)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`
  - files: `hermes_cli/cli_commands_mixin.py`, `tests/hermes_cli/test_branch_command.py`, `tests/hermes_cli/test_session_switch_mid_turn_guard.py`, `website/docs/reference/slash-commands.md`
- **#112138: fix(cli): refuse /branch mid-turn — an in-flight run flushes onto the branch**. open
  - maintainer direction: category `partial_fix`; implication `needs_llm`
  - files: `hermes_cli/cli_commands_mixin.py`, `tests/hermes_cli/test_branch_mid_turn_guard.py`
- **#112531: fix(session): keep in-flight turn writes on the parent across /branch**. open
  - maintainer direction: category `silent_close`; implication `active`
  - files: `agent/session_persistence.py`, `tests/agent/test_session_persistence_ownership.py`

## Fix status

- Merged to main in PR #113210 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-09-17`.
- Subsystem: `agent`
