Skip to content

feat(discovery): add GitHub Copilot CLI session adapter - #249

Open
markbosch wants to merge 6 commits into
kunchenguid:mainfrom
markbosch:copilot-adapter
Open

markbosch wants to merge 6 commits into
kunchenguid:mainfrom
markbosch:copilot-adapter

Conversation

@markbosch

@markbosch markbosch commented Nov 16, 2026 •

Copy link
Copy Markdown

What Changed

  • Added a copilot discovery adapter that reads ~/.copilot/session-state/<uuid>/events.jsonl and ties sessions to a repo through session.start cwd/gitRoot. It is registered in ALL_HARNESSES, the discovery index, the SSH probe and bundle, and the TUI render. README now lists eight harnesses.
  • Added invocation-scoped model and effort overrides for copilot in harness-invoke.js. They go through an argv wrapper that passes --model, --reasoning-effort and --acp --stdio, and are refused on Windows or when copilot is not on PATH. Also added a copilot login hint in agents.js.
  • Added a golden fixture (copilot-session.jsonl) with adapter tests, a config test update, and harness-invoke-copilot tests.

Risk Assessment

✅ Low: This adds a fail-soft read-only Copilot discovery adapter and an invocation-scoped model/effort wrapper that follow the existing grok and pi patterns, and I found no concrete defects.

Testing

I ran the real backpass CLI scan against a disposable Copilot session store and repo. The copilot harness row showed 1 scanned and 1 matched, with the session classified as interactive and associated by cwd at tier 1. With a missing store it exited 0 and the copilot row did not appear in the output at all, rather than failing. The targeted adapter, harness-invoke and config tests also passed. I did not drive a model call through the copilot binary, so the model/effort flag wiring is covered only by those unit tests.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Local scan with a synthetic Copilot session store discovers and matches the session to the repo by cwd ✅ pass live scan.txt: copilot SCANNED 1, MATCHED 1, interactive, tier1
Scan with a nonexistent COPILOT_HOME stays fail-soft ✅ pass live scan-missing.txt: the scan ran and the copilot row did not appear; exit code 0
Copilot model and effort overrides reach the copilot binary as process flags, and no wrapper is used without overrides ✅ pass live tests.txt: harness-invoke-copilot tests pass. These run a fake copilot binary through the real invocation wrapper.
Evidence: scan with Copilot session
repo · 1 worktree(s) · since 30d

HOST   HARNESS   SCANNED  MATCHED  SELF  CACHED  NOTE
local  claude    0        0        0     0
local  codex     0        0        0     0
local  pi        0        0        0     0
local  opencode  0        0        0     0
local  grok      0        0        0     0
local  cursor    0        0        0     0
local  hermes    0        0        0     0
local  copilot   1        1        0     0

1 transcript(s) associated with this repo · tier1 1 (exact) · tier1.5 0 (sibling clone) · tier2 0 (remote) · tier3 0 (best-effort) · interactive 1 · non-interactive 0

HOST   HARNESS  SESSION       KIND         WHEN   SIZE  TIER  HOW
local  copilot  11111111-222  interactive  today  2KB   t1    cwd is worktree /private/var/folders/z_/1h77d1t162gdqt_blpjhqn5w0000gn/T/tmp.8RXa8g1wWg/repo
Evidence: scan with missing store
repo · 1 worktree(s) · since 30d

HOST   HARNESS   SCANNED  MATCHED  SELF  CACHED  NOTE
local  claude    0        0        0     0
local  codex     0        0        0     0
local  pi        0        0        0     0
local  opencode  0        0        0     0
local  grok      0        0        0     0
local  cursor    0        0        0     0
local  hermes    0        0        0     0
local  copilot   0        0        0     0

0 transcript(s) associated with this repo · tier1 0 (exact) · tier1.5 0 (sibling clone) · tier2 0 (remote) · tier3 0 (best-effort) · interactive 0 · non-interactive 0

HOST  HARNESS  SESSION  KIND  WHEN  SIZE  TIER  HOW
Evidence: targeted tests
✔ claude adapter classifies a session by its per-line cwd (4.157875ms)
✔ claude adapter reads messages, folds tool results, and drops sidechains (0.4715ms)
✔ claude adapter enumerates the default store and CLAUDE_CONFIG_DIR, without double-counting (8.3915ms)
✔ copilot adapter classifies a session from its session.start context (0.710958ms)
✔ copilot adapter keeps user turns, folds tool results, and drops injected and sub-agent events (0.273916ms)
✔ copilot adapter enumerates events.jsonl per session and honors COPILOT_HOME (2.893792ms)
✔ codex adapter honors CODEX_HOME (0.346167ms)
✔ codex adapter reads the recorded git remote, enabling tier-2 association (2.792166ms)
✔ codex adapter keeps user/assistant turns and skips developer scaffolding (0.331083ms)
✔ pi adapter reads the session header and drops thinking blocks (2.1195ms)
✔ pi adapter ignores an omp-style model field outside a title-led transcript (1.955041ms)
✔ pi adapter classifies omp sessions past the title record and reads model (2.163291ms)
✔ pi adapter accepts only line one or line two after a title header (4.414542ms)
✔ pi adapter links an OMP subagent to its sibling parent session (4.022209ms)
✔ pi adapter links a second-level OMP subagent to the root session (4.644292ms)
✔ pi adapter links OMP subagents by nested path even when their cwd differs (4.54375ms)
✔ pi discovery checks a missing parent path once per scan (5.000583ms)
✔ pi nested layout signals subagents without readable ancestor headers (9.151125ms)
✔ pi adapter keeps plain Pi stores one level deep and reads nested layout only in the opt-in OMP store (15.249417ms)
✔ pi adapter reads an OMP store reached through PI_CODING_AGENT_DIR only when includeOmp is on (5.56125ms)
✔ pi adapter enumerates standalone and BB-managed session roots without duplicates (13.941916ms)
✔ pi adapter merges flat and nested scans for one sessions root (2.73675ms)
✔ BB-managed Pi cwd values use the existing live and deleted worktree association (5.162208ms)
✔ grok adapter reads remotes from summary.json and tool calls off the assistant record (4.178542ms)
✔ cursor CLI chat directories are addressed by md5 of the cwd (0.288667ms)
✔ hermes adapter recovers cli/acp cwd, skips gateway, converts seconds to ms, and folds tools (25.0245ms)
✔ hermes adapter collects v26 interactive sessions with trustworthy cwd and skips shared sources (10.58975ms)
✔ normal discovery associates only trustworthy Hermes TUI sessions in project and user scope (118.066125ms)
✔ opencode test homes are removed and HOME restored on success and failure (3.87725ms)
✔ opencode adapter lists an OpenCode 2 store by session_v2, dated by its newest message (41.948542ms)
✔ opencode adapter counts epoch-dated messages as recorded (36.719ms)
✔ opencode adapter reads an OpenCode 2 session: turns and calls in order, harness text left out (38.206625ms)
✔ opencode adapter still reads an OpenCode 1.x store, which leaves session_message empty (25.348208ms)
✔ an upgraded opencode store is read from session_v2, where each copied session continues (55.247ms)
✔ an opencode store with neither session table is named as drifted, never read as empty (4.010459ms)
warn unknown harness "not-a-harness" in config.discovery.harnesses - ignoring
warn discarding corrupt state file ../../../../../../var/folders/z_/1h77d1t162gdqt_blpjhqn5w0000gn/T/backpass-state-RQ9JyK/.backpass/scan-cache.json: Unexpected token 'o', "not json at all" is not valid JSON
✔ the defaults match the approved design (14.9975ms)
✔ a model without an agent is rejected rather than half-auto-picked (16.876083ms)
✔ ladders are user-editable and validated (11.435042ms)
✔ repo config overrides defaults, and CLI flags override both (3.811084ms)
✔ repo null explicitly overrides a global agent pin with auto-pick (6.905083ms)
✔ skillsDir is normalized when the configuration loads (3.65ms)
✔ skillsDir rejects malformed configuration values (17.922125ms)
✔ skillSearchPaths defaults to none and rejects non-array-of-strings values (13.59825ms)
✔ skillSearchPaths rejects degenerate roots: the empty string and the filesystem root (23.973875ms)
✔ skillSearchPaths rejects a root that is the repo root, or an ancestor of it (7.699667ms)
✔ skillSearchPaths rejects a root that equals or contains the repo's own skillsDir (9.41675ms)
✔ skillSearchPaths expands ~ and feeds the read-only awareness list without touching skillsDir (2.869625ms)
✔ --include-cursor-ide is the only way the deferred store is scanned (0.620833ms)
✔ OMP discovery rejects non-boolean opt-ins rather than treating them as enabled (10.187584ms)
✔ unknown harness names are dropped rather than failing the run (3.053667ms)
✔ invalid config values fail loudly with a usable message (18.9535ms)
✔ --since accepts durations and an explicit "all" (0.093167ms)
✔ evidence is keyed to both the transcript and the memory file it was judged against (0.701875ms)
✔ state round-trips through disk and survives a corrupt file (26.440084ms)
✔ an interrupted legacy evidence migration remains stale under the current analysis index (12.235709ms)
✔ transcript ids are turned into safe filenames (0.057959ms)
✔ user-scope config ignores a checkout .backpassrc.json and defaults minGapProjects to 1 (5.707209ms)
✔ user-scope defaults honor relocated Claude and Codex homes (5.494875ms)
✔ copilot model and effort reach the real binary as flags, ahead of the ACP stdio flags (469.708042ms)
✔ copilot without overrides needs no wrapper (0.089084ms)
ℹ tests 60
ℹ suites 0
ℹ pass 60
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 633.884708

Pipeline

Updates from git push no-mistakes

⏭️ **Intent** - skipped

Step was skipped.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Local scan with a synthetic Copilot session store discovers and matches the session to the repo by cwd ✅ pass live scan.txt: copilot SCANNED 1, MATCHED 1, interactive, tier1
Scan with a nonexistent COPILOT_HOME stays fail-soft ✅ pass live scan-missing.txt: the scan ran and the copilot row did not appear; exit code 0
Copilot model and effort overrides reach the copilot binary as process flags, and no wrapper is used without overrides ✅ pass live tests.txt: harness-invoke-copilot tests pass. These run a fake copilot binary through the real invocation wrapper.
  • node bin/backpass.js scan in a disposable git repo, with COPILOT_HOME pointing at a synthetic copy of the test/fixtures/copilot-session.jsonl fixture
  • node bin/backpass.js scan with COPILOT_HOME pointing at a nonexistent directory
  • node --test test/adapters.test.js test/harness-invoke-copilot.test.js test/config.test.js (60 tests passed)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Reads ~/.copilot/session-state/<id>/events.jsonl (COPILOT_HOME aware).
Skips sub-agent events and harness-injected user messages.
@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous finding is fully fixed.

Reviews (4) · Last reviewed commit: "fix: drop agents that also reject Window..." · Reviewed by Greptile

@greptile-apps

This comment has been minimized.

@markbosch markbosch changed the title feat(discovery): add GitHub Copilot CLI session adapter feat(discovery): add GitHub Copilot CLI harness adapter Nov 16, 2026
@markbosch markbosch changed the title feat(discovery): add GitHub Copilot CLI harness adapter feat: add GitHub Copilot CLI session adapter and harness Nov 16, 2026
Comment thread src/harness-invoke.js Resolved
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @markbosch for the Copilot CLI adapter. It's a clean, fail-soft read-only adapter with a pinned fixture, which is exactly how VISION wants new harnesses added.

I reviewed the diff and approved the fork CI runs. Build-and-test passes on ubuntu and macOS, and the generated-files guard passes.

This is waiting on you: the required PR must be raised via no-mistakes check fails because the pipeline attestation in the PR body is bound to 5ab20a1, but the PR head is now 420eabe (the Windows-hints fix came in after the raise). Please re-run git push no-mistakes from the branch so the attestation matches the current head.

Once that's green, this goes to Kun for a decision rather than auto-merge. Adding copilot to the default discovery.harnesses list means an unconfigured backpass run will start reading ~/.copilot stores, and default-behavior changes need his call. Merge conflicts, if any come up, won't need anything from you; we'll handle those.

@markbosch markbosch changed the title feat: add GitHub Copilot CLI session adapter and harness feat(discovery): add GitHub Copilot CLI session adapter Nov 16, 2026
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.

2 participants