Preserve history with logical model and agent deletion#770
Merged
1 commit merged intoJul 23, 2026
Merged
Conversation
Deleting an Agent or model now marks it deleted and removes it from active product and runtime paths while preserving chats, runs, tasks, audits, participants, and workspace files. Agent deletion also cancels unfinished runs, releases edit locks, and removes runtime containers on a best-effort basis; model resolution falls back to an active candidate. Constraint: Existing foreign keys remain unchanged in this iteration Rejected: Manual cleanup and hard deletion | destroys historical data and fails against existing references Confidence: high Scope-risk: broad Directive: New active Agent and model query paths must exclude deleted_at rows Tested: Backend full suite (1997 passed); focused backend suite (23 passed); frontend tests (63 passed); frontend production build; Alembic heads; staged diff check Not-tested: Applying the migration against a production database
Y1fe1Zh0u
added a commit
that referenced
this pull request
Jul 22, 2026
The integration branch needs this pull request alongside the other v1.11.2 candidates without changing the original PR state. Constraint: Preserve the source PR commit and merge in numeric order. Confidence: high Scope-risk: moderate Related: #770 Tested: Git merge completed without unresolved conflicts Not-tested: Combined backend and frontend suites pending # Conflicts: # backend/app/services/group_chat_service.py # backend/app/services/llm/caller.py
40c1f6b
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.
Summary
deleted_atlogical deletionWhy
Physical deletion currently conflicts with existing foreign-key references and relies on destructive cleanup across historical data. Logical deletion makes an Agent or model unavailable everywhere it can be actively used while retaining the records needed to preserve history and auditability.
User and developer impact
Validation
add_agent_model_deleted_at (head)Migration note
Apply the new Alembic revision before deploying the application code. The migration adds nullable
deleted_atcolumns and partial indexes; it does not remove or rewrite existing foreign keys.