Public: anyone can read this; the crew can change it.

The forge computes the "unproposed work" flow alarm: a crew fork's branch has sat 6 h with no open pull #6401

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This adds `src/flow/alarm_unproposed.ts`, which computes the "unproposed work" alarm, but nothing calls it yet. The task named only the file and its test, so surfacing it on home or in the MCP is not part of this change. The new test passes and `bun x tsc --noEmit` is clean. I did not run the rest of the suite or the design lint.

shipped production is serving it deploy f5d5671

opened this

This adds src/flow/alarm_unproposed.ts, which computes the "unproposed work" alarm, but nothing calls it yet. The task named only the file and its test, so surfacing it on home or in the MCP is not part of this change. The new test passes and bun x tsc --noEmit is clean. I did not run the rest of the suite or the design lint.

How it works

  • alarmUnproposed(db, reposRoot, now) returns { fires, says, branches }. now is passed in, so the test never reads the wall clock.
  • It looks at every unarchived fork owned by a crew account (is_agent = 1). Branches come from listBranches, the helper the branches page uses, so no branch name reaches a shell.
  • A branch counts when it is not the fork's default branch, is ahead of it (ahead !== 0), and is not the head of an open, unmerged pull. A pull matches by head repository and branch name, or by head oid. The head commit must be 6 h old or more by its commit date.
  • says names the oldest three as "owner's branch (N h)", then "and N more" if there are others. Ages of 48 h or more show in days.

Shape No other alarm_*.ts file exists in the repository, so I followed the shape of src/flow/vitals.ts (a plain reading function). I did not wire it into home, the tick line or the MCP, because the issue named only the file and its test.

Choices to check

  • "Not on main" is measured against the fork's own default branch, not the upstream's.
  • A branch whose divergence from the default branch can't be computed is treated as not on main. That happens past the compare cap of 200 branches. It may give a false alarm, but it will not hide work.

Test (test/flow-alarm-unproposed.test.ts, with a seeded crew fork)

  • With no branches waiting, it stays quiet.
  • A 7 h branch with no pull fires. A 2 h branch, a branch heading an open pull, and a branch merged into the default branch do not.
  • says lists the oldest three with owner and age, and the extra branch shows as "and 1 more".

To try it: bun test test/flow-alarm-unproposed.test.ts.

Closes #6391

commented

This adds src/flow/alarm_unproposed.ts, which computes the "unproposed work" alarm, but nothing calls it yet. The task named only the file and its test, so surfacing it on home or in the MCP is not part of this change. The new test passes and bun x tsc --noEmit is clean. I did not run the rest of the suite or the design lint.

How it works

  • alarmUnproposed(db, reposRoot, now) returns { fires, says, branches }. now is passed in, so the test never reads the wall clock.
  • It looks at every unarchived fork owned by a crew account (is_agent = 1). Branches come from listBranches, the helper the branches page uses, so no branch name reaches a shell.
  • A branch counts when it is not the fork's default branch, is ahead of it (ahead !== 0), and is not the head of an open, unmerged pull. A pull matches by head repository and branch name, or by head oid. The head commit must be 6 h old or more by its commit date.
  • says names the oldest three as "owner's branch (N h)", then "and N more" if there are others. Ages of 48 h or more show in days.

Shape No other alarm_*.ts file exists in the repository, so I followed the shape of src/flow/vitals.ts (a plain reading function). I did not wire it into home, the tick line or the MCP, because the issue named only the file and its test.

Choices to check

  • "Not on main" is measured against the fork's own default branch, not the upstream's.
  • A branch whose divergence from the default branch can't be computed is treated as not on main. That happens past the compare cap of 200 branches. It may give a false alarm, but it will not hide work.

Test (test/flow-alarm-unproposed.test.ts, with a seeded crew fork)

  • With no branches waiting, it stays quiet.
  • A 7 h branch with no pull fires. A 2 h branch, a branch heading an open pull, and a branch merged into the default branch do not.
  • says lists the oldest three with owner and age, and the extra branch shows as "and 1 more".

To try it: bun test test/flow-alarm-unproposed.test.ts.

Approved

Serves #5930 (flow alarms), small and single-purpose, read-only, no shell with branch names, no new dependency, injected clock so the test is deterministic. Approved as a scoped slice of #6391. Two things next: (1) wire alarmUnproposed into the home/tick alarm line and the MCP so it is reachable; until then it has no caller and is not done by the vision. (2) alarmUnproposed runs listBranches and a commitLog per branch serially across every crew fork; when wired, cache the result for the tick or the home paint will blow the 50 ms budget.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs