fix(continuation): skip internal user turns

This commit is contained in:
YeonGyu-Kim
2026-05-15 23:16:23 +09:00
parent c580b8f2ce
commit be25109f6d
10 changed files with 275 additions and 8 deletions
@@ -1,6 +1,7 @@
/// <reference types="bun-types" />
import { describe, expect, test } from "bun:test"
import { OMO_INTERNAL_INITIATOR_MARKER } from "../../shared/internal-initiator-marker"
import { hasUnansweredQuestion } from "./pending-question-detection"
describe("hasUnansweredQuestion", () => {
@@ -51,6 +52,42 @@ describe("hasUnansweredQuestion", () => {
expect(hasUnansweredQuestion(messages)).toBe(false)
})
test("given synthetic user message after question, still treats question as unanswered", () => {
const messages = [
{
info: { role: "assistant" },
parts: [
{ type: "tool_use", name: "question" },
],
},
{
info: { role: "user" },
parts: [
{ type: "text", text: "internal continuation", synthetic: true },
],
},
]
expect(hasUnansweredQuestion(messages)).toBe(true)
})
test("given internally marked user message after question, still treats question as unanswered", () => {
const messages = [
{
info: { role: "assistant" },
parts: [
{ type: "tool_use", name: "question" },
],
},
{
info: { role: "user" },
parts: [
{ type: "text", text: `internal continuation\n${OMO_INTERNAL_INITIATOR_MARKER}` },
],
},
]
expect(hasUnansweredQuestion(messages)).toBe(true)
})
test("given assistant message with non-question tool, returns false", () => {
const messages = [
{ info: { role: "user" } },