From 5207a98fd89cb0e7a352e666ffbcb8fa38922140 Mon Sep 17 00:00:00 2001 From: can1357 Date: Sun, 21 Jun 2026 07:41:53 +0200 Subject: [PATCH] refactor(coding-agent): simplified temporary model status message - Inlined the temporary model status formatting logic directly into the controller. - Removed the unused `formatTemporaryModelStatus` utility function and its associated test. --- .../src/modes/controllers/selector-controller.ts | 8 +++----- .../coding-agent/src/prompts/system/system-prompt.md | 1 - .../test/selector-settings-side-effects.test.ts | 11 +---------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/coding-agent/src/modes/controllers/selector-controller.ts b/packages/coding-agent/src/modes/controllers/selector-controller.ts index 3218f9edc..7ecf68e90 100644 --- a/packages/coding-agent/src/modes/controllers/selector-controller.ts +++ b/packages/coding-agent/src/modes/controllers/selector-controller.ts @@ -71,10 +71,6 @@ import { buildCopyTargets } from "../utils/copy-targets"; const MANUAL_LOGIN_TIP = "Tip: You can complete pairing with /login ."; -export function formatTemporaryModelStatus(modelLabel: string, roleSelectorHint = "Alt+M"): string { - return `Temporary model selection is session-only: ${modelLabel}. Use ${roleSelectorHint} or /model for role models (default/smol/plan/task/slow/custom roles).`; -} - export class SelectorController { constructor(private ctx: InteractiveModeContext) {} @@ -499,7 +495,9 @@ export class SelectorController { this.ctx.statusLine.invalidate(); this.ctx.updateEditorBorderColor(); const roleSelectorHint = this.ctx.keybindings.getKeys("app.model.select")[0] ?? "Alt+M"; - this.ctx.showStatus(formatTemporaryModelStatus(selector ?? model.id, roleSelectorHint)); + this.ctx.showStatus( + `Session-only model: ${selector ?? model.id}. Use ${roleSelectorHint} or /model for roles.`, + ); done(); this.ctx.ui.requestRender(); } else if (role === "default") { diff --git a/packages/coding-agent/src/prompts/system/system-prompt.md b/packages/coding-agent/src/prompts/system/system-prompt.md index 4173e874a..1a46b0594 100644 --- a/packages/coding-agent/src/prompts/system/system-prompt.md +++ b/packages/coding-agent/src/prompts/system/system-prompt.md @@ -17,7 +17,6 @@ You are a helpful assistant the team trusts with load-bearing changes, operating - You are not alone in this repo. Treat unexpected changes as the user's work and adapt. - In terminal prose and final chat, you MAY use LaTeX math (`$`, `$$`, `\text`, `\times`) and color (`\textcolor`, `\colorbox`, `\fcolorbox`). - To show a diagram, you MAY emit a ` ```mermaid ` block — the terminal renders it as ASCII. Use it for genuine structure or flow, not trivia. -- For a visual separator between sections, use `─` (U+2500). RUNTIME ============== diff --git a/packages/coding-agent/test/selector-settings-side-effects.test.ts b/packages/coding-agent/test/selector-settings-side-effects.test.ts index 2ce0c1425..ba92fefc0 100644 --- a/packages/coding-agent/test/selector-settings-side-effects.test.ts +++ b/packages/coding-agent/test/selector-settings-side-effects.test.ts @@ -1,9 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test"; import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; -import { - formatTemporaryModelStatus, - SelectorController, -} from "@oh-my-pi/pi-coding-agent/modes/controllers/selector-controller"; +import { SelectorController } from "@oh-my-pi/pi-coding-agent/modes/controllers/selector-controller"; import { beginSettingsTest, restoreSettingsTestState, type SettingsTestState } from "./helpers/settings-test-state"; let settingsState: SettingsTestState | undefined; @@ -19,12 +16,6 @@ afterEach(() => { }); describe("selector setting side effects", () => { - it("formats temporary model status with role assignment guidance", () => { - expect(formatTemporaryModelStatus("openai/gpt-5.1", "alt+m")).toBe( - "Temporary model selection is session-only: openai/gpt-5.1. Use alt+m or /model for role models (default/smol/plan/task/slow/custom roles).", - ); - }); - it("refreshes the status line when git integration changes at runtime", () => { const updateSettings = vi.fn(); const updateEditorTopBorder = vi.fn();