Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .agents/skills/implement-issue/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ git push
gh pr create -R <repo> --title "<type>: <what>" --body "<body>" [--label <label_mine>]
gh pr edit <pr> -R <repo> --add-label <label_review> # when set
gh pr edit <pr> -R <repo> --add-label <label_ui_review> # when set, and a person sees the change in the UI
$RS park <pr>... # every pull request of the issue; then its waiter, below
$RS park <pr>... # every pull request of the issue; then end the turn as it says
```

The body: what changed and why, how it was verified (the commands, and what
Expand All @@ -151,8 +151,8 @@ that fails, is one line there, and a later round tries again. Then `Fixes #<n>`
`Written by this agent — <link>` from `bash "$HOME/scripts/session-link.sh"`.
With `label_mine` set it carries that label from the start: without it, no
later run finds the pull request, and `finish` refuses `pr-opened`.
Then **babysit it in this session** until it is merged: park it, start
`$RS wait --park` as a background task and end the turn; when the waiter wakes
Then **babysit it in this session** until it is merged: park it and end the
turn as `park` says; when the precheck (or, without a tick, the waiter) wakes
the session, `start` the item, handle what landed, push, park again —
[`docs/babysit.md`](../../../docs/babysit.md). The run ends `released` once it is
merged or closed, and `blocked` when it cannot get green.
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ Applying the kit never touches an agent already created from it, so an instance
crosses a version only when its operator walks it through these steps, in the
direct session.

## 6.17.0 — 2026-11-10

**The precheck watches a parked item; nothing waits in the sandbox.** `park`
ends the turn with nothing running: the tick's precheck, which reads the pull
requests anyway, messages the parked session when a review, a person's comment,
a failed check, a conflict or the merge lands after its last round — and
nothing else wakes it. The two-hour waiter, and its wake every two hours to
start it again, is left only where no tick runs: a person's session, or
`schedules` without `tick`. A session not back within fifteen minutes is handed
to a fresh run, as before.

**Upgrade:** nothing. An item parked before this version moves over by itself:
its running waiter hands it to the precheck when it next ends, and one lost to a
restart is watched instead of messaged.

## 6.16.2 — 2026-11-10

**An item with work pushed past its merged pull requests is not done.** `start`
Expand Down
8 changes: 4 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ requests, comments. Every step below goes through `scripts/run-state.sh`:
<check> pass|fail|skipped [cause]`. A check that did not pass is never only a
line in a pull request body: `checked` says what to post, and park and finish
hold a change on `verify_required_paths` back from review until it passes.
- **Waiting on a person** — a review, a merge: `park` it, with its waiter
running ([`docs/babysit.md`](docs/babysit.md) → **Held, then parked**).
- **Waiting on a person** — a review, a merge: `park` it, and end the turn as
it says ([`docs/babysit.md`](docs/babysit.md) → **Held, then parked**).
- **Last, on every way out:** push everything, report on GitHub, then
`run-state.sh finish <outcome> [pr]` — `nothing`, `pr-opened`, `pr-updated`,
`released`, `blocked`, `waiting-lock`, `waiting-env` or `needs-info`. It refuses until the
slot is pushed and this run's report is on the issue or its pull request
([`docs/runs.md`](docs/runs.md) → **Reports**); then it frees the item and the
slot, and backs `work/` up. A `Stop` hook keeps an unattended run's turn
from ending before it, or before it is parked with its waiter running. A run that ends without it anyway is found dead by the next precheck, and
from ending before it, or before it is parked. A run that ends without it anyway is found dead by the next precheck, and
its item handed on as half-done — say so in your report when you resume one.
- **Resumed after a restart** (`<turn-interrupted>`): `start` your item again.

Expand All @@ -161,7 +161,7 @@ Nothing to do is a normal outcome. Say so, finish `nothing`, end the turn.
Never end a turn asking, summarizing or promising to continue.
- **Never leave work running behind you**: a build detached with `nohup`, `setsid` or `&` outlives its locks.
- **Long commands run in the background, and you work meanwhile**: `verify`,
`verify_exclusive`, a build, a test suite, `run-state.sh wait`, its waiter — start each as
`verify_exclusive`, a build, a test suite, `run-state.sh wait` — start each as
the harness's own background task (Claude Code: `run_in_background`), then
review the diff, draft the pull request body, read what comes next, and act on
its result when it arrives. Never change what it is testing while it runs,
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ through review.
- `work-backup.sh` backs `work/` up to a private repository of its own, and
restores it on a fresh volume;
- `harness/claude-code/` holds the `Stop` hook that keeps an unattended run
from ending its turn until it is at rest — finished, or parked with its
waiter running — and the installer that registers it and links the skills;
from ending its turn until it is at rest — finished, or parked — and the installer that registers it and links the skills;
- `verify-onboarding.sh` checks an instance has the shape onboarding
promises, and every failure names its fix;
- `audit.sh` is the deterministic half of the weekly audit;
Expand Down Expand Up @@ -58,8 +57,8 @@ run the weekly audit.
One session carries an issue from its claim to the merge. While it works, it
holds the issue and a slot, and the Stop hook keeps its turn going. While a
person moves — a review, a merge — it **parks**: the slot and the exclusive
lock go back, the issue stays its own, and a waiter wakes that same session
when a review, a comment, a red check or the merge lands
lock go back, the issue stays its own, nothing runs, and the precheck wakes
that same session when a review, a comment, a red check or the merge lands
([`docs/babysit.md`](docs/babysit.md)).

```mermaid
Expand All @@ -71,13 +70,13 @@ stateDiagram-v2
Working --> Verifying: lock · takes exclusive
Verifying --> Working: unlock
}
state "PARKED · the turn ends, a waiter watches" as Parked {
state "PARKED · the turn ends, the precheck watches" as Parked {
InReview --> AwaitingMerge: approved
AwaitingMerge --> InReview: approval dismissed
}
Held --> Parked: park · frees slot + exclusive
Parked --> Held: a review, a comment, a red check · same session
Parked --> Held: waiter lost to a restart · a fresh run
Parked --> Held: session not back in time · a fresh run
Parked --> Released: merged or closed · frees item
Released --> [*]
Held --> Aside: finish · frees item + slot
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.16.2
6.17.0
8 changes: 4 additions & 4 deletions app/control-room/machine.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"id": "in-review",
"label": "In review",
"zone": "outflow",
"holds": "item · waiter",
"holds": "item · watched",
"stages": [
"in-review"
]
Expand All @@ -58,7 +58,7 @@
"id": "awaiting-merge",
"label": "Awaiting merge",
"zone": "outflow",
"holds": "item · waiter",
"holds": "item · watched",
"stages": [
"awaiting-merge"
]
Expand Down Expand Up @@ -147,7 +147,7 @@
"from": "in-review",
"to": "working",
"by": "start · review or failed check",
"who": "waiter · booking · tick"
"who": "precheck · waiter · tick"
},
{
"from": "in-review",
Expand All @@ -159,7 +159,7 @@
"from": "awaiting-merge",
"to": "working",
"by": "start · maintainer comment or red",
"who": "waiter · booking · tick"
"who": "precheck · waiter · tick"
},
{
"from": "awaiting-merge",
Expand Down
6 changes: 3 additions & 3 deletions app/control-room/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ <h2>Event log · TICK.log <span class="tag" id="l-tag">—</span></h2>
: changes ? `changes requested on ${p.map((q) => q.ref).join(" ")}: the next round answers it`
: p.length ? `in review: ${p.map((q) => q.ref).join(" ")}` : x.stage === "orphan" ? "claimed, no pull request and no run on it" : x.stage;
const held = x.lock && x.lock.parked_at
? (x.watched === "waiter" ? " · parked, its waiter watching" : x.watched === "booking" ? ` · parked, no waiter: a wake-up at ${(x.lock.wake_at || "").slice(11, 16)} UTC` : x.watched === "message" ? " · parked, its waiter lost: its session was messaged to come back" : " · parked, nothing watching: the next tick takes it over")
? (x.watched === "precheck" ? " · parked, the precheck watching" : x.watched === "waiter" ? " · parked, its waiter watching" : x.watched === "booking" ? ` · parked, no waiter: a wake-up at ${(x.lock.wake_at || "").slice(11, 16)} UTC` : x.watched === "message" ? " · parked, its session messaged to come back" : " · parked, nothing watching: the next tick takes it over")
: x.lock && !x.slot ? ` · item lock held by session ${x.lock.session.slice(0, 8)}, no slot` : "";
wait.push(row(red || changes ? "adv" : x.stage === "orphan" ? "adv" : "park", lbl(x.item), x.url, x.title || x.branch, why + held,
p.length && (changes || red) ? askBtn("Round", `Start a review round on PR ${p[0].ref}: docs/direct-session.md → review round. Read its reviews, comments and checks first and tell me the plan before you push.`, true) : ""));
Expand Down Expand Up @@ -762,10 +762,10 @@ <h2>Event log · TICK.log <span class="tag" id="l-tag">—</span></h2>
$("s-flight-sub").textContent = `${f.filter((x) => x.slot).length} working · ${parkedN} parked`;
$("s-flight-sub").title = `${f.filter((x) => x.slot).length} in a slot · ${parkedN} parked, waiting on a person · ${by("in-review")} in review · ${by("awaiting-merge")} approved, awaiting merge`;
const rz = S.resumes || {};
const cont = (rz.waiter || 0) + (rz.booking || 0) + (rz.operator || 0);
const cont = (rz.precheck || 0) + (rz.waiter || 0) + (rz.booking || 0) + (rz.operator || 0);
$("s-res").textContent = rz.total ? `${cont}/${rz.total}` : "—";
$("s-res-sub").textContent = rz.total ? `continued · ${rz.fresh || 0} fresh` : "none this week";
$("s-res-sub").title = `last 7 days: ${rz.waiter || 0} woken by the waiter, ${rz.booking || 0} by a booked wake-up, ${rz.operator || 0} by a person typing in the session; ${rz.messaged || 0} asked to restart a waiter a restart killed; ${rz.fresh || 0} taken over by a fresh session without the context`;
$("s-res-sub").title = `last 7 days: ${rz.precheck || 0} woken by the precheck, ${rz.waiter || 0} by the waiter, ${rz.booking || 0} by a booked wake-up, ${rz.operator || 0} by a person typing in the session; ${rz.messaged || 0} messages sent to parked sessions; ${rz.fresh || 0} taken over by a fresh session without the context`;
const r = S.gh?.rate;
if (r && r.remaining != null) {
const lim = r.limit || 5000, pct = Math.max(0, Math.min(100, Math.round(100 * r.remaining / lim)));
Expand Down
8 changes: 4 additions & 4 deletions app/src/developer/audit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ export const audit: Command = async (deps) => {
);
// How often the session that wrote a change was the one woken to answer what
// landed on it, and how often a fresh run had to take it over without that
// context. A fresh one after a parked item is a waiter lost to a restart
// whose session the sweep's message did not bring back.
// context. A fresh one after a parked item is a session the precheck's or
// the sweep's message did not bring back.
const resumed = week.filter((l) => l.split(" ")[1] === "resumed");
if (resumed.length > 0) {
const by = (c: string) => resumed.filter((l) => new RegExp(`cause=${c}( |$)`).test(l)).length;
const continued = resumed.length - by("fresh");
o(
`resumes: ${continued} continued in their own session (waiter ${by("waiter")}, booked wake-up ${by("booking")}, a person ${by("operator")}), ${by("fresh")} taken over by a fresh one`,
`resumes: ${continued} continued in their own session (precheck ${by("precheck")}, waiter ${by("waiter")}, booked wake-up ${by("booking")}, a person ${by("operator")}), ${by("fresh")} taken over by a fresh one`,
);
const messaged = week.filter((l) => l.split(" ")[1] === "messaged").length;
if (messaged > 0) o(`waiters lost to a restart: ${messaged}, each session messaged to start its own again`);
if (messaged > 0) o(`parked sessions messaged: ${messaged}, for what landed or a waiter lost to a restart`);
if (by("fresh") > continued)
o(`warn runs.resumed — most resumes lost their context: ${by("fresh")} of ${resumed.length} started fresh`);
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/developer/control-room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { join } from "node:path";
import type { Command, Deps } from "../factory/context.ts";
import { issueRefs, login } from "../factory/github.ts";
import { parseKv, readText } from "../factory/kv.ts";
import type { Held } from "../factory/locks.ts";
import type { Held, ParkedHolder } from "../factory/locks.ts";
import { run } from "../factory/proc.ts";
import type { SessionInfo } from "../factory/runtime.ts";
import { epoch, iso, nowSeconds } from "../factory/time.ts";
Expand Down Expand Up @@ -84,9 +84,9 @@ export interface LockView {
readonly silent_min: number | null;
readonly stop_blocks: number;
readonly holder: Holder;
/** A parked item lock: when, and what keeps it — its waiter, a booked wake-up, a message asking its session back, or nothing. */
/** A parked item lock: when, and what keeps it — the precheck, its waiter, a booked wake-up, a message asking its session back, or nothing. */
readonly parked_at: string;
readonly kept_by: "waiter" | "booking" | "message" | "";
readonly kept_by: ParkedHolder;
readonly wake_at: string;
}

Expand Down Expand Up @@ -227,6 +227,7 @@ export function resumeCounts(text: string, sinceIso: string) {
const by = (c: string) => lines.filter((l) => new RegExp(`cause=${c}( |$)`).test(l)).length;
return {
total: lines.length,
precheck: by("precheck"),
waiter: by("waiter"),
booking: by("booking"),
messaged: text.split("\n").filter((l) => l.split(" ")[1] === "messaged" && (l.split(" ")[0] ?? "") > sinceIso)
Expand Down
14 changes: 7 additions & 7 deletions app/src/developer/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ const WAITER = /run-state(\.sh)?["']?\s+wait\s+--park/;
* hook asks. Nobody watches a scheduled run, so a turn that ends mid-work —
* a summary, a question, "I'll continue next time" — is work nobody hears
* about until a later run finds it dead. A run whose pull request waits on a
* person is at rest once it is parked and something will wake it: then the
* turn ends, and the waiter brings it back. Exit 2 keeps the turn going and
* shows the model stderr: what is left, and how.
* person is at rest once it is parked and something will wake it — the
* precheck, which watches it, or else its waiter: then the turn ends with
* nothing running, and a message brings it back. Exit 2 keeps the turn going
* and shows the model stderr: what is left, and how.
*
* A waiter the harness lists as a running background task counts as one even
* before it has written its pid: the model may end the turn the moment it
* A waiter, where one is still started, the harness lists as a running
* background task counts as one even before it has written its pid: the model may end the turn the moment it
* starts it. The hook counts its own blocks on the item's lock; after
* MAX_BLOCKS it lets the stop through — the harness ends a turn after eight
* blocks anyway — and the next precheck finds the run dead and hands its item
Expand Down Expand Up @@ -88,8 +89,7 @@ export const enforceFinish: Command = async (deps) => {
e("- Waiting on a person — a review, a merge? Push, comment the pull request");
e(" with this run's session link, then:");
e(' bash "$HOME/scripts/run-state.sh" park <pr>...');
e(' bash "$HOME/scripts/run-state.sh" wait --park (a background task)');
e(" and end the turn: the waiter wakes this session when something lands.");
e(" and end the turn as it says: this session is woken when something lands.");
e("- Done, or cannot go on: push, report on the issue or its pull request with");
e(' the session link (bash "$HOME/scripts/session-link.sh"), then');
e(' bash "$HOME/scripts/run-state.sh" finish <outcome> [pr]');
Expand Down
6 changes: 6 additions & 0 deletions app/src/developer/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ export class Kit {
get stuckMin(): number {
return this.cfg.int("stuck_after_min", 120);
}
/** Whether the tick's precheck runs, and so watches a parked item: autonomous, with the tick among `schedules`. */
get precheckWatches(): boolean {
if (this.cfg.mode() !== "autonomous") return false;
const on = this.cfg.list("schedules");
return on.length === 0 || on.includes("tick");
}
get babysitMaxHours(): number {
return this.cfg.int("babysit_max_hours", 4);
}
Expand Down
Loading
Loading