# NousResearch/hermes-agent · Model switch persistence in draft sessions (foreign key error)

## Open now

- 1 issue, 2 PRs open on GitHub.
- #138260: \[Bug\]: Switching models in a draft session fails to persist — _append_model_switch_marker hits FOREIGN KEY constraint failed and the switch silently reverts
- PR #138268: fix: persist model switches for draft sessions
- PR #151671: fix(gateway): persist the model-switch marker on a draft session

The members concern model switches in draft sessions not persisting; one issue report cites a FOREIGN KEY constraint failure in _append_model_switch_marker with the switch reverting. Two pull requests propose changes to persist the model-switch marker or switch for draft sessions.

## TL;DR

- 3 member(s): 1 open issue(s), 0 closed issue(s), 2 open PR(s), 0 merged PR(s), 0 PR(s) closed without merging.
- No fix has been merged to main; one or more PRs were attempted (see below).
- **Recommended:** review the prior/competing PR(s) below. A fix was attempted but not merged; your case may extend or revive that work.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `unresolved`. 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.67`: 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.

## Open related issues

- #138260: \[Bug\]: Switching models in a draft session fails to persist — _append_model_switch_marker hits FOREIGN KEY constraint failed and the switch silently reverts

## Prior & competing PRs

- **#138268: fix: persist model switches for draft sessions**. open
  - maintainer direction: category `silent_close`; implication `active`
  - files: `tests/tui_gateway/test_submit_row_session_target.py`, `tui_gateway/agent_factory.py`
- **#151671: fix(gateway): persist the model-switch marker on a draft session**. open
  - maintainer direction: category `silent_close`; implication `active`
  - files: `tests/tui_gateway/test_model_switch_marker_fresh_chat.py`, `tui_gateway/server.py`

## Fix status

- No merged fix on record.
- Subsystem: `gateway`
- Kind: `bug` (from the open issues' GitHub type labels).
