Add runpane panes archive command#342
Merged
Merged
Conversation
Closes dcouple#339. Lets agents archive a pane from the CLI same as the UI Archive action, including safe worktree removal. Refuses to archive (unless --force) when the pane has uncommitted, untracked, or unpushed-to-remote changes, so an agent can't accidentally nuke work. Waits for worktree cleanup to actually finish before returning and reports the outcome in worktreeCleanup. Wired into both the npm and Python CLI wrappers via the contract.
parsakhaz
approved these changes
Jul 21, 2026
parsakhaz
left a comment
Member
There was a problem hiding this comment.
Approved based on completed implementation review against issue #339.
Evidence checked:
- Contract and generated artifacts include
runpane panes archive, andpnpm run test:runpane-contractpasses. - npm and Python wrappers both parse, dispatch, confirm, and print archive results consistently.
- Daemon registers
runpane:panes:archiveand delegates to the existing UI archive path after a live safety preflight. - Archive safety refuses uncommitted, untracked, unpushed, and unknown-status panes unless
--forceis supplied. The preflight bypasses cached git status and uses live git plumbing/upstream comparison. - Cleanup semantics are explicit via
worktreeCleanup: completed|failed|timeout|not-applicable, using ArchiveProgressManager when available and polling as fallback. - Focused RunPane IPC tests cover clean archive, already archived/unknown pane rejection, dirty refusal, forced dirty archive, unpushed refusal, merged/pushed archive, main-repo not-applicable cleanup, status-unknown refusal, cleanup failure, and polling fallback.
Intentional tradeoffs noted: main-repo panes skip the worktree safety gate because there is no Pane-managed worktree to remove; branches without upstream use comparison-branch ahead count as a conservative proxy for unpushed work; cleanup waits are bounded and can report timeout rather than blocking indefinitely.
Recommendation: approve and merge after current-main integration checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #339.
runpane panes archive --pane <id> [--force] [--source user|agent] --yes [--json]--force) if the pane has uncommitted, untracked, or unpushed-to-remote commits, so agents can't silently blow away workworktreeCleanup: completed|failed|timeout|not-applicableTest plan
pnpm --filter main test runpane(41 tests, some hit real temp git repos for dirty/unpushed/merged cases)pnpm run check:runpane-contractandpnpm run test:runpane-contractmainandpackages/runpane--forcearchive with real worktree removal, already-archived rejection