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
9 changes: 6 additions & 3 deletions doc/fleet-schedule-registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Execution route/pool is recorded separately from work scope: the repo-health que
| `aea12c82-c5af-4e5a-9b66-f8e360f87177` | Queue lane (scheduled) - code | `*/40 * * * *` | True | `~/.config/openchamber/projects/path_L2hvbWUvdXNlci9naXQvY29kZQ.json` | not recorded | not recorded | not recorded | not recorded | 2026-11-03 |
| `f1b4a33b-14d5-4a69-9ad6-d221e42e3ac9` | Opencode lane claimant/executor - #3026 | `*/10 * * * *` | True | `~/.config/openchamber/projects/path_L2hvbWUvdXNlci9naXQvY29kZQ.json` | opencode-route / workhorse | not recorded | not recorded | not recorded | 2026-11-03 |

### 2b. Laptop systemd user timers (44 listed: 40 enabled, 1 installed-but-disabled; 4 Nix-configured pending deployment)
### 2b. Laptop systemd user timers (45 listed: 41 enabled, 1 installed-but-disabled; 4 Nix-configured pending deployment)

The OS-timer half of surface 2. Cadence is the unit's own `OnCalendar`/`OnUnitActiveUSec` spec, read live from `systemctl --user show`. Specs are recorded **complete** — the full effective calendar expression, date **and** time components (e.g. `*-*-* *:*:00`); never truncate a spec to a date-only prefix, because a bare `*-*-*` normalizes to daily at midnight and misstates the cadence (issue #5313). Prompt/brief pointer is the unit file in `~/.config/systemd/user/` (or its Nix store target for linked units). Installed-but-disabled timer units ARE listed in this table and marked `(disabled)` after the unit name: the registry inventories what is installed on the laptop, not only what is currently scheduled, so a disabled unit stays visible until it is uninstalled (reconciled 2026-11-04, issue #5661).

Expand Down Expand Up @@ -295,6 +295,7 @@ The OS-timer half of surface 2. Cadence is the unit's own `OnCalendar`/`OnUnitAc
| `pm-apps-health.timer` (Nix-configured system timer; not yet loaded) | `OnUnitActiveSec=1min,OnBootSec=2min` (not live-verified) | `pm-apps-health.service` | laptop (system systemd; NixOS pm-apps readiness probe, code#8940) | not recorded | not recorded | 2026-11-12 | 2026-11-12 |
| `pm-dashboard-backup.timer` | `OnCalendar=*-*-* 04:30:00` | `pm-dashboard-backup.service` | laptop (user systemd) | not recorded | not recorded | not recorded | 2026-11-04 |
| `pm-digest-daily.timer` | `OnCalendar=*-*-* 07:00:00` | `pm-digest-daily.service` | laptop (user systemd) | not recorded | not recorded | not recorded | 2026-11-04 |
| `pm-console-expose.timer` | `OnUnitActiveUSec=15min,OnBootUSec=5min` | `pm-console-expose.service` | laptop (user systemd; code#12452; runs `pm-stack/console/scripts/expose.py`: keeps the public address as declared, turns Google sign-in on once its secrets exist) | not recorded | not recorded | 2026-11-22 | 2026-11-22 |
| `pm-digest-weekly.timer` | `OnCalendar=Mon *-*-* 07:05:00` | `pm-digest-weekly.service` | laptop (user systemd) | not recorded | not recorded | not recorded | 2026-11-04 |
| `pm-git-sync.timer` | `OnUnitActiveUSec=30s,OnBootUSec=30s` | `pm-git-sync.service` | laptop (user systemd) | not recorded | not recorded | not recorded | 2026-11-04 |
| `pm-host-health.timer` | `OnCalendar=*-*-* *:00/5:00,OnBootUSec=1min` | `pm-host-health.service` | laptop (user systemd; code#10141) | not recorded | not recorded | 2026-11-14 | 2026-11-14 |
Expand Down Expand Up @@ -374,15 +375,17 @@ registered. The primary user's repos are maintained by git's own
per-user launchd agents, which `git maintenance start` installs outside
Nix; they are not recorded here until a review reads them on the Mac.

## Surface 6 — PM-stack process intervals (1 entry)
## Surface 6 — PM-stack process intervals (3 entries)

Recurring loops owned by the PM-stack aggregator process. These are not
Recurring loops owned by PM-stack processes (aggregator, console). These are not
external scheduler surfaces; this inventory records timers that run only
while the service is alive.

| name/id | repo/scope | cadence | state | owner / scope | prompt/brief pointer | budget | kill criteria | created | last review |
| --------------------------- | --------------------- | ---------------- | ---------------------------- | ------------- | -------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ---------- | ----------- |
| SLO journal sampler (#9988) | developing-today/code | every 60 seconds | live aggregator process only | issue #9988 | `pm-stack/aggregator/src/server.ts` (`SLO_SAMPLE_INTERVAL_MS`) | not recorded | Remove/disable if the health view or append-only journal becomes unavailable; sampler is unref'd and does not keep the process alive | 2026-11-18 | 2026-11-18 |
| Console state refresh | developing-today/code | every 5 seconds | live console process only | PR #12452 | `pm-stack/console/src/docs.ts` (`Docs.start`) | not recorded | Reads only while the app was opened in the last 10 minutes; remove if state is no longer served from memory | 2026-11-22 | 2026-11-22 |
| Console notifier | developing-today/code | every 60 seconds | live console process only | PR #12452 | `pm-stack/console/src/notify.ts` (`Notifier.start`) | not recorded | Reads only while a device is subscribed; remove if notifications move to another sender | 2026-11-22 | 2026-11-22 |

## Surface 7 — Cloudflare Worker cron triggers (1 entry)

Expand Down
8 changes: 6 additions & 2 deletions pm-stack/console/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ function needCounts() {

let shown = 12;
const pending = new Map();
/** Choices ticked on a many-answer question, kept across redraws. */
const picks = new Map();

/** Answer after a short pause, so a slip of the thumb can be undone. */
function later(key, label, send) {
Expand Down Expand Up @@ -398,6 +400,7 @@ async function sendAnswer(kind, args, key) {
try {
const { result } = await api("act", { kind, args });
if (result?.refused?.length) toast(`Not recorded: ${result.refused[0].why}`, true);
picks.delete(key);
if (docs.questions?.questions) {
const open = docs.questions.questions.open.filter((q) => `${q.set}|${q.ledger}|${q.qid}` !== key);
docs.questions.questions.total = open.length;
Expand Down Expand Up @@ -438,15 +441,16 @@ function questionCard(q) {
const key = `${q.set}|${q.ledger}|${q.qid}`;
if (pending.has(key)) return null;
const id = { set: q.set, ledger: q.ledger, qid: q.qid };
const picked = new Set();
const picked = picks.get(key) ?? new Set();
picks.set(key, picked);
const choose = (o) => later(key, `Answered: ${o.label.slice(0, 60)}`, () => sendAnswer("question.answer", { ...id, option: o.id }, key));
const options = q.options.map((o) => {
const rec = q.recommended.includes(o.id);
return h(
"button",
{
class: `option${rec ? " rec" : ""}`,
"aria-pressed": q.multi ? "false" : null,
"aria-pressed": q.multi ? String(picked.has(o.id)) : null,
onclick: (e) => {
if (!q.multi) return choose(o);
const b = e.currentTarget;
Expand Down
7 changes: 6 additions & 1 deletion pm-stack/console/scripts/demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,12 @@ const table = new Proxy({} as Record<string, ReturnType<typeof done>>, {
has: () => true,
getOwnPropertyDescriptor: () => ({ configurable: true, enumerable: true, value: done({}) }),
});
const port = Number(process.argv[2] ?? 4899);
const extra = process.argv.slice(2);
if (extra.length > 1 || (extra[0] !== undefined && !/^[1-9][0-9]{1,4}$/.test(extra[0]))) {
console.error("usage: bun run scripts/demo.ts [port]");
process.exit(2);
}
const port = Number(extra[0] ?? 4899);
Bun.serve({
hostname: "127.0.0.1",
port,
Expand Down
58 changes: 34 additions & 24 deletions pm-stack/console/src/work.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const ASK_NOTE =
const SET_ID = /^[A-Za-z0-9._:-]{1,160}$/;
const REF = /^([A-Za-z0-9._-]+\/[A-Za-z0-9._-]+)#([1-9][0-9]{0,8})$/;
const LEANS = ["none", "skeptical", "approve"] as const;
const SUBMIT_BATCH = 200;

function clip(value: unknown, max: number): string {
const s = typeof value === "string" ? value : "";
Expand Down Expand Up @@ -374,7 +375,14 @@ export class Work {
}
}
if (subs.length === 0) throw new OpError(409, "no open question in that set has a recommendation");
return this.submit(setId, subs);
// The dashboard takes at most 256 answers in one request.
const total = { set: String(setId), applied: 0, refused: [] as { qid: string; why: string }[] };
for (let at = 0; at < subs.length; at += SUBMIT_BATCH) {
const part = await this.submit(setId, subs.slice(at, at + SUBMIT_BATCH));
total.applied += part.applied;
total.refused.push(...part.refused);
}
return total;
}

private ref(value: unknown): { repo: string; number: number } {
Expand Down Expand Up @@ -411,26 +419,22 @@ export class Work {

async asks() {
const label = this.ops.cfg.promptLabel;
const found = (await this.ops.gh([
"-X",
"GET",
"search/issues",
"-f",
`q=repo:${this.repo} is:issue label:"${label}" sort:updated-desc`,
"-f",
"per_page=20",
// The issue list, not the search index: a prompt sent a second ago
// must already be here, and the index runs a minute behind.
const listed = (await this.ops.gh([
`repos/${this.repo}/issues?labels=${encodeURIComponent(label)}&state=all&sort=updated&direction=desc&per_page=20`,
])) as {
items: {
number: number;
title: string;
body: string | null;
html_url: string;
state: string;
created_at: string;
updated_at: string;
comments: number;
}[];
};
number: number;
title: string;
body: string | null;
html_url: string;
state: string;
created_at: string;
updated_at: string;
comments: number;
pull_request?: unknown;
}[];
const found = { items: listed.filter((i) => !i.pull_request) };
// The newest task for each prompt's issue, by the key the task was filed under.
const keys = found.items.map((i) => `repo-health:v1:triage:${this.repo}:issue:${i.number}`);
const tasks = keys.length
Expand All @@ -448,10 +452,16 @@ export class Work {
for (const i of found.items) {
let thread = this.replies.get(i.number);
if (i.comments > 0 && thread?.updated !== i.updated_at) {
const comments = (await this.ops.gh([`repos/${this.repo}/issues/${i.number}/comments?per_page=100`])) as {
body: string | null;
created_at: string;
}[];
// The newest comments are on the last page. Bots that only link the
// issue elsewhere (the board sync) are not the fleet answering.
const page = Math.max(1, Math.ceil(i.comments / 100));
const comments = (
(await this.ops.gh([`repos/${this.repo}/issues/${i.number}/comments?per_page=100&page=${page}`])) as {
Comment on lines +457 to +459

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Read preceding pages when the final page lacks replies

For a thread with 101 comments where comment 100 is a fleet answer and comment 101 is a board-sync bot message, fetching only page 2 and filtering bots produces no replies. This overwrites the cached conversation and changes an open, unclaimed prompt from answered to waiting or queued; the reply notifier also cannot see the answer. Even without bots, crossing a page boundary reduces the displayed conversation from six replies to one. Read preceding pages until six non-bot replies have been collected or the thread's beginning is reached.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Real. Fixed on the next branch (commit 4c87fe0): replies are read from the last page backwards, up to three pages, until six non-bot replies are in hand; tested with a 101-comment thread whose last page is only the bot, and a 250-comment thread.


Generated by Claude Code

body: string | null;
created_at: string;
user?: { type?: string } | null;
}[]
).filter((c) => c.user?.type !== "Bot");
thread = {
updated: i.updated_at,
replies: comments.slice(-6).map((c) => ({
Expand Down
52 changes: 42 additions & 10 deletions pm-stack/console/test/work.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ describe("questions waiting on the owner", () => {
{ ledgerId: "L1", qid: "c", kind: "answered", optionIds: ["opt-1", "opt-2"] },
]);
await expect(work.acceptRecommended("nope")).rejects.toThrow(/not in the store/);
// The dashboard takes at most 256 answers a request: a large set goes in parts, and all of it goes.
const large = JSON.parse(store());
const template = large.sets[1].items[0].questions[0];
large.sets[1].items[0].questions = Array.from({ length: 450 }, (_, n) => ({ ...template, qid: `q${n}`, order: n }));
const big = world({
dash: (_p, body) => ({
outcomes: (body as { submissions: { qid: string }[] }).submissions.map((x) => ({ qid: x.qid, applied: true })),
}),
});
expect((await new Work(big.ops, async () => JSON.stringify(large)).acceptRecommended("new-set")).applied).toBe(450);
const sizes = big.dashed.map((d) => (d.body as { submissions: unknown[] }).submissions.length);
expect(sizes).toEqual([200, 200, 50]);
expect(Math.max(...sizes)).toBeLessThanOrEqual(256);
const none = JSON.parse(store());
none.sets[1].items[0].questions = none.sets[1].items[0].questions.filter((q: { qid: string }) => q.qid === "norec");
await expect(new Work(w.ops, async () => JSON.stringify(none)).acceptRecommended("new-set")).rejects.toThrow(
Expand Down Expand Up @@ -506,16 +519,16 @@ describe("what the owner asks for in his own words", () => {
let commentReads = 0;
const w = world({
commands: (argv) => {
if (argv.includes("search/issues"))
return JSON.stringify({
items: [
found(1, "closed", 1),
found(2, "open", 1),
found(3, "open", 0),
found(4, "open", 2),
found(5, "open", 0),
],
});
// The issue list (not the search index, which lags), newest change first.
if (argv[3] === `repos/${REPO}/issues?labels=owner%2Fprompt&state=all&sort=updated&direction=desc&per_page=20`)
return JSON.stringify([
found(1, "closed", 1),
found(2, "open", 1),
found(3, "open", 0),
{ ...found(99, "open", 0), pull_request: {} }, // a labelled pull request is not a prompt
found(4, "open", 2),
found(5, "open", 0),
]);
commentReads++;
const n = Number(/issues\/(\d+)\/comments/.exec(argv[3])?.[1]);
return JSON.stringify(
Expand Down Expand Up @@ -543,6 +556,25 @@ describe("what the owner asks for in his own words", () => {
[5, "waiting", null, "words 5", []],
]);
expect(asks[3].replies[1].text).toBe("and I say");
// A long thread is read from its last page, and a bot that only links
// the issue somewhere else is not the fleet answering.
const long = world({
commands: (argv) =>
argv[3].includes("/issues?labels=")
? JSON.stringify([found(7, "open", 250)])
: JSON.stringify([
{ body: "the real answer", created_at: "2026-11-22T02:00:00Z", user: { type: "User" } },
{
body: "[CODE-1](https://kaneo.example/task/1)",
created_at: "2026-11-22T02:01:00Z",
user: { type: "Bot" },
},
]),
});
const [thread] = await new Work(long.ops).asks();
expect(long.gh()[1]).toEqual([`repos/${REPO}/issues/7/comments?per_page=100&page=3`]);
expect(thread.replies.map((r) => r.text)).toEqual(["the real answer"]);
expect(thread.status).toBe("answered");
// Threads are read again only when the issue has changed.
await work.asks();
expect(commentReads).toBe(3);
Expand Down