fix(gastown): push new model onto resumed mayor session on hot-swap#2999
Merged
kilo-code-bot[bot] merged 1 commit intogastown-stagingfrom May 1, 2026
Merged
fix(gastown): push new model onto resumed mayor session on hot-swap#2999kilo-code-bot[bot] merged 1 commit intogastown-stagingfrom
kilo-code-bot[bot] merged 1 commit intogastown-stagingfrom
Conversation
When a user changes the mayor's model in town settings, updateAgentModel restarts the SDK server with new KILO_CONFIG_CONTENT and resumes the existing session from kilo.db. Commit 9785570 intentionally stopped sending any session.prompt on resume to avoid duplicating the MAYOR_STARTUP_PROMPT, but that also dropped the model param — so the resumed session kept its prior per-session model until the user ran /model manually. Extract the fresh vs. resumed session-prompt logic into applyModelToSession and on resume send a noReply:true prompt carrying only the new model param. This updates the SDK server's per-session model without replaying the startup prompt. Errors on the resume path are swallowed so the hot-swap still succeeds; the SDK server fell back to the config-loaded model at startup, which was already updated. Add container tests covering both fresh and resumed paths.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by gpt-5.5-2026-04-23 · 674,099 tokens |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a regression where changing the mayor's model in Gastown town settings did not take effect on the running mayor until the user manually ran
/modelin chat.Commit
9785570b9(skip initial prompt on resume) dropped the entireclient.session.prompt(...)call when resuming an existing session to avoid duplicatingMAYOR_STARTUP_PROMPT. That call was also carrying themodelparam, so the SDK server never learned about the new per-session model selection and the resumed session kept running on the old model.This change extracts the fresh-vs-resumed session-prompt logic into a new
applyModelToSessionhelper inservices/gastown/container/src/process-manager.ts:MAYOR_STARTUP_PROMPTwith the model param so the first turn uses the new model.noReply: trueprompt carrying only the model param and an empty text part. The SDK treats this as a session-state update (no model invocation), and the next real user turn uses the updated model. Errors on this path are caught and logged — the SDK server already loaded the new model from the refreshedKILO_CONFIG_CONTENTat startup, so a push failure is not fatal.Verification
pnpm --filter gastown-container test— the 4 newapplyModelToSessiontests pass (fresh-path sends startup prompt + model, resumed-path sends empty +noReply: true+ model, resumed-path error is swallowed, resumed-path success is logged). Two pre-existing JWT-header failures inplugin/client.test.tsare unrelated to this change.MAYOR_STARTUP_PROMPTturn is injected (regression from 9785570 not reintroduced).updateAgentModelfailure is preserved (control flow aroundapplyModelToSessionis unchanged).Visual Changes
N/A
Reviewer Notes
parts: [{ type: 'text', text: '' }]plusnoReply: true. If the SDK ever rejects empty text parts in a future version, swap to' '. The issue thread mentionsclient.session.commandas a fallback, but that would require the/modelcommand to be registered server-side which is brittle.applyModelToSessionis exported so tests can exercise both paths with a minimal fake client (structuralSessionPromptClienttype defined locally — no mocking of the whole KiloClient).pnpm typecheckwas skipped perAGENTS.md(too heavy); package-level typecheck is covered byvitestcompile.