diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index b387e76fd..338a46dc0 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- Fixed print mode claiming `plan.defaultOnStartup` was ignored and recommending `--plan-yolo` when that headless plan flow was already active ([#8312](https://github.com/can1357/oh-my-pi/issues/8312)). + ## [17.2.15] - 2026-08-12 ### Added diff --git a/packages/coding-agent/src/main.ts b/packages/coding-agent/src/main.ts index 8872c5570..e2fb3d625 100644 --- a/packages/coding-agent/src/main.ts +++ b/packages/coding-agent/src/main.ts @@ -1787,6 +1787,7 @@ export async function runRootCommand( initialMessage, initialImages, printThoughts: initialArgs.printThoughts, + planYolo: parsedArgs.planYolo, }); if ($env.PI_TIMING) { logger.printTimings(); diff --git a/packages/coding-agent/src/modes/print-mode.ts b/packages/coding-agent/src/modes/print-mode.ts index 55886d7b3..612fb5408 100644 --- a/packages/coding-agent/src/modes/print-mode.ts +++ b/packages/coding-agent/src/modes/print-mode.ts @@ -27,6 +27,8 @@ export interface PrintModeOptions { initialImages?: ImageContent[]; /** If true, include thinking blocks in text output */ printThoughts?: boolean; + /** Whether the caller explicitly started the headless plan flow. */ + planYolo?: boolean; } /** Matches the longest built-in provider request deadline while bounding tool-loop stalls. */ @@ -87,7 +89,7 @@ export function printableEvent(event: AgentSessionEvent): unknown { * Sends prompts to the agent and outputs the result. */ export async function runPrintMode(session: AgentSession, options: PrintModeOptions): Promise { - const { mode, messages = [], initialMessage, initialImages, printThoughts } = options; + const { mode, messages = [], initialMessage, initialImages, printThoughts, planYolo = false } = options; // process.stdout.write is fire-and-forget: a large final record (e.g. a // multi-MB agent_end) can be dropped when the process exits before the pipe @@ -138,7 +140,8 @@ export async function runPrintMode(session: AgentSession, options: PrintModeOpti session.settings.get("plan.defaultOnStartup") && session.settings.get("plan.enabled") && session.sessionManager.buildSessionContext().messages.length === 0 && - !session.sessionManager.getEntries().some(entry => entry.type === "mode_change"); + !session.sessionManager.getEntries().some(entry => entry.type === "mode_change") && + !planYolo; if (planStartupIgnored) { process.stderr.write( "Note: plan.defaultOnStartup is ignored in print mode (no interactive surface to review the plan). Use --plan-yolo for a headless plan flow.\n", diff --git a/packages/coding-agent/test/print-mode-working-indicator.test.ts b/packages/coding-agent/test/print-mode-working-indicator.test.ts index 77062e079..902f62121 100644 --- a/packages/coding-agent/test/print-mode-working-indicator.test.ts +++ b/packages/coding-agent/test/print-mode-working-indicator.test.ts @@ -198,6 +198,23 @@ describe("print mode working indicator", () => { expect(stdoutOutput.join("")).toBe("final answer\n"); }); + it("suppresses the startup-default note when the headless plan flow is already active", async () => { + const delayed = createDelayedSession(makeAssistantMessage("final answer"), { defaultPlanMode: true }); + const run = runPrintMode(delayed.session, { + mode: "text", + initialMessage: "Reply with exactly: OK", + planYolo: true, + }); + + await delayed.promptStarted; + try { + expect(stderrOutput.join("")).not.toContain("plan.defaultOnStartup"); + } finally { + delayed.resolvePrompt(); + await run; + } + }); + it("writes a text-mode working indicator before the prompt resolves and prints the final answer afterward", async () => { const delayed = createDelayedSession(makeAssistantMessage("final answer")); const run = runPrintMode(delayed.session, { mode: "text", initialMessage: "hello" });