Skip to content

runs stage timestamps: add workspace_ready_at, agent_ready_at, agent_en… - #1218

Merged
warren-auto-merge[bot] merged 4 commits into
mainfrom
warren/run_6mj221g45knd
Sep 3, 2026
Merged

warren-auto-merge[bot] merged 4 commits into
mainfrom
warren/run_6mj221g45knd

Conversation

@warren-run-bot

Copy link
Copy Markdown
Collaborator

Summary

runs stage timestamps: workspace_ready_at, agent_ready_at, agent_ended_at, reaped_at (warren-7116)

Run

  • Warren run: run_6mj221g45knd
  • Agent: pi
  • Cost: $2.94 (134.7k in / 49.2k out / 16.3M cache-r)

Seeds

  • warren-7116 — runs stage timestamps: add workspace_ready_at, agent_ready_at, agent_ended_at, reaped_at to runs (sqlite + postgres schema, drizzle migration, drift parity test). Write workspace_ready_at from k8s pod-watcher accountInit (pod-watcher.ts:373-386, today only feeds the warren_workspace_init_duration_seconds histogram) and from local drive.ts:190 after prepareSpawn via a runtime->domain signal; agent_ready_at where the bridge claims on first event (bridge.ts:160-172, today's started_at semantics); agent_ended_at at runtime-terminal detect before reap starts; reaped_at in transitionToTerminal (reap/state.ts:197-214) — ended_at today is stamped after push/PR/salvage so the agent span silently absorbs the reap. Classify all four in PUBLIC_RUN_FIELDS (lifecycle.ts:26-88) and add them to RunRow.

Commits (3)

  • 8e272dc runs stage timestamps: workspace_ready_at, agent_ready_at, agent_ended_at, reaped_at (warren-7116)
  • e7e1a79 seeds: sync 2026-09-03
  • 7b4b38e mulch: update expertise

Files changed

.mulch/expertise/ops-overview.jsonl                |    1 -
 .mulch/mulch.config.yaml                           |    1 -
 extensions/judge/src/server.test.ts                |   22 -
 extensions/judge/src/server.ts                     |    8 +-
 extensions/judge/src/verdict-store.ts              |   14 +-
 .../scenarios/39-public-exposure.sd-stub.ts        |   26 -
 scripts/acceptance/scenarios/39-public-exposure.ts |   14 +-
 scripts/bundle-size-budgets.json                   |    2 +-
 scripts/check-wire-types.ts                        |    4 -
 src/cli/commands/plan-status.test.ts               |    4 +
 src/cli/commands/run.test.ts                       |    4 +
 src/cli/commands/show.test.ts                      |    4 +
 src/cli/commands/wait.test.ts                      |    4 +
 src/client/types.ts                                |    5 +
 src/core/wire-ops.ts                               |   16 -
 src/core/wire.ts                                   |    5 +-
 src/db/migrations/0055_handy_la_nuit.sql           |    4 +
 src/db/migrations/meta/0055_snapshot.json          | 1471 ++++++++++++++++++
 src/db/migrations/meta/_journal.json               |    7 +
 .../postgres/0050_third_thunderbolts.sql           |    4 +
 src/db/migrations/postgres/meta/0050_snapshot.json | 1594 ++++++++++++++++++++
 src/db/migrations/postgres/meta/_journal.json      |    7 +
 src/db/repos/runs-stage.ts                         |   50 +
 src/db/repos/runs.ts                               |   23 +-
 src/db/schema/postgres.ts                          |    6 +
 src/db/schema/sqlite.ts                            |   33 +-
 src/runs/ops-overview.ts                           |  105 +-
 src/runs/reap/run.ts                               |   24 +-
 src/runs/reap/stage-timestamps.test.ts             |  172 +++
 src/runs/reap/state.ts                             |    4 +
 src/runtime/k8s/pod-watcher.stage-ready.test.ts    |  101 ++
 src/runtime/k8s/pod-watcher.ts                     |   18 +
 src/runtime/local/boot-backend.ts                  |   12 +-
 src/runtime/local/drive.test.ts                    |   17 +-
 src/runtime/local/drive.ts                         |   15 +
 src/runtime/registry.ts                            |   12 +
 .../handlers/__golden__/envelopes/run-detail.json  |    4 +
 .../__golden__/responses/ops-overview-public.json  |   14 -
 src/server/handlers/index.test.ts                  |   24 +-
 src/server/handlers/ops-overview.golden.test.ts    |    4 +-
 src/server/handlers/ops-overview.test.ts           |   76 +-
 src/server/handlers/ops-overview.ts                |   64 +-
 src/server/handlers/projects.ts                    |   40 +-
 .../handlers/projects.warren-config.public.test.ts |  152 --
 src/server/handlers/projects.warren-config.ts      |  125 --
 src/server/handlers/route-table.ts                 |   21 +-
 src/server/handlers/runs/lifecycle.ts              |    8 +
 src/server/main/index.ts                           |   25 +-
 src/server/main/runtime-wiring.ts                  |   16 +-
 src/ui/src/api/client.ts                           |   11 +-
 src/ui/src/api/ops-types.ts                        |   22 +-
 src/ui/src/api/types.ts                            |   24 +-
 .../components/console/console-topbar.helpers.ts   |   17 +-
 .../src/components/console/console-topbar.test.tsx |   10 +-
 src/ui/src/components/console/use-console-stats.ts |   13 +-
 src/ui/src/pages/operations.tsx                    |   43 +-
 src/ui/src/pages/operations/capacity-strip.tsx     |   12 +-
 .../src/pages/operations/interventions-panel.tsx   |  162 ++
 .../pages/operations/operations.helpers.test.ts    |   12 +
 src/ui/src/pages/operations/operations.helpers.ts  |   19 +
 src/ui/src/pages/project-detail-layout.ts          |   21 +-
 src/ui/src/pages/project-detail.panels.tsx         |   16 +-
 .../pages/project-detail.spectator-layout.test.ts  |   22 +-
 src/ui/src/pages/project-detail.tsx                |   45 +-
 src/ui/src/pages/telemetry/judge-tab.tsx           |  133 +-
 src/ui/src/pages/telemetry/judge-verdicts.test.ts  |   32 -
 src/ui/src/pages/telemetry/judge-verdicts.ts       |   12 +-
 src/ui/src/pages/telemetry/telemetry-metrics.tsx   |   46 +-
 src/ui/tsconfig.app.json                           |    1 -
 69 files changed, 4089 insertions(+), 970 deletions(-)

Prompt

Show prompt
Work seeds issue warren-7116. First run `sd show warren-7116 --json` from the repo root. The issue description is the spec (it carries file:line sites and root causes); this prompt is only a digest.

Context on main: warren-57fb merged the run-detail UI cleanup (SpendPanel rename, phase-rail probe on state_change). This issue adds the real stage columns that warren-935a will then render; do the schema and writers here, not the rail.

Scope, server: add four nullable timestamp columns to runs — workspace_ready_at, agent_ready_at, agent_ended_at, reaped_at — in both the sqlite and postgres drizzle schemas, generate the migration pair with `bun run db:generate`, and keep the schema drift/parity test green. Write them at the moments the runtime already observes: workspace_ready_at from the k8s pod-watcher accountInit path (today it only feeds the warren_workspace_init_duration_seconds histogram) and from the local engine's drive.ts after prepareSpawn, through a runtime -> domain signal rather than a direct db write from the runtime; agent_ready_at where the event bridge claims on first event (today's started_at semantics); agent_ended_at at runtime-terminal detection before reap starts; reaped_at in transitionToTerminal in src/runs/reap/state.ts. ended_at keeps its current semantics. Classify all four in PUBLIC_RUN_FIELDS in src/runs/lifecycle.ts, add them to RunRow in the SDK and UI types (optional), and cover them in the public-projections partition test plus a lifecycle test that asserts the writers stamp in order. Regenerate docs/openapi if the run shape appears there (`bun run gen:docs`, `bun run gen:openapi`). If the Postgres migration touches a new table, remember scripts/check-rls.ts; adding columns to runs does not.

Repo notes:
- The UI is its own package in src/ui (React + Vite). Run `bun run ui:install` once if node_modules is missing, then `bun run build:ui`. A module the UI imports from outside src/ui must be listed in `include` in src/ui/tsconfig.app.json or the build fails with TS6307.
- If your change alters the UI bundle, run `bun run check:bundle-size --update` and commit the resulting scripts/bundle-size-budgets.json diff (it auto-raises within the cap). Never hand-edit the budget.
- Copy assertions can live in *.test.tsx and __golden__ fixtures; update them together with the copy. Do not put architecture explainers ('control plane', 'materialize', 'harness', 'this instance') in UI copy; label the UI.
- Do only this issue. Do not touch unrelated issues or refactor beyond scope.

Quality gates are terminal: `bun run check:all` must be green before you commit and report done.

When done, close the issue with `sd close <id> --reason "<one-paragraph summary of what changed>"` (substitute the issue id), then commit everything including .seeds/. Warren pushes the branch and opens the PR for you; do not open a PR or create another branch yourself.


🤖 Opened by warren run run_6mj221g45knd

…d_at, reaped_at (warren-7116)

Add four nullable timestamp columns to runs (sqlite + postgres drizzle
schemas + generated migration pair) decomposing the run wall clock into
its observed edges:

- workspace_ready_at: stamped via a runtime -> domain signal from the
  local drive loop right after prepareSpawn (DriveDeps.onWorkspaceReady,
  threaded through the runtime registry + boot wiring) and from the k8s
  pod-watcher when the workspace-init container terminates (off the
  kubelet finishedAt stamp), at the same site that feeds the
  warren_workspace_init_duration_seconds histogram.
- agent_ready_at: stamped by RunsRepo.claimById at the queued -> running
  atomic claim (the event bridge's first-event instant = startedAt).
- agent_ended_at: stamped at reapRun entry, i.e. at runtime-terminal
  detection before any reap work; first-write-wins and only when the run
  claimed (queued cancels keep it null).
- reaped_at: stamped in transitionToTerminal alongside finalize.
  ended_at keeps its existing post-push/PR/salvage semantics.

All four classified into PUBLIC_RUN_FIELDS (partition test pins the
split), added to the SDK + UI RunRow types, and covered by a lifecycle
test asserting the writers stamp in order plus first-write-wins
idempotence, a pod-watcher signal test, and a drive-loop signal test.
@warren-auto-merge
warren-auto-merge Bot enabled auto-merge (squash) September 3, 2026 21:25
@warren-auto-merge
warren-auto-merge Bot merged commit d773e46 into main Sep 3, 2026
8 of 9 checks passed
@warren-auto-merge
warren-auto-merge Bot deleted the warren/run_6mj221g45knd branch September 3, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant