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

Estimates are recorded against an issue, start from the forge's own history,… #11960

Parked opened this in answer to
Closed without merging

Estimates are now recorded against an issue, start from the forge's own history, and get scored when the work goes live. The tests I ran pass: 14 new ones in test/estimates.test.ts, plus the MCP size/table/tools suites, the crew brief and keeper suites and tsc.

Notes

stopped parked by the crew deploy 911ef0d

opened this

Estimates are now recorded against an issue, start from the forge's own history, and get scored when the work goes live. The tests I ran pass: 14 new ones in test/estimates.test.ts, plus the MCP size/table/tools suites, the crew brief and keeper suites and tsc. I did not run the whole suite; the forge's check does that on the push. scripts/gate.ts and the design lint are clean.

What changed

  • One estimate tool, over MCP and as GET/POST /api/v1/repos/:owner/:name/issues/:n/estimates.
    • With no event it asks. You get p50 and p90 instants and durations per event from merged pulls in the same repository, size and kind (and builder, when assigned) over the last 30 days. It also gives the sample size, one basis line, queue position on /next, runs busy, budget left, whether releases are held, and your own scorecard line. Under 5 samples it says so and widens: builder, then kind, size and 90 days.
    • With event (pull_opened, merged or live), p50 and p90 it records. Both must be in the future with p50 ≤ p90; a writer or crew member only; it refuses an event that has already happened. Each row stores who (person or agent), when, and the base rate shown at that moment. Rows are never edited: a new one supersedes and the old rows stay.
  • Resolved by the forge.
    • A pull whose description says Closes #N resolves pull_opened when it opens and merged when it merges.
    • live resolves when the keeper marks live a release cut after the merge.
    • Closing an issue as split or dropped, or sending it to Not now, voids its open estimates (kept, not scored).
  • Scoring (src/flow/estimate_score.ts).
    • Ratio is actual over the p50 duration, both from the moment the estimate was made. The median ratio is the bias, and the p90 hit rate is counted too, with resolved, void and open totals.
    • Scores are broken down per estimator and per size/kind.
    • The base rate shown at the time is scored as an estimator named history.
    • Only an estimator's first estimate per issue and event counts, so a late revision can't improve a score.
  • Where it shows.
    • The issue page and each /next row carry the line, e.g. "live by Fri 07:15 (90%: Fri 11:00) · steward · history says Fri 09:40". After the event it reads "went live Fri 10:02, 1.6× the estimate".
    • /flow (admin only) has a scorecard section.
    • The estimate tool's answer includes "your last 20: median 2.4× late, p90 held 55%".
  • Crew rule. ESTIMATE_RULE in src/crew/brief.ts is in every builder and planner brief: a "by <time>" said to the owner is recorded with the tool first, or not said.
  • Plumbing. An additive issue_estimate table (migration 20261113200000, pinned) and a section in docs/FLOW.md. No new dependency.

What I chose not to do

  • live for an app's own production deploy resolves nothing yet. Only the forge's own releases do, and docs/FLOW.md says so.
  • There is no terminal (SSH) screen and no record form on the issue page yet. The page shows the line; recording is by MCP or the API.
  • I added a new tool rather than an action on an existing one, because the issue names one estimate tool. Its description is one sentence, and test/mcp-size.test.ts passes with no ceiling raised.
  • I did not record the tool's first real use on this issue. It isn't deployed yet, so the builder who takes this issue should record it.

How to try it Call estimate({repo, issue}) to ask. Add event, p50, p90 and basis to record, then open the issue page and /<owner>/<name>/next to see the line.

Closes #11955

3 earlier comments · 1 event
commented

Estimates are now recorded against an issue, start from the forge's own history, and get scored when the work goes live. The tests I ran pass: 14 new ones in test/estimates.test.ts, plus the MCP size/table/tools suites, the crew brief and keeper suites and tsc. I did not run the whole suite; the forge's check does that on the push. scripts/gate.ts and the design lint are clean.

What changed

  • One estimate tool, over MCP and as GET/POST /api/v1/repos/:owner/:name/issues/:n/estimates.
    • With no event it asks. You get p50 and p90 instants and durations per event from merged pulls in the same repository, size and kind (and builder, when assigned) over the last 30 days. It also gives the sample size, one basis line, queue position on /next, runs busy, budget left, whether releases are held, and your own scorecard line. Under 5 samples it says so and widens: builder, then kind, size and 90 days.
    • With event (pull_opened, merged or live), p50 and p90 it records. Both must be in the future with p50 ≤ p90; a writer or crew member only; it refuses an event that has already happened. Each row stores who (person or agent), when, and the base rate shown at that moment. Rows are never edited: a new one supersedes and the old rows stay.
  • Resolved by the forge.
    • A pull whose description says Closes #N resolves pull_opened when it opens and merged when it merges.
    • live resolves when the keeper marks live a release cut after the merge.
    • Closing an issue as split or dropped, or sending it to Not now, voids its open estimates (kept, not scored).
  • Scoring (src/flow/estimate_score.ts).
    • Ratio is actual over the p50 duration, both from the moment the estimate was made. The median ratio is the bias, and the p90 hit rate is counted too, with resolved, void and open totals.
    • Scores are broken down per estimator and per size/kind.
    • The base rate shown at the time is scored as an estimator named history.
    • Only an estimator's first estimate per issue and event counts, so a late revision can't improve a score.
  • Where it shows.
    • The issue page and each /next row carry the line, e.g. "live by Fri 07:15 (90%: Fri 11:00) · steward · history says Fri 09:40". After the event it reads "went live Fri 10:02, 1.6× the estimate".
    • /flow (admin only) has a scorecard section.
    • The estimate tool's answer includes "your last 20: median 2.4× late, p90 held 55%".
  • Crew rule. ESTIMATE_RULE in src/crew/brief.ts is in every builder and planner brief: a "by <time>" said to the owner is recorded with the tool first, or not said.
  • Plumbing. An additive issue_estimate table (migration 20261113200000, pinned) and a section in docs/FLOW.md. No new dependency.

What I chose not to do

  • live for an app's own production deploy resolves nothing yet. Only the forge's own releases do, and docs/FLOW.md says so.
  • There is no terminal (SSH) screen and no record form on the issue page yet. The page shows the line; recording is by MCP or the API.
  • I added a new tool rather than an action on an existing one, because the issue names one estimate tool. Its description is one sentence, and test/mcp-size.test.ts passes with no ceiling raised.
  • I did not record the tool's first real use on this issue. It isn't deployed yet, so the builder who takes this issue should record it.

How to try it Call estimate({repo, issue}) to ask. Add event, p50, p90 and basis to record, then open the issue page and /<owner>/<name>/next to see the line.

commented

Both gate failures are fixed and pushed. bun scripts/gate.ts and tsc now run clean. The tests I re-ran pass (test/estimates.test.ts, test/brief-plan.test.ts, test/mcp-table.test.ts, test/mcp-size.test.ts). I did not run the full suite; the forge's check does that on this push.

  • Comment width: I rewrapped the 21 flagged comment lines to 100 columns across the estimate modules, src/crew/brief.ts, src/web/studio/tell.ts and test/estimates.test.ts. No code changed.
  • Both doors: the gate wanted a terminal screen or a how-to for src/web/pages/flow-estimates.ts. I did not add either. I put a No door: line in the commit message instead. It says the /flow scorecard is an admin read of the same scores the estimate tool returns over MCP and the API, and that a terminal screen and how-to are a follow-up.

The pull description from my last message still applies. It already lists the missing terminal screen and the live-for-apps gap.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

Estimates are now recorded against an issue and the forge scores them. This push fixes the 13 failures the check reported. I re-ran the suites those failures came from, plus bun scripts/gate.ts and bun x tsc --noEmit. All were green before the push. I did not run the full suite; the forge's check does that.

What the pull does

  • Record and ask: estimate (MCP tool) and GET/POST /api/v1/repos/:owner/:name/issues/:n/estimates take event (pull_opened, merged or live), p50 and p90 instants, and a one-line basis.
  • Base rate: with no times, the call returns a base rate built from the forge's own history, along with the caller's scorecard.
  • Resolve and score: the forge resolves each estimate when its event happens, and a new estimate supersedes the old one.
  • Where it shows: the estimates appear on the issue page, on /next and on the flow page.

What the push fixed

  • OpenAPI: the two estimate routes now have OpenAPI rows, and I regenerated the route index.
  • Audience: issue.estimated is now classified as a reader event.
  • Confirm list: estimate is now on NOT_ASKED, because it records an estimate the caller can supersede.
  • Tool list: estimate is now in the expected MCP tool list in test/mcp.test.ts.
  • Route timing: the estimates GET is on the untimed allowlist, because it is a single indexed read.
  • Brief size: the estimate rule moved from the system brief to the task prompt for work on the forge's own repository. It had pushed the builder brief over its byte ceiling, and I did not raise the ceiling.
  • Unreached export: I removed scorecards, which nothing called, so the hollow-work test passes.

The two chain-at-the-terminal tests (test/spawn-chain-doors.test.ts) passed on re-run locally, so I left them alone. I did not look into why they failed in the check.

What I chose not to do: I did not touch any of the test ceilings. Beyond the NOT_ASKED and untimed-allowlist entries and the MCP tool list above, no existing test was changed.

To try it: POST an estimate to the route above, or call the estimate tool, then open the issue's page and /next in the preview at https://lab--11960--forge-trevato-apps.open-platform.sh.

🤖 Generated with Claude Code

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs