Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install dependencies
timeout-minutes: 20
run: npm ci --ignore-scripts --workspaces=false --no-audit --no-fund
- uses: treeseed-ai/sdk/.github/actions/install-exact-sdk@5bf0a7bc3e9090f0885abb915101d33fe5d28df8
- uses: treeseed-ai/sdk/.github/actions/install-exact-sdk@1186bff3b400fe442642013b2de93e7f0d4939df
with:
github-token: ${{ github.token }}
paths: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Graph nodes and immutable assignments are the only scheduling authority.
-- Retired demand, participation, and capacity-plan rows cannot be replayed.
DROP TABLE IF EXISTS capacity_workday_participation_entries;
DROP TABLE IF EXISTS capacity_workday_participation_cycles;
DROP TABLE IF EXISTS capacity_workday_demands;
DROP TABLE IF EXISTS agent_capacity_plans;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- The immutable assignment attempt is the sole execution input authority.
ALTER TABLE capacity_provider_assignments DROP COLUMN IF EXISTS decision_input_json;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Activity profiles in exact project-library content own handler and mode policy.
ALTER TABLE project_agent_classes DROP COLUMN IF EXISTS allowed_modes_json;
ALTER TABLE project_agent_classes DROP COLUMN IF EXISTS required_capabilities_json;
ALTER TABLE project_agent_classes DROP COLUMN IF EXISTS kernel_profile_json;
ALTER TABLE project_agent_classes DROP COLUMN IF EXISTS kernel_policy_json;
ALTER TABLE project_agent_classes DROP COLUMN IF EXISTS output_contracts_json;
42 changes: 42 additions & 0 deletions drizzle/control-plane/0038_remove_retired_mode_runs.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-- Keep assignment provenance before removing the duplicate execution authority.
DO $$
BEGIN
IF EXISTS (
SELECT 1 FROM capacity_ledger_entries ledger
JOIN agent_mode_runs run ON run.id = ledger.mode_run_id
WHERE ledger.assignment_id IS NOT NULL AND ledger.assignment_id <> run.provider_assignment_id
) OR EXISTS (
SELECT 1 FROM capacity_usage_actuals usage
JOIN agent_mode_runs run ON run.id = usage.mode_run_id
WHERE usage.assignment_id IS NOT NULL AND usage.assignment_id <> run.provider_assignment_id
) OR EXISTS (
SELECT 1 FROM capacity_workday_events event
LEFT JOIN agent_mode_runs run ON run.id = event.mode_run_id
WHERE event.mode_run_id IS NOT NULL
AND (run.id IS NULL OR event.assignment_id IS NOT NULL AND event.assignment_id <> run.provider_assignment_id)
) THEN
RAISE EXCEPTION 'retired mode-run provenance conflicts with assignment custody';
END IF;
END $$;

UPDATE capacity_ledger_entries ledger
SET assignment_id = run.provider_assignment_id
FROM agent_mode_runs run
WHERE ledger.mode_run_id = run.id AND ledger.assignment_id IS NULL;

UPDATE capacity_usage_actuals usage
SET assignment_id = run.provider_assignment_id
FROM agent_mode_runs run
WHERE usage.mode_run_id = run.id AND usage.assignment_id IS NULL;

UPDATE capacity_workday_events event
SET assignment_id = run.provider_assignment_id
FROM agent_mode_runs run
WHERE event.mode_run_id = run.id AND event.assignment_id IS NULL;

ALTER TABLE capacity_ledger_entries DROP CONSTRAINT IF EXISTS fk_capacity_ledger_mode_run;
ALTER TABLE capacity_usage_actuals DROP CONSTRAINT IF EXISTS fk_capacity_usage_actuals_mode_run;
ALTER TABLE capacity_ledger_entries DROP COLUMN IF EXISTS mode_run_id;
ALTER TABLE capacity_usage_actuals DROP COLUMN IF EXISTS mode_run_id;
ALTER TABLE capacity_workday_events DROP COLUMN IF EXISTS mode_run_id;
DROP TABLE agent_mode_runs;
12 changes: 12 additions & 0 deletions drizzle/control-plane/0039_remove_workday_capacity_envelopes.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- A live envelope cannot be discarded while it might still admit work.
DO $$
BEGIN
IF EXISTS (
SELECT 1 FROM workday_capacity_envelopes
WHERE status IN ('draft', 'queued', 'active', 'paused')
) THEN
RAISE EXCEPTION 'retired workday envelopes must be drained before migration';
END IF;
END $$;

DROP TABLE workday_capacity_envelopes;
39 changes: 39 additions & 0 deletions drizzle/control-plane/0040_remove_retired_allocation_authority.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-- Allocation is derived from the living graph and workday policy. Retired
-- allocation sets and decision graphs must not remain writable authorities.
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM capacity_provider_assignments WHERE status IN ('pending', 'leased', 'running')) THEN
RAISE EXCEPTION 'drain active assignments before removing retired allocation authority';
END IF;
END $$;

-- With no executable assignment left, these rows cannot make further progress.
-- Settle the one-time architecture cutover explicitly instead of leaving the
-- API unable to start merely to call its ordinary stop operation.
UPDATE capacity_reservations
SET state = 'released',
released_seconds = GREATEST(released_seconds, reserved_seconds - active_seconds),
updated_at = CURRENT_TIMESTAMP::text
WHERE state IN ('reserved', 'consuming', 'continuation_required')
AND work_day_id IN (
SELECT id FROM capacity_workday_runs WHERE status IN ('queued', 'running', 'degraded')
);

UPDATE capacity_workday_runs
SET status = 'cancelled',
completed_at = COALESCE(completed_at, CURRENT_TIMESTAMP::text),
updated_at = CURRENT_TIMESTAMP::text,
error_json = '{"code":"architecture_contract_cutover"}'
WHERE status IN ('queued', 'running', 'degraded');

ALTER TABLE capacity_provider_assignments DROP CONSTRAINT IF EXISTS fk_capacity_provider_assignments_allocation;
ALTER TABLE capacity_reservations DROP CONSTRAINT IF EXISTS fk_capacity_reservations_allocation;
ALTER TABLE capacity_reservations DROP CONSTRAINT IF EXISTS chk_capacity_reservations_allocation_version;

ALTER TABLE capacity_provider_assignments DROP COLUMN allocation_set_id;
ALTER TABLE capacity_reservations DROP COLUMN allocation_set_id;
ALTER TABLE capacity_reservations DROP COLUMN allocation_version;
ALTER TABLE capacity_reservations DROP COLUMN allocation_slice_ids_json;

DROP TABLE decision_assignment_graphs;
DROP TABLE capacity_allocation_sets;
25 changes: 12 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"@modelcontextprotocol/server": "2.0.0",
"@octokit/auth-app": "^8.2.0",
"@react-email/render": "^2.0.8",
"@treeseed/deployment": "https://github.com/treeseed-ai/deployment/releases/download/0.1.0-rc.299/treeseed-deployment-runtime-0.1.0-rc.299.tgz",
"@treeseed/deployment": "https://github.com/treeseed-ai/deployment/releases/download/0.1.0-rc.321/treeseed-deployment-runtime-0.1.0-rc.321.tgz",
"@treeseed/identity": "0.1.0-rc.19",
"@treeseed/sdk": "0.13.0-rc.119",
"@treeseed/sdk": "0.13.0-rc.122",
"@treeseed/treedx": "0.3.0-rc.17",
"drizzle-orm": "^0.45.2",
"hono": "4.13.3",
Expand Down
18 changes: 0 additions & 18 deletions src/api/capacity/artifact-manifest.ts

This file was deleted.

Loading
Loading