fix(continuation): mark resumes synthetic
This commit is contained in:
@@ -61,15 +61,33 @@ describe("ralph-loop continuation prompt injector", () => {
|
||||
|
||||
test("#given inherited message agent has ZWSP prefix #when injecting continuation prompt #then promptAsync receives normalized agent", async () => {
|
||||
// given
|
||||
let promptBody: { agent?: string } | undefined
|
||||
let promptBody: { agent?: string; noReply?: boolean } | undefined
|
||||
let promptPart:
|
||||
| {
|
||||
text: string
|
||||
synthetic?: boolean
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
| undefined
|
||||
const ctx = {
|
||||
client: {
|
||||
session: {
|
||||
messages: async () => ({
|
||||
data: [{ info: { agent: "\u200bSisyphus - Ultraworker" } }],
|
||||
}),
|
||||
promptAsync: async (input: { body: { agent?: string } }) => {
|
||||
promptAsync: async (input: {
|
||||
body: {
|
||||
agent?: string
|
||||
noReply?: boolean
|
||||
parts?: Array<{
|
||||
text: string
|
||||
synthetic?: boolean
|
||||
metadata?: Record<string, unknown>
|
||||
}>
|
||||
}
|
||||
}) => {
|
||||
promptBody = input.body
|
||||
promptPart = input.body.parts?.[0]
|
||||
return {}
|
||||
},
|
||||
},
|
||||
@@ -87,6 +105,9 @@ describe("ralph-loop continuation prompt injector", () => {
|
||||
// then
|
||||
expect(promptBody?.agent).toBe("sisyphus")
|
||||
expect(promptBody?.agent).not.toContain("\u200b")
|
||||
expect(promptBody?.noReply).toBeUndefined()
|
||||
expect(promptPart?.synthetic).toBe(true)
|
||||
expect(promptPart?.metadata?.compaction_continue).toBe(true)
|
||||
})
|
||||
|
||||
test("#given inherited message agent has no ZWSP prefix #when injecting continuation prompt #then promptAsync receives normalized agent", async () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { findNearestMessageWithFields } from "../../features/hook-message-inject
|
||||
import { getMessageDir } from "./message-storage-directory"
|
||||
import { withTimeout } from "./with-timeout"
|
||||
import {
|
||||
createInternalAgentTextPart,
|
||||
createInternalAgentContinuationTextPart,
|
||||
isRecord,
|
||||
normalizeSDKResponse,
|
||||
resolveInheritedPromptTools,
|
||||
@@ -126,7 +126,7 @@ export async function injectContinuationPrompt(
|
||||
...(launchModel ? { model: launchModel } : {}),
|
||||
...(launchVariant ? { variant: launchVariant } : {}),
|
||||
...(inheritedTools ? { tools: inheritedTools } : {}),
|
||||
parts: [createInternalAgentTextPart(options.prompt)],
|
||||
parts: [createInternalAgentContinuationTextPart(options.prompt)],
|
||||
},
|
||||
query: { directory: options.directory },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user