Skip to content

dispatch_context table: sqlite+postgres schema, migrations, insert-only… - #990

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

dispatch_context table: sqlite+postgres schema, migrations, insert-only…#990
warren-auto-merge[bot] merged 3 commits into
mainfrom
warren/run_amh3vnqrmrcw

Conversation

@warren-forge-bnnl24

Copy link
Copy Markdown
Contributor

Summary

seeds: sync 2026-08-19

Agent notes

Add the core dispatch-context fact table (one row per dispatched run,
PK run_id CASCADE) across sqlite+postgres with generated migrations
(pg ENABLE ROW LEVEL SECURITY, unqualified runs FK). Register an
insert-only DispatchContextRepo and include both dispatch_context and
the previously missing tool_calls entry in the dialect drift walk.

Run

  • Warren run: run_amh3vnqrmrcw
  • Agent: pi
  • Cost: $1.51 (414.8k in / 22.7k out / 1.8M cache-r)

Seeds

  • warren-36e7 — dispatch_context table: sqlite+postgres schema, migrations, insert-only repo, drift-test registration (incl. missing tool_calls entry)

Commits (2)

  • 6a1d6d4 seeds: sync 2026-08-19
  • b237300 feat(db): dispatch_context insert-only table + repo (warren-36e7)

Files changed

README.md                                          |   99 +-
 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/schema/columns.ts                           |    6 +
 src/db/schema/drift.test.ts                        |   12 +
 src/db/schema/postgres.ts                          |   51 +
 src/db/schema/sqlite.ts                            |   78 +-
 src/plan-runs/dispatch.test.ts                     |    2 -
 src/plan-runs/dispatch.ts                          |    3 -
 src/runs/index.ts                                  |    8 +-
 src/runs/retry/infra-lost-retry.test.ts            |    2 -
 src/runs/retry/infra-lost-retry.ts                 |    4 -
 src/runs/retry/provider-retry.test.ts              |    2 -
 src/runs/retry/provider-retry.ts                   |    4 -
 src/runs/spawn/dispatch-origin.test.ts             |   29 -
 src/runs/spawn/dispatch.logging.test.ts            |   21 -
 src/runs/spawn/dispatch.ts                         |   14 +-
 src/runs/spawn/index.ts                            |    3 +-
 src/runs/spawn/rollback.ts                         |   27 +-
 src/runs/spawn/types.ts                            |   34 -
 src/server/handlers/alerts.test.ts                 |   21 +-
 src/server/handlers/alerts.ts                      |    2 -
 src/server/handlers/projects.triggers-run.test.ts  |   12 +-
 src/server/handlers/projects.ts                    |    6 -
 src/server/handlers/runs.dispatch.test.ts          |   83 +-
 src/server/handlers/runs.test-helpers.ts           |   32 -
 src/server/handlers/runs/dispatch.ts               |  123 +-
 src/server/scheduler.test.ts                       |   95 --
 src/server/scheduler.ts                            |   36 +-
 src/triggers/dispatch-scheduled.test.ts            |    4 -
 src/triggers/dispatch.test.ts                      |    4 -
 src/triggers/dispatch.ts                           |   15 -
 39 files changed, 3528 insertions(+), 542 deletions(-)

Prompt

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

Context: this is step 2 of Track A (dispatch-context log) of plan pl-a37b for v0.18.0. Sibling warren-9ce3 (dispatch provenance plumbing) may already be merged on main — build on whatever main has. Your table is schema + repo only; warren-d6ca (a later issue, not yours) writes the rows.

Scope: create the insert-only dispatch_context table exactly as the issue specifies, copying the tool_calls pattern: src/db/schema/columns.ts TABLE_NAMES/INDEX_NAMES, sqlite.ts + postgres.ts table definitions with $infer type exports, `bun run db:generate` for both dialects (the pg migration must carry ENABLE ROW LEVEL SECURITY so check:rls passes), a new insert-only repo src/db/repos/dispatch-context.ts (no UPDATE path), registered in src/db/repos/index.ts. Also register BOTH dispatch_context and the currently-missing tool_calls entry in src/db/schema/drift.test.ts SQLITE_TABLES/PG_TABLES. Facts only, NULL means unknown. Do not add the writer, the analytics endpoint, or any read surface beyond the repo.

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-36e7 --reason "<one-line evidence>"`, then commit everything.


🤖 Opened by warren run run_amh3vnqrmrcw

Add the core dispatch-context fact table (one row per dispatched run,
PK run_id CASCADE) across sqlite+postgres with generated migrations
(pg ENABLE ROW LEVEL SECURITY, unqualified runs FK). Register an
insert-only DispatchContextRepo and include both dispatch_context and
the previously missing tool_calls entry in the dialect drift walk.
@warren-auto-merge
warren-auto-merge Bot enabled auto-merge (squash) August 19, 2026 17:37
@warren-auto-merge
warren-auto-merge Bot merged commit e4652a4 into main Aug 19, 2026
8 checks passed
@warren-auto-merge
warren-auto-merge Bot deleted the warren/run_amh3vnqrmrcw branch August 19, 2026 17:38
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