Skip to content

Commit b197372

Browse files
committed
Actually implement it so ending session puts you back in model picker
1 parent e8fd2c8 commit b197372

4 files changed

Lines changed: 9 additions & 17 deletions

File tree

cli/src/chat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import { reportActivity } from './utils/activity-tracker'
5757
import { trackEvent } from './utils/analytics'
5858
import { showClipboardMessage } from './utils/clipboard'
5959
import { readClipboardImage } from './utils/clipboard-image'
60-
import { endAndRejoinFreebuffSession } from './hooks/use-freebuff-session'
60+
import { returnToFreebuffLanding } from './hooks/use-freebuff-session'
6161
import { END_SESSION_MESSAGE, IS_FREEBUFF } from './utils/constants'
6262
import { getSystemMessage } from './utils/message-history'
6363
import { getInputModeConfig } from './utils/input-modes'
@@ -1460,7 +1460,7 @@ export const Chat = ({
14601460
...prev,
14611461
getSystemMessage(END_SESSION_MESSAGE),
14621462
])
1463-
endAndRejoinFreebuffSession().catch(() => {})
1463+
returnToFreebuffLanding({ resetChat: true }).catch(() => {})
14641464
}}
14651465
freebuffSession={freebuffSession}
14661466
/>

cli/src/commands/command-registry.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { handleInitializationFlowLocally } from './init'
99
import { buildInterviewPrompt, buildPlanPrompt, buildReviewPromptFromArgs } from './prompt-builders'
1010
import { runBashCommand } from './router'
1111
import { handleUsageCommand } from './usage'
12-
import { endAndRejoinFreebuffSession } from '../hooks/use-freebuff-session'
12+
import { returnToFreebuffLanding } from '../hooks/use-freebuff-session'
1313
import { useThemeStore } from '../hooks/use-theme'
1414
import { WEBSITE_URL } from '../login/constants'
1515
import { useChatStore } from '../state/chat-store'
@@ -613,9 +613,10 @@ const ALL_COMMANDS: CommandDefinition[] = [
613613
clearInput(params)
614614
},
615615
}),
616-
// /end-session (freebuff-only) — end the active session early and re-queue. The
617-
// hook flips status from 'active' → 'queued', which unmounts <Chat> and
618-
// mounts <WaitingRoomScreen>, where the user can pick a different model.
616+
// /end-session (freebuff-only) — end the active session early and drop back
617+
// to the model picker. The hook flips status to 'none', which unmounts
618+
// <Chat> and mounts <WaitingRoomScreen> on the landing view, where the
619+
// user picks a model and hits Enter to rejoin the queue.
619620
defineCommand({
620621
name: 'end-session',
621622
handler: (params) => {
@@ -626,7 +627,7 @@ const ALL_COMMANDS: CommandDefinition[] = [
626627
])
627628
params.saveToHistory(params.inputValue.trim())
628629
clearInput(params)
629-
endAndRejoinFreebuffSession().catch(() => {
630+
returnToFreebuffLanding({ resetChat: true }).catch(() => {
630631
// The hook surfaces poll errors via the session store; nothing to do
631632
// here beyond letting the chat history reflect the attempt.
632633
})

cli/src/hooks/use-freebuff-session.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,6 @@ export function joinFreebuffQueue(model: string): Promise<void> {
262262
return restartFreebuffSession('rejoin')
263263
}
264264

265-
/**
266-
* End the current session and immediately rejoin the queue. Used by the
267-
* "switch model" confirmation flow when the server returned `model_locked`,
268-
* and by any UI that lets the user exit an active session early.
269-
*/
270-
export function endAndRejoinFreebuffSession(): Promise<void> {
271-
return restartFreebuffSession('rejoin', { resetChat: true, releaseSlot: true })
272-
}
273-
274265
/**
275266
* Best-effort DELETE of the caller's session row. Used by exit paths that
276267
* skip React unmount (process.exit on Ctrl+C) so the seat frees up quickly

cli/src/utils/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const IS_FREEBUFF = getCliEnv().FREEBUFF_MODE === 'true'
1010

1111
/** Message shown when the user ends a freebuff session early. */
1212
export const END_SESSION_MESSAGE =
13-
'Ending session and returning to the waiting room…'
13+
'Ending session and returning to the model picker…'
1414

1515
// Agent IDs that should not be rendered in the CLI UI
1616
export const HIDDEN_AGENT_IDS = ['codebuff/context-pruner'] as const

0 commit comments

Comments
 (0)