fix(prompting): rendered system prompt template for system md

Route resolved SYSTEM.md content through the custom prompt template path instead of replacing the fully rendered default prompt block.

Fixes #3014
This commit is contained in:
roboomp
2026-06-19 11:50:45 +00:00
parent 623ae8df35
commit e2da0c5458
5 changed files with 70 additions and 12 deletions
@@ -2,8 +2,9 @@ import { afterEach, describe, expect, it, vi } from "bun:test";
import * as fs from "node:fs/promises";
import * as os from "node:os";
import * as path from "node:path";
import { submitInteractiveInput } from "@oh-my-pi/pi-coding-agent/main";
import { applyResolvedSystemPromptInputs, submitInteractiveInput } from "@oh-my-pi/pi-coding-agent/main";
import type { SubmittedUserInput } from "@oh-my-pi/pi-coding-agent/modes/types";
import type { CreateAgentSessionOptions } from "@oh-my-pi/pi-coding-agent/sdk";
import { discoverTitleSystemPromptFile } from "@oh-my-pi/pi-coding-agent/system-prompt";
const cleanupDirs: string[] = [];
@@ -35,6 +36,18 @@ describe("discoverTitleSystemPromptFile", () => {
});
});
describe("applyResolvedSystemPromptInputs", () => {
it("routes SYSTEM.md content through template-aware session options", () => {
const options: CreateAgentSessionOptions = {};
applyResolvedSystemPromptInputs(options, "project system prompt", "append prompt");
expect(options.customSystemPrompt).toBe("project system prompt");
expect(options.appendSystemPrompt).toBe("append prompt");
expect(options.systemPrompt).toBeUndefined();
});
});
describe("submitInteractiveInput", () => {
it("routes already-started synthetic continue submissions to a hidden developer prompt", async () => {
const mode = {