Open History to see the last commit
1import { assert, describe, it } from "@effect/vitest";
2
3import { buildRuntimeInstructions } from "./runtimeInstructions.ts";
4
5describe("buildRuntimeInstructions", () => {
6 it("links PRs the agent creates, takes over, or pushes to, and no others", () => {
7 const instructions = buildRuntimeInstructions({ harness: "Codex" });
8
9 assert.include(instructions, "Link each PR you create, take over, or push to");
10 assert.include(instructions, "one link_pull_request per PR");
11 assert.include(instructions, "Skip PRs you only read or review");
12 assert.include(instructions, "If linking fails, say so.");
13 assert.notInclude(instructions, "git log -1");
14 assert.notInclude(instructions, "work on");
15 // Listing linked PRs as an end-of-work check found nothing to add in audited threads.
16 assert.notInclude(instructions, "list_thread_pull_requests");
17 });
18
19 it("waits on a PR only with the watch, never with a poll loop", () => {
20 const instructions = buildRuntimeInstructions({ harness: "Codex" });
21
22 assert.notInclude(instructions, "Creation, pending checks, or a merge ask alone is not enough");
23 assert.include(instructions, "Links and watches persist across pushes.");
24 // The wake message itself carries the do-not-re-watch rule.
25 assert.notInclude(instructions, "On a wake");
26 assert.include(
27 instructions,
28 "Call watch_pull_request when asked to monitor or babysit, or when work you were asked to do, such as a merge, still waits on checks or reviews, even after an earlier unwatch",
29 );
30 assert.notInclude(instructions, "merge it now");
31 assert.include(instructions, "Otherwise act now or hand back.");
32 assert.include(instructions, "then watch and end your turn");
33 assert.include(instructions, "never watch, even if the brief says babysit");
34 assert.include(
35 instructions,
36 "After PR work, a child's last line is: PR <full URL>, head <SHA>, checks and reviews <state>.",
37 );
38 assert.include(
39 instructions,
40 "For PR waits, no sleep, loops, gh --watch, Monitor or ScheduleWakeup.",
41 );
42 assert.include(instructions, "call unwatch_pull_request");
43 });
44});