fix(local-model): a chip that was only looked at never hides "Start a session"

Selecting a chip stored it for the device at once. Someone who clicked
"DeepSeek" (Needs setup) or "Pi" (Not installed) just to see what it
says then got a window that reopened on that chip: "Install Pi", or no
main button at all, with "Start a session" out of sight.

The device now remembers the agent a session was STARTED with, an
opening of the window selects it only while it can be started, and a
selection made in one opening does not carry into the next. Otherwise
the server's default agent is selected, as before.

Also: a real-browser test for the chips (they wrap inside the window at
1440, 390 and 320 px, the install command included, one tab stop), and
one sentence in the API reference: a readiness mark says the composer is
there, not that nothing else is (DeepSeek Harness's setup guide draws
the same glyph).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-11 10:24:03 +01:00
1 parent 0f9f877a5a
commit bd362f736b
5 files changed
+117 -12

No files matched your search

+25 -2
View File
@@ -2898,7 +2898,7 @@ describe('the coding agents of an installed model', () => {
expect(frameOf(page.body).querySelectorAll('.lm-buttons .wt-btn-primary')).toHaveLength(1);
});
it('starts the session with the selected agent, and this device remembers the choice', async () => {
it('starts the session with the selected agent, and this device remembers the agent it started', async () => {
const page = mount();
const { app } = await opened(page, WITH_AGENTS);
const launch = launcher(app);
@@ -2907,11 +2907,13 @@ describe('the coding agents of an installed model', () => {
// What the catalogue says about its first answer.
expect(texts(page.body, '.lm-agent-about .lm-aside')).toEqual(['The first answer can take minutes.']);
expect(verbs(app)).toEqual([]);
// Looking at a chip is not a choice yet.
expect(page.dom.window.localStorage.getItem('codeman-local-model-agent')).toBeNull();
press(page.body, 'Start a session');
await settle();
expect(launch).toHaveBeenCalledWith('claude', 'local-ollama');
// The window opened again later: the last choice stands, not the default.
// The window opened again later: the agent last started stands, not the default.
expect(page.dom.window.localStorage.getItem('codeman-local-model-agent')).toBe('claude');
const again = page.newApp(ok(WITH_AGENTS));
await again.loadLocalModel();
@@ -2920,6 +2922,27 @@ describe('the coding agents of an installed model', () => {
expect(chosen(page)).toBe('Claude Code');
});
it('a chip that was only looked at never hides Start a session when the window is opened again', async () => {
const page = mount();
const { app } = await opened(page, WITH_AGENTS);
pick(page, 'DeepSeek');
expect(buttons(page.body)).toEqual(['Remove', 'Stop']);
app.closeLocalModelWindow();
app.openLocalModelWindow();
await settle();
// Back on the default agent, with the main action in reach.
expect(chosen(page)).toBe('OpenCode');
expect(buttons(page.body)).toEqual(['Remove', 'Stop', 'Start a session']);
// And an agent that was started once and has since been uninstalled does not win either.
page.dom.window.localStorage.setItem('codeman-local-model-agent', 'pi');
app.closeLocalModelWindow();
app.openLocalModelWindow();
await settle();
expect(chosen(page)).toBe('OpenCode');
expect(buttons(page.body)).toEqual(['Remove', 'Stop', 'Start a session']);
});
it('a remembered agent the server no longer lists falls back to the default', async () => {
const page = mount();
page.dom.window.localStorage.setItem('codeman-local-model-agent', 'gone');