Add coop up --new-instance for a second instance on one project - #450
Add coop up --new-instance for a second instance on one project#450DarkaMaul wants to merge 1 commit into
coop up --new-instance for a second instance on one project#450Conversation
`coop up` treats the project directory (or `--git-repo` URL) as identity and reuses the instance already recorded for it. Add `--new-instance` to skip that lookup and create a second, separately named instance for the same source tree, so two agents can work from one project. The flag requires `--name`, since the project-derived name is already taken.
hbrodin
left a comment
There was a problem hiding this comment.
Reviewed base 229c2d106e68 through head 8c1a75964afd. One finding: missing runtime coverage for sibling creation. Correctness, design, conventions, security, API usage, tests, docs, and comments lenses were covered; none skipped. No substantive diff-noise concerns or prior unresolved feedback.
Validation included diff checks, call-chain and CI inspection, and a standalone probe using pinned clap 4.6.6 that confirmed the name requirement and demonstrated that removing it defeats the rejection assertion. Full project tests and Lima/Firecracker integration were not run locally. CI is green but includes neither VM integration gate.
| } | ||
|
|
||
| if let Some(inst) = find_workspace_instance(cfg, &project_dir)? { | ||
| if !opts.new_instance |
There was a problem hiding this comment.
Please add runtime coverage for sibling creation. Neither this lookup bypass nor the Git URL bypass is exercised by tests: the new tests only parse arguments, and the existing multi-instance integration phase uses different directories. Both handlers are excluded from mutation testing, so removing either bypass would leave those checks green.
Add integration coverage for directory and Git URL siblings that verifies independent instances, duplicate-name rejection, and subsequent plain-up ambiguity, and run it on Lima and Firecracker before merge.
coop uptreats the project directory (or--git-repoURL) as the instanceidentity: it reuses the instance already recorded for that path and applies
creation-only inputs only when it creates one. There was no way to ask for a
second environment on the same source tree — the existing instance always won.
--new-instanceskips the workspace/git-repo lookup and creates a separateinstance instead. It requires
--name, since the project-derived name isalready taken by the first instance.
Behavior notes
--new-instance --name Xfails inallocate_instancewith
Instance 'X' already exists, so the flag is not idempotent the wayplain
upis.coop up DIRreports the existing "Multiple instances share workspace"ambiguity error instead of picking one, including when
--nameis given(
upbails during the lookup, before the name is considered). Instances areaddressed by name from then on:
coop start <name>,coop shell <name>.Whether
up --nameshould instead select the named sibling is a separatedecision — flagging it here rather than changing
up's semantics in this PR.Tests / gates
--new-instanceparses with--name, and errors withMissingRequiredArgumentwithout it.cargo fmt -- --check,cargo clippy --all-targets --all-features -D warnings,cargo test(1113 passed) — all green.(bypassing the lookup and booting a sibling VM) has no
tests/integration.shphase;
cmd_up/cmd_up_git_repoare excluded from the mutation sweep by theexisting
\bcmd_[a-z_]+\brule, so the guard has no unit-level coverageeither. An integration phase next to the existing two-instance phase is the
gap to close before merge.