Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(spend): migration-only spend columns, two handler seams, goldens
garrytan13a68de3b8d3
diff --git a/docs/architecture/key-files/core-minions-2.md b/docs/architecture/key-files/core-minions-2.mdindex 70e74e4bb3..db80ef0f60 100644--- a/docs/architecture/key-files/core-minions-2.md+++ b/docs/architecture/key-files/core-minions-2.md@@ -7,7 +7,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL- `src/core/minions/spawn-helpers.ts` — pure `detectTini()` + `buildSpawnInvocation()` consumed by both `supervisor.ts` and `autopilot.ts` (one implementation for both spawn sites; tini wrapping is testable without `mock.module()`, rule R2 of `scripts/check-test-isolation.sh`). `detectTini()` calls `execFileSync('which', ['tini'])` with explicit `env: process.env` so Bun sees runtime PATH mutations. `buildSpawnInvocation(tiniPath, cmd, args)` returns `{cmd, args}` with `tini -s --` prepended when present, or the bare invocation otherwise. Subreaper mode also serves job children; it does not imply PID 1 or containment of descendants that escape the process group. Pinned by `test/spawn-helpers.test.ts` (5) and `test/supervisor-tini.test.ts` (4).-- `src/core/minions/spend-authorization.ts` + `spend-record.ts` — submit-time spend authorization on queued paid jobs. `spend-record.ts` holds the stored shape (`version`, `kind` `authorized`/`legacy_default`, `group_id`, `of`, `cap_usd` or `uncapped`, `cap_source`, `via`, `command`, `est_usd`, `argv`, `authorized_at`), its strict parser and `spendBasis` (`authorized`, `legacy_default`, `unrecorded`, `invalid` with a `why`). `jobSpendAuthorization(auth, {command, est_usd, of, argv})` builds a group from a consent `Authorization`; `legacyDefaultClaimSetSql` is the claim's fence and legacy stamp. `runWithJobSpend(engine, job, ctx, handler)` runs at every handler seam (worker, `run-child`, inline drain): NULL rows run as before, uncapped records reserve nothing, capped records run under `withAIInvocationGuard` (nested) so each provider attempt reserves its maximum against `group:<id>` and settles measured usage. Settled exhaustion (or an unpriced model under a user cap) throws `SpendGroupRefusedError` (`derived_cap_exhausted`/`cost_cap_exceeded`/`no_pricing`, group amounts, rerun fix with twice the cap) and records it as `result.spend_refusal`; live-hold pressure throws `SpendGroupPressureError` (a lease release, at most `MAX_PRESSURE_RENEWALS` = 6, counted from `minion_lease_pressure_log`); unpriced models under derived/default caps warn and run. Every claimed paid job logs one `job_spend_basis` line. `spendSubmitSummary` prints the producer's group, kept authorizations (with `gbrain jobs cancel --group`) and reused rows; `groupJobs`/`jobGroupAmounts` back `jobs list --group`/`jobs cancel --group`/`jobs get`. Tests: `test/minions-spend-authorization.test.ts`, `test/minions-spend-authorization.serial.test.ts`, `test/minions-spend-enforcement-child.test.ts`.+- `src/core/minions/spend-authorization.ts` + `spend-record.ts` — submit-time spend authorization on queued paid jobs. `spend-record.ts` holds the stored shape (`version`, `kind` `authorized`/`legacy_default`, `group_id`, `of`, `cap_usd` or `uncapped`, `cap_source`, `via`, `command`, `est_usd`, `argv`, `authorized_at`), its strict parser and `spendBasis` (`authorized`, `legacy_default`, `unrecorded`, `invalid` with a `why`). `jobSpendAuthorization(auth, {command, est_usd, of, argv})` builds a group from a consent `Authorization`; `legacyDefaultClaimSetSql` is the claim's fence and legacy stamp. `runWithJobSpend(engine, job, ctx, handler)` runs at both handler seams (worker, `run-child`; the dream inline drain only claims private-queue subagents, which never carry an authorization): NULL rows run as before, uncapped records reserve nothing, capped records run under `withAIInvocationGuard` (nested) so each provider attempt reserves its maximum against `group:<id>` and settles measured usage. Settled exhaustion (or an unpriced model under a user cap) throws `SpendGroupRefusedError` (`derived_cap_exhausted`/`cost_cap_exceeded`/`no_pricing`, group amounts, rerun fix with twice the cap) and records it as `result.spend_refusal`; live-hold pressure throws `SpendGroupPressureError` (a lease release, at most `MAX_PRESSURE_RENEWALS` = 6, counted from `minion_lease_pressure_log`); unpriced models under derived/default caps warn and run. Every claimed paid job logs one `job_spend_basis` line. `spendSubmitSummary` prints the producer's group, kept authorizations (with `gbrain jobs cancel --group`) and reused rows; `groupJobs`/`jobGroupAmounts` back `jobs list --group`/`jobs cancel --group`/`jobs get`. Tests: `test/minions-spend-authorization.test.ts`, `test/minions-spend-authorization.serial.test.ts`, `test/minions-spend-enforcement-child.test.ts`.- `src/core/minions/submission-authority.ts` — versioned authority kept outside caller job data. Submission normalization and worker revalidation bind remote jobs to immutable principal/grant/source/payload ceilings; application authority preserves trusted internal work. `coalesceDecision(rawRow, authority)` is the one coalesce rule for all five `MinionQueue.add` coalesce paths (idempotency fast path, param coalescing, pending and waiting caps, insert race); rows are read with `LEGACY_AUTHORITY_COLUMN` so only SQL NULL authority gets the legacy rule (dead/cancelled keys released by a CAS update, completed/failed coalesce for application callers only, live rows refused with the `legacy_job_authority` catalogue error); `UNREVIEWED_LIVE_JOBS_WHERE` is the claim gate's predicate, shared with doctor `legacy_job_authority`. Tests: `test/minions-legacy-coalesce.test.ts` (PGLite) and `test/e2e/minions-legacy-coalesce-postgres.test.ts`, both over `test/helpers/legacy-coalesce-matrix.ts`. `src/core/minions/authorize-legacy.ts` provides explicit local preview and transactional snapshot comparison for selected historical rows: `--ids`, or `--select <filter>` whose preview saves the exact id set under a hash of the filter and the snapshot digest with `saveApprovedSet` (preview-approval helper) so `--expect <hash> --yes` authorizes exactly that set; every refusal is a catalogue error (`legacy_job_selection_invalid`, `legacy_jobs_active`, `preview_changed`). `src/core/minions/source-filesystem.ts` provides reentrant canonical root/worktree locking and descriptor-based confined reads/writes. Both worker modes enforce the same authority gate. Upgrade protocol: `docs/guides/authorization-upgrade.md`.- `src/core/minions/supervisor-pid.ts` — `readSupervisorPid(pidFile) → {pid, running}`: the shared `existsSync → readFileSync → parseInt → process.kill(pid,0)` PID-file + liveness reader shared by `jobs.ts` (supervisor status), `jobs.ts` (stats), and `doctor.ts`. EPERM from the liveness probe counts as running. Pinned by `test/supervisor-pid.test.ts`.diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 5366aa4630..95761036cc 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -9,7 +9,7 @@ src/commands/doctor.ts 667 ratchet +1 agent operator gate fixes: --probe consentsrc/commands/embed.ts 2219 ratchet +2 agent operator wave D2: --json failure envelope via writeCliError; lowered v0.46.26.0: embedBatchWithBackoff + retry cluster peeled to core/embed-retry.ts (core/commands layering fix); grown wave-g (#4530): per-model input-limit wiring; wave-k #3622 reimpl: --stale zero-progress failure quarantine; +29 #4668 (#4530): oversize-heal call sites in both --stale drains — kept low by peeling the healed-row remap to core/embed-oversize-heal.ts (shared with embed-stale.ts); +35 #4647 (refs #4599): per-tick timeout+abort on the single-flight lock heartbeat refresh (interval deliberately NOT unref'd); +122 refs #4599: stall-watchdog race around the drain + shared idempotent flushAndRelease + CLI stall exit mapping (watchdog machinery itself lives in core/embed-stall.ts); +12: adversarial-review hardening (healed_splits progress key + heal-tick comment); #5105: guarded derived projection preparation and read seals; #5105: conditional embedding installer wiring; archived eligibility: active-only dispatch with honest stranded-work reporting; explicit archived admission: live-source snapshots and honest refused-installation failures; +2 fw3: embed --stale --images dispatch (sweep lives in core/embed-stale-images.ts); +5 #5289: dry run reports restamp-only chunks apart from chunks to embed (count lives in core/embedding-invalidation.ts); +6 #4616: keep a partially refused batch in embedPageTexts and name the recovery command in failure samples (guard lives in core/ai/embedding-guard.ts); +5 #5226: embed summary counts distinct pages; +3 #5804: null projection snapshot counted as a failure with one batch summary in embed --stale; +18 wave 8 lane D1: #5527 mixed-space warning subtracts current-model chunks (+4), #5885 takes option/result fields and the stale-drain takes call (pass lives in core/embed-takes.ts); +9 Foundations 1 F4d: time-budget stop result fields, stdout verdict and stop recording in embed --stale (logic in core/embed-budget-stop.ts)src/commands/extract-conversation-facts.ts 2182 ratchet grown v0.46.x per-provider gateway-unavailable copy; grown wave-g (#4482): expected budget/deadline caps classified apart from error halts; wave-k: save-time resolution caller (#4052/#3729 — supersedes wave-g's per-row resolveEntitySlug mapper); +1: key-aware llm-fallback default (#3813); +1: pricingOverrides wiring into the owned BudgetTracker (#4633 adoption); +3: #4869 snapshot-mismatch counts as pages_failed; merged reliability/shared-skills source integration; +19: additive skip reasons and model-free dry-run (#5364); +21 #5757: managed extraction buffers a page's rows and replaces the prior batch in one coordinator transaction (replacement helper lives in core/persistence/derived-facts.ts); +18 #5823: result diagnostics, strict explicit-cap parsing and CLI recovery/help; default-cap decision lives in facts/conversation-budget.ts; +18 fix wave 7 (#5704, #5448): --json envelope on stdout (parser flag, help line, summary block gated behind the human-output branch)src/commands/extract.ts 2528 ratchet grown v0.46.26.0 megawave: FS-walk stamp snapshot + legacy timeline repair wiring (#3957 D4) + PR#4486 rebase onto current master; grown wave-g (#4542): --from-meetings zero-match warning + default-pass note; +29: #3478 federated-only gate on the cross-source 'default' link fallback; +44: #3908 cross_source opt-in — counted drops + deterministic cross-source pick; +36: #4611 configured-sources.default fallback (resolveLinkFallbackDefault); +14: #4890 extractStaleFromDB quiet opt + extractForSlugs jsonMode batch_error stderr fallback; +5: #4855 stroke-letter fold in link extraction; +5: #4793 by-mention scan honours link_resolution.cross_source; +18: wave review — ExtractOpts.quiet threaded through the fs-walk extractors (stdout silence decoupled from jsonMode); +77: shared buildSlugPathIndex — every per-slug extractor resolves the real on-disk path, and the sync hooks report which slugs they actually read; +10 #4999: includeFrontmatter default-resolved inside extractLinksForSlugs + extractStaleFromDB (resolveIncludeFrontmatter), --stale flag absent -> configured knob; +20: pre-landing review of #4967 — resolveSlugRelPath: index miss falls back to the legacy slug+'.md' path so admitted _-prefixed / include_hidden pages keep their edges; T2: source-qualified inference and atomic origin-scoped derived links; standard DB extraction fences captured endpoint revisions; shared authoritative attendance/source reconciliation moved to the core module; +7 A2 preview-bound attendance repair import, help and authority dispatch; bounded incomplete-attendance diagnostics and consistent basename resolution; fail closed before graph mutation when active ontology is unavailable; +16 source-selected ontology cache, type-scoped preflight and non-starving failed stale drain; +7 write-path wave: per-slug extractors replace page links + retract removed timeline rows + rename-alias resolution; +5 fw3 derived-sync: timeline --prune-orphans CLI (#4649) and full-walk page link replacement; +13 fw3 A16/A15: sync link hook reads scoped page metadata and reports per-page extraction errors; +1 fw3 managed-lifecycle: extract --stale dispatches managed brains to the coordinator-safe path; +4 fw3 integration: managed brains refuse the direct timeline orphan prune; +26 #5609: managed extract --stale publishes links, canonical timeline and watermark per page in one coordinated transaction; fix wave 3 x fix wave 2 (v0.60.5.0) composition: +4 at the merge; +6 fix wave 3 lane B: a managed brain routes the extract phase file walk through extractManagedStaleLinks instead of the refused raw timeline batch, keeping the extract.links_fs progress phase; +6 #5761: the unmanaged extract --stale sweep marks unresolved-attendance skips attendance-blocked; +2 eval-wave N9-3/N12-7: a page-type-bound pack attended rule defers to canonical attendance on the filesystem path (ownsAttendanceInference); lowered to 2528 #5904: the DB timeline walk moved to commands/extract-timeline-db.ts (coordinated publication on managed brains, honest refusal + non-zero exit)-src/commands/jobs.ts 661 ratchet +1 spend authorization: jobs submit --yes/--max-usd help line; refactor wave 1 split target (W4 jobs, cut line); ceiling rationale: docs/architecture/key-files/commands-4.md entry for src/commands/jobs.ts; help lines: authorize-legacy --select (#5157 T3) and jobs cancel --select (DX-T2); submit --queue-only + PGLite work drain note (agent-first operator wave E5)+src/commands/jobs.ts 662 ratchet +2 spend authorization: jobs submit --yes/--max-usd and jobs list --group help lines; refactor wave 1 split target (W4 jobs, cut line); ceiling rationale: docs/architecture/key-files/commands-4.md entry for src/commands/jobs.ts; help lines: authorize-legacy --select (#5157 T3) and jobs cancel --select (DX-T2); submit --queue-only + PGLite work drain note (agent-first operator wave E5)src/commands/serve-http.ts 921 ratchet refactor wave 1 W4 split into serve-http-<area>.ts modules; ceiling rationale: docs/architecture/key-files/commands-5.md entry for src/commands/serve-http.ts; +2 agent operator wave A6: ServeHttpContext.noticeLedger (import + field; logic in core/notice-ledger.ts); +2 agent contract F1/F2: ServeHttpContext.readinessCache (probed readiness for initialize tails + gbrain://capabilities); +2 agent-operator follow-up Item 3: ServeHttpOptions.adoptServer (status-only recovery hands its bound listener to listenOrRefuse; logic in serve-http-status.ts)src/core/ai/gateway.ts 4407 ratchet +7 fix wave 5 (#5137): provider-key redactor on every upstream error path and the first embedding 401/403 report (logic in ai/key-redact.ts, ai/key-warnings.ts); +20 System One v1: decide() delegating export + transport seam, RerankInput.onMeta/RerankMeta, TypeSafe reranker delegation to ai/decide/rerank-adapter.ts; +3 #5585: reconfigureGatewayWithEngine records expansion/chat model provenance (ai/gateway-model-sources.ts) + clears it with gateway state; lowered #5585: tracker record sites collapsed onto ai/budget-record.ts (recordOnTracker + failedCallUsage) while adding ledger fields (requested model, purpose, failed, estimated, countsAsCall); +20: schema-rejection fallback in chat() (retry once schemaless on a json_schema 4xx, remember the recipe for the process — mirrors expand()); re-summed after merging master v0.50.0.0 with the wave (structured-output + pricing hunks); +48: #4863 ChatOpts.responseSchema → tolerant json_schema Output on the chat() generateText call for openai-compatible recipes that declare structured outputs (facts extraction on Ollama); +74: #3657 post-sunset rerank short-circuit (effective-model check, once-per-process audit row + stderr, injected-clock seam); grown v0.46.26.0 megawave: config-plane probes + halt telemetry (#3387 #4312); +21 lines (OpenAI Responses API reasoning-item echo: ChatBlock 'reasoning' variant, chat()/toModelMessages() round-trip); wave-k absorbs: OCR routing seam (#4107 class), config-snapshot reader block (#3980); +21: #4107 OCR-model routing (getImageOcrModel); +10: keyless OPENAI_BASE_URL embedding override (#4385); wave-k #3622 reimpl: GBRAIN_EMBED_MAX_BATCH_TOKENS env cap for no_batch_cap recipes; +9: DeepSeek judge thinking pin plumbed through chat opts (#4069); +master v0.48 merge true-up (reranker succession: no_key preflight, reranker_skipped stage, readiness); ranker wave v0.48.4.0: ChatOpts.temperature threaded to the transport (+15); +24: #4172 recipe-declared thinking headroom on the chat()/toolLoop() default — shared isThinkingModel predicate (Claude-5 regex || recipe thinking_by_default, fail-closed), also consumed by the subagent handler; +20: #4861 claude-cli expansion routed to the schemaless viaText path (the CLI adapter ignores responseFormat, so the native generateObject branch had no fallback); retired provider integration removed; safety wave: migration reranker input ceilings; lowered by fix wave 3 #5680 (embed request planning peeled to ai/embed-batch-plan.ts); +5 #4616: empty inputs skip the provider and every text/multimodal result is screened for zero-norm/NaN/Inf vectors (logic lives in ai/embedding-guard.ts); fix wave 3 integration: #4616 empty-input filtering feeds the shared #5680 batch planner; +3 #5691: embedQuery takes a per-request queryPrefix (no gateway state); +26 fix wave 7 (#5642): embed spend records bank provider-reported usage.tokens (all sub-batches reported → measured; chars-per-token estimate stays the fallback and the failure charge); +2 #5892: import + load-time call of installAiSdkWarningWriter (writer lives in ai/sdk-warnings.ts); +12 #5490: chat() delegation to ai/chat-fallback.ts when chat_fallback_chain is set (attempt loop lives there), ChatOpts.allowFallback + ToolLoopOpts.allowFallback fields and the toolLoop forward; +2 #5490 review: ChatResult.fallbackFrom (the call model a chat_fallback_chain answer replaced)src/commands/sync.ts 510 ratchet refactor wave 1 split target (W4 sync); ceiling rationale: docs/architecture/key-files/commands-6.md entry for src/commands/sync.ts; +2 for the #5751 SyncResult.legacySkips interface field (fix wave 4); +2 fix wave 4 lane B: SyncResult.connectorHolds interface field (held counts for the sync summary); +1 fix wave 5 (#5032): SyncResult.fileRefusals interface field (named per-file Windows colon refusals); +13 #5984: SyncResult.drain / managedCursor and SyncOpts.drain / drainStartedAt interface fields (drain loop lives in persistence/sync-drain.ts); +1 #5984: SyncOpts.noBulk / bulk interface fields; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (510 measured)diff --git a/src/commands/jobs.ts b/src/commands/jobs.tsindex 2a28b93ad9..261a8faa17 100644--- a/src/commands/jobs.ts+++ b/src/commands/jobs.ts@@ -165,7 +165,8 @@ USAGE[--yes] [--max-usd USD|off] (enrich, subagent: paid)[--redact-secrets] (shell only; scrubs inheritvalues from stdout/stderr)- gbrain jobs list [--status S] [--queue Q] [--limit N] [--group SPEND_GROUP] [--json]+ gbrain jobs list [--status S] [--queue Q] [--limit N] [--json]+ gbrain jobs list --group SPEND_GROUP [--json]gbrain jobs get <id> [--json]gbrain jobs cancel <id> | --group SPEND_GROUPgbrain jobs cancel --select "status=waiting|paused,name=synthesize" [--expect <hash> --yes] [--json]diff --git a/src/core/cycle/inline-drain.ts b/src/core/cycle/inline-drain.tsindex d4b53f655b..f24d805dd0 100644--- a/src/core/cycle/inline-drain.ts+++ b/src/core/cycle/inline-drain.ts@@ -42,7 +42,6 @@ import { makeSubagentHandler } from '../minions/handlers/subagent.ts';import { RateLeaseUnavailableError, leaseFullBackoffMs } from '../minions/rate-leases.ts';import { reconnectAfterConnectionError } from '../minions/reconnect.ts';import { withChatPhase } from '../ai/chat-usage.ts';-import { runWithJobSpend } from '../minions/spend-authorization.ts';import { isRetryableConnError } from '../retry-matcher.ts';import { anySignal, throwIfAborted } from '../abort-check.ts';import { CYCLE_DEADLINE_RESERVE_MS } from './base-phase.ts';@@ -365,7 +364,7 @@ async function drainLoop(// work (e.g. dream synthesize) would silently absorb every child's// spend into the phase tag, breaking the one-ledger-per-surface rule// the phase telemetry depends on.- result = await withChatPhase(`job:${job.name}`, () => runWithJobSpend(engine, job, context, handler));+ result = await withChatPhase(`job:${job.name}`, () => handler(context));handlerRan = true;} catch (e) {handlerErr = e;diff --git a/src/core/engine-sql/bootstrap.ts b/src/core/engine-sql/bootstrap.tsindex 15783c597a..feddb1cdaa 100644--- a/src/core/engine-sql/bootstrap.ts+++ b/src/core/engine-sql/bootstrap.ts@@ -166,8 +166,6 @@ const FORWARD_REFERENCE_PROBES: readonly Probe[] = [['minion_jobs_pq_lease_exists', 'minion_jobs', 'private_queue_lease_until'],['minion_jobs_submission_authority_exists', 'minion_jobs', 'submission_authority'],['minion_jobs_claim_generation_exists', 'minion_jobs', 'claim_generation'],- ['minion_jobs_spend_authorization_exists', 'minion_jobs', 'spend_authorization'],- ['minion_jobs_spend_claim_token_exists', 'minion_jobs', 'spend_claim_token'],['facts_exists', 'facts'],['facts_embedding_model_exists', 'facts', 'embedding_model'],['facts_embedded_text_hash_exists', 'facts', 'embedded_text_hash'],@@ -299,12 +297,10 @@ export function forwardReferenceGaps(probe: ProbeRow, dialect: ForwardReferenceBconst needsMinionJobsPrivateQueue = probe.minion_jobs_exists&& (!probe.minion_jobs_pq_owner_exists || !probe.minion_jobs_pq_token_exists|| !probe.minion_jobs_pq_lease_exists);- // v149/v204: the schema-blob queue protocol references these fields and the- // blob indexes the spend group. Repair any missing field without assigning- // authority to historical work.+ // v149: the schema-blob queue protocol references both fields. Repair either+ // missing field without assigning authority to historical work.const needsMinionJobsAuthority = probe.minion_jobs_exists- && (!probe.minion_jobs_submission_authority_exists || !probe.minion_jobs_claim_generation_exists- || !probe.minion_jobs_spend_authorization_exists || !probe.minion_jobs_spend_claim_token_exists);+ && (!probe.minion_jobs_submission_authority_exists || !probe.minion_jobs_claim_generation_exists);// v143 (dream_verdicts_ttl, #4657): the Postgres blob index// dream_verdicts_expires_idx references expires_at, but the column only// lands via migration v143 — a Postgres brain at schema v30-v142@@ -719,8 +715,6 @@ async function applyLaterColumnGaps(target: ForwardReferenceBootstrapTarget, gapawait exec(`ALTER TABLE minion_jobs ADD COLUMN IF NOT EXISTS submission_authority JSONB;ALTER TABLE minion_jobs ADD COLUMN IF NOT EXISTS claim_generation BIGINT NOT NULL DEFAULT 0;- ALTER TABLE minion_jobs ADD COLUMN IF NOT EXISTS spend_authorization JSONB;- ALTER TABLE minion_jobs ADD COLUMN IF NOT EXISTS spend_claim_token BIGINT;`);}}diff --git a/src/core/pglite-schema.generated.ts b/src/core/pglite-schema.generated.tsindex 02a9f6772e..ba3350c493 100644--- a/src/core/pglite-schema.generated.ts+++ b/src/core/pglite-schema.generated.ts@@ -596,8 +596,6 @@ CREATE TABLE IF NOT EXISTS minion_jobs (priority INTEGER NOT NULL DEFAULT 0,submission_authority JSONB,claim_generation BIGINT NOT NULL DEFAULT 0,- spend_authorization JSONB,- spend_claim_token BIGINT,data JSONB NOT NULL DEFAULT '{}',max_attempts INTEGER NOT NULL DEFAULT 3,attempts_made INTEGER NOT NULL DEFAULT 0,@@ -653,7 +651,6 @@ CREATE INDEX IF NOT EXISTS idx_minion_jobs_delayed ON minion_jobs (delay_until)CREATE INDEX IF NOT EXISTS idx_minion_jobs_parent ON minion_jobs(parent_job_id);CREATE INDEX IF NOT EXISTS idx_minion_jobs_timeout ON minion_jobs (timeout_at) WHERE status = 'active' AND timeout_at IS NOT NULL;CREATE INDEX IF NOT EXISTS idx_minion_jobs_parent_status ON minion_jobs (parent_job_id, status) WHERE parent_job_id IS NOT NULL;-CREATE INDEX IF NOT EXISTS idx_minion_jobs_spend_group ON minion_jobs ((spend_authorization->>'group_id')) WHERE spend_authorization IS NOT NULL;CREATE UNIQUE INDEX IF NOT EXISTS uniq_minion_jobs_idempotency ON minion_jobs (idempotency_key) WHERE idempotency_key IS NOT NULL;CREATE INDEX IF NOT EXISTS idx_minion_jobs_queue_status_updated ON minion_jobs (queue, status, updated_at);CREATE INDEX IF NOT EXISTS idx_minion_jobs_private_queue_recoverydiff --git a/src/core/schema-embedded.generated.ts b/src/core/schema-embedded.generated.tsindex 82d8044148..6f95ca4b5f 100644--- a/src/core/schema-embedded.generated.ts+++ b/src/core/schema-embedded.generated.ts@@ -1072,8 +1072,6 @@ CREATE TABLE IF NOT EXISTS minion_jobs (priority INTEGER NOT NULL DEFAULT 0,submission_authority JSONB, -- NULL legacy rows require local authorization before workers startclaim_generation BIGINT NOT NULL DEFAULT 0, -- advanced atomically by protocol-aware claims- spend_authorization JSONB, -- submit-time consent record of a paid producer; never read from data- spend_claim_token BIGINT, -- per-acquisition fence: spend-aware claims set it to the new claim_generationdata JSONB NOT NULL DEFAULT '{}',max_attempts INTEGER NOT NULL DEFAULT 3,attempts_made INTEGER NOT NULL DEFAULT 0,@@ -1129,7 +1127,6 @@ CREATE INDEX IF NOT EXISTS idx_minion_jobs_delayed ON minion_jobs (delay_until)CREATE INDEX IF NOT EXISTS idx_minion_jobs_parent ON minion_jobs(parent_job_id);CREATE INDEX IF NOT EXISTS idx_minion_jobs_timeout ON minion_jobs (timeout_at) WHERE status = 'active' AND timeout_at IS NOT NULL;CREATE INDEX IF NOT EXISTS idx_minion_jobs_parent_status ON minion_jobs (parent_job_id, status) WHERE parent_job_id IS NOT NULL;-CREATE INDEX IF NOT EXISTS idx_minion_jobs_spend_group ON minion_jobs ((spend_authorization->>'group_id')) WHERE spend_authorization IS NOT NULL;CREATE UNIQUE INDEX IF NOT EXISTS uniq_minion_jobs_idempotency ON minion_jobs (idempotency_key) WHERE idempotency_key IS NOT NULL;-- WP4/WP5 (v127, ENG-10): wedge-signal index — covers the queue-health count-- FILTERs and max(updated_at) reads in queryWedgeSignals (supervisor.ts).diff --git a/src/schema.sql b/src/schema.sqlindex 24b8ce7c84..8865ab2778 100644--- a/src/schema.sql+++ b/src/schema.sql@@ -1068,8 +1068,6 @@ CREATE TABLE IF NOT EXISTS minion_jobs (priority INTEGER NOT NULL DEFAULT 0,submission_authority JSONB, -- NULL legacy rows require local authorization before workers startclaim_generation BIGINT NOT NULL DEFAULT 0, -- advanced atomically by protocol-aware claims- spend_authorization JSONB, -- submit-time consent record of a paid producer; never read from data- spend_claim_token BIGINT, -- per-acquisition fence: spend-aware claims set it to the new claim_generationdata JSONB NOT NULL DEFAULT '{}',max_attempts INTEGER NOT NULL DEFAULT 3,attempts_made INTEGER NOT NULL DEFAULT 0,@@ -1125,7 +1123,6 @@ CREATE INDEX IF NOT EXISTS idx_minion_jobs_delayed ON minion_jobs (delay_until)CREATE INDEX IF NOT EXISTS idx_minion_jobs_parent ON minion_jobs(parent_job_id);CREATE INDEX IF NOT EXISTS idx_minion_jobs_timeout ON minion_jobs (timeout_at) WHERE status = 'active' AND timeout_at IS NOT NULL;CREATE INDEX IF NOT EXISTS idx_minion_jobs_parent_status ON minion_jobs (parent_job_id, status) WHERE parent_job_id IS NOT NULL;-CREATE INDEX IF NOT EXISTS idx_minion_jobs_spend_group ON minion_jobs ((spend_authorization->>'group_id')) WHERE spend_authorization IS NOT NULL;CREATE UNIQUE INDEX IF NOT EXISTS uniq_minion_jobs_idempotency ON minion_jobs (idempotency_key) WHERE idempotency_key IS NOT NULL;-- WP4/WP5 (v127, ENG-10): wedge-signal index — covers the queue-health count-- FILTERs and max(updated_at) reads in queryWedgeSignals (supervisor.ts).diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.jsonindex 2890c3db77..0c7f0f93cf 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json@@ -1819,49 +1819,49 @@"5 priority integer/int4 NOT NULL DEFAULT 0","6 submission_authority jsonb/jsonb NULL","7 claim_generation bigint/int8 NOT NULL DEFAULT 0",- "8 spend_authorization jsonb/jsonb NULL",- "9 spend_claim_token bigint/int8 NULL",- "10 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",- "11 max_attempts integer/int4 NOT NULL DEFAULT 3",- "12 attempts_made integer/int4 NOT NULL DEFAULT 0",- "13 attempts_started integer/int4 NOT NULL DEFAULT 0",- "14 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",- "15 backoff_delay integer/int4 NOT NULL DEFAULT 1000",- "16 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",- "17 stalled_counter integer/int4 NOT NULL DEFAULT 0",- "18 max_stalled integer/int4 NOT NULL DEFAULT 5",- "19 lock_token text/text NULL",- "20 lock_until timestamp with time zone/timestamptz NULL",- "21 delay_until timestamp with time zone/timestamptz NULL",- "22 parent_job_id integer/int4 NULL",- "23 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",- "24 tokens_input integer/int4 NOT NULL DEFAULT 0",- "25 tokens_output integer/int4 NOT NULL DEFAULT 0",- "26 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",- "27 depth integer/int4 NOT NULL DEFAULT 0",- "28 max_children integer/int4 NULL",- "29 timeout_ms integer/int4 NULL",- "30 lock_duration_ms integer/int4 NULL",- "31 timeout_at timestamp with time zone/timestamptz NULL",- "32 remove_on_complete boolean/bool NOT NULL DEFAULT false",- "33 remove_on_fail boolean/bool NOT NULL DEFAULT false",- "34 idempotency_key text/text NULL",- "35 private_queue_owner_job_id integer/int4 NULL",- "36 private_queue_owner_token text/text NULL",- "37 private_queue_lease_until timestamp with time zone/timestamptz NULL",- "38 result jsonb/jsonb NULL",- "39 progress jsonb/jsonb NULL",- "40 error_text text/text NULL",- "41 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",- "42 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",- "43 started_at timestamp with time zone/timestamptz NULL",- "44 finished_at timestamp with time zone/timestamptz NULL",- "45 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",- "46 quiet_hours jsonb/jsonb NULL",- "47 stagger_key text/text NULL",- "48 budget_remaining_cents integer/int4 NULL",- "49 budget_owner_job_id bigint/int8 NULL",- "50 budget_root_owner_id bigint/int8 NULL"+ "8 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "9 max_attempts integer/int4 NOT NULL DEFAULT 3",+ "10 attempts_made integer/int4 NOT NULL DEFAULT 0",+ "11 attempts_started integer/int4 NOT NULL DEFAULT 0",+ "12 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",+ "13 backoff_delay integer/int4 NOT NULL DEFAULT 1000",+ "14 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",+ "15 stalled_counter integer/int4 NOT NULL DEFAULT 0",+ "16 max_stalled integer/int4 NOT NULL DEFAULT 5",+ "17 lock_token text/text NULL",+ "18 lock_until timestamp with time zone/timestamptz NULL",+ "19 delay_until timestamp with time zone/timestamptz NULL",+ "20 parent_job_id integer/int4 NULL",+ "21 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",+ "22 tokens_input integer/int4 NOT NULL DEFAULT 0",+ "23 tokens_output integer/int4 NOT NULL DEFAULT 0",+ "24 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",+ "25 depth integer/int4 NOT NULL DEFAULT 0",+ "26 max_children integer/int4 NULL",+ "27 timeout_ms integer/int4 NULL",+ "28 lock_duration_ms integer/int4 NULL",+ "29 timeout_at timestamp with time zone/timestamptz NULL",+ "30 remove_on_complete boolean/bool NOT NULL DEFAULT false",+ "31 remove_on_fail boolean/bool NOT NULL DEFAULT false",+ "32 idempotency_key text/text NULL",+ "33 private_queue_owner_job_id integer/int4 NULL",+ "34 private_queue_owner_token text/text NULL",+ "35 private_queue_lease_until timestamp with time zone/timestamptz NULL",+ "36 result jsonb/jsonb NULL",+ "37 progress jsonb/jsonb NULL",+ "38 error_text text/text NULL",+ "39 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",+ "40 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "41 started_at timestamp with time zone/timestamptz NULL",+ "42 finished_at timestamp with time zone/timestamptz NULL",+ "43 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "44 quiet_hours jsonb/jsonb NULL",+ "45 stagger_key text/text NULL",+ "46 budget_remaining_cents integer/int4 NULL",+ "47 budget_owner_job_id bigint/int8 NULL",+ "48 budget_root_owner_id bigint/int8 NULL",+ "49 spend_authorization jsonb/jsonb NULL",+ "50 spend_claim_token bigint/int8 NULL"],"flags": "relkind=r rls=false force_rls=false"},diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.jsonindex 36bcbd26ba..26676b205d 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json@@ -1819,49 +1819,49 @@"5 priority integer/int4 NOT NULL DEFAULT 0","6 submission_authority jsonb/jsonb NULL","7 claim_generation bigint/int8 NOT NULL DEFAULT 0",- "8 spend_authorization jsonb/jsonb NULL",- "9 spend_claim_token bigint/int8 NULL",- "10 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",- "11 max_attempts integer/int4 NOT NULL DEFAULT 3",- "12 attempts_made integer/int4 NOT NULL DEFAULT 0",- "13 attempts_started integer/int4 NOT NULL DEFAULT 0",- "14 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",- "15 backoff_delay integer/int4 NOT NULL DEFAULT 1000",- "16 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",- "17 stalled_counter integer/int4 NOT NULL DEFAULT 0",- "18 max_stalled integer/int4 NOT NULL DEFAULT 5",- "19 lock_token text/text NULL",- "20 lock_until timestamp with time zone/timestamptz NULL",- "21 delay_until timestamp with time zone/timestamptz NULL",- "22 parent_job_id integer/int4 NULL",- "23 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",- "24 tokens_input integer/int4 NOT NULL DEFAULT 0",- "25 tokens_output integer/int4 NOT NULL DEFAULT 0",- "26 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",- "27 depth integer/int4 NOT NULL DEFAULT 0",- "28 max_children integer/int4 NULL",- "29 timeout_ms integer/int4 NULL",- "30 lock_duration_ms integer/int4 NULL",- "31 timeout_at timestamp with time zone/timestamptz NULL",- "32 remove_on_complete boolean/bool NOT NULL DEFAULT false",- "33 remove_on_fail boolean/bool NOT NULL DEFAULT false",- "34 idempotency_key text/text NULL",- "35 private_queue_owner_job_id integer/int4 NULL",- "36 private_queue_owner_token text/text NULL",- "37 private_queue_lease_until timestamp with time zone/timestamptz NULL",- "38 result jsonb/jsonb NULL",- "39 progress jsonb/jsonb NULL",- "40 error_text text/text NULL",- "41 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",- "42 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",- "43 started_at timestamp with time zone/timestamptz NULL",- "44 finished_at timestamp with time zone/timestamptz NULL",- "45 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",- "46 quiet_hours jsonb/jsonb NULL",- "47 stagger_key text/text NULL",- "48 budget_remaining_cents integer/int4 NULL",- "49 budget_owner_job_id bigint/int8 NULL",- "50 budget_root_owner_id bigint/int8 NULL"+ "8 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "9 max_attempts integer/int4 NOT NULL DEFAULT 3",+ "10 attempts_made integer/int4 NOT NULL DEFAULT 0",+ "11 attempts_started integer/int4 NOT NULL DEFAULT 0",+ "12 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",+ "13 backoff_delay integer/int4 NOT NULL DEFAULT 1000",+ "14 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",+ "15 stalled_counter integer/int4 NOT NULL DEFAULT 0",+ "16 max_stalled integer/int4 NOT NULL DEFAULT 5",+ "17 lock_token text/text NULL",+ "18 lock_until timestamp with time zone/timestamptz NULL",+ "19 delay_until timestamp with time zone/timestamptz NULL",+ "20 parent_job_id integer/int4 NULL",+ "21 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",+ "22 tokens_input integer/int4 NOT NULL DEFAULT 0",+ "23 tokens_output integer/int4 NOT NULL DEFAULT 0",+ "24 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",+ "25 depth integer/int4 NOT NULL DEFAULT 0",+ "26 max_children integer/int4 NULL",+ "27 timeout_ms integer/int4 NULL",+ "28 lock_duration_ms integer/int4 NULL",+ "29 timeout_at timestamp with time zone/timestamptz NULL",+ "30 remove_on_complete boolean/bool NOT NULL DEFAULT false",+ "31 remove_on_fail boolean/bool NOT NULL DEFAULT false",+ "32 idempotency_key text/text NULL",+ "33 private_queue_owner_job_id integer/int4 NULL",+ "34 private_queue_owner_token text/text NULL",+ "35 private_queue_lease_until timestamp with time zone/timestamptz NULL",+ "36 result jsonb/jsonb NULL",+ "37 progress jsonb/jsonb NULL",+ "38 error_text text/text NULL",+ "39 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",+ "40 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "41 started_at timestamp with time zone/timestamptz NULL",+ "42 finished_at timestamp with time zone/timestamptz NULL",+ "43 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "44 quiet_hours jsonb/jsonb NULL",+ "45 stagger_key text/text NULL",+ "46 budget_remaining_cents integer/int4 NULL",+ "47 budget_owner_job_id bigint/int8 NULL",+ "48 budget_root_owner_id bigint/int8 NULL",+ "49 spend_authorization jsonb/jsonb NULL",+ "50 spend_claim_token bigint/int8 NULL"],"flags": "relkind=r rls=false force_rls=false"},diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.jsonindex 56beff620b..d83d83058c 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json@@ -1815,49 +1815,49 @@"5 priority integer/int4 NOT NULL DEFAULT 0","6 submission_authority jsonb/jsonb NULL","7 claim_generation bigint/int8 NOT NULL DEFAULT 0",- "8 spend_authorization jsonb/jsonb NULL",- "9 spend_claim_token bigint/int8 NULL",- "10 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",- "11 max_attempts integer/int4 NOT NULL DEFAULT 3",- "12 attempts_made integer/int4 NOT NULL DEFAULT 0",- "13 attempts_started integer/int4 NOT NULL DEFAULT 0",- "14 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",- "15 backoff_delay integer/int4 NOT NULL DEFAULT 1000",- "16 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",- "17 stalled_counter integer/int4 NOT NULL DEFAULT 0",- "18 max_stalled integer/int4 NOT NULL DEFAULT 5",- "19 lock_token text/text NULL",- "20 lock_until timestamp with time zone/timestamptz NULL",- "21 delay_until timestamp with time zone/timestamptz NULL",- "22 parent_job_id integer/int4 NULL",- "23 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",- "24 tokens_input integer/int4 NOT NULL DEFAULT 0",- "25 tokens_output integer/int4 NOT NULL DEFAULT 0",- "26 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",- "27 depth integer/int4 NOT NULL DEFAULT 0",- "28 max_children integer/int4 NULL",- "29 timeout_ms integer/int4 NULL",- "30 lock_duration_ms integer/int4 NULL",- "31 timeout_at timestamp with time zone/timestamptz NULL",- "32 remove_on_complete boolean/bool NOT NULL DEFAULT false",- "33 remove_on_fail boolean/bool NOT NULL DEFAULT false",- "34 idempotency_key text/text NULL",- "35 private_queue_owner_job_id integer/int4 NULL",- "36 private_queue_owner_token text/text NULL",- "37 private_queue_lease_until timestamp with time zone/timestamptz NULL",- "38 result jsonb/jsonb NULL",- "39 progress jsonb/jsonb NULL",- "40 error_text text/text NULL",- "41 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",- "42 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",- "43 started_at timestamp with time zone/timestamptz NULL",- "44 finished_at timestamp with time zone/timestamptz NULL",- "45 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",- "46 quiet_hours jsonb/jsonb NULL",- "47 stagger_key text/text NULL",- "48 budget_remaining_cents integer/int4 NULL",- "49 budget_owner_job_id bigint/int8 NULL",- "50 budget_root_owner_id bigint/int8 NULL"+ "8 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "9 max_attempts integer/int4 NOT NULL DEFAULT 3",+ "10 attempts_made integer/int4 NOT NULL DEFAULT 0",+ "11 attempts_started integer/int4 NOT NULL DEFAULT 0",+ "12 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",+ "13 backoff_delay integer/int4 NOT NULL DEFAULT 1000",+ "14 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",+ "15 stalled_counter integer/int4 NOT NULL DEFAULT 0",+ "16 max_stalled integer/int4 NOT NULL DEFAULT 5",+ "17 lock_token text/text NULL",+ "18 lock_until timestamp with time zone/timestamptz NULL",+ "19 delay_until timestamp with time zone/timestamptz NULL",+ "20 parent_job_id integer/int4 NULL",+ "21 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",+ "22 tokens_input integer/int4 NOT NULL DEFAULT 0",+ "23 tokens_output integer/int4 NOT NULL DEFAULT 0",+ "24 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",+ "25 depth integer/int4 NOT NULL DEFAULT 0",+ "26 max_children integer/int4 NULL",+ "27 timeout_ms integer/int4 NULL",+ "28 lock_duration_ms integer/int4 NULL",+ "29 timeout_at timestamp with time zone/timestamptz NULL",+ "30 remove_on_complete boolean/bool NOT NULL DEFAULT false",+ "31 remove_on_fail boolean/bool NOT NULL DEFAULT false",+ "32 idempotency_key text/text NULL",+ "33 private_queue_owner_job_id integer/int4 NULL",+ "34 private_queue_owner_token text/text NULL",+ "35 private_queue_lease_until timestamp with time zone/timestamptz NULL",+ "36 result jsonb/jsonb NULL",+ "37 progress jsonb/jsonb NULL",+ "38 error_text text/text NULL",+ "39 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",+ "40 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "41 started_at timestamp with time zone/timestamptz NULL",+ "42 finished_at timestamp with time zone/timestamptz NULL",+ "43 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "44 quiet_hours jsonb/jsonb NULL",+ "45 stagger_key text/text NULL",+ "46 budget_remaining_cents integer/int4 NULL",+ "47 budget_owner_job_id bigint/int8 NULL",+ "48 budget_root_owner_id bigint/int8 NULL",+ "49 spend_authorization jsonb/jsonb NULL",+ "50 spend_claim_token bigint/int8 NULL"],"flags": "relkind=r rls=false force_rls=false"},diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json b/test/fixtures/goldens/catalog/pglite-schema-blob-default.jsonindex 3cdfb7edb8..8ab27cc209 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-default.json@@ -587,7 +587,6 @@"idx_minion_jobs_private_queue_owner": "CREATE INDEX idx_minion_jobs_private_queue_owner ON public.minion_jobs USING btree (private_queue_owner_job_id) WHERE (private_queue_owner_job_id IS NOT NULL)","idx_minion_jobs_private_queue_recovery": "CREATE INDEX idx_minion_jobs_private_queue_recovery ON public.minion_jobs USING btree (queue, private_queue_lease_until) WHERE ((queue ~~ 'dream-inline-%'::text) AND (status = ANY (ARRAY['waiting'::text, 'active'::text, 'delayed'::text, 'waiting-children'::text, 'paused'::text])))","idx_minion_jobs_queue_status_updated": "CREATE INDEX idx_minion_jobs_queue_status_updated ON public.minion_jobs USING btree (queue, status, updated_at)",- "idx_minion_jobs_spend_group": "CREATE INDEX idx_minion_jobs_spend_group ON public.minion_jobs USING btree (((spend_authorization ->> 'group_id'::text))) WHERE (spend_authorization IS NOT NULL)","idx_minion_jobs_stalled": "CREATE INDEX idx_minion_jobs_stalled ON public.minion_jobs USING btree (lock_until) WHERE (status = 'active'::text)","idx_minion_jobs_status": "CREATE INDEX idx_minion_jobs_status ON public.minion_jobs USING btree (status)","idx_minion_jobs_timeout": "CREATE INDEX idx_minion_jobs_timeout ON public.minion_jobs USING btree (timeout_at) WHERE ((status = 'active'::text) AND (timeout_at IS NOT NULL))",@@ -1308,44 +1307,42 @@"5 priority integer/int4 NOT NULL DEFAULT 0","6 submission_authority jsonb/jsonb NULL","7 claim_generation bigint/int8 NOT NULL DEFAULT 0",- "8 spend_authorization jsonb/jsonb NULL",- "9 spend_claim_token bigint/int8 NULL",- "10 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",- "11 max_attempts integer/int4 NOT NULL DEFAULT 3",- "12 attempts_made integer/int4 NOT NULL DEFAULT 0",- "13 attempts_started integer/int4 NOT NULL DEFAULT 0",- "14 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",- "15 backoff_delay integer/int4 NOT NULL DEFAULT 1000",- "16 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",- "17 stalled_counter integer/int4 NOT NULL DEFAULT 0",- "18 max_stalled integer/int4 NOT NULL DEFAULT 5",- "19 lock_token text/text NULL",- "20 lock_until timestamp with time zone/timestamptz NULL",- "21 delay_until timestamp with time zone/timestamptz NULL",- "22 parent_job_id integer/int4 NULL",- "23 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",- "24 tokens_input integer/int4 NOT NULL DEFAULT 0",- "25 tokens_output integer/int4 NOT NULL DEFAULT 0",- "26 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",- "27 depth integer/int4 NOT NULL DEFAULT 0",- "28 max_children integer/int4 NULL",- "29 timeout_ms integer/int4 NULL",- "30 lock_duration_ms integer/int4 NULL",- "31 timeout_at timestamp with time zone/timestamptz NULL",- "32 remove_on_complete boolean/bool NOT NULL DEFAULT false",- "33 remove_on_fail boolean/bool NOT NULL DEFAULT false",- "34 idempotency_key text/text NULL",- "35 private_queue_owner_job_id integer/int4 NULL",- "36 private_queue_owner_token text/text NULL",- "37 private_queue_lease_until timestamp with time zone/timestamptz NULL",- "38 result jsonb/jsonb NULL",- "39 progress jsonb/jsonb NULL",- "40 error_text text/text NULL",- "41 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",- "42 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",- "43 started_at timestamp with time zone/timestamptz NULL",- "44 finished_at timestamp with time zone/timestamptz NULL",- "45 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "9 max_attempts integer/int4 NOT NULL DEFAULT 3",+ "10 attempts_made integer/int4 NOT NULL DEFAULT 0",+ "11 attempts_started integer/int4 NOT NULL DEFAULT 0",+ "12 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",+ "13 backoff_delay integer/int4 NOT NULL DEFAULT 1000",+ "14 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",+ "15 stalled_counter integer/int4 NOT NULL DEFAULT 0",+ "16 max_stalled integer/int4 NOT NULL DEFAULT 5",+ "17 lock_token text/text NULL",+ "18 lock_until timestamp with time zone/timestamptz NULL",+ "19 delay_until timestamp with time zone/timestamptz NULL",+ "20 parent_job_id integer/int4 NULL",+ "21 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",+ "22 tokens_input integer/int4 NOT NULL DEFAULT 0",+ "23 tokens_output integer/int4 NOT NULL DEFAULT 0",+ "24 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",+ "25 depth integer/int4 NOT NULL DEFAULT 0",+ "26 max_children integer/int4 NULL",+ "27 timeout_ms integer/int4 NULL",+ "28 lock_duration_ms integer/int4 NULL",+ "29 timeout_at timestamp with time zone/timestamptz NULL",+ "30 remove_on_complete boolean/bool NOT NULL DEFAULT false",+ "31 remove_on_fail boolean/bool NOT NULL DEFAULT false",+ "32 idempotency_key text/text NULL",+ "33 private_queue_owner_job_id integer/int4 NULL",+ "34 private_queue_owner_token text/text NULL",+ "35 private_queue_lease_until timestamp with time zone/timestamptz NULL",+ "36 result jsonb/jsonb NULL",+ "37 progress jsonb/jsonb NULL",+ "38 error_text text/text NULL",+ "39 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",+ "40 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "41 started_at timestamp with time zone/timestamptz NULL",+ "42 finished_at timestamp with time zone/timestamptz NULL",+ "43 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"],"flags": "relkind=r rls=false force_rls=false"},diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.jsonindex da553e209c..b2fc3c0f30 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json@@ -587,7 +587,6 @@"idx_minion_jobs_private_queue_owner": "CREATE INDEX idx_minion_jobs_private_queue_owner ON public.minion_jobs USING btree (private_queue_owner_job_id) WHERE (private_queue_owner_job_id IS NOT NULL)","idx_minion_jobs_private_queue_recovery": "CREATE INDEX idx_minion_jobs_private_queue_recovery ON public.minion_jobs USING btree (queue, private_queue_lease_until) WHERE ((queue ~~ 'dream-inline-%'::text) AND (status = ANY (ARRAY['waiting'::text, 'active'::text, 'delayed'::text, 'waiting-children'::text, 'paused'::text])))","idx_minion_jobs_queue_status_updated": "CREATE INDEX idx_minion_jobs_queue_status_updated ON public.minion_jobs USING btree (queue, status, updated_at)",- "idx_minion_jobs_spend_group": "CREATE INDEX idx_minion_jobs_spend_group ON public.minion_jobs USING btree (((spend_authorization ->> 'group_id'::text))) WHERE (spend_authorization IS NOT NULL)","idx_minion_jobs_stalled": "CREATE INDEX idx_minion_jobs_stalled ON public.minion_jobs USING btree (lock_until) WHERE (status = 'active'::text)","idx_minion_jobs_status": "CREATE INDEX idx_minion_jobs_status ON public.minion_jobs USING btree (status)","idx_minion_jobs_timeout": "CREATE INDEX idx_minion_jobs_timeout ON public.minion_jobs USING btree (timeout_at) WHERE ((status = 'active'::text) AND (timeout_at IS NOT NULL))",@@ -1308,44 +1307,42 @@"5 priority integer/int4 NOT NULL DEFAULT 0","6 submission_authority jsonb/jsonb NULL","7 claim_generation bigint/int8 NOT NULL DEFAULT 0",- "8 spend_authorization jsonb/jsonb NULL",- "9 spend_claim_token bigint/int8 NULL",- "10 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",- "11 max_attempts integer/int4 NOT NULL DEFAULT 3",- "12 attempts_made integer/int4 NOT NULL DEFAULT 0",- "13 attempts_started integer/int4 NOT NULL DEFAULT 0",- "14 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",- "15 backoff_delay integer/int4 NOT NULL DEFAULT 1000",- "16 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",- "17 stalled_counter integer/int4 NOT NULL DEFAULT 0",- "18 max_stalled integer/int4 NOT NULL DEFAULT 5",- "19 lock_token text/text NULL",- "20 lock_until timestamp with time zone/timestamptz NULL",- "21 delay_until timestamp with time zone/timestamptz NULL",- "22 parent_job_id integer/int4 NULL",- "23 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",- "24 tokens_input integer/int4 NOT NULL DEFAULT 0",- "25 tokens_output integer/int4 NOT NULL DEFAULT 0",- "26 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",- "27 depth integer/int4 NOT NULL DEFAULT 0",- "28 max_children integer/int4 NULL",- "29 timeout_ms integer/int4 NULL",- "30 lock_duration_ms integer/int4 NULL",- "31 timeout_at timestamp with time zone/timestamptz NULL",- "32 remove_on_complete boolean/bool NOT NULL DEFAULT false",- "33 remove_on_fail boolean/bool NOT NULL DEFAULT false",- "34 idempotency_key text/text NULL",- "35 private_queue_owner_job_id integer/int4 NULL",- "36 private_queue_owner_token text/text NULL",- "37 private_queue_lease_until timestamp with time zone/timestamptz NULL",- "38 result jsonb/jsonb NULL",- "39 progress jsonb/jsonb NULL",- "40 error_text text/text NULL",- "41 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",- "42 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",- "43 started_at timestamp with time zone/timestamptz NULL",- "44 finished_at timestamp with time zone/timestamptz NULL",- "45 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "9 max_attempts integer/int4 NOT NULL DEFAULT 3",+ "10 attempts_made integer/int4 NOT NULL DEFAULT 0",+ "11 attempts_started integer/int4 NOT NULL DEFAULT 0",+ "12 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",+ "13 backoff_delay integer/int4 NOT NULL DEFAULT 1000",+ "14 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",+ "15 stalled_counter integer/int4 NOT NULL DEFAULT 0",+ "16 max_stalled integer/int4 NOT NULL DEFAULT 5",+ "17 lock_token text/text NULL",+ "18 lock_until timestamp with time zone/timestamptz NULL",+ "19 delay_until timestamp with time zone/timestamptz NULL",+ "20 parent_job_id integer/int4 NULL",+ "21 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",+ "22 tokens_input integer/int4 NOT NULL DEFAULT 0",+ "23 tokens_output integer/int4 NOT NULL DEFAULT 0",+ "24 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",+ "25 depth integer/int4 NOT NULL DEFAULT 0",+ "26 max_children integer/int4 NULL",+ "27 timeout_ms integer/int4 NULL",+ "28 lock_duration_ms integer/int4 NULL",+ "29 timeout_at timestamp with time zone/timestamptz NULL",+ "30 remove_on_complete boolean/bool NOT NULL DEFAULT false",+ "31 remove_on_fail boolean/bool NOT NULL DEFAULT false",+ "32 idempotency_key text/text NULL",+ "33 private_queue_owner_job_id integer/int4 NULL",+ "34 private_queue_owner_token text/text NULL",+ "35 private_queue_lease_until timestamp with time zone/timestamptz NULL",+ "36 result jsonb/jsonb NULL",+ "37 progress jsonb/jsonb NULL",+ "38 error_text text/text NULL",+ "39 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",+ "40 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "41 started_at timestamp with time zone/timestamptz NULL",+ "42 finished_at timestamp with time zone/timestamptz NULL",+ "43 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"],"flags": "relkind=r rls=false force_rls=false"},diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.jsonindex 454ea7ec59..9582368249 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json@@ -586,7 +586,6 @@"idx_minion_jobs_private_queue_owner": "CREATE INDEX idx_minion_jobs_private_queue_owner ON public.minion_jobs USING btree (private_queue_owner_job_id) WHERE (private_queue_owner_job_id IS NOT NULL)","idx_minion_jobs_private_queue_recovery": "CREATE INDEX idx_minion_jobs_private_queue_recovery ON public.minion_jobs USING btree (queue, private_queue_lease_until) WHERE ((queue ~~ 'dream-inline-%'::text) AND (status = ANY (ARRAY['waiting'::text, 'active'::text, 'delayed'::text, 'waiting-children'::text, 'paused'::text])))","idx_minion_jobs_queue_status_updated": "CREATE INDEX idx_minion_jobs_queue_status_updated ON public.minion_jobs USING btree (queue, status, updated_at)",- "idx_minion_jobs_spend_group": "CREATE INDEX idx_minion_jobs_spend_group ON public.minion_jobs USING btree (((spend_authorization ->> 'group_id'::text))) WHERE (spend_authorization IS NOT NULL)","idx_minion_jobs_stalled": "CREATE INDEX idx_minion_jobs_stalled ON public.minion_jobs USING btree (lock_until) WHERE (status = 'active'::text)","idx_minion_jobs_status": "CREATE INDEX idx_minion_jobs_status ON public.minion_jobs USING btree (status)","idx_minion_jobs_timeout": "CREATE INDEX idx_minion_jobs_timeout ON public.minion_jobs USING btree (timeout_at) WHERE ((status = 'active'::text) AND (timeout_at IS NOT NULL))",@@ -1307,44 +1306,42 @@"5 priority integer/int4 NOT NULL DEFAULT 0","6 submission_authority jsonb/jsonb NULL","7 claim_generation bigint/int8 NOT NULL DEFAULT 0",- "8 spend_authorization jsonb/jsonb NULL",- "9 spend_claim_token bigint/int8 NULL",- "10 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",- "11 max_attempts integer/int4 NOT NULL DEFAULT 3",- "12 attempts_made integer/int4 NOT NULL DEFAULT 0",- "13 attempts_started integer/int4 NOT NULL DEFAULT 0",- "14 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",- "15 backoff_delay integer/int4 NOT NULL DEFAULT 1000",- "16 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",- "17 stalled_counter integer/int4 NOT NULL DEFAULT 0",- "18 max_stalled integer/int4 NOT NULL DEFAULT 5",- "19 lock_token text/text NULL",- "20 lock_until timestamp with time zone/timestamptz NULL",- "21 delay_until timestamp with time zone/timestamptz NULL",- "22 parent_job_id integer/int4 NULL",- "23 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",- "24 tokens_input integer/int4 NOT NULL DEFAULT 0",- "25 tokens_output integer/int4 NOT NULL DEFAULT 0",- "26 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",- "27 depth integer/int4 NOT NULL DEFAULT 0",- "28 max_children integer/int4 NULL",- "29 timeout_ms integer/int4 NULL",- "30 lock_duration_ms integer/int4 NULL",- "31 timeout_at timestamp with time zone/timestamptz NULL",- "32 remove_on_complete boolean/bool NOT NULL DEFAULT false",- "33 remove_on_fail boolean/bool NOT NULL DEFAULT false",- "34 idempotency_key text/text NULL",- "35 private_queue_owner_job_id integer/int4 NULL",- "36 private_queue_owner_token text/text NULL",- "37 private_queue_lease_until timestamp with time zone/timestamptz NULL",- "38 result jsonb/jsonb NULL",- "39 progress jsonb/jsonb NULL",- "40 error_text text/text NULL",- "41 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",- "42 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",- "43 started_at timestamp with time zone/timestamptz NULL",- "44 finished_at timestamp with time zone/timestamptz NULL",- "45 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 data jsonb/jsonb NOT NULL DEFAULT '{}'::jsonb",+ "9 max_attempts integer/int4 NOT NULL DEFAULT 3",+ "10 attempts_made integer/int4 NOT NULL DEFAULT 0",+ "11 attempts_started integer/int4 NOT NULL DEFAULT 0",+ "12 backoff_type text/text NOT NULL DEFAULT 'exponential'::text",+ "13 backoff_delay integer/int4 NOT NULL DEFAULT 1000",+ "14 backoff_jitter real/float4 NOT NULL DEFAULT 0.2",+ "15 stalled_counter integer/int4 NOT NULL DEFAULT 0",+ "16 max_stalled integer/int4 NOT NULL DEFAULT 5",+ "17 lock_token text/text NULL",+ "18 lock_until timestamp with time zone/timestamptz NULL",+ "19 delay_until timestamp with time zone/timestamptz NULL",+ "20 parent_job_id integer/int4 NULL",+ "21 on_child_fail text/text NOT NULL DEFAULT 'fail_parent'::text",+ "22 tokens_input integer/int4 NOT NULL DEFAULT 0",+ "23 tokens_output integer/int4 NOT NULL DEFAULT 0",+ "24 tokens_cache_read integer/int4 NOT NULL DEFAULT 0",+ "25 depth integer/int4 NOT NULL DEFAULT 0",+ "26 max_children integer/int4 NULL",+ "27 timeout_ms integer/int4 NULL",+ "28 lock_duration_ms integer/int4 NULL",+ "29 timeout_at timestamp with time zone/timestamptz NULL",+ "30 remove_on_complete boolean/bool NOT NULL DEFAULT false",+ "31 remove_on_fail boolean/bool NOT NULL DEFAULT false",+ "32 idempotency_key text/text NULL",+ "33 private_queue_owner_job_id integer/int4 NULL",+ "34 private_queue_owner_token text/text NULL",+ "35 private_queue_lease_until timestamp with time zone/timestamptz NULL",+ "36 result jsonb/jsonb NULL",+ "37 progress jsonb/jsonb NULL",+ "38 error_text text/text NULL",+ "39 stacktrace jsonb/jsonb NULL DEFAULT '[]'::jsonb",+ "40 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "41 started_at timestamp with time zone/timestamptz NULL",+ "42 finished_at timestamp with time zone/timestamptz NULL",+ "43 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"],"flags": "relkind=r rls=false force_rls=false"},diff --git a/test/fixtures/goldens/catalog/postgres-db-initschema.json b/test/fixtures/goldens/catalog/postgres-db-initschema.jsonindex 49158bae10..4697b4c339 100644--- a/test/fixtures/goldens/catalog/postgres-db-initschema.json+++ b/test/fixtures/goldens/catalog/postgres-db-initschema.json@@ -249,7 +249,7 @@"functions": {"bump_page_generation_clock_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=c40a0a3b86e640b6c8979976173dd93ae92c8c1b9a9e3595cae2af1e265328fe","bump_page_generation_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=c4135ae3f74177aa71313a6c73f22bda7a298bbf12435a8def390212ae11466a",- "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=e0b3db944d3b4281b9483ce77aa734e0c9aa5b0d46bb5dcb5284b6469441a1b8",+ "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=be82640d1979fc81dc812efb78bb3596ef536f656d20750e5e4aa19016bf4784","gbrain_advance_page_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=ae793ff5263f7b76311e0c22593fb658db9f82e7b3781914421d9508b6da0e88","gbrain_advance_tag_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=7807b26b4933148aa63c67fca824a60d3492396728205d04e16c48c81174cbd5","gbrain_guard_effect_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=e8b5589dafd4a355106104daffdf57c7776d34fe18c5b5f5336a27de188688a1",diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-default.json b/test/fixtures/goldens/catalog/postgres-engine-init-default.jsonindex d3ca09e144..f2958b2955 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-default.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-default.json@@ -98,8 +98,10 @@"loop_suppressions.loop_suppressions_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","loop_suppressions.loop_suppressions_uniq": "u UNIQUE (source_id, kind, value)","mcp_request_log.mcp_request_log_pkey": "p PRIMARY KEY (id)",+ "mcp_spend_log.mcp_spend_log_one_budget_owner": "c CHECK (((client_id IS NULL) OR (budget_key IS NULL)))","mcp_spend_log.mcp_spend_log_pkey": "p PRIMARY KEY (id)","mcp_spend_reservations.mcp_spend_reservations_job_id_fkey": "f FOREIGN KEY (job_id) REFERENCES minion_jobs(id) ON DELETE SET NULL",+ "mcp_spend_reservations.mcp_spend_reservations_one_budget_owner": "c CHECK (((client_id IS NULL) <> (budget_key IS NULL)))","mcp_spend_reservations.mcp_spend_reservations_pkey": "p PRIMARY KEY (reservation_id)","mcp_spend_reservations.mcp_spend_reservations_status_check": "c CHECK ((status = ANY (ARRAY['pending'::text, 'settled'::text, 'expired'::text])))","migration_impact_log.migration_impact_log_job_id_fkey": "f FOREIGN KEY (job_id) REFERENCES minion_jobs(id) ON DELETE SET NULL",@@ -312,7 +314,7 @@"auto_enable_rls()": "RETURNS event_trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=5e5e0a0ee902f481f07da929c5fd39c2a16671869535b12a1e2270543a5a30eb","bump_page_generation_clock_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=d3359bcd09cccd881585abd9eee81c3dcf4161d935164f7953f2e9fdef73ed3e","bump_page_generation_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=78059745996cfbb72586a2e0e161635b96a62a5db9d0be5c710f4d437d994431",- "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=e0b3db944d3b4281b9483ce77aa734e0c9aa5b0d46bb5dcb5284b6469441a1b8",+ "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=be82640d1979fc81dc812efb78bb3596ef536f656d20750e5e4aa19016bf4784","gbrain_advance_page_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=ae793ff5263f7b76311e0c22593fb658db9f82e7b3781914421d9508b6da0e88","gbrain_advance_tag_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=7807b26b4933148aa63c67fca824a60d3492396728205d04e16c48c81174cbd5","gbrain_clear_atom_page_state()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=7db0ef05d1220a579e64428b2dd7cf5183191da186fbe64b6496433a7a713d11",@@ -781,8 +783,10 @@"idx_links_to": "CREATE INDEX idx_links_to ON public.links USING btree (to_page_id)","idx_mcp_log_agent_time": "CREATE INDEX idx_mcp_log_agent_time ON public.mcp_request_log USING btree (agent_name, created_at DESC)","idx_mcp_log_time_agent": "CREATE INDEX idx_mcp_log_time_agent ON public.mcp_request_log USING btree (created_at, token_name)",+ "idx_mcp_spend_log_budget_key": "CREATE INDEX idx_mcp_spend_log_budget_key ON public.mcp_spend_log USING btree (budget_key) WHERE (budget_key IS NOT NULL)","idx_mcp_spend_log_client_time": "CREATE INDEX idx_mcp_spend_log_client_time ON public.mcp_spend_log USING btree (client_id, created_at)","idx_mcp_spend_log_token_time": "CREATE INDEX idx_mcp_spend_log_token_time ON public.mcp_spend_log USING btree (token_name, created_at)",+ "idx_mcp_spend_reservations_budget_key": "CREATE INDEX idx_mcp_spend_reservations_budget_key ON public.mcp_spend_reservations USING btree (budget_key) WHERE (budget_key IS NOT NULL)","idx_mcp_spend_reservations_client_time": "CREATE INDEX idx_mcp_spend_reservations_client_time ON public.mcp_spend_reservations USING btree (client_id, created_at)","idx_mcp_spend_reservations_pending_expires": "CREATE INDEX idx_mcp_spend_reservations_pending_expires ON public.mcp_spend_reservations USING btree (status, expires_at) WHERE (status = 'pending'::text)","idx_minion_attachments_job": "CREATE INDEX idx_minion_attachments_job ON public.minion_attachments USING btree (job_id)",@@ -796,6 +800,7 @@"idx_minion_jobs_private_queue_owner": "CREATE INDEX idx_minion_jobs_private_queue_owner ON public.minion_jobs USING btree (private_queue_owner_job_id) WHERE (private_queue_owner_job_id IS NOT NULL)","idx_minion_jobs_private_queue_recovery": "CREATE INDEX idx_minion_jobs_private_queue_recovery ON public.minion_jobs USING btree (queue, private_queue_lease_until) WHERE ((queue ~~ 'dream-inline-%'::text) AND (status = ANY (ARRAY['waiting'::text, 'active'::text, 'delayed'::text, 'waiting-children'::text, 'paused'::text])))","idx_minion_jobs_queue_status_updated": "CREATE INDEX idx_minion_jobs_queue_status_updated ON public.minion_jobs USING btree (queue, status, updated_at)",+ "idx_minion_jobs_spend_group": "CREATE INDEX idx_minion_jobs_spend_group ON public.minion_jobs USING btree (((spend_authorization ->> 'group_id'::text))) WHERE (spend_authorization IS NOT NULL)","idx_minion_jobs_stagger_key": "CREATE INDEX idx_minion_jobs_stagger_key ON public.minion_jobs USING btree (stagger_key) WHERE (stagger_key IS NOT NULL)","idx_minion_jobs_stalled": "CREATE INDEX idx_minion_jobs_stalled ON public.minion_jobs USING btree (lock_until) WHERE (status = 'active'::text)","idx_minion_jobs_status": "CREATE INDEX idx_minion_jobs_status ON public.minion_jobs USING btree (status)",@@ -1737,14 +1742,15 @@"5 spend_cents numeric/numeric NOT NULL DEFAULT 0","6 provider text/text NULL","7 model text/text NULL",- "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "9 budget_key text/text NULL"],"flags": "relkind=r rls=true force_rls=false"},"mcp_spend_reservations": {"columns": ["1 reservation_id uuid/uuid NOT NULL",- "2 client_id text/text NOT NULL",+ "2 client_id text/text NULL","3 job_id bigint/int8 NULL","4 estimated_cents numeric/numeric NOT NULL","5 actual_cents numeric/numeric NULL",@@ -1755,7 +1761,8 @@"10 settled_at timestamp with time zone/timestamptz NULL","11 expires_at timestamp with time zone/timestamptz NOT NULL","12 estimate_known boolean/bool NOT NULL DEFAULT true",- "13 usage_unknown_reason text/text NULL"+ "13 usage_unknown_reason text/text NULL",+ "14 budget_key text/text NULL"],"flags": "relkind=r rls=true force_rls=false"},@@ -1864,7 +1871,9 @@"45 stagger_key text/text NULL","46 budget_remaining_cents integer/int4 NULL","47 budget_owner_job_id bigint/int8 NULL",- "48 budget_root_owner_id bigint/int8 NULL"+ "48 budget_root_owner_id bigint/int8 NULL",+ "49 spend_authorization jsonb/jsonb NULL",+ "50 spend_claim_token bigint/int8 NULL"],"flags": "relkind=r rls=true force_rls=false"},diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.jsonindex c63ccab414..e6a3e4c764 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json@@ -98,8 +98,10 @@"loop_suppressions.loop_suppressions_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","loop_suppressions.loop_suppressions_uniq": "u UNIQUE (source_id, kind, value)","mcp_request_log.mcp_request_log_pkey": "p PRIMARY KEY (id)",+ "mcp_spend_log.mcp_spend_log_one_budget_owner": "c CHECK (((client_id IS NULL) OR (budget_key IS NULL)))","mcp_spend_log.mcp_spend_log_pkey": "p PRIMARY KEY (id)","mcp_spend_reservations.mcp_spend_reservations_job_id_fkey": "f FOREIGN KEY (job_id) REFERENCES minion_jobs(id) ON DELETE SET NULL",+ "mcp_spend_reservations.mcp_spend_reservations_one_budget_owner": "c CHECK (((client_id IS NULL) <> (budget_key IS NULL)))","mcp_spend_reservations.mcp_spend_reservations_pkey": "p PRIMARY KEY (reservation_id)","mcp_spend_reservations.mcp_spend_reservations_status_check": "c CHECK ((status = ANY (ARRAY['pending'::text, 'settled'::text, 'expired'::text])))","migration_impact_log.migration_impact_log_job_id_fkey": "f FOREIGN KEY (job_id) REFERENCES minion_jobs(id) ON DELETE SET NULL",@@ -312,7 +314,7 @@"auto_enable_rls()": "RETURNS event_trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=5e5e0a0ee902f481f07da929c5fd39c2a16671869535b12a1e2270543a5a30eb","bump_page_generation_clock_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=d3359bcd09cccd881585abd9eee81c3dcf4161d935164f7953f2e9fdef73ed3e","bump_page_generation_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=78059745996cfbb72586a2e0e161635b96a62a5db9d0be5c710f4d437d994431",- "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=e0b3db944d3b4281b9483ce77aa734e0c9aa5b0d46bb5dcb5284b6469441a1b8",+ "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=be82640d1979fc81dc812efb78bb3596ef536f656d20750e5e4aa19016bf4784","gbrain_advance_page_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=ae793ff5263f7b76311e0c22593fb658db9f82e7b3781914421d9508b6da0e88","gbrain_advance_tag_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=7807b26b4933148aa63c67fca824a60d3492396728205d04e16c48c81174cbd5","gbrain_clear_atom_page_state()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=7db0ef05d1220a579e64428b2dd7cf5183191da186fbe64b6496433a7a713d11",@@ -781,8 +783,10 @@"idx_links_to": "CREATE INDEX idx_links_to ON public.links USING btree (to_page_id)","idx_mcp_log_agent_time": "CREATE INDEX idx_mcp_log_agent_time ON public.mcp_request_log USING btree (agent_name, created_at DESC)","idx_mcp_log_time_agent": "CREATE INDEX idx_mcp_log_time_agent ON public.mcp_request_log USING btree (created_at, token_name)",+ "idx_mcp_spend_log_budget_key": "CREATE INDEX idx_mcp_spend_log_budget_key ON public.mcp_spend_log USING btree (budget_key) WHERE (budget_key IS NOT NULL)","idx_mcp_spend_log_client_time": "CREATE INDEX idx_mcp_spend_log_client_time ON public.mcp_spend_log USING btree (client_id, created_at)","idx_mcp_spend_log_token_time": "CREATE INDEX idx_mcp_spend_log_token_time ON public.mcp_spend_log USING btree (token_name, created_at)",+ "idx_mcp_spend_reservations_budget_key": "CREATE INDEX idx_mcp_spend_reservations_budget_key ON public.mcp_spend_reservations USING btree (budget_key) WHERE (budget_key IS NOT NULL)","idx_mcp_spend_reservations_client_time": "CREATE INDEX idx_mcp_spend_reservations_client_time ON public.mcp_spend_reservations USING btree (client_id, created_at)","idx_mcp_spend_reservations_pending_expires": "CREATE INDEX idx_mcp_spend_reservations_pending_expires ON public.mcp_spend_reservations USING btree (status, expires_at) WHERE (status = 'pending'::text)","idx_minion_attachments_job": "CREATE INDEX idx_minion_attachments_job ON public.minion_attachments USING btree (job_id)",@@ -796,6 +800,7 @@"idx_minion_jobs_private_queue_owner": "CREATE INDEX idx_minion_jobs_private_queue_owner ON public.minion_jobs USING btree (private_queue_owner_job_id) WHERE (private_queue_owner_job_id IS NOT NULL)","idx_minion_jobs_private_queue_recovery": "CREATE INDEX idx_minion_jobs_private_queue_recovery ON public.minion_jobs USING btree (queue, private_queue_lease_until) WHERE ((queue ~~ 'dream-inline-%'::text) AND (status = ANY (ARRAY['waiting'::text, 'active'::text, 'delayed'::text, 'waiting-children'::text, 'paused'::text])))","idx_minion_jobs_queue_status_updated": "CREATE INDEX idx_minion_jobs_queue_status_updated ON public.minion_jobs USING btree (queue, status, updated_at)",+ "idx_minion_jobs_spend_group": "CREATE INDEX idx_minion_jobs_spend_group ON public.minion_jobs USING btree (((spend_authorization ->> 'group_id'::text))) WHERE (spend_authorization IS NOT NULL)","idx_minion_jobs_stagger_key": "CREATE INDEX idx_minion_jobs_stagger_key ON public.minion_jobs USING btree (stagger_key) WHERE (stagger_key IS NOT NULL)","idx_minion_jobs_stalled": "CREATE INDEX idx_minion_jobs_stalled ON public.minion_jobs USING btree (lock_until) WHERE (status = 'active'::text)","idx_minion_jobs_status": "CREATE INDEX idx_minion_jobs_status ON public.minion_jobs USING btree (status)",@@ -1737,14 +1742,15 @@"5 spend_cents numeric/numeric NOT NULL DEFAULT 0","6 provider text/text NULL","7 model text/text NULL",- "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "9 budget_key text/text NULL"],"flags": "relkind=r rls=true force_rls=false"},"mcp_spend_reservations": {"columns": ["1 reservation_id uuid/uuid NOT NULL",- "2 client_id text/text NOT NULL",+ "2 client_id text/text NULL","3 job_id bigint/int8 NULL","4 estimated_cents numeric/numeric NOT NULL","5 actual_cents numeric/numeric NULL",@@ -1755,7 +1761,8 @@"10 settled_at timestamp with time zone/timestamptz NULL","11 expires_at timestamp with time zone/timestamptz NOT NULL","12 estimate_known boolean/bool NOT NULL DEFAULT true",- "13 usage_unknown_reason text/text NULL"+ "13 usage_unknown_reason text/text NULL",+ "14 budget_key text/text NULL"],"flags": "relkind=r rls=true force_rls=false"},@@ -1864,7 +1871,9 @@"45 stagger_key text/text NULL","46 budget_remaining_cents integer/int4 NULL","47 budget_owner_job_id bigint/int8 NULL",- "48 budget_root_owner_id bigint/int8 NULL"+ "48 budget_root_owner_id bigint/int8 NULL",+ "49 spend_authorization jsonb/jsonb NULL",+ "50 spend_claim_token bigint/int8 NULL"],"flags": "relkind=r rls=true force_rls=false"},diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.jsonindex 72d43c05df..76fb083e39 100644--- a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json@@ -98,8 +98,10 @@"loop_suppressions.loop_suppressions_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","loop_suppressions.loop_suppressions_uniq": "u UNIQUE (source_id, kind, value)","mcp_request_log.mcp_request_log_pkey": "p PRIMARY KEY (id)",+ "mcp_spend_log.mcp_spend_log_one_budget_owner": "c CHECK (((client_id IS NULL) OR (budget_key IS NULL)))","mcp_spend_log.mcp_spend_log_pkey": "p PRIMARY KEY (id)","mcp_spend_reservations.mcp_spend_reservations_job_id_fkey": "f FOREIGN KEY (job_id) REFERENCES minion_jobs(id) ON DELETE SET NULL",+ "mcp_spend_reservations.mcp_spend_reservations_one_budget_owner": "c CHECK (((client_id IS NULL) <> (budget_key IS NULL)))","mcp_spend_reservations.mcp_spend_reservations_pkey": "p PRIMARY KEY (reservation_id)","mcp_spend_reservations.mcp_spend_reservations_status_check": "c CHECK ((status = ANY (ARRAY['pending'::text, 'settled'::text, 'expired'::text])))","migration_impact_log.migration_impact_log_job_id_fkey": "f FOREIGN KEY (job_id) REFERENCES minion_jobs(id) ON DELETE SET NULL",@@ -312,7 +314,7 @@"auto_enable_rls()": "RETURNS event_trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=5e5e0a0ee902f481f07da929c5fd39c2a16671869535b12a1e2270543a5a30eb","bump_page_generation_clock_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=d3359bcd09cccd881585abd9eee81c3dcf4161d935164f7953f2e9fdef73ed3e","bump_page_generation_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=78059745996cfbb72586a2e0e161635b96a62a5db9d0be5c710f4d437d994431",- "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=e0b3db944d3b4281b9483ce77aa734e0c9aa5b0d46bb5dcb5284b6469441a1b8",+ "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=be82640d1979fc81dc812efb78bb3596ef536f656d20750e5e4aa19016bf4784","gbrain_advance_page_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=ae793ff5263f7b76311e0c22593fb658db9f82e7b3781914421d9508b6da0e88","gbrain_advance_tag_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=7807b26b4933148aa63c67fca824a60d3492396728205d04e16c48c81174cbd5","gbrain_clear_atom_page_state()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=7db0ef05d1220a579e64428b2dd7cf5183191da186fbe64b6496433a7a713d11",@@ -779,8 +781,10 @@"idx_links_to": "CREATE INDEX idx_links_to ON public.links USING btree (to_page_id)","idx_mcp_log_agent_time": "CREATE INDEX idx_mcp_log_agent_time ON public.mcp_request_log USING btree (agent_name, created_at DESC)","idx_mcp_log_time_agent": "CREATE INDEX idx_mcp_log_time_agent ON public.mcp_request_log USING btree (created_at, token_name)",+ "idx_mcp_spend_log_budget_key": "CREATE INDEX idx_mcp_spend_log_budget_key ON public.mcp_spend_log USING btree (budget_key) WHERE (budget_key IS NOT NULL)","idx_mcp_spend_log_client_time": "CREATE INDEX idx_mcp_spend_log_client_time ON public.mcp_spend_log USING btree (client_id, created_at)","idx_mcp_spend_log_token_time": "CREATE INDEX idx_mcp_spend_log_token_time ON public.mcp_spend_log USING btree (token_name, created_at)",+ "idx_mcp_spend_reservations_budget_key": "CREATE INDEX idx_mcp_spend_reservations_budget_key ON public.mcp_spend_reservations USING btree (budget_key) WHERE (budget_key IS NOT NULL)","idx_mcp_spend_reservations_client_time": "CREATE INDEX idx_mcp_spend_reservations_client_time ON public.mcp_spend_reservations USING btree (client_id, created_at)","idx_mcp_spend_reservations_pending_expires": "CREATE INDEX idx_mcp_spend_reservations_pending_expires ON public.mcp_spend_reservations USING btree (status, expires_at) WHERE (status = 'pending'::text)","idx_minion_attachments_job": "CREATE INDEX idx_minion_attachments_job ON public.minion_attachments USING btree (job_id)",@@ -794,6 +798,7 @@"idx_minion_jobs_private_queue_owner": "CREATE INDEX idx_minion_jobs_private_queue_owner ON public.minion_jobs USING btree (private_queue_owner_job_id) WHERE (private_queue_owner_job_id IS NOT NULL)","idx_minion_jobs_private_queue_recovery": "CREATE INDEX idx_minion_jobs_private_queue_recovery ON public.minion_jobs USING btree (queue, private_queue_lease_until) WHERE ((queue ~~ 'dream-inline-%'::text) AND (status = ANY (ARRAY['waiting'::text, 'active'::text, 'delayed'::text, 'waiting-children'::text, 'paused'::text])))","idx_minion_jobs_queue_status_updated": "CREATE INDEX idx_minion_jobs_queue_status_updated ON public.minion_jobs USING btree (queue, status, updated_at)",+ "idx_minion_jobs_spend_group": "CREATE INDEX idx_minion_jobs_spend_group ON public.minion_jobs USING btree (((spend_authorization ->> 'group_id'::text))) WHERE (spend_authorization IS NOT NULL)","idx_minion_jobs_stagger_key": "CREATE INDEX idx_minion_jobs_stagger_key ON public.minion_jobs USING btree (stagger_key) WHERE (stagger_key IS NOT NULL)","idx_minion_jobs_stalled": "CREATE INDEX idx_minion_jobs_stalled ON public.minion_jobs USING btree (lock_until) WHERE (status = 'active'::text)","idx_minion_jobs_status": "CREATE INDEX idx_minion_jobs_status ON public.minion_jobs USING btree (status)",@@ -1733,14 +1738,15 @@"5 spend_cents numeric/numeric NOT NULL DEFAULT 0","6 provider text/text NULL","7 model text/text NULL",- "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "9 budget_key text/text NULL"],"flags": "relkind=r rls=true force_rls=false"},"mcp_spend_reservations": {"columns": ["1 reservation_id uuid/uuid NOT NULL",- "2 client_id text/text NOT NULL",+ "2 client_id text/text NULL","3 job_id bigint/int8 NULL","4 estimated_cents numeric/numeric NOT NULL","5 actual_cents numeric/numeric NULL",@@ -1751,7 +1757,8 @@"10 settled_at timestamp with time zone/timestamptz NULL","11 expires_at timestamp with time zone/timestamptz NOT NULL","12 estimate_known boolean/bool NOT NULL DEFAULT true",- "13 usage_unknown_reason text/text NULL"+ "13 usage_unknown_reason text/text NULL",+ "14 budget_key text/text NULL"],"flags": "relkind=r rls=true force_rls=false"},@@ -1860,7 +1867,9 @@"45 stagger_key text/text NULL","46 budget_remaining_cents integer/int4 NULL","47 budget_owner_job_id bigint/int8 NULL",- "48 budget_root_owner_id bigint/int8 NULL"+ "48 budget_root_owner_id bigint/int8 NULL",+ "49 spend_authorization jsonb/jsonb NULL",+ "50 spend_claim_token bigint/int8 NULL"],"flags": "relkind=r rls=true force_rls=false"},diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex 2f61c9202a..5967d5ab40 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -507,7 +507,7 @@},{"category": "meta",- "message": "Version 201 (latest: 201)",+ "message": "Version 204 (latest: 204)","name": "schema_version","status": "ok"},@@ -1085,6 +1085,11 @@"authorizable_total": 0,"docs": "docs/guides/repair.md#legacy-job-authority","live": 0,+ "queued_spend": {+ "by_basis": {},+ "long_waiting": 0,+ "long_waiting_ids": []+ },"terminal_keyed": {},"terminal_keyed_total": 0,"unsupported": 0,diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex af20286e14..7b1fb98d67 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -510,7 +510,7 @@},{"category": "meta",- "message": "Version 201 (latest: 201)",+ "message": "Version 204 (latest: 204)","name": "schema_version","status": "ok"},@@ -1173,6 +1173,11 @@"authorizable_total": 0,"docs": "docs/guides/repair.md#legacy-job-authority","live": 0,+ "queued_spend": {+ "by_basis": {},+ "long_waiting": 0,+ "long_waiting_ids": []+ },"terminal_keyed": {},"terminal_keyed_total": 0,"unsupported": 0,diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex 1c33d8a06c..401cc8a8e5 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -503,7 +503,7 @@},{"category": "meta",- "message": "Version 201 (latest: 201)",+ "message": "Version 204 (latest: 204)","name": "schema_version","status": "ok"},@@ -1165,6 +1165,11 @@"authorizable_total": 0,"docs": "docs/guides/repair.md#legacy-job-authority","live": 0,+ "queued_spend": {+ "by_basis": {},+ "long_waiting": 0,+ "long_waiting_ids": []+ },"terminal_keyed": {},"terminal_keyed_total": 0,"unsupported": 0,diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.jsonindex 151f9d6019..a2c410b8e7 100644--- a/test/fixtures/goldens/exports/types.json+++ b/test/fixtures/goldens/exports/types.json@@ -5202,6 +5202,8 @@"remove_on_complete: boolean","remove_on_fail: boolean","result: Record<string, unknown> | null",+ "spend_authorization?: SpendAuthorization | null | undefined",+ "spend_authorization_invalid?: true | undefined","stacktrace: string[]","stagger_key: string | null","stalled_counter: number",@@ -5230,6 +5232,7 @@"readInbox: () => Promise<InboxMessage[]>","shutdownSignal: AbortSignal","signal: AbortSignal",+ "spend?: JobSpendContext | undefined","submission_authority?: SubmissionAuthority | null | undefined","updateProgress: (progress: unknown) => Promise<void>","updateTokens: (tokens: TokenUpdate) => Promise<void>"diff --git a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.jsonindex c1a538bef0..60e029ced6 100644--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json@@ -95,8 +95,10 @@"loop_suppressions.loop_suppressions_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE CASCADE","loop_suppressions.loop_suppressions_uniq": "u UNIQUE (source_id, kind, value)","mcp_request_log.mcp_request_log_pkey": "p PRIMARY KEY (id)",+ "mcp_spend_log.mcp_spend_log_one_budget_owner": "c CHECK (((client_id IS NULL) OR (budget_key IS NULL)))","mcp_spend_log.mcp_spend_log_pkey": "p PRIMARY KEY (id)","mcp_spend_reservations.mcp_spend_reservations_job_id_fkey": "f FOREIGN KEY (job_id) REFERENCES minion_jobs(id) ON DELETE SET NULL",+ "mcp_spend_reservations.mcp_spend_reservations_one_budget_owner": "c CHECK (((client_id IS NULL) <> (budget_key IS NULL)))","mcp_spend_reservations.mcp_spend_reservations_pkey": "p PRIMARY KEY (reservation_id)","mcp_spend_reservations.mcp_spend_reservations_status_check": "c CHECK ((status = ANY (ARRAY['pending'::text, 'settled'::text, 'expired'::text])))","migration_impact_log.migration_impact_log_job_id_fkey": "f FOREIGN KEY (job_id) REFERENCES minion_jobs(id) ON DELETE SET NULL",@@ -308,7 +310,7 @@"functions": {"bump_page_generation_clock_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=c40a0a3b86e640b6c8979976173dd93ae92c8c1b9a9e3595cae2af1e265328fe","bump_page_generation_fn()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=c4135ae3f74177aa71313a6c73f22bda7a298bbf12435a8def390212ae11466a",- "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=e0b3db944d3b4281b9483ce77aa734e0c9aa5b0d46bb5dcb5284b6469441a1b8",+ "enforce_minion_queue_protocol()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[search_path=pg_catalog, public] body_sha256=be82640d1979fc81dc812efb78bb3596ef536f656d20750e5e4aa19016bf4784","gbrain_advance_page_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=ae793ff5263f7b76311e0c22593fb658db9f82e7b3781914421d9508b6da0e88","gbrain_advance_tag_revision()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=7807b26b4933148aa63c67fca824a60d3492396728205d04e16c48c81174cbd5","gbrain_clear_atom_page_state()": "RETURNS trigger kind=f lang=plpgsql volatility=v secdef=false config=[] body_sha256=7db0ef05d1220a579e64428b2dd7cf5183191da186fbe64b6496433a7a713d11",@@ -778,8 +780,10 @@"idx_links_to": "CREATE INDEX idx_links_to ON public.links USING btree (to_page_id)","idx_mcp_log_agent_time": "CREATE INDEX idx_mcp_log_agent_time ON public.mcp_request_log USING btree (agent_name, created_at DESC)","idx_mcp_log_time_agent": "CREATE INDEX idx_mcp_log_time_agent ON public.mcp_request_log USING btree (created_at, token_name)",+ "idx_mcp_spend_log_budget_key": "CREATE INDEX idx_mcp_spend_log_budget_key ON public.mcp_spend_log USING btree (budget_key) WHERE (budget_key IS NOT NULL)","idx_mcp_spend_log_client_time": "CREATE INDEX idx_mcp_spend_log_client_time ON public.mcp_spend_log USING btree (client_id, created_at)","idx_mcp_spend_log_token_time": "CREATE INDEX idx_mcp_spend_log_token_time ON public.mcp_spend_log USING btree (token_name, created_at)",+ "idx_mcp_spend_reservations_budget_key": "CREATE INDEX idx_mcp_spend_reservations_budget_key ON public.mcp_spend_reservations USING btree (budget_key) WHERE (budget_key IS NOT NULL)","idx_mcp_spend_reservations_client_time": "CREATE INDEX idx_mcp_spend_reservations_client_time ON public.mcp_spend_reservations USING btree (client_id, created_at)","idx_mcp_spend_reservations_pending_expires": "CREATE INDEX idx_mcp_spend_reservations_pending_expires ON public.mcp_spend_reservations USING btree (status, expires_at) WHERE (status = 'pending'::text)","idx_minion_attachments_job": "CREATE INDEX idx_minion_attachments_job ON public.minion_attachments USING btree (job_id)",@@ -793,6 +797,7 @@"idx_minion_jobs_private_queue_owner": "CREATE INDEX idx_minion_jobs_private_queue_owner ON public.minion_jobs USING btree (private_queue_owner_job_id) WHERE (private_queue_owner_job_id IS NOT NULL)","idx_minion_jobs_private_queue_recovery": "CREATE INDEX idx_minion_jobs_private_queue_recovery ON public.minion_jobs USING btree (queue, private_queue_lease_until) WHERE ((queue ~~ 'dream-inline-%'::text) AND (status = ANY (ARRAY['waiting'::text, 'active'::text, 'delayed'::text, 'waiting-children'::text, 'paused'::text])))","idx_minion_jobs_queue_status_updated": "CREATE INDEX idx_minion_jobs_queue_status_updated ON public.minion_jobs USING btree (queue, status, updated_at)",+ "idx_minion_jobs_spend_group": "CREATE INDEX idx_minion_jobs_spend_group ON public.minion_jobs USING btree (((spend_authorization ->> 'group_id'::text))) WHERE (spend_authorization IS NOT NULL)","idx_minion_jobs_stagger_key": "CREATE INDEX idx_minion_jobs_stagger_key ON public.minion_jobs USING btree (stagger_key) WHERE (stagger_key IS NOT NULL)","idx_minion_jobs_stalled": "CREATE INDEX idx_minion_jobs_stalled ON public.minion_jobs USING btree (lock_until) WHERE (status = 'active'::text)","idx_minion_jobs_status": "CREATE INDEX idx_minion_jobs_status ON public.minion_jobs USING btree (status)",@@ -1725,14 +1730,15 @@"5 spend_cents numeric/numeric NOT NULL DEFAULT 0","6 provider text/text NULL","7 model text/text NULL",- "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ "8 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "9 budget_key text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},"mcp_spend_reservations": {"columns": ["1 reservation_id uuid/uuid NOT NULL",- "2 client_id text/text NOT NULL",+ "2 client_id text/text NULL","3 job_id bigint/int8 NULL","4 estimated_cents numeric/numeric NOT NULL","5 actual_cents numeric/numeric NULL",@@ -1743,7 +1749,8 @@"10 settled_at timestamp with time zone/timestamptz NULL","11 expires_at timestamp with time zone/timestamptz NOT NULL","12 estimate_known boolean/bool NOT NULL DEFAULT true",- "13 usage_unknown_reason text/text NULL"+ "13 usage_unknown_reason text/text NULL",+ "14 budget_key text/text NULL"],"flags": "relkind=r rls=false force_rls=false"},@@ -1852,7 +1859,9 @@"45 stagger_key text/text NULL","46 budget_remaining_cents integer/int4 NULL","47 budget_owner_job_id bigint/int8 NULL",- "48 budget_root_owner_id bigint/int8 NULL"+ "48 budget_root_owner_id bigint/int8 NULL",+ "49 spend_authorization jsonb/jsonb NULL",+ "50 spend_claim_token bigint/int8 NULL"],"flags": "relkind=r rls=false force_rls=false"},diff --git a/test/schema-bootstrap-coverage.test.ts b/test/schema-bootstrap-coverage.test.tsindex a1a15e8f1c..392fefabb8 100644--- a/test/schema-bootstrap-coverage.test.ts+++ b/test/schema-bootstrap-coverage.test.ts@@ -232,9 +232,6 @@ const REQUIRED_BOOTSTRAP_COVERAGE: ForwardReference[] = [// Authority remains nullable: bootstrap must never authorize historical work.{ kind: 'column', table: 'minion_jobs', column: 'submission_authority' },{ kind: 'column', table: 'minion_jobs', column: 'claim_generation' },- // v204 spend protocol: the fence trigger reads both; the group index reads the record.- { kind: 'column', table: 'minion_jobs', column: 'spend_authorization' },- { kind: 'column', table: 'minion_jobs', column: 'spend_claim_token' },];test('applyForwardReferenceBootstrap covers every forward reference declared in REQUIRED_BOOTSTRAP_COVERAGE', async () => {@@ -354,9 +351,6 @@ test('applyForwardReferenceBootstrap covers every forward reference declared inALTER TABLE minion_jobs DROP COLUMN IF EXISTS private_queue_lease_until;ALTER TABLE minion_jobs DROP COLUMN IF EXISTS submission_authority;ALTER TABLE minion_jobs DROP COLUMN IF EXISTS claim_generation;- DROP INDEX IF EXISTS idx_minion_jobs_spend_group;- ALTER TABLE minion_jobs DROP COLUMN IF EXISTS spend_authorization;- ALTER TABLE minion_jobs DROP COLUMN IF EXISTS spend_claim_token;`);// Note: we don't strip sources.archived* here because they're inline in the@@ -461,9 +455,6 @@ test('after bootstrap, PGLITE_SCHEMA_SQL replays without crashing on missing forALTER TABLE minion_jobs DROP COLUMN IF EXISTS private_queue_lease_until;ALTER TABLE minion_jobs DROP COLUMN IF EXISTS submission_authority;ALTER TABLE minion_jobs DROP COLUMN IF EXISTS claim_generation;- DROP INDEX IF EXISTS idx_minion_jobs_spend_group;- ALTER TABLE minion_jobs DROP COLUMN IF EXISTS spend_authorization;- ALTER TABLE minion_jobs DROP COLUMN IF EXISTS spend_claim_token;-- WP4 (v127) strip: surface columns + the wedge-signal index; replay-- must succeed from the pre-v127 shape.@@ -887,6 +878,12 @@ const COLUMN_EXEMPTIONS = new Set<string>([// no blob forward reference; the migration chain adds the column and index.'mcp_spend_reservations.budget_key','mcp_spend_log.budget_key',+ // Spend fence columns (v204): migration-only, appended after every earlier+ // migration-added column so fresh and upgraded catalogs agree. No blob index+ // references them; the blob's queue-protocol trigger reads them only on a+ // claim, after the migration chain has run.+ 'minion_jobs.spend_authorization',+ 'minion_jobs.spend_claim_token',// T7 — search_telemetry rank-1 drift columns (migration v111). search_telemetry// is created entirely by migration v57 (not in the schema blob), so the v57+v111// chain handles fresh + upgrade; no CREATE INDEX references these columns, so