feat(cli): add a --handoff command emitting a redacted handoff brief for a parallel agent's leased workspace (#236)#237
Merged
Conversation
…for a parallel agent's leased workspace (#236) Operators could provision, observe, integrate, and cancel parallel workspaces, but when a parallel agent finished there was no structured handoff describing what that specific agent accomplished — they had to inspect the lease branch by hand before deciding to integrate or cancel. Add collectWorktreeHandoff plus an opt-in --handoff command (by --task-identity/--agent-identity) that reports the lease branch, the commits the agent made since the base, the changed paths, and the clean/dirty state, bounded and redacted. Strictly read-only; an absent lease is an absent handoff, not an error.
Owner
Author
E2E verification
|
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
Adds an opt-in (
--handoff) read-only command that emits a handoff brief for a parallel agent's leased workspace, decomposed from roadmap #39 (isolated parallel agents).Operators could provision (#50), observe (#232), integrate (#228), and cancel (#230) parallel workspaces, but when a parallel agent finished there was no structured handoff describing what that specific agent accomplished — they had to inspect the lease branch by hand before deciding to integrate or cancel. The existing briefs (#70/#116) describe the current change, not a specific parallel agent's leased workspace.
Design
src/worktree-lease.ts: newcollectWorktreeHandoff(opts)(reusing the module's lease-derivation/git helpers) plusformatWorktreeHandoff. For a specific lease (task+agent identity) it reports the branch, abbreviated head, the commits the agent made since the base (HEAD..branch), the changed paths (HEAD...branch, home-collapsed), and the clean/dirty state — bounded (50 commits / 100 paths) and redacted. Strictly read-only; an absent lease yieldspresent:false(not an error).src/index.ts: opt-in--handoff(with--task-identity/--agent-identity) wired as a read-only mode (JSON + text), exiting 0 on success and 2 on a missing identity or non-repository target.Testing
tests/unit/result-handoff.test.ts(9 tests): absent handoff, branch/head/commits/changed-paths for a lease that committed, dirty state, secret-shaped commit-subject redaction, no-mutation proof, missing-identity and non-repository refusal, and formatting (absent + present).tests/integration/result-handoff.test.ts(3 tests): CLI emits a handoff brief (JSON) for a lease that made a commit (read-only), an absent handoff (text) for an unknown lease, and exit 2 on a missing identity.Gates: typecheck, build, unit (1667), integration (464 + desktop), smoke (51) all pass.
Closes #236