fix(variant): respect TUI variant and enforce max in ultrawork mode
- keyword-detector: always set variant to 'max' when ultrawork/ulw keyword detected
- chat-message: remove variant resolution logic to passthrough TUI variant unchanged
- Tests updated to reflect new behavior
🤖 Generated with OhMyOpenCode assistance
This commit is contained in:
@@ -45,9 +45,9 @@ function createMockOutput(variant?: string): ChatMessageHandlerOutput {
|
||||
return { message, parts: [] }
|
||||
}
|
||||
|
||||
describe("createChatMessageHandler - first message variant", () => {
|
||||
test("first message: sets variant from fallback chain when user has no selection", async () => {
|
||||
//#given - first message, no user-selected variant, hephaestus with medium in chain
|
||||
describe("createChatMessageHandler - TUI variant passthrough", () => {
|
||||
test("first message: does not override TUI variant when user has no selection", async () => {
|
||||
//#given - first message, no user-selected variant
|
||||
const args = createMockHandlerArgs({ shouldOverride: true })
|
||||
const handler = createChatMessageHandler(args)
|
||||
const input = createMockInput("hephaestus", { providerID: "openai", modelID: "gpt-5.3-codex" })
|
||||
@@ -56,8 +56,8 @@ describe("createChatMessageHandler - first message variant", () => {
|
||||
//#when
|
||||
await handler(input, output)
|
||||
|
||||
//#then - should set variant from fallback chain
|
||||
expect(output.message["variant"]).toBeDefined()
|
||||
//#then - TUI sent undefined, should stay undefined (no config override)
|
||||
expect(output.message["variant"]).toBeUndefined()
|
||||
})
|
||||
|
||||
test("first message: preserves user-selected variant when already set", async () => {
|
||||
@@ -70,25 +70,11 @@ describe("createChatMessageHandler - first message variant", () => {
|
||||
//#when
|
||||
await handler(input, output)
|
||||
|
||||
//#then - user's xhigh must be preserved, not overwritten to "medium"
|
||||
//#then - user's xhigh must be preserved
|
||||
expect(output.message["variant"]).toBe("xhigh")
|
||||
})
|
||||
|
||||
test("first message: preserves user-selected 'high' variant", async () => {
|
||||
//#given - user selected "high" variant
|
||||
const args = createMockHandlerArgs({ shouldOverride: true })
|
||||
const handler = createChatMessageHandler(args)
|
||||
const input = createMockInput("hephaestus", { providerID: "openai", modelID: "gpt-5.3-codex" })
|
||||
const output = createMockOutput("high")
|
||||
|
||||
//#when
|
||||
await handler(input, output)
|
||||
|
||||
//#then
|
||||
expect(output.message["variant"]).toBe("high")
|
||||
})
|
||||
|
||||
test("subsequent message: does not override existing variant", async () => {
|
||||
test("subsequent message: preserves TUI variant", async () => {
|
||||
//#given - not first message, variant already set
|
||||
const args = createMockHandlerArgs({ shouldOverride: false })
|
||||
const handler = createChatMessageHandler(args)
|
||||
@@ -102,6 +88,20 @@ describe("createChatMessageHandler - first message variant", () => {
|
||||
expect(output.message["variant"]).toBe("xhigh")
|
||||
})
|
||||
|
||||
test("subsequent message: does not inject variant when TUI sends none", async () => {
|
||||
//#given - not first message, no variant from TUI
|
||||
const args = createMockHandlerArgs({ shouldOverride: false })
|
||||
const handler = createChatMessageHandler(args)
|
||||
const input = createMockInput("hephaestus", { providerID: "openai", modelID: "gpt-5.3-codex" })
|
||||
const output = createMockOutput() // no variant
|
||||
|
||||
//#when
|
||||
await handler(input, output)
|
||||
|
||||
//#then - should stay undefined, not auto-resolved from config
|
||||
expect(output.message["variant"]).toBeUndefined()
|
||||
})
|
||||
|
||||
test("first message: marks gate as applied regardless of variant presence", async () => {
|
||||
//#given - first message with user-selected variant
|
||||
const args = createMockHandlerArgs({ shouldOverride: true })
|
||||
|
||||
Reference in New Issue
Block a user