Skip to content

emrg: update server_id on /model switch so status line persists new model - #121

Merged
argszero merged 1 commit into
masterfrom
fix/model-switch-server-id
Jul 22, 2026
Merged

emrg: update server_id on /model switch so status line persists new model#121
argszero merged 1 commit into
masterfrom
fix/model-switch-server-id

Conversation

@argszero

Copy link
Copy Markdown
Owner

What

When the user switches models with /model, the model_set handler previously only updated the status line inline but did not update the server_id variable. This meant subsequent status updates (tool start/end, session resume, etc.) would revert to showing the old model — or no model at all — in the status line.

Fix

The model_set success handler now updates server_id to include [model_name], so all future status line updates correctly reflect the active model. Also handles the edge case where server_id is empty (before the server handshake arrives).

Before

status.update(center=f"{server_id} [{model_name}]" if server_id else f"emrg [{model_name}]")
# server_id stays unchanged — next tool execution resets status to old value

After

base_id = server_id.split(" [")[0] if " [" in server_id else server_id
server_id = f"{base_id} [{model_name}]" if base_id else f"emrg [{model_name}]"
status.update(center=server_id)
# server_id now includes [model] — all future status updates show the correct model

The split(" [") handles the case where server_id already contains a model suffix (from PR #120's model-in-handshake change, once merged).

Validation

  • 248 tests pass (uv run pytest tests/ -v)
  • Import check OK
  • emrg --help OK

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle #31

Reviewed the server_id update fix. 248 tests pass, import/help OK. The split(' [') approach correctly handles the model-in-handshake suffix when PR #120 lands. 1st ✅.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle #1

Re-reviewed the server_id fix. 248 tests pass, import/help OK. The split(' [') approach correctly handles the model-in-handshake suffix from PR #120 (now merged). 2nd ✅ (#31, #1).

…odel
Previously the model_set handler only updated the status line inline
(via status.update) but did not update the server_id variable. This
meant subsequent status updates (tool start/end, session switch, etc.)
would revert to showing the old model (or no model) in the status line.
Now server_id is updated to include [model_name], so all future status
line updates correctly reflect the active model. Also handles the edge
case where server_id is empty (before handshake).
@argszero
argszeroforce-pushed the fix/model-switch-server-id branch from d367704 to 8198a86CompareJuly 22, 2026 11:34

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle #2

Re-reviewed the server_id fix after rebasing onto master (was based on pre-#119/#120 commit). 273 tests pass, import/help OK. The split(' [') approach correctly strips any model suffix from pong then appends the new model name. 3rd ✅ (#31, #1, #2).

@argszero
argszero merged commit 72b55cb into masterJul 22, 2026
1 check passed
@argszero
argszero deleted the fix/model-switch-server-id branch July 28, 2026 12:00
Sign up for freeto 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

@argszero