g1t/services/work/migrations/0018_guardrails.sql
| 1 | -- Guardrails: what a workspace lets its agents do in a sandbox. One row |
| 2 | -- for the workspace's defaults (scope 'workspace', scope_key its slug) and |
| 3 | -- one per project that overrides them (scope 'project', scope_key its |
| 4 | -- repository's id). A missing row inherits everything. |
| 5 | CREATE TABLE guardrails ( |
| 6 | scope TEXT NOT NULL, |
| 7 | scope_key TEXT NOT NULL, |
| 8 | -- The workspace's slug, for renames. |
| 9 | workspace TEXT NOT NULL, |
| 10 | -- JSON: g1t_contracts::guardrails::GuardrailSettings, unset fields inherited. |
| 11 | settings TEXT NOT NULL, |
| 12 | updated_by TEXT NOT NULL, |
| 13 | updated_at TEXT NOT NULL, |
| 14 | PRIMARY KEY (scope, scope_key) |
| 15 | ); |
| 16 | CREATE INDEX guardrails_by_workspace ON guardrails (workspace); |
| 17 | |
| 18 | -- The caps a run started with, and which one stopped it. |
| 19 | ALTER TABLE agent_runs ADD COLUMN budget_usd REAL; |
| 20 | ALTER TABLE agent_runs ADD COLUMN time_cap_minutes INTEGER; |
| 21 | -- budget or time, when g1t stopped it for reaching that cap. |
| 22 | ALTER TABLE agent_runs ADD COLUMN halted TEXT; |