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
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.18.0 — 2026-11-13

**Who hands an issue off on GitHub can hear of it in a Slack direct message.**
With the new key `slack_people` — `login=<Slack user id>` pairs — `park` and
`finish` also print a `notify:` line for a direct message to the person who
last put the hand-off label on the issue, when it is ready to merge, needs
info or is blocked ([`docs/notify.md`](docs/notify.md) → **A direct message**).
A hand-off from Slack is left out: its thread reaches who asked. Off by
default.

**Upgrade (operator only):** to turn it on, add `slack_people` to
`work/CONFIG.md`, a pair for each person, their Slack user id from
`describe_channel_users`, e.g. `- slack_people: alice=U0123ABCD`. Without it,
nothing changes.

## 6.17.1 — 2026-11-12

**The kit declares no compute size and no disk.** `kit.yaml` no longer carries
Expand Down
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ a line in any other shape is invisible, not wrong.
`off`; missing: anyone. `slack_ui_review` — the chat told, once, of each
`label_ui_review` pull request out of draft; missing: none. `slack_automerge`
— who there may ask for auto-merge on a pull request of yours: `off`,
`people`, or Slack user ids; missing: off.
`people`, or Slack user ids; missing: off. `slack_people` — `login=<Slack
user id>` pairs: who handed an issue off on GitHub hears of its ✅ ❓ 🛑 in a
direct message; missing: nobody.
- `repos_also` — `owner/name` or `owner/*`, by spaces or commas: the other
repositories an issue of `repo` may need changed too, in any run
([`docs/runs.md`](docs/runs.md) → **Other repositories**). Missing: `repo` alone.
Expand Down
7 changes: 6 additions & 1 deletion ONBOARDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ confirming or correcting rather than composing from nothing.
— the default is no: `off`, `people`, or the Slack user ids of who may,
from `describe_channel_users`; whoever it names may in effect merge.
Record it as `slack_automerge`, and say so in **Bounds**.
Offer, too, to tell whoever hands an issue off on GitHub of its moments in
a direct message: for each person who may, their GitHub login and their
Slack user id from `describe_channel_users`, as `slack_people` pairs. A
hand-off from Slack needs none: its thread reaches who asked.
Look in the repository's skills for one that grills a plan and one that
files issues; offer them as `skill_grill` and `skill_file_issue`, or the
definition's defaults when there are none. Not connected: skip it, and say a Slack channel can be bound in the agent's
Expand Down Expand Up @@ -218,6 +222,7 @@ that is not one of them fails verification, because nothing would ever read it:
- slack_handoff: anyone
- slack_ui_review: C0123ABCD
- slack_automerge: off
- slack_people: alice=U0123ABCD bob=U0456EFGH
- skill_grill: grill-me
- skill_file_issue: file-issue
- repos_also: owner/*
Expand All @@ -234,7 +239,7 @@ Interactive, leave out `label_handoff`, `label_failed`, `label_needs_info`,
no demo, `demo_environment`; with
neither check, or no path that needs one, `verify_required_paths`; with no
Environment at all, `label_ui_review`; with no
review label, `label_review`; with no backup, leave out `work_repo` and `work_account`; when the active account reaches it, `work_account`; with no Slack, leave out `slack_channel`, `slack_handoff`, `slack_ui_review` and `slack_automerge`;
review label, `label_review`; with no backup, leave out `work_repo` and `work_account`; when the active account reaches it, `work_account`; with no Slack, leave out `slack_channel`, `slack_handoff`, `slack_ui_review`, `slack_automerge` and `slack_people`; with nobody to tell directly, `slack_people`;
with every slot open, `slots_closed`; for the default grill skills, `skill_grill` and `skill_file_issue`; leave
`repos_also` out when the work never leaves `repo`; leave `prune` and
`prune_below_gb` out when builds leave little behind.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.17.1
6.18.0
34 changes: 34 additions & 0 deletions app/src/developer/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,37 @@ export async function slackThread(kit: Kit, itemIn: string, prsIn: string, chat:
}
return ts;
}

const PAIR = /^([A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)=([UW][A-Z0-9]+)$/;

/** `slack_people`'s pairs, GitHub login → Slack user id; a word not shaped `login=U…` is left out. */
export function slackPeople(value: string): Map<string, string> {
const people = new Map<string, string>();
for (const word of value.split(/[\s,]+/)) {
const m = PAIR.exec(word);
if (m) people.set(login(m[1]), m[2] as string);
}
return people;
}

/**
* Who hears of an issue's moments in a Slack direct message (docs/notify.md →
* A direct message): the account that last put `label_handoff` on it, when
* `slack_people` pairs it with a Slack id. `author` itself put it there for a
* hand-off from Slack, whose thread already reaches who asked: none. A pull
* request alone, no pair, or GitHub unreadable: none. Reads GitHub only with
* `slack_people` set.
*/
export async function requester(kit: Kit, item: string): Promise<{ login: string; slack: string } | undefined> {
const people = slackPeople(kit.cfg.get("slack_people"));
if (people.size === 0 || !/^\d+$/.test(item)) return undefined;
const events = await kit.deps.github.getAll(kit.host, `repos/${kit.slug}/issues/${item}/events?per_page=100`);
const by = (events ?? [])
.map(obj)
.filter((e) => str(e.event) === "labeled" && str(obj(e.label).name) === kit.labelHandoff)
.map((e) => login(str(obj(e.actor).login)))
.at(-1);
if (!by || (kit.author && by === login(kit.author))) return undefined;
const slack = people.get(by);
return slack ? { login: by, slack } : undefined;
}
32 changes: 23 additions & 9 deletions app/src/developer/run-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
// park and finish read it (app/src/developer/checks.ts)
// finish <outcome> [pr]... the run's last act, on every way out: refused
// until the work is pushed and reported on GitHub;
// then backs work/ up, and with slack_channel set
// says what to post (notify:)
// then backs work/ up, and with slack_channel or
// slack_people set says what to post (notify:)
// sweep free the locks of dead holders (the precheck)
// held the items live runs hold, one per line
// live how many slots are held
Expand Down Expand Up @@ -77,7 +77,7 @@ import {
toComment,
verdict,
} from "./pulls.ts";
import { ours, reported, slackThread } from "./reports.ts";
import { ours, reported, requester, slackThread } from "./reports.ts";
import { alsoDirs, prepare } from "./slots.ts";

const USAGE =
Expand Down Expand Up @@ -746,12 +746,16 @@ class RunState {
const labels = refs.map((x) => labelRef(x, this.kit.slug)).join(" ");
// a moment a person acts on: approved, it waits for whoever merges — said once
const chat = this.kit.cfg.get("slack_channel");
if (chat && state === "awaiting-merge" && this.itemKey(item, "notified") !== prs) {
const ts = await slackThread(this.kit, item, prs, chat);
const where = ts
? `as a reply in thread ${ts} of slack_channel ${chat}`
: `to slack_channel ${chat}, and record its thread`;
this.say(`notify: post that ${labels} is ready to merge ${where} (docs/notify.md)`);
const dm = this.kit.cfg.get("slack_people");
if ((chat || dm) && state === "awaiting-merge" && this.itemKey(item, "notified") !== prs) {
if (chat) {
const ts = await slackThread(this.kit, item, prs, chat);
const where = ts
? `as a reply in thread ${ts} of slack_channel ${chat}`
: `to slack_channel ${chat}, and record its thread`;
this.say(`notify: post that ${labels} is ready to merge ${where} (docs/notify.md)`);
}
await this.tellRequester(item, `that ${labels} is ready to merge`);
this.writeItem(item, { notified: prs });
}
const uiChat = this.kit.cfg.get("slack_ui_review");
Expand Down Expand Up @@ -1255,9 +1259,19 @@ class RunState {
: `to slack_channel ${chat}, and record its thread`;
if (outcome !== "released") this.say(`notify: post this ${outcome} ${where} (docs/notify.md)`);
}
if (outcome === "needs-info" || outcome === "blocked") await this.tellRequester(item, `this ${outcome}`);
return 0;
}

/** With `slack_people` pairing who handed the issue off, the line that tells them too (docs/notify.md). */
private async tellRequester(item: string, what: string): Promise<void> {
const to = await requester(this.kit, item);
if (to)
this.say(
`notify: tell ${to.login}, who handed #${item} off, ${what} in a direct message to Slack user ${to.slack} (docs/notify.md → A direct message)`,
);
}

/**
* Frees what dead holders left. A dead slot holder is an abandoned run:
* logged, and counted on its item, which the precheck then lists as
Expand Down
17 changes: 17 additions & 0 deletions app/src/developer/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { bulletKeys, readText } from "../factory/kv.ts";
import { hookInstalled } from "./harness.ts";
import { GATE_KEYS, ITEM_KEYS, Kit } from "./kit.ts";
import { precheck } from "./precheck.ts";
import { slackPeople } from "./reports.ts";

/** Every key CONFIG.md may hold. `docs/self-modification.md` §2: CLAUDE.md, ONBOARDING and this list name the same keys. */
export const KNOWN = [
Expand Down Expand Up @@ -55,6 +56,7 @@ export const KNOWN = [
"slack_handoff",
"slack_ui_review",
"slack_automerge",
"slack_people",
"schedules",
"skill_grill",
"skill_file_issue",
Expand Down Expand Up @@ -180,6 +182,21 @@ function configChecks(kit: Kit, r: Report): void {
`'${automerge}' is not off, people or Slack user ids`,
"write one of them, e.g. U0123ABCD, or leave it out for off",
);
const people = cfg.get("slack_people");
const pairs = slackPeople(people);
const words = people.split(/[\s,]+/).filter(Boolean);
if (!people) r.ok("config.slack_people", "unset — nobody hears of an issue they handed off in a direct message");
else if (pairs.size !== words.length)
r.fail(
"config.slack_people",
`'${people}' is not all login=Slack user id pairs`,
"write e.g. alice=U0123ABCD bob=U0456EFGH, the ids from describe_channel_users",
);
else
r.ok(
"config.slack_people",
`${[...pairs.keys()].join(" ")} hear of an issue they handed off in a direct message (docs/notify.md → A direct message)`,
);
const app = cfg.get("app_url");
if (app && !/^https?:\/\/\S+$/.test(app))
r.fail(
Expand Down
40 changes: 40 additions & 0 deletions app/test/run-state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,46 @@ test("with slack_channel set, park and finish say what to post, and only for a m
assert.doesNotMatch(r.err, /notify:/, "nothing for a person to do");
}));

test("with slack_people set, who handed the issue off on GitHub hears of its moments in a direct message", () =>
inSandbox(async (s) => {
world(s);
s.originCheckout();
s.github.on(PULL, PULL21);
s.github.prViews = [view("OPEN", "APPROVED", "MERGEABLE", GREEN)];
s.config("- slack_people: alice=U0123ABCD dev-bot=U0999ZZZZ");
const labeled = (by: string) => ({ event: "labeled", label: { name: "agent/implement" }, actor: { login: by } });
s.github.on(/\/issues\/7\/events/, [
labeled("Alice"),
{ event: "labeled", label: { name: "bug" }, actor: { login: "mallory" } },
]);
await as(s, "sess-a", "start", "7", "feat/7");
let r = await as(s, "sess-a", "park", "21");
assert.match(
r.err,
/notify: tell alice, who handed #7 off, that #21 is ready to merge in a direct message to Slack user U0123ABCD/,
);
assert.doesNotMatch(r.err, /notify: post/, "no slack_channel: no channel post");
await as(s, "sess-a", "start", "7", "feat/7");
r = await as(s, "sess-a", "park", "21");
assert.doesNotMatch(r.err, /notify:/, "said once for the same pull request");
await as(s, "sess-a", "start", "7", "feat/7");
s.github.on(ISSUE, { labels: [{ name: "agent/needs-info" }] });
r = await as(s, "sess-a", "finish", "needs-info");
assert.match(
r.err,
/notify: tell alice, who handed #7 off, this needs-info in a direct message to Slack user U0123ABCD/,
);
s.github.on(/\/issues\/7\/events/, [labeled("alice"), labeled("dev-bot")]);
await as(s, "sess-a", "start", "7", "feat/7");
s.github.on(ISSUE, { labels: [{ name: "agent/failed" }] });
r = await as(s, "sess-a", "finish", "blocked");
assert.doesNotMatch(r.err, /notify:/, "handed off from Slack: its thread reaches who asked");
s.github.on(/\/issues\/7\/events/, [labeled("carol")]);
await as(s, "sess-a", "start", "7", "feat/7");
r = await as(s, "sess-a", "finish", "blocked");
assert.doesNotMatch(r.err, /notify:/, "no pair for carol: nobody to tell");
}));

test("with slack_ui_review set, park says to post a label_ui_review pull request out of draft, once", () =>
inSandbox(async (s) => {
world(s);
Expand Down
14 changes: 14 additions & 0 deletions app/test/verify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ test("slack_automerge is off when missing, and off, people or user ids when set"
assert.match(r.out, /ok {3}config\.slack_automerge — U0123ABCD U0456EFGH may ask for auto-merge/);
}));

test("slack_people is unset when missing, and login=Slack user id pairs when set", () =>
inSandbox(async (s) => {
assert.match((await v(s, "--config")).out, /ok {3}config\.slack_people — unset — nobody hears/);
s.config("- slack_people: alice=U0123ABCD bob");
assert.match(
(await v(s, "--config")).out,
/FAIL config\.slack_people — 'alice=U0123ABCD bob' is not all login=Slack user id pairs/,
);
s.setConfig("slack_people", "alice=U0123ABCD, Bob=W0456EFGH");
const r = await v(s, "--config");
assert.equal(r.rc, 0);
assert.match(r.out, /ok {3}config\.slack_people — alice bob hear of an issue they handed off/);
}));

test("a grill skill is the repository's when named, the default otherwise", () =>
inSandbox(async (s) => {
s.onboarded();
Expand Down
16 changes: 14 additions & 2 deletions docs/notify.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Slack posts

Read this when `finish` prints a `notify:` line, and in the weekly audit.
Read this when `park` or `finish` prints a `notify:` line, and in the weekly audit.

GitHub is the record; Slack is a nudge for the moments a person has to act. Off
unless `slack_channel` names a chat — a channel id from `describe_channel`.
Missing, or Slack not connected to this agent: post nothing, say nothing.
Missing, or Slack not connected to this agent: post nothing, say nothing — a
direct message has a key of its own (below).

## When

Expand All @@ -18,6 +19,17 @@ Missing, or Slack not connected to this agent: post nothing, say nothing.
| Every Environment held, none to take back, with `verify_environment` | `room`, once a day per set of pull requests | 🧱 `<repo>#<n>` waits for an Environment — then each pull request holding one: review it, or merge it |
| Weekly audit | the audit's report | the report's header and its **Action needed** lines; a 🚨 first when it has a red line |

## A direct message

Off unless `slack_people` pairs GitHub logins with Slack user ids; it does not
need `slack_channel`. When the ✅, ❓ or 🛑 of an issue is due, `park` or
`finish` also prints `notify: tell <login> … in a direct message to Slack user
<id>` for the account that last put the hand-off label on it — never for
`author`, whose hand-off came from Slack and whose thread already reaches who
asked. Send the same line, its link included, with
`send_channel_message(channel: "slack", chatId: <id>, text: …, unfurlLinks: false)`,
and record nothing on GitHub.

## A required check that did not pass

Posted the moment `checked` prints its `notify:` line, before the run goes
Expand Down
Loading