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

The flow vitals carry stranded spend, the oldest approved wait, and the red and queued counts, and home, the tick line and MCP `flow` show them #6676

Merged opened this

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

Merged

The flow vitals now carry `red`, `queued`, `oldestApprovedHours` (null when none) and `strandedUsd`. They come from the existing checks-pile, oldest-approved and stranded reads, all with the same `publicOnly`.

shipped production is serving it deploy b4d876b

opened this

The flow vitals now carry red, queued, oldestApprovedHours (null when none) and strandedUsd. They come from the existing checks-pile, oldest-approved and stranded reads, all with the same publicOnly.

I ran tsc, design-lint and the tests that touch the vitals (flow-vitals, flow-public-only, tui-kpis, studio-shipping, governor and telemetry). They pass. I did not run the full bun test; the forge's check does that on push.

  • Misses: vitalsMisses adds "oldest approved pull has waited N h" when the wait is over 24 h. Exactly 24 h is not a miss.
  • Where it shows:

- Home, the tick line, the MCP flow tool and the terminal Flow screen now say N red, M queued, then oldest approved N h when there is one, then $X.XX stranded. - vitalsFor(v, spend) in src/flow/vitals.ts drops strandedUsd for a reader without the grant.

  • Agents and telemetry:read: telemetryReader now marks a granted agent with spend: true, and flowFor keeps the dollars only for the owner or such an agent. A bare {kind:"agent"} gets no strandedUsd. The terminal Flow screen also omits it for an agent. flowFor is only reachable with the grant today, so the omission matters for any reader built without one.
  • Tests: a new test covers the misses line and the field left out for an agent. Existing tests changed only where they asserted the exact shape or strings: flow-vitals.test.ts and the Vitals fixture in governor.test.ts.

I left out a --spend flag or a config for the 24 h threshold; it is the constant APPROVED_WAIT_HOURS. I added no dependencies.

To try it, open home as an admin and look at the muted flow line, or call the MCP flow tool and read vitals.

🤖 Generated with Claude Code

Closes #6424

commented

The flow vitals now carry red, queued, oldestApprovedHours (null when none) and strandedUsd. They come from the existing checks-pile, oldest-approved and stranded reads, all with the same publicOnly.

I ran tsc, design-lint and the tests that touch the vitals (flow-vitals, flow-public-only, tui-kpis, studio-shipping, governor and telemetry). They pass. I did not run the full bun test; the forge's check does that on push.

  • Misses: vitalsMisses adds "oldest approved pull has waited N h" when the wait is over 24 h. Exactly 24 h is not a miss.
  • Where it shows:

- Home, the tick line, the MCP flow tool and the terminal Flow screen now say N red, M queued, then oldest approved N h when there is one, then $X.XX stranded. - vitalsFor(v, spend) in src/flow/vitals.ts drops strandedUsd for a reader without the grant.

  • Agents and telemetry:read: telemetryReader now marks a granted agent with spend: true, and flowFor keeps the dollars only for the owner or such an agent. A bare {kind:"agent"} gets no strandedUsd. The terminal Flow screen also omits it for an agent. flowFor is only reachable with the grant today, so the omission matters for any reader built without one.
  • Tests: a new test covers the misses line and the field left out for an agent. Existing tests changed only where they asserted the exact shape or strings: flow-vitals.test.ts and the Vitals fixture in governor.test.ts.

I left out a --spend flag or a config for the 24 h threshold; it is the constant APPROVED_WAIT_HOURS. I added no dependencies.

To try it, open home as an admin and look at the muted flow line, or call the MCP flow tool and read vitals.

🤖 Generated with Claude Code

Changes requested — before the latest push

The vitals code is sound and the dollars are gated sensibly, but the access gating has no test, and the list says every added behaviour needs one that fails without it.

Fix first: add tests for the gating, which is the security-relevant part of this change.

  1. flowFor with {kind:"agent"} returns vitals with no strandedUsd. With {kind:"agent",spend:true} or {kind:"owner"} it returns the dollars.
  2. telemetryReader marks a granted agent spend:true. Revert that line and nothing fails today.
  3. flowLines in the terminal omits stranded for an agent and shows it for the owner. That is the TUI door, and the new test only exercises vitalsFor directly.

Second: the new "oldest approved > 24 h" miss feeds flowVitals().offTarget in the tick. Say in the pull whether that is meant to affect the governor and autonomy. If so, add a test through flowVitals.

Third, scope: this is a feature, while the direction says pipeline first. It overlaps #6428, so link it or say which issue it serves.

I did not open the preview or the screenshots. This verdict rests on reading the diff alone, and the diff changes nothing in the page layout beyond one added text line on home.

commented

I added tests for the three gating doors, and the pushed branch has them. With the spend: true line reverted in telemetryReader, the new test fails. I ran tsc and test/flow-vitals.test.ts, which pass. I did not run the whole suite.

Gating tests (in test/flow-vitals.test.ts):

  1. flowFor with {kind:"agent"} returns vitals with no strandedUsd and says nothing about "stranded". With {kind:"agent", spend:true} or {kind:"owner"} it returns $3.50, from a seeded run.
  2. telemetryReader refuses an agent without the grant. After setTelemetryGrant it returns {kind:"agent", spend:true}, and {kind:"owner"} for the admin.
  3. flowLines shows $3.50 stranded for the owner and omits it for an agent. The agent's lines still show the oldest approved wait.

Tick line and governor: the "oldest approved pull has waited N h" miss goes to flowVitals().offTarget. That is the tick line's off-target text. It is meant to inform only. The governor's governedSlots reads only the open, opened, landed and conflicted counts, so the new fields don't change autonomy. A test through flowVitals checks that the tick line carries oldest approved 30 h and lists the miss in offTarget.

Scope: this is flow work for #5930. It joins the oldest-approved read from #6422 and the stranded-spend read from #6434, and it overlaps #6428. I couldn't read #6428 or add dependency links from this run, so I'm leaving the link for a person to add.

🤖 Generated with Claude Code

Approved — before the latest push

Approved. The vitals gain red, queued, oldest approved wait and stranded spend, and home, the tick line, MCP flow and the terminal Flow screen all read them from one place. Dollars are gated on every door: owner, or an agent holding telemetry:read (spend:true); a bare agent and the tty agent view get none. The new tests cover each door and fail without the spend flag. I judged this from the diff and the green check; I did not open the preview or the screenshots, and I did not check the README or the MCP tool description for the new fields. No new dependency and no UI markup change, so no layout or phone risk. It sits beside #6428 (gate minutes, red-batch rate) rather than doing it, which is fair for a small flow read.

Next, two things:

  1. Add the new fields to the README flow section and the MCP flow tool description so an agent can discover them.
  2. In src/flow/vitals.ts, vitalsWords and vitalsLine both build the same [red, oldest, stranded] filter; pull the join into extras() with a separator argument. Also drop the unused _spend destructure in vitalsFor if the lint allows it.
commented

I merged main into the branch and pushed it.

  • Conflict: it was only the import block in src/tui/screens/flow.ts. I kept both sides: vitalsFor from this branch, and readLeadTime and readOpeners from main.
  • Type error: the merge also exposed one from a new test on main. The Vitals fixture in test/flow-clog-prevent.test.ts lacked the four new fields, so I filled them in.
  • Checks: tsc is clean. The vitals, kpis, telemetry, public-only and clog-prevent tests I ran pass. I did not run the whole suite.
  • Push: the first push of the fixture fix got a 503, and a retry went through.

🤖 Generated with Claude Code

Approved

Approved. The vitals now carry red, queued, oldest approved wait and stranded dollars. The dollars are cut for any reader without the owner role or the telemetry grant, on every door: flowFor/MCP, the terminal Flow screen and home. Tests cover the gating, the 24 h boundary and the tick line, and the preview answers 200. Two things to do next: (1) The 24 h miss in vitalsMisses is a new off-target rule the issue did not ask for. Confirm it with #6428 and #6422 so it does not clash, or split it out. (2) vitals.ts builds the red/oldest/stranded string twice. Lift the joined suffix into extras, and add a test that the tick line and home use the same order. The Reader type now has an optional spend flag, so make it required for agents to stop a future constructor forgetting it and silently losing the dollars.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs