Repository navigation
Conversation
Step 1 of the organization teardown: the organization's sandboxes, agent instances, agents and their sub-resources, and environments. First, because almost everything else in the organization is either referenced by these or refuses to be deleted while they exist. The per-resource delete paths do not compose into an org-wide sweep here. envs, init_scripts, mcps and skills reference agents with NO ACTION, and agents and sandboxes reference environments the same way, so deleting either parent while a child remains is a foreign key violation. The store orders the whole set once, in one transaction; the invariants the individual paths enforce hold because the order satisfies them rather than because each row is checked. The order is derived from the live schema rather than from the migration history -- hooks, volume_attachments, image_pull_secret_attachments and the old entity model's tables were dropped by later migrations and no longer exist. Tuples come off before the rows, batched at OpenFGA's per-Write limit of 100. Nicknames are given back best-effort: one that outlives its agent is a stale row Identity's own step reaches at step 8, not a reason to stall step 1. Exercised against a real database (AGENTS_TEST_DATABASE_URL) rather than a fake store, because the foreign keys are the thing being ordered against.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 1 of the organization teardown: the organization's sandboxes, agent instances, agents and their sub-resources, and environments. First in the order, because almost everything else in the organization is either referenced by these or refuses to be deleted while they exist.
This is the one service where the per-resource delete paths do not compose into an org-wide sweep.
envs,init_scripts,mcpsandskillsreferenceagentswithNO ACTION, andagentsandsandboxesreferenceenvironmentsthe same way — so deleting either parent while a child remains is a foreign key violation, and walking the existing per-resource paths would hit that on almost every row. The store orders the whole set once, in one transaction. The invariants the individual paths enforce — an agent with no live instances, an environment nothing references — hold here because the order satisfies them, not because each row is re-checked. Flagging this as the deliberate deviation from "reuse the paths that already exist"; everything else in this change set does reuse them.The order is derived from the live schema, not the migration history. Reading the migrations suggested tables —
hooks,volume_attachments,image_pull_secret_attachments, and the old entity model'smemory_buckets/tools/variables/workspace_configurations/attachments— that later migrations had dropped. My first draft deleted fromvolume_attachmentsand failed at runtime withrelation does not exist. The final order comes frompg_constrainton a migrated database.Tuples come off before the rows, batched at OpenFGA's per-
Writelimit of 100. Nicknames are given back best-effort — one that outlives its agent is a stale row Identity's own step reaches at step 8, not a reason to stall step 1.Tested against a real database.
Server.storeis a concrete*store.Storewith no interface seam, and more importantly the foreign keys are the thing being ordered against, so a fake store would prove nothing. The test follows the existingAGENTS_TEST_DATABASE_URLpattern and seeds a skill and a sandbox specifically so the ordering is exercised. Note that it skips silently when the variable is unset — I ran it against a live postgres, and it is worth doing the same when reviewing.New rule on the existing
AuthorizationPolicyadmitting only theorganizationsServiceAccount. Chart bumped to 0.2.0.The two
.gen/go/agynio/api/identity/v1/*.pb.gofiles are tracked here despite.genbeing gitignored; they were stale relative to the BSR and this regenerates them.Part of organization settings and deletion.