Skip to content

bug: renamed agent's soft-delete recovery mounts a fresh empty workspace volume (rename keeps the old volume) #1665

Description

@dolho

Found while fixing #1664 — deliberately left out of that PR to keep the P0 data-loss fix tight.

Summary

Rename keeps the agent's Docker volumes under the pre-rename base (agent-{old}-workspace); the live container carries the mount forward, so the running agent is fine. But three code paths still derive the volume name by f-stringing the agent's current name, which for a renamed agent points at a volume that does not exist:

Fix

#1664 added the primitive: agent_ownership.volume_base_name (NULL ⇒ agent_name) + db.get_volume_base_name(agent). The purge path and the orphan sweep already resolve through it. These paths should too:

base = db.get_volume_base_name(agent_name) or agent_name
base_volumes = {f"agent-{base}-workspace": {"bind": "/home/developer", "mode": "rw"}}

A repo-wide grep for f"agent-{...}-workspace" is the audit — every site that means "this agent's volume" must go through get_volume_base_name, never the current name.

Repro

  1. Create agent old, write files to its workspace.
  2. Rename oldnew.
  3. Soft-delete new, then recover it via POST /api/admin/soft-deleted/agents/new/recover.
  4. POST /api/agents/new/start → container comes up on a brand-new empty agent-new-workspace; the data sits unreferenced in agent-old-workspace.

Related

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions