Add agent deletion with explicit retention and active-work guards - #12
Open
srctl wants to merge 2 commits into
Open
Add agent deletion with explicit retention and active-work guards#12srctl wants to merge 2 commits into
srctl wants to merge 2 commits into
Conversation
srctl
marked this pull request as ready for review
September 9, 2026 01:25
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.
Adds a visible Delete agent action in agent settings on desktop and mobile. Confirmation names the agent and explains removal and retention. Success reloads Home with a fresh agent list; cancellation preserves the agent and failures stay in the confirmation with an actionable message.
Deletion checks and record removal share one SQLite transaction. Active/steering turns, uncertain coding workers, and outstanding delegated work on another agent block deletion. A stop request alone is insufficient. Queued work is discarded, idle local Codex runtimes are disposed, and persistent tombstones reject stale creation retries and late agent-owned writes.
Retention and assumptions
The policy was recorded before implementing deletion. Its full retention and recovery guidance is preserved below; task-specific documentation is excluded from the final code diff.
agents/<id>(soul, history, Codex memory/sessions),workspaces/<id>, andfiles/<id>indefinitely. Their contents are unavailable through the deleted agent in Roost. This is not secure erasure; backups/provider-side history remain unchanged.Verification
Verification used isolated temporary fixtures. Initial checks inherited live-worker binary/port overrides and a restrictive umask; tests passed after cleaning only the child-process environment and using umask 022. An inherited
NITRO_PORT=3000initially blocked the production-auth fixture; removing it from that test subprocess allowed the smoke check to pass. No live agents, services, host configuration, or the separate UI-update worktree were changed.Verification logs:
/tmp/delete-agents-check-clean.log(lint/typecheck, 168 tests, builds),/tmp/delete-agents-check-remaining.log(production auth/sites). Browser scripts and logs are disposable local artifacts under/tmp/delete-agents-*.Full retention and recovery guidance
Deleting an agent
Lifecycle decision (recorded before implementation)
Agent ownership is recorded in
roost.sqlite; agent workspaces and Codex homesare separate directories. Herdr coding jobs can operate on external machines and
repositories. There are no cascading foreign keys or existing agent deletion API.
Deletion permanently removes the agent from Roost, including its conversation
and run history, soul change records, automations, reflection settings,
dashboards/datasets, notifications, approvals, file metadata, coding configuration,
and coding job records. Queued work is discarded in the same transaction.
There is no undo or automatic recovery. A minimal ID/time tombstone is retained
indefinitely to reject stale creation retries and late database writes.
Disk data is retained indefinitely:
agents/<id>(soul, soul history, Codexsessions and memory),
workspaces/<id>, andfiles/<id>attachment/artifact bytes. Ownershipof workspace content and repositories is uncertain; deletion is not a secure
erasure feature. These files are no longer accessible through that agent in
Roost. Backups and provider-side history are unchanged. Administrative recovery
or cleanup is outside this feature; retained files alone do not restore app state.
Thread-indexed database metadata is retained conservatively because legacy
threads can be shared. Shared execution profiles, global settings, subscriptions,
other agents, external repositories, worktrees, terminals and infrastructure are
preserved.
An active/steering conversation blocks deletion; stop it using existing controls
and wait for its terminal outcome, then retry. Coding jobs block deletion unless
never launched, completed, or confirmed cancelled. Failed/ambiguous launches and
blocked/review workers require inspection and a confirmed stop or completion.
Deletion sends no shell commands or interrupts and never equates a stop request
with a stopped worker. Outstanding delegated work involving this agent also
blocks deletion until it settles, preserving other agents' work. Historical
handoff messages already copied into other conversations remain there.
Checks and removal hold the SQLite write lock together. A concurrent claim or
submission either commits first and blocks deletion, or loses to deletion and
cannot recreate agent-owned rows. Successful deletion navigates Home and reloads
the agent list. A failed request keeps the confirmation open for inspection/retry.
Runtime and recovery limits
Roost's normal deployment runs one server/worker process for a data directory.
Deletion closes that process's idle per-agent Codex runtime (including native
memory work) before committing. A busy runtime refuses deletion. Active job
checks use persistent SQLite state; deletion does not attempt distributed
termination of another Roost installation or manually restarted external
terminals. Stopped external sessions remain available for manual inspection.
The feature never deletes worktrees or revokes provider credentials.
The schema advances from 10 to 11. Older Roost binaries refuse the newer schema;
use a pre-upgrade backup for a downgrade. Tombstones must be preserved when
migrating data to keep old creation requests from recreating deleted identities.
Matched rendered screenshots
Actual screenshots were captured before the UI edit and after it, using the same synthetic Scout agent, settings/Soul screen, light theme, scroll position, device scale 1, and viewport. Confirmation images are additional after-only views. No mockups or screenshot artifacts are committed.
All six GitHub attachments were downloaded successfully and their SHA-256 hashes matched the original PNG bytes. The PR remains draft for coordinator review; this handoff does not claim final acceptance.
Desktop before — settings, 1440×1000
Desktop after — settings, 1440×1000
Mobile before — settings, 390×844
Mobile after — settings, 390×844
Desktop confirmation — after only, 1440×1000
Mobile confirmation — after only, 390×844