test(qa): add managed-worktrees CLI lifecycle scenario coverage (#120335)

* test(qa): add managed-worktrees CLI lifecycle scenario coverage

Managed worktrees had zero QA scenario-pack coverage despite being a
headline feature. Mint agent-runtime.managed-worktrees-lifecycle in the
taxonomy, add a runtime scenario, and prove the real child CLI through
create with .worktreeinclude provisioning and the .openclaw setup hook,
dirty removal pinning a snapshot ref, restore rebuilding tracked,
untracked, and provisioned files with their modes, and gc preserving
manual worktrees.

* fix(qa): align model-switch catalog assertion with expectedAlternate flow

qa/scenarios/models/model-switch-follow-up.yaml switched to
expectedAlternate.model in 5a795f4dda but the catalog test still greps
for the retired alternate?.model literal; the test is outside the PR
change-classification lanes, so the break only surfaces on direct runs.

* test(qa): narrow managed-worktrees taxonomy description to proven manual-owner gc

ClawSweeper P2 on #120335: the scenario proves manual-owner gc retention
only; session and Workboard cleanup lifecycles are not exercised, so the
coverage description must not claim them.
This commit is contained in:
Peter Steinberger
2026-08-07 14:18:12 -07:00
committed by GitHub
parent 87156bab23
commit 45b1dbf962
4 changed files with 231 additions and 1 deletions
@@ -0,0 +1,27 @@
title: Managed worktrees CLI lifecycle
scenario:
id: managed-worktrees-cli
surface: runtime
category: agent-runtime.agent-turn-execution
coverage:
primary:
- agent-runtime.managed-worktrees-lifecycle
objective: Prove the real child CLI creates a manual managed worktree with ignored-file provisioning and its repository setup hook, snapshots dirty state during removal, restores tracked, untracked, and provisioned files with their modes, and preserves the active manual worktree through gc.
successCriteria:
- Create provisions ignored files with their modes and runs the repository setup hook with canonical source and worktree paths.
- Dirty removal pins a snapshot ref in the source repository and retains the removed record for restoration.
- Restore rebuilds tracked and untracked changes plus provisioned ignored files with their modes without putting the synthetic snapshot commit in branch history.
- Garbage collection returns its structured result while preserving the active manual worktree.
docsRefs:
- docs/concepts/managed-worktrees.md
- docs/concepts/qa-e2e-automation.md
codeRefs:
- src/cli/worktrees-cli.ts
- src/agents/worktrees/service.ts
- src/agents/worktrees/provisioned-files.ts
- test/e2e/qa-lab/runtime/managed-worktrees-cli-product-proof.e2e.test.ts
execution:
kind: vitest
path: test/e2e/qa-lab/runtime/managed-worktrees-cli-product-proof.e2e.test.ts
summary: Run the real child CLI through managed worktree provisioning, snapshot removal, restoration, and manual-owner garbage collection.