Skip to content

fix(cli): overlay the live roster when restoring a backup - #3319

Merged
zhayujie merged 1 commit into
zhayujie:masterfrom
Lesereingrape:fix/restore-live-agent-roster
Sep 29, 2026
Merged

zhayujie merged 1 commit into
zhayujie:masterfrom
Lesereingrape:fix/restore-live-agent-roster

Conversation

@Lesereingrape

Copy link
Copy Markdown
Contributor

Fixes #3318

restore_backup_archive read the live roster out of config.json, but
team.migrate() moves it to <instance_root>/agents/team.json on every
startup, so on a running install current_config.get("agents") is always empty
and the "reuse the layout this machine already runs on" branch in
_multi_agent_destinations never fires.

An Agent parked outside the derived agents/<id> tree was therefore restored
into a shadow directory under the instance root, and because that directory is
exactly what the layout implies, team.compact() dropped its workspace key
while rewriting the roster. The restore reported success, the Agent's real
workspace was left untouched, and the pointer to it was gone.

create_backup_archive already overlays the team file; restore now does the
same, so both sides resolve the layout the machine actually runs on.

Test: test_multi_agent_restore_reuses_the_local_roster_file builds a
migrated install (config.json with only agent_workspace, roster in
team.json, research on a custom path) and asserts the archive lands in the
live workspace and the roster keeps that path. Red on 3e74cd07:

AssertionError: assert 'local research' == 'new research'

Full suite before and after, on the same commit, are identical apart from the
new test: 32 failed, 2298 passed → 32 failed, 2299 passed, and the sorted
FAILED list diffs empty. ruff --select F clean.

`team.migrate()` keeps the roster beside the workspaces, so `restore` read an
empty `agents` list from config.json and every Agent landed on the layout the
archive implies: the real workspace was left untouched and `team.compact()`
dropped its custom `workspace`, silently relocating the Agent.
@zhayujie
zhayujie merged commit 724ecb0 into zhayujie:master Sep 29, 2026
3 checks passed
@zhayujie

Copy link
Copy Markdown
Owner

Merged, thanks @Lesereingrape! Overlaying team.json before picking destinations keeps restore consistent with backup, and the resolved config is only used for locating targets, so the published config.json still stays free of roster keys. This will ship in v2.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cow restore ignores the live roster in agents/team.json and silently relocates agents

2 participants