mirror of
https://github.com/wassname/pi-plan.git
synced 2026-09-26 14:10:23 +08:00
Rotate curated supervisor nudges and repeat delivered upkeep
Keep the hourly schedule unchanged. Advance the local nudge cycle only on prompt delivery and reset the unchanged-turn counter so upkeep repeats. Test compaction supersession, cadence, rotation and solo behavior. Co-Authored-By: Pi/OpenAI <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
+24
-1
@@ -4,7 +4,7 @@ import { join } from "node:path";
|
||||
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
||||
import { afterEach, expect, it, vi } from "vitest";
|
||||
import goalsExtension from "../src/index.js";
|
||||
import { scheduleCheckIn } from "../src/prompts.js";
|
||||
import { scheduleCheckIn, upkeep } from "../src/prompts.js";
|
||||
|
||||
const roots: string[] = [];
|
||||
const shutdowns: Array<() => void> = [];
|
||||
@@ -625,6 +625,29 @@ it.each(["solo", "supervising"])("%s upkeep is turn-driven, folds Log, and joins
|
||||
expect(reminders()).toHaveLength(0);
|
||||
});
|
||||
|
||||
it.each(["supervising", "solo"])("%s repeats upkeep every eight unchanged turns and rotates only delivered supervisor nudges", async mode => {
|
||||
const f = fixture(); await f.draft();
|
||||
if (mode === "solo") { f.ctx.ui.select.mockResolvedValueOnce("Worker confirmed stopped"); await f.command("solo"); }
|
||||
else await f.command("ready");
|
||||
const prepare = () => f.hooks.get("before_agent_start")({ systemPrompt: "base" }, f.ctx);
|
||||
prepare();
|
||||
for (let i = 0; i < 9; i++) f.hooks.get("turn_end")({}, f.ctx);
|
||||
f.hooks.get("session_compact")();
|
||||
expect(prepare().message.customType).toBe("pi-goals-plan");
|
||||
const sent = f.messages.length;
|
||||
for (let round = 0; round < 7; round++) {
|
||||
for (let turn = 0; turn < 7; turn++) f.hooks.get("turn_end")({}, f.ctx);
|
||||
expect(prepare().message).toBeUndefined();
|
||||
f.hooks.get("turn_end")({}, f.ctx);
|
||||
expect(f.messages).toHaveLength(sent);
|
||||
expect(prepare().message).toMatchObject({
|
||||
customType: "pi-goals-upkeep",
|
||||
content: upkeep(f.path, mode === "supervising" ? round : undefined),
|
||||
});
|
||||
expect(prepare().message).toBeUndefined();
|
||||
}
|
||||
});
|
||||
|
||||
it("extra subagent launches are recorded as helpers and never steal the implementation identity", async () => {
|
||||
const f = fixture(); await f.draft(); await f.command("ready");
|
||||
f.hooks.get("tool_result")({ toolName: "subagent", details: { id: "impl", sessionFile: "/tmp/impl.jsonl" } });
|
||||
|
||||
+10
-1
@@ -1,5 +1,14 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { planDrafting } from "../src/prompts.js";
|
||||
import { planDrafting, upkeep } from "../src/prompts.js";
|
||||
|
||||
it("cycles six curated supervisor nudges without changing the shared upkeep instructions", () => {
|
||||
const base = upkeep("/plan.md");
|
||||
const variants = Array.from({ length: 6 }, (_, round) => upkeep("/plan.md", round));
|
||||
expect(new Set(variants).size).toBe(6);
|
||||
for (const text of variants) expect(text.endsWith(base)).toBe(true);
|
||||
expect(upkeep("/plan.md", 6)).toBe(variants[0]);
|
||||
expect(base.startsWith("Plan upkeep:")).toBe(true);
|
||||
});
|
||||
|
||||
describe("planning prompt", () => {
|
||||
it("requires fact finding or a focused question before a goal", () => {
|
||||
|
||||
Reference in New Issue
Block a user