Skip to content

queue-state counts + runtime-kind introspection: countNonTerminal(proje… - #993

Merged
warren-auto-merge[bot] merged 2 commits into
mainfrom
warren/run_328mhfgwvfsr
Aug 19, 2026
Merged

queue-state counts + runtime-kind introspection: countNonTerminal(proje…#993
warren-auto-merge[bot] merged 2 commits into
mainfrom
warren/run_328mhfgwvfsr

Conversation

@warren-forge-bnnl24

Copy link
Copy Markdown
Contributor

Summary

feat(dispatch-log): countNonTerminal + RuntimeProvider.kind (warren-e1f1)

Agent notes

Queue snapshot and runtime-backend introspection for the dispatch-context
writer (warren-d6ca):

  • countNonTerminal(projectId?) in runs-stats, exposed on RunsRepo —
    counts state IN (queued, running) instance-wide or per-project from the
    runs table (queue_snapshot_source=runs_table).
  • readonly kind: 'local' | 'docker' | 'k8s' on RuntimeProvider; each
    concrete provider (and FakeProvider) reports its backend identity.

Run

  • Warren run: run_328mhfgwvfsr
  • Agent: pi
  • Cost: $1.25 (298.8k in / 14.0k out / 1.9M cache-r)

Seeds

  • warren-e1f1 — queue-state counts + runtime-kind introspection: countNonTerminal(projectId?) in runs-stats, RuntimeProvider kind field

Commits (1)

  • 776a498 feat(dispatch-log): countNonTerminal + RuntimeProvider.kind (warren-e1f1)

Files changed

src/db/migrations/0050_melted_jetstream.sql        |   37 -
 src/db/migrations/meta/0050_snapshot.json          | 1413 ------------------
 src/db/migrations/meta/_journal.json               |    7 -
 src/db/migrations/postgres/0045_lively_zombie.sql  |   38 -
 src/db/migrations/postgres/meta/0045_snapshot.json | 1544 --------------------
 src/db/migrations/postgres/meta/_journal.json      |    7 -
 src/db/repos/dispatch-context.test.ts              |  128 --
 src/db/repos/dispatch-context.ts                   |   60 -
 src/db/repos/index.ts                              |    4 -
 src/db/repos/runs-stats.test.ts                    |   44 +-
 src/db/repos/runs-stats.ts                         |   28 +-
 src/db/repos/runs.ts                               |   27 +-
 src/db/schema/columns.ts                           |    6 -
 src/db/schema/drift.test.ts                        |   12 -
 src/db/schema/postgres.ts                          |   51 -
 src/db/schema/sqlite.ts                            |   78 +-
 src/runs/retry/infra-lost-retry.test.ts            |    1 +
 src/runs/spawn/dispatch.provider.test.ts           |    2 +
 src/runs/stream/bridge.oom.test.ts                 |    1 +
 src/runs/stream/test-helpers.ts                    |    1 +
 src/runtime/contract.ts                            |   17 +-
 src/runtime/docker/provider.test.ts                |    4 +
 src/runtime/docker/provider.ts                     |    1 +
 src/runtime/fake/fake-provider.ts                  |    2 +
 src/runtime/k8s/provider.test.ts                   |    4 +
 src/runtime/k8s/provider.ts                        |    2 +-
 src/runtime/local/provider.test.ts                 |    4 +
 src/runtime/local/provider.ts                      |    1 +
 28 files changed, 137 insertions(+), 3387 deletions(-)

Prompt

Show prompt
Work seeds issue warren-e1f1. First run `sd show warren-e1f1 --json` from the repo root — the issue body is the full spec; this summary is only a digest.

Context: this is step 3 of Track A (dispatch-context log) of plan pl-a37b for v0.18.0. Siblings warren-9ce3 (dispatch provenance) and warren-36e7 (dispatch_context table) may already be merged on main — build on whatever main has. warren-d6ca (a later issue, not yours) will consume both introspection surfaces you add.

Scope, two parts exactly as the issue specifies: (1) add countNonTerminal(projectId?) to src/db/repos/runs-stats.ts (state IN ('queued','running'); instance-wide and per-project forms), exposed on RunsRepo — do NOT reuse the k8s admission gate's AdmissionCounts, they never reach the dispatch site; queue_snapshot_source will be 'runs_table'. (2) add readonly kind: 'local' | 'docker' | 'k8s' to the RuntimeProvider contract (src/runtime/contract.ts) with one line per provider. Gotcha: check:runtime-ids forbids runtime-id literals outside src/runtime/adapters/ — the provider implementations under src/runtime/{local,docker,k8s}/ setting their own kind may trip it; if so, extend the allowlist bucket for files that name a runtime on purpose rather than working around the guard. Tests: runs-stats counts across states and projects; each provider reports its kind.

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

When the work is verified, close the issue with `sd close warren-e1f1 --reason "<one-line evidence>"`, then commit everything.


🤖 Opened by warren run run_328mhfgwvfsr

…1f1)

Queue snapshot and runtime-backend introspection for the dispatch-context
writer (warren-d6ca):

- countNonTerminal(projectId?) in runs-stats, exposed on RunsRepo —
  counts state IN (queued, running) instance-wide or per-project from the
  runs table (queue_snapshot_source=runs_table).
- readonly kind: 'local' | 'docker' | 'k8s' on RuntimeProvider; each
  concrete provider (and FakeProvider) reports its backend identity.
@warren-auto-merge
warren-auto-merge Bot enabled auto-merge (squash) August 19, 2026 18:04
@warren-auto-merge
warren-auto-merge Bot merged commit e9a367b into main Aug 19, 2026
8 checks passed
@warren-auto-merge
warren-auto-merge Bot deleted the warren/run_328mhfgwvfsr branch August 19, 2026 18:05
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.

2 participants