Skip to content

WL-0MKYOAM4Q10TGWND: Implement wl github delegate command#783

Merged
rgardler-msft merged 5 commits intomainfrom
wl-0mm8lx8rb0ovljwb-register-delegate-subcommand
Mar 2, 2026
Merged

WL-0MKYOAM4Q10TGWND: Implement wl github delegate command#783
rgardler-msft merged 5 commits intomainfrom
wl-0mm8lx8rb0ovljwb-register-delegate-subcommand

Conversation

@rgardler-msft
Copy link
Copy Markdown
Owner

@rgardler-msft rgardler-msft commented Mar 2, 2026

Summary

Implements the complete wl github delegate <id> CLI subcommand that pushes a Worklog work item to GitHub and assigns it to the Copilot coding agent in one command.

  • Registers delegate as a subcommand of wl github with --force, --json, and --prefix options
  • Implements guard rails: do-not-delegate tag check (with --force bypass) and children warning (TTY prompt in interactive mode, silent proceed in non-interactive)
  • Wires push (via upsertIssuesFromWorkItems) + assign (via assignGithubIssueAsync) + local state update (status=in-progress, assignee=@github-copilot)
  • On assignment failure: does NOT update local state, adds a comment describing the failure, and re-pushes the item to restore consistency
  • Supports both human-readable progress messages and structured --json output with partial failure details
  • Adds 13 unit tests covering all guard rails, success/failure paths, and output formatting
  • Fix: Corrected assignee handle from copilot to @copilot to match GitHub's required format for Copilot assignment (WL-0MM8NN4S71WUBRFT)

Work Items

  • Parent: Delegate to GitHub Coding Agent (WL-0MKYOAM4Q10TGWND)
  • WL-0MM8LX8RB0OVLJWB: Register delegate subcommand with guard rails
  • WL-0MM8LXODU1DA2PON: Implement push, assign, and local state update flow
  • WL-0MM8LXZ0M04W2YUF: Human-readable and JSON output formatting
  • WL-0MM8LY8LU1PDY487: End-to-end unit test suite for delegate
  • WL-0MM8NN4S71WUBRFT: Fix @copilot assignee handle in delegate command

Note: This PR depends on PR #782 (assignGithubIssue helper) being merged first.

Files Changed

  • src/commands/github.ts — Added delegate subcommand; fixed @copilot assignee handle
  • tests/cli/delegate-guard-rails.test.ts — 13 unit tests, updated for @copilot
  • src/github.ts — Added assignGithubIssueAsync and assignGithubIssue helpers (from PR WL-0MM8LWWCD014HTGU: Add assignGithubIssue helper for delegate command #782)
  • tests/github-assign-issue.test.ts — 11 assign helper tests, updated for @copilot

Testing

All 1172 tests pass. TypeScript compiles cleanly.

… helpers

Add new exported functions to src/github.ts that wrap
`gh issue edit --add-assignee` with the existing retry/backoff
infrastructure:

- assignGithubIssueAsync: async variant with rate-limit retry/backoff
  (configurable retries, default 3). Returns { ok, error? } without
  throwing on failure.
- assignGithubIssue: sync variant using runGhDetailed. Returns
  { ok, error? } without throwing on failure.
- AssignGithubIssueResult interface exported for consumers.

Includes 11 unit tests covering success, failure, retry on rate-limit/403,
max retry exhaustion, and command construction verification.
…ent delegate subcommand with guard rails, push/assign flow, and output formatting

- Register `wl github delegate <id>` subcommand with --force, --json, --prefix options
- Implement do-not-delegate tag guard rail with --force bypass
- Implement children warning with TTY prompt; non-interactive mode proceeds silently
- Wire push (upsertIssuesFromWorkItems) + assign (assignGithubIssueAsync) + local state update
- On assignment failure: skip local state update, add comment, re-push for consistency
- Support both human-readable progress output and structured --json output
- Add 13 unit tests covering guard rails, success/failure paths, and output formatting
The delegate command was passing 'copilot' to gh issue edit --add-assignee,
but GitHub requires '@copilot' for Copilot assignment. Updated the assignee
argument, error messages, console output, and all related tests.
…ul delegation

On successful delegation, the local state update now includes stage='in_progress'
alongside status='in-progress' and assignee='@github-copilot'. A re-push is
performed after the local update so the GitHub issue immediately reflects the
updated wl:status:in-progress and wl:stage:in_progress labels.
…dated." to failure output and first-push test

- Fix AC #2: failure message now includes "Local state was not updated."
  to clearly indicate local state was preserved on assignment failure
- Add test verifying failure output contains the phrase
- Add test for first-push path (no githubIssueNumber) that creates the
  GitHub issue before assigning to @copilot
- All 1174 tests pass across 92 test files
@rgardler-msft rgardler-msft merged commit 20b344e into main Mar 2, 2026
4 checks passed
@rgardler-msft rgardler-msft deleted the wl-0mm8lx8rb0ovljwb-register-delegate-subcommand branch March 2, 2026 05:15
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.

1 participant