feat: soft-delete with archive for local assistant retirement#7413
Conversation
Archive ~/.vellum to an XDG-compliant location before deleting on retire, and add a recover command to restore previously retired local assistants. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 13322a08e0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| export function getArchivePath(assistantId: string): string { | ||
| return join(getRetiredDir(), `${assistantId}.tar.gz`); |
There was a problem hiding this comment.
Validate assistant IDs before building archive paths
getArchivePath/getMetadataPath concatenate a user-controlled assistant name directly into path.join, so names containing .. can escape $XDG_DATA_HOME/vellum/retired. Since names come from CLI input (hatch --name and recover <name>), this lets retire write archives outside the retired directory and lets recover read/unlink unintended .tar.gz/.json files, which can clobber or delete unrelated files on the host. Reject path separators/traversal segments (or canonicalize and enforce the retired-dir prefix) before constructing these paths.
Useful? React with 👍 / 👎.
Reject names containing path separators or traversal segments, and canonicalize+verify the resolved path stays inside the retired directory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Export validateAssistantName from retire-archive and call it in parseArgs when --name is provided. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
~/.vellumto$XDG_DATA_HOME/vellum/retired/(tar.gz + JSON metadata) before deleting onretire, with graceful fallback to destructive deletion if archiving failsvellum-cli recover <name>command that restores a retired local assistant from its archive, re-registers the lockfile entry, and starts daemon + gatewayTest plan
vellum-cli hatch local— hatch an assistantvellum-cli retire <name>— verify archive appears at~/.local/share/vellum/retired/<name>.tar.gzand.jsonvellum-cli recover <name>— verify~/.vellumis restored, lockfile entry is back, daemon startsvellum-cli recover <name>with no archive — verify clean error messagevellum-cli recover <name>with~/.vellumexisting — verify clean error message🤖 Generated with Claude Code