The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { assert, describe, it } from "@effect/vitest"; |
| 2 | |
| 3 | import { buildRuntimeInstructions } from "./runtimeInstructions.ts"; |
| 4 | |
| 5 | describe("buildRuntimeInstructions", () => { |
| 6 | it("leaves PR linking to a session that already carries it, and keeps runtime identity", () => { |
| 7 | const instructions = buildRuntimeInstructions({ |
| 8 | harness: "Antigravity", |
| 9 | model: "gemini-3.8-flash", |
| 10 | pullRequestLinking: false, |
| 11 | }); |
| 12 | |
| 13 | assert.include(instructions, "through the Antigravity harness, as gemini-3.8-flash."); |
| 14 | assert.notInclude(instructions, "<pull_request_linking>"); |
| 15 | }); |
| 16 | |
| 17 | it("links PRs the agent creates, takes over, or pushes to, and no others", () => { |
| 18 | const instructions = buildRuntimeInstructions({ harness: "Codex" }); |
| 19 | |
| 20 | assert.include(instructions, "Link each PR you create, take over, or push to"); |
| 21 | assert.include(instructions, "every stack layer"); |
| 22 | assert.include(instructions, "link_issue"); |
| 23 | assert.include(instructions, "Skip PRs you only read or review"); |
| 24 | assert.include(instructions, "If linking fails, say so."); |
| 25 | assert.notInclude(instructions, "git log -1"); |
| 26 | assert.notInclude(instructions, "work on"); |
| 27 | // Listing linked PRs as an end-of-work check found nothing to add in audited threads. |
| 28 | assert.notInclude(instructions, "list_thread_pull_requests"); |
| 29 | }); |
| 30 | |
| 31 | it("waits on a PR only with the watch, never with a poll loop", () => { |
| 32 | const instructions = buildRuntimeInstructions({ harness: "Codex" }); |
| 33 | |
| 34 | assert.notInclude(instructions, "Creation, pending checks, or a merge ask alone is not enough"); |
| 35 | assert.include(instructions, "Links and watches persist across pushes."); |
| 36 | // The wake message itself carries the do-not-re-watch rule. |
| 37 | assert.notInclude(instructions, "On a wake"); |
| 38 | assert.include( |
| 39 | instructions, |
| 40 | "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", |
| 41 | ); |
| 42 | assert.notInclude(instructions, "merge it now"); |
| 43 | assert.include(instructions, "Otherwise act now or hand back."); |
| 44 | assert.include(instructions, "then watch and end your turn"); |
| 45 | assert.include(instructions, "never watch, even if the brief says babysit"); |
| 46 | assert.include( |
| 47 | instructions, |
| 48 | "After PR work, a child's last line is: PR <full URL>, head <SHA>, checks and reviews <state>.", |
| 49 | ); |
| 50 | assert.include( |
| 51 | instructions, |
| 52 | "For PR waits, no sleep, loops, gh --watch, Monitor or ScheduleWakeup.", |
| 53 | ); |
| 54 | assert.include(instructions, "call unwatch_pull_request"); |
| 55 | }); |
| 56 | }); |