test: fix prometheus-prompt syntax + sync display name casing to lowercase

- prometheus-prompt.test.ts: close missing }) on the OpenSpec expanded
  commands describe block (introduced by d66b6bcbf, parse error).
- agent-sort-shim/agent-config-integration/continuation-injection/
  unstable-agent-babysitter/subagent-resolver/sync-executor/
  resolve-caller-team-lead tests: expect 'Sisyphus - ultraworker'
  (lowercase) to match production after cd39f8858, which lowercased the
  display name to dodge a TUI ZWSP rendering glitch. Legacy uppercase
  inputs that exercise the normalization path are preserved.
- sync-executor.ts + resolve-caller-team-lead.ts: route legacy display
  name inputs through normalizeAgentForPrompt so prompt agent names and
  caller team lead lookups produce the canonical lowercase form.
This commit is contained in:
YeonGyu-Kim
2026-05-22 00:05:42 +09:00
parent beed9e8906
commit bc0da0fad3
10 changed files with 55 additions and 41 deletions
@@ -1,3 +1,5 @@
/// <reference types="bun-types" />
import { unsafeTestValue } from "../../../test-support/unsafe-test-value"
import { describe, test, expect, mock } from "bun:test"
@@ -140,7 +142,7 @@ describe("executeSync", () => {
//#then
const promptInput = recorder.getCapturedInput()
expect(promptInput?.body.agent).toBe("Sisyphus - Ultraworker")
expect(promptInput?.body.agent).toBe("Sisyphus - ultraworker")
})
test("#given subagent_type is the lowercase config key 'hephaestus' #when executeSync runs #then prompt receives the registered display name 'Hephaestus - Deep Agent'", async () => {
@@ -449,7 +451,7 @@ describe("executeSync", () => {
//#then
const promptInput = recorder.getCapturedInput()
expect(promptInput?.body.agent).toBe("Sisyphus - Ultraworker")
expect(promptInput?.body.agent).toBe("Sisyphus - ultraworker")
})
test("returns generic prompt failure with task metadata", async () => {
+2 -2
View File
@@ -2,7 +2,7 @@ import type { PluginInput } from "@opencode-ai/plugin"
import { clearSessionAgent, setSessionAgent, subagentSessions, syncSubagentSessions } from "../../features/claude-code-session-state"
import { dispatchInternalPrompt, isInternalPromptDispatchAccepted } from "../../hooks/shared/prompt-async-gate"
import { getAgentToolRestrictions, isAmbiguousPostDispatchPromptFailure, log } from "../../shared"
import { getAgentDisplayName, stripAgentListSortPrefix } from "../../shared/agent-display-names"
import { normalizeAgentForPrompt, stripAgentListSortPrefix } from "../../shared/agent-display-names"
import {
clearDelegatedChildSessionBootstrap,
registerDelegatedChildSessionBootstrap,
@@ -118,7 +118,7 @@ export async function executeSync(
log(`[call_omo_agent] Sending prompt to session ${sessionID}`)
log(`[call_omo_agent] Prompt text:`, args.prompt.substring(0, 100))
const normalizedSubagentType = stripAgentListSortPrefix(args.subagent_type)
const promptAgent = getAgentDisplayName(normalizedSubagentType)
const promptAgent = normalizeAgentForPrompt(normalizedSubagentType) ?? normalizedSubagentType
const promptTools = buildSyncPromptTools(normalizedSubagentType)
setSessionAgent(sessionID, promptAgent)
setSessionTools(sessionID, promptTools)
@@ -1,3 +1,5 @@
/// <reference types="bun-types" />
import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test"
import type { DelegateTaskArgs } from "../types"
import type { ExecutorContext } from "../executor-types"
@@ -180,7 +182,7 @@ describe("resolveSubagentExecution", () => {
})
const args = createBaseArgs({ subagent_type: "sisyphus" })
const executorCtx = createExecutorContext(async () => ([
{ name: "\u200BSisyphus - Ultraworker", mode: "primary", model: "anthropic/claude-opus-4-7" },
{ name: "Sisyphus - ultraworker", mode: "primary", model: "anthropic/claude-opus-4-7" },
{ name: "oracle", mode: "subagent" },
]))
@@ -191,7 +193,7 @@ describe("resolveSubagentExecution", () => {
//#then
expect(result.error).toBeUndefined()
expect(result.agentToUse).toBe("\u200BSisyphus - Ultraworker")
expect(result.agentToUse).toBe("Sisyphus - ultraworker")
})
test("allows delegating to Sisyphus-Junior when allowSisyphusJuniorDirect is enabled (team-mode path)", async () => {
@@ -665,7 +667,7 @@ describe("resolveSubagentExecution", () => {
//#given
const args = createBaseArgs({ subagent_type: "\uFEFFSisyphus - Ultraworker" })
const executorCtx = createExecutorContext(async () => ([
{ name: "\u200BSisyphus - Ultraworker", mode: "subagent", model: "openai/gpt-5.3-codex" },
{ name: "\u200BSisyphus - ultraworker", mode: "subagent", model: "openai/gpt-5.3-codex" },
]))
//#when
@@ -673,7 +675,7 @@ describe("resolveSubagentExecution", () => {
//#then
expect(result.error).toBeUndefined()
expect(result.agentToUse).toBe("Sisyphus - Ultraworker")
expect(result.agentToUse).toBe("Sisyphus - ultraworker")
})
test("uses agent override fallback_models for subagent runtime fallback chain", async () => {
@@ -1409,7 +1411,7 @@ describe("resolveSubagentExecution - agent name sanitization", () => {
})
const args = createBaseArgs({ subagent_type: "Sisyphus - Ultraworker" })
const executorCtx = createExecutorContext(async () => ([
{ name: "\u200BSisyphus - Ultraworker", mode: "subagent", model: "openai/gpt-5.3-codex" },
{ name: "\u200BSisyphus - ultraworker", mode: "subagent", model: "openai/gpt-5.3-codex" },
]))
//#when
@@ -1417,7 +1419,7 @@ describe("resolveSubagentExecution - agent name sanitization", () => {
//#then
expect(result.error).toBeUndefined()
expect(result.agentToUse).toBe("Sisyphus - Ultraworker")
expect(result.agentToUse).toBe("Sisyphus - ultraworker")
})
test("strips legacy ZWSP-prefixed agent names from persisted subagent runtime state (GH-3259)", async () => {