Skip to content

feat: add GitHub Copilot CLI crewmate and scout adapter - #5510

Open
Mani212005 wants to merge 3 commits into
kunchenguid:mainfrom
Mani212005:fm/fm-copilot-adapter
Open

Mani212005 wants to merge 3 commits into
kunchenguid:mainfrom
Mani212005:fm/fm-copilot-adapter

Conversation

@Mani212005

Copy link
Copy Markdown

Intent

Add GitHub Copilot as a worker with the auto model, so firstmate can dispatch coding work to it. The user has a GitHub Copilot student plan, which only allows the "auto" model. Delivery: a PR to upstream kunchenguid/firstmate opened from the user's fork (Mani212005/firstmate), since the user has no push access upstream.

What Changed

  • Added GitHub Copilot CLI (copilot) as a verified crewmate and scout harness adapter, supporting launch with -i brief auto-submission, --yolo, COPILOT_ALLOW_ALL=true workspace trust, --model selection (including auto), and reasoning effort mapping.
  • Implemented process identity classification in bin/fm-copilot-lib.sh for Copilot's Node loader shim and native child binary, along with turn-state tracking in bin/fm-busy-lib.sh by folding Copilot's durable per-session events.jsonl log.
  • Wired task lifecycle management (Ctrl+C interrupt, /exit exit command, post-launch folder-trust dialog handling, sidecar cleanup at teardown), reference documentation, and portable and live test suites.

Risk Assessment

✅ Low: The GitHub Copilot adapter is cleanly integrated across process detection, spawn templating, busy-state log folding, and control mechanics following established harness patterns with thorough test coverage and empirical verification documentation.

Testing

Exercised all Copilot adapter capabilities: harness marker precedence and argv/PID process ancestry detection, crewmate/scout launch construction with model auto and trust bypass, sidecar session binding, fold state transitions (busy/settled/abort), live execution of model turns with folder trust bypass, live turn steering and Ctrl+C interrupt aborts, and clean /exit pane termination.

  • Live validation: ✅ go - 3 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Copilot CLI harness detection via environment marker and command ancestry ⏸️ untested no The prior payload validated this scenario using unit/contract test assertions rather than driving it against a live running product instance.
Copilot worker control mechanics and role restrictions ⏸️ untested no The prior payload validated this scenario using unit/contract test assertions rather than driving it against a live running product instance.
Copilot worker spawn command construction with model auto, trust bypass, and binding sidecar ⏸️ untested no The prior payload validated this scenario using unit/contract test assertions rather than driving it against a live running product instance.
Live Copilot worker execution with auto model and workspace trust bypass ✅ pass live tests/fm-copilot-signals-live-e2e.test.sh (cases 1 and 2 in ~/.no-mistakes/evidence/01M39GZNHPFVJGVVFQ8H24J8GR/copilot-live-signals-e2e.log)
Live Copilot session fold and turn state convergence ✅ pass live tests/fm-copilot-signals-live-e2e.test.sh (case 3 in ~/.no-mistakes/evidence/01M39GZNHPFVJGVVFQ8H24J8GR/copilot-live-signals-e2e.log)
Live steering prompt delivery, Ctrl+C interrupt, and clean /exit ✅ pass live tests/fm-copilot-signals-live-e2e.test.sh (cases 4 and 5 in ~/.no-mistakes/evidence/01M39GZNHPFVJGVVFQ8H24J8GR/copilot-live-signals-e2e.log)
Backend process classification for Copilot binary and loader shim ⏸️ untested no The prior payload validated this scenario using unit/contract test assertions rather than driving it against a live running product instance.
Evidence: Copilot Harness Adapter Unit & Contract Test Log

Source: Copilot Harness Adapter Unit & Contract Test Log

FM_TEST_BEGIN 2026-09-24T11:06:34Z tests/fm-copilot-harness.test.sh family=unclassified expected_gate_skip=none
ok - fm-harness.sh: the copilot marker claims the identity before CLAUDECODE
ok - fm-harness.sh: ancestry detects a natively-named copilot command
ok - fm-harness.sh: ancestry reaches the node loader shim through argv
ok - fm-harness.sh: ancestry rejects unrelated copilot mentions
ok - fm-harness.sh: no inherited launcher marker claims the copilot identity
ok - fm-control-lib: copilot mechanics are Ctrl+C once, no clear key, and /exit
ok - fm-composer-lib: copilot delivery signatures never cross harnesses
ok - fm-busy-lib: the copilot fold reads opens, closes, gaps, and aborts
ok - fm-busy-lib: worker output cannot fake a copilot turn boundary
ok - fm-busy-lib: copilot session binding matches the (resolved) worktree
ok - fm-busy-lib: copilot binding excludes priors and refuses ambiguity
ok - fm-busy-lib: copilot classifies busy, idle, and unknown through the fold
ok - bin/fm-agent-process-lib.sh: copilot is an agent, fragments and strangers are not
ok - herdr exit detection: a registered pane with a copilot foreground stays live
ok - herdr exit detection: the loader shim proves through argv, strangers do not
ok - fm-spawn: copilot launch carries brief, model, effort, trust, and autonomy with cleared markers
ok - fm-spawn: copilot maps max effort and omits the flag by default
ok - fm-spawn: copilot arms no busy wiring and writes only its binding sidecar
ok - fm-spawn: copilot launches straight into a busy turn with no dialog
ok - fm-spawn: copilot answers a dialog that renders anyway exactly once, then confirms busy
ok - fm-spawn: a copilot dialog that never turns busy fails the spawn and closes the endpoint
ok - fm-spawn: a missing copilot executable refuses before pane creation
ok - fm-spawn: copilot cannot be launched as a secondmate
FM_TEST_END 2026-09-24T11:07:03Z tests/fm-copilot-harness.test.sh exit=0 duration_ms=28656 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=28728
FM_TEST_SUMMARY_FAMILY family=unclassified count=1 duration_ms=28656 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-copilot-harness.test.sh duration_ms=28656
Evidence: Copilot Live Signals End-to-End Test Log

Source: Copilot Live Signals End-to-End Test Log

FM_TEST_BEGIN 2026-09-24T11:07:06Z tests/fm-copilot-signals-live-e2e.test.sh family=unclassified expected_gate_skip=none
ok - live: the folder-trust dialog renders without the bypass and one Enter answers it
ok - live: COPILOT_ALLOW_ALL=true suppresses the trust dialog and the turn runs
ok - live: session events bind the workspace and fold busy/settled
ok - live: steering delivers and Ctrl+C aborts the turn
ok - live: /exit stops the agent and returns the pane to its shell
ok - copilot live signals verified end to end
FM_TEST_END 2026-09-24T11:08:25Z tests/fm-copilot-signals-live-e2e.test.sh exit=0 duration_ms=78914 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=78986
FM_TEST_SUMMARY_FAMILY family=unclassified count=1 duration_ms=78914 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-copilot-signals-live-e2e.test.sh duration_ms=78914
Evidence: Harness Precedence & Documentation Integration Test Log

Source: Harness Precedence & Documentation Integration Test Log

FM_TEST_BEGIN 2026-09-24T11:08:30Z tests/fm-harness-precedence.test.sh family=pure-contract-unit expected_gate_skip=none
FM_TEST_BEGIN 2026-09-24T11:08:30Z tests/fm-documentation-audiences.test.sh family=pure-contract-unit expected_gate_skip=none
FM_TEST_BEGIN 2026-09-24T11:08:30Z tests/fm-harness-adapter-references.test.sh family=pure-contract-unit expected_gate_skip=none
ok - harness adapter routing artifact is normalized and every target is readable
FM_TEST_END 2026-09-24T11:08:30Z tests/fm-harness-adapter-references.test.sh exit=0 duration_ms=79 gate_skip=false
ok - documentation inventory classifies every maintained prose surface exactly once
ok - classification, setup routing, and maintained-prose scope fail safely
ok - required documentation owner pointers cannot silently disappear
ok - local links resolve while dates, versions, commands, and incident prose remain semantically reviewed
FM_TEST_END 2026-09-24T11:08:31Z tests/fm-documentation-audiences.test.sh exit=0 duration_ms=789 gate_skip=false
ok - a markerless harness keeps its identity under an inherited foreign marker
ok - a harness that publishes a marker inside its own process tree is unchanged
ok - with ancestry silent, the marker layer and its cursor-first ordering still decide
ok - a retained cursor marker does not rename a nested claude worker
ok - an agreeing marker keeps Pi's finer identity that ancestry cannot prove
ok - an interpreter script-path match answers alone but never outranks a marker
ok - a native harness binary under an interpreter shim decides at comm strength
ok - a harness that is pid 1 of its own namespace is examined, not skipped
ok - the descent probe reaches comm strength where the top-of-session probe sees only args
ok - the descent probe reports no verdict from a sibling branch detection cannot reach
ok - a foreign args-only verdict at the deepest vantage leaves the comm-strength identity intact
ok - equal-depth descent ties prefer the comm-strength leaf regardless of spawn order
ok - a supervision branch resolves own, crew, and secondmate to the primary's pinned harness
ok - a supervision branch refuses to resolve a harness from a pin that names none
ok - session start renders the Codex protocol for a Codex primary holding a retained CLAUDECODE
FM_TEST_END 2026-09-24T11:08:38Z tests/fm-harness-precedence.test.sh exit=0 duration_ms=8166 gate_skip=false
FM_TEST_SUMMARY total=3 failed=0 skipped_gate=0 duration_ms=8383
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=3 duration_ms=9034 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-harness-precedence.test.sh duration_ms=8166
FM_TEST_SLOWEST rank=2 script=tests/fm-documentation-audiences.test.sh duration_ms=789
FM_TEST_SLOWEST rank=3 script=tests/fm-harness-adapter-references.test.sh duration_ms=79

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Copilot CLI harness detection via environment marker and command ancestry ⏸️ untested no The prior payload validated this scenario using unit/contract test assertions rather than driving it against a live running product instance.
Copilot worker control mechanics and role restrictions ⏸️ untested no The prior payload validated this scenario using unit/contract test assertions rather than driving it against a live running product instance.
Copilot worker spawn command construction with model auto, trust bypass, and binding sidecar ⏸️ untested no The prior payload validated this scenario using unit/contract test assertions rather than driving it against a live running product instance.
Live Copilot worker execution with auto model and workspace trust bypass ✅ pass live tests/fm-copilot-signals-live-e2e.test.sh (cases 1 and 2 in ~/.no-mistakes/evidence/01M39GZNHPFVJGVVFQ8H24J8GR/copilot-live-signals-e2e.log)
Live Copilot session fold and turn state convergence ✅ pass live tests/fm-copilot-signals-live-e2e.test.sh (case 3 in ~/.no-mistakes/evidence/01M39GZNHPFVJGVVFQ8H24J8GR/copilot-live-signals-e2e.log)
Live steering prompt delivery, Ctrl+C interrupt, and clean /exit ✅ pass live tests/fm-copilot-signals-live-e2e.test.sh (cases 4 and 5 in ~/.no-mistakes/evidence/01M39GZNHPFVJGVVFQ8H24J8GR/copilot-live-signals-e2e.log)
Backend process classification for Copilot binary and loader shim ⏸️ untested no The prior payload validated this scenario using unit/contract test assertions rather than driving it against a live running product instance.
  • bin/fm-test-run.sh tests/fm-copilot-harness.test.sh
  • FM_COPILOT_SIGNALS_LIVE=1 bin/fm-test-run.sh tests/fm-copilot-signals-live-e2e.test.sh
  • bin/fm-test-run.sh tests/fm-harness-precedence.test.sh tests/fm-documentation-audiences.test.sh tests/fm-harness-adapter-references.test.sh
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 1)
✅ **Push** - passed

✅ No issues found.

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