fix(prompts): normalize agent names for continuation injections

This commit is contained in:
ismeth
2026-02-18 19:26:46 +01:00
committed by YeonGyu-Kim
parent 8de10c1f2b
commit a1645ad6ee
6 changed files with 15 additions and 7 deletions
@@ -889,7 +889,7 @@ describe("BackgroundManager.notifyParentSession - dynamic message lookup", () =>
.notifyParentSession(task)
//#then
expect(capturedBody?.agent).toBe("sisyphus")
expect(capturedBody?.agent).toBe("Sisyphus (Ultraworker)")
expect(capturedBody?.model).toEqual({ providerID: "anthropic", modelID: "claude-opus-4.6" })
manager.shutdown()
+4 -2
View File
@@ -17,6 +17,7 @@ import {
createInternalAgentTextPart,
} from "../../shared"
import { applySessionPromptParams } from "../../shared/session-prompt-params-helpers"
import { normalizeAgentForPrompt } from "../../shared/agent-display-names"
import { setSessionTools } from "../../shared/session-tools-store"
import { SessionCategoryRegistry } from "../../shared/session-category-registry"
import { ConcurrencyManager } from "./concurrency"
@@ -1829,10 +1830,11 @@ export class BackgroundManager {
}
const resolvedTools = resolveInheritedPromptTools(task.parentSessionID, tools)
const promptAgent = normalizeAgentForPrompt(agent)
log("[background-agent] notifyParentSession context:", {
taskId: task.id,
resolvedAgent: agent,
resolvedAgent: promptAgent,
resolvedModel: model,
})
@@ -1846,7 +1848,7 @@ export class BackgroundManager {
path: { id: task.parentSessionID },
body: {
noReply: !shouldReply,
...(agent !== undefined ? { agent } : {}),
...(promptAgent !== undefined ? { agent: promptAgent } : {}),
...(model !== undefined ? { model } : {}),
...(variant !== undefined ? { variant } : {}),
...(resolvedTools ? { tools: resolvedTools } : {}),