From 21ae48a5c8fcb81d2acbb61a48765b2233ff8795 Mon Sep 17 00:00:00 2001 From: Codeman maintainer Date: Wed, 7 Oct 2026 19:54:17 +0200 Subject: [PATCH] fix(deepseek): the dsh footer field after a switched-off model is not the model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dsh-TUI draws the model as its status line's first field only while the status bar's model field is on (the default). Switched off, the first field is the reasoning effort (` medium · th-scratch`), else the mode, else the cwd's basename, and the footer pattern read that as the model, which would also outrank the route config added in the previous commit. The captured field must now carry a digit, as a model id does (a version) and an effort word, a mode name or most folder names do not. A model id without one (`deepseek-chat`) is not read from the screen and the session falls back to its route config: silent, never wrong. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/config/cli-registry/stock.ts | 8 +++++++- test/session-display-model.test.ts | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/config/cli-registry/stock.ts b/src/config/cli-registry/stock.ts index caa73a03..6a0a9c3a 100644 --- a/src/config/cli-registry/stock.ts +++ b/src/config/cli-registry/stock.ts @@ -1240,8 +1240,14 @@ const DEEPSEEK: CliEntry = { // and, on the row right under its bottom border, ` qwen3.8-27b · medium · `. // The border anchors it: nothing the agent writes can sit below the composer, and a // suggestion popup there starts with `/` or `+`, never a model id. + // ⚠ The first field is the model only while the status bar's model field is on (the + // default). Switched off, the first field is the next one: the reasoning effort + // (` medium · th-scratch`), else the mode, else the cwd's basename. So the field must + // carry a digit, which a model id does (a version) and an effort word, a mode name or + // most folder names do not. A model id without one (`deepseek-chat`) is not read, + // and the session falls back to its route config: silent, never wrong. modelDetect: { - screenLine: String.raw`╰─+╯\n ?([A-Za-z0-9][\w.:/@+-]{0,79})(?= · |\n|$)`, + screenLine: String.raw`╰─+╯\n ?((?=[\w.:/@+-]*\d)[A-Za-z0-9][\w.:/@+-]{0,79})(?= · |\n|$)`, screenLines: 3, // With the status bar's model field off (or before it paints), the route the // session's profile pins, read the way dsh-TUI resolves it: src/deepseek-route-config.ts. diff --git a/test/session-display-model.test.ts b/test/session-display-model.test.ts index 3421c189..13b4613c 100644 --- a/test/session-display-model.test.ts +++ b/test/session-display-model.test.ts @@ -127,6 +127,16 @@ describe('readScreenModel', () => { ); }); + it("never reads the field after a switched-off model as the model (dsh's effort, mode, cwd)", () => { + // dsh-TUI with `statusBar.model: false`: the effort word comes first. + expect(readScreenModel(dshPane(' medium · th-scratch'), DSH, DSH_ROWS)).toBeUndefined(); + expect(readScreenModel(dshPane(' xhigh · plan · th-scratch'), DSH, DSH_ROWS)).toBeUndefined(); + expect(readScreenModel(dshPane(' th-scratch'), DSH, DSH_ROWS)).toBeUndefined(); + // A model id carries a version digit; one that does not is left to the config. + expect(readScreenModel(dshPane(' deepseek-v4-flash · max · th-scratch'), DSH, DSH_ROWS)).toBe('deepseek-v4-flash'); + expect(readScreenModel(dshPane(' deepseek-chat · max'), DSH, DSH_ROWS)).toBeUndefined(); + }); + it("reads codex's model off its status line (0.147.0 and 0.154.0 layouts)", () => { expect(readScreenModel(CODEX_LIVE, CODEX, CODEX_ROWS)).toBe('gpt-5.6-terra'); expect(readScreenModel(CODEX_154, CODEX, CODEX_ROWS)).toBe('gpt-5.6-sol');