Skip to content

feat(sessions): read Copilot CLI transcripts - #1785

Merged
SaulMoro merged 4 commits into
Tencent:mainfrom
XY-code1:feat/1418-copilot-sessions
Nov 8, 2026
Merged

SaulMoro merged 4 commits into
Tencent:mainfrom
XY-code1:feat/1418-copilot-sessions

Conversation

@XY-code1

@XY-code1 XY-code1 commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a read-only GitHub Copilot CLI session adapter for the Copilot portion of #1418.

  • reads native Copilot CLI 0.0.x and 1.0.x session-state/<id>/events.jsonl logs
  • restores the working directory from workspace.yaml when it is absent from the event stream
  • preserves user, assistant, model-change, tool-call, and tool-result ordering
  • registers Copilot session discovery and updates the support matrices/documentation
  • keeps the native Copilot store read-only

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes
  • npx vitest run passes
  • Added/updated tests for the change
  • npx vitest run src/__tests__/copilot-session-adapter.test.ts src/__tests__/session-platform-facts.test.ts src/__tests__/locate-sessions.test.ts — 553 tests passed
  • Targeted type-aware oxlint on the changed TypeScript files passes
  • npm run build passes
  • Real CLI verification against official Copilot CLI 0.0.411 and 1.0.107 logs
  • Built TeamAI CLI detected Copilot and session push --source copilot archived 3 native sessions into an isolated Git repository
  • score --session was not run because this checkout is not initialized as a TeamAI repository (not_initialized)

The full Windows suite and repository-wide documentation checker are not clean in this checkout for pre-existing, unrelated workflow/docs and Windows fixture failures; the focused adapter, registry, platform-facts, build, typecheck, and lint coverage above is green.

Related Issues

Part of #1418

Notes for Reviewers

  • The adapter implements only the read path; writes deliberately throw ToolUnavailableError.
  • workspace.yaml is a fallback for logs that do not carry a workspace event.
  • CWD matching resolves symlinks to keep --cwd filtering consistent.
  • Tested with real sessions created by official Copilot CLI 0.0.411 and 1.0.107, including a native tool call.
  • AI disclosure: developed with Codex assistance; the author reviewed the changes and ran the verification recorded above.

Add a read-only Copilot session adapter for 0.0.x and 1.0.x event logs, including workspace, model, tool-call, and tool-result recovery.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

No confident findings in the scoped PR diff.

The description satisfies the real-CLI testing requirement: it records a successful build and session push --source copilot archiving three native sessions from official Copilot CLI versions into an isolated Git repository. It also documents focused tests and remaining validation limitations.

Review was read-only; I did not run, build, or install PR code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@XY-code1

XY-code1 commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed the CI regressions in 522b44bb.

The Copilot adapter changes Copilot from an unread tool to a readable session source, so I updated the three stale expectations that still assumed otherwise:

  • dashboard session-sharing unit expectation now reports no unread tool
  • dashboard session-sharing E2E expectation now reports no unread tool
  • score drain now expects a missing local Copilot session to use the standard not found message instead of reads no sessions

Validation: the session-sharing unit suite passes (13 tests), the targeted E2E reaches the updated assertion locally, typecheck passes, targeted type-aware oxlint passes, and git diff --check is clean. CI has restarted from the push.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

No confident findings in the scoped PR diff. The earlier review raised no findings, so there are none to mark resolved.

The PR description satisfies the real-CLI testing requirement: it records a successful build and session push --source copilot archiving three native sessions from official Copilot CLI versions into an isolated Git repository. It also documents focused test coverage and remaining validation limitations.

Review was read-only; I did not run, build, or install PR code.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

I built 522b44bb and the merge-base (05fe72a2) and ran session push --source copilot on both:

  • Base: exits 1 with Unknown platform "copilot".
  • Head: archives 4 sanitized fixtures, plus 30 real local Copilot CLI logs from versions 0.0.411 and 1.0.90. For every session the archived message count matches the raw log. A partial last line is handled. I had no 1.0.107 logs to check against.

[P2 non-blocking] One malformed line anywhere except the last fails the whole Copilot listing. parsed() in src/session-flow/adapters/copilot.ts:154-166 parses every events.jsonl with no handling per file. I put one bad non-final line in one session, and then:

  • session push --source copilot --all exits 1 and archives nothing;
  • session migrate of a different, valid session fails with list_failed.

The Claude adapter skips a bad session and keeps going. None of the 30 real logs had a bad line, so this needs a corrupted file, but when it happens it takes out every Copilot session. Fix: wrap parseCopilotFile in parsed(), so a file that fails to parse is skipped and logged at debug.

[P2 non-blocking] The score --session --source copilot item from #1418 has no record. Neither the body nor my runs cover it. It needs an initialized repo and a judge.

[P2 non-blocking] docs/guide/dashboard.md:367 and the zh-CN page still don't list copilot among the session platforms.

[P3 nit]

  • The adapter's own write-error text never appears through migrate, because the read-only message comes from the platform facts (agent-session.ts:162-167).
  • Records that fail the schema are skipped without a message. I saw no loss from it.
  • The body's caveats about Windows and the doc checker are out of date: both pass in CI at this head.
  • The real-CLI record cites 1.0.107 but only summarizes the run. Pasting the commands and output would make it checkable.

CI review: it reports no findings. I disagree on the malformed-line case above, which it did not raise. CI is green at this head, apart from the GitHub-provider E2E, which is skipped on forks.

Merge risk: medium

  • Alignment: decent. The reader and its registry, platform facts, the TOOLS entry and README marks are consistent. The score item and the dashboard doc are missing.
  • Impact: medium. It adds a new session source to push, migrate, score and the dashboard. Other platforms are untouched.
  • Verification: decent. Built-CLI runs on real logs from two Copilot versions, and green CI. Not run: score, and the 1.0.107 format.
  • Rollback cost: low. It only adds code.
  • Error detection: decent. One bad file fails the whole platform instead of only that session.

@jeff-r2026 your call on this one: it adds Copilot CLI as a new session source. The code works on real logs. The malformed-file case above is the one change I'd want before it ships.

@SaulMoro
SaulMoro requested a review from jeff-r2026 November 8, 2026 18:36
One malformed line in any events.jsonl made the whole Copilot listing
throw, so `session push --all` archived nothing and migrating another
valid session failed. A log that fails to read is now skipped with a
debug line, and the other sessions still list.
Copilot CLI sessions are read-only sources, so they belong in the
platform list next to omp and agy.
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

No confident findings in the scoped PR diff. Earlier reviews raised no findings, so there are none to mark resolved.

The PR description satisfies the real-CLI testing requirement: it records a successful build and session push --source copilot archiving three native sessions from official Copilot CLI versions into an isolated Git repository. Focused tests and remaining validation limitations are documented.

Review was read-only; I did not run, build, or install PR code.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Approving. I pushed two commits on top so this can land:

  • b3b404c4f reads each Copilot log through a wrapper, so a log that fails to parse is skipped with a debug line and the other sessions still list. The new test, two sessions with a malformed middle line in one, failed before and passes now.
  • 407fc95dd adds copilot to the session platforms in docs/guide/dashboard.md and the zh-CN page.

On the built CLI with one good log and one with a malformed middle line, session push --source copilot --all --repo-root <repo> -y used to exit 1 with Listing copilot sessions failed: Unexpected end of JSON input and archive nothing. Now it exits 0, archives the good session and writes the skip to the debug log. The earlier runs on 30 real logs from Copilot 0.0.411 and 1.0.90 still apply.

Still open, and not blocking: the score --session --source copilot record from #1418, which needs a judge. The shared readJsonl throws on a malformed non-final line, so other adapters that call it without a per-file catch can fail the same way. That is a separate follow-up.

Merge risk: low

  • Alignment: good. The Copilot CLI reader, the TOOLS entry, the README marks and the docs are consistent.
  • Impact: medium. It adds a new read-only session source. Other platforms are untouched.
  • Verification: good. Built-CLI runs on real logs from two versions, the malformed-log case before and after, and CI.
  • Rollback cost: low. The change only adds code.
  • Error detection: good. A damaged log is skipped and logged instead of hiding every session.

@SaulMoro
SaulMoro merged commit a8cd1da into Tencent:main Nov 8, 2026
18 checks passed
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.

3 participants