fix: propagate variant field in all promptAsync continuation paths (#3081)

All 5 continuation paths now send variant as top-level body field:
- boulder-continuation-injector.ts
- ralph-loop/continuation-prompt-injector.ts
- todo-continuation-enforcer/continuation-injection.ts
- unstable-agent-babysitter-hook.ts
- session-recovery/resume.ts

Plus type/helper updates in atlas, todo-continuation-enforcer,
unstable-agent-babysitter, and session-recovery.

TDD: 18 regression tests added, all pass. tsc clean.
This commit is contained in:
YeonGyu-Kim
2026-04-07 15:10:38 +09:00
parent 3e8fd5ff18
commit aa528e42c0
15 changed files with 310 additions and 23 deletions
+30 -2
View File
@@ -22,9 +22,35 @@ describe("session-recovery resume", () => {
expect(config.tools).toEqual({ question: false, bash: true })
})
test("resumeSession sends inherited tools with continuation prompt", async () => {
test("#given the last user message includes model variant #when extracting resume config #then the variant is preserved", () => {
// given
const model = {
providerID: "openai",
modelID: "gpt-5.3-codex",
variant: "max",
}
const userMessage: MessageData = {
info: {
agent: "Hephaestus",
model,
},
}
// when
const config = extractResumeConfig(userMessage, "ses_resume_variant")
// then
expect(config.model).toEqual(model)
})
test("resumeSession sends inherited tools and variant with continuation prompt", async () => {
// given
let promptBody: Record<string, unknown> | undefined
const model = {
providerID: "openai",
modelID: "gpt-5.3-codex",
variant: "max",
}
const client = {
session: {
promptAsync: async (input: { body: Record<string, unknown> }) => {
@@ -38,12 +64,14 @@ describe("session-recovery resume", () => {
const ok = await resumeSession(client as never, {
sessionID: "ses_resume_prompt",
agent: "Hephaestus",
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
model,
tools: { question: false, bash: true },
})
// then
expect(ok).toBe(true)
expect(promptBody?.model).toEqual({ providerID: "openai", modelID: "gpt-5.3-codex" })
expect(promptBody?.variant).toBe("max")
expect(promptBody?.tools).toEqual({ question: false, bash: true })
expect(Array.isArray(promptBody?.parts)).toBe(true)
const firstPart = (promptBody?.parts as Array<{ text?: string }>)?.[0]
+7 -1
View File
@@ -27,12 +27,18 @@ export function extractResumeConfig(userMessage: MessageData | undefined, sessio
export async function resumeSession(client: Client, config: ResumeConfig): Promise<boolean> {
try {
const inheritedTools = resolveInheritedPromptTools(config.sessionID, config.tools)
const launchModel = config.model
? { providerID: config.model.providerID, modelID: config.model.modelID }
: undefined
const launchVariant = config.model?.variant
await client.session.promptAsync({
path: { id: config.sessionID },
body: {
parts: [createInternalAgentTextPart(RECOVERY_RESUME_TEXT)],
agent: config.agent,
model: config.model,
...(launchModel ? { model: launchModel } : {}),
...(launchVariant ? { variant: launchVariant } : {}),
...(inheritedTools ? { tools: inheritedTools } : {}),
},
})
+2
View File
@@ -73,6 +73,7 @@ export interface MessageData {
model?: {
providerID: string
modelID: string
variant?: string
}
system?: string
tools?: Record<string, boolean>
@@ -94,6 +95,7 @@ export interface ResumeConfig {
model?: {
providerID: string
modelID: string
variant?: string
}
tools?: Record<string, boolean>
}