feat(trace): GitHub Copilot support (spec, plan, and M1)
This PR adds GitHub Copilot support to Chainloop Trace. It holds the spec, the implementation plan, and the first milestone of the plan..
- Spec:
docs/specs/issue-3800-copilot-trace-provider.md - Plan:
docs/plans/issue-3800-copilot-trace-provider.md - Implementation: M1 of the plan (R-001 to R-007, R-010)
One copilot provider covers Copilot CLI and the Copilot agent in VS Code. Both read the hook files in .github/hooks/, and Trace owns its own file there, .github/hooks/chainloop-trace.json. chainloop trace init --copilot and chainloop trace run --copilot install it. Trace records the Copilot session event log as AI coding-session evidence: conversation, tools, models, tokens from the session summary, an API-price cost estimate, and code attribution for the file and shell tools.
The Copilot agent also runs the hooks in .claude/settings.json. The Claude Code provider now ignores Copilot payloads (R-003), so a repository with both providers records a Copilot session once, under Copilot.
Skills tracking, spec source pointers, and pasted image pointers are M2 of the plan, in a later PR.
The trace init summary now ends with the docs link, with no per-agent notes. This goes against two earlier specs:
- Codex spec issue-3657 R-006 ("Initialization MUST tell Codex users to review and trust the installed hooks"). The spec is frozen, so it is not changed here.
- Pi spec issue-3520 R-009. This PR supersedes it with R-010, which keeps every rule except the init note.
The Trace README keeps the trust steps of Pi, Codex, and Copilot.
Open question for reviewers:
- Does the Copilot agent in VS Code write the same session event log as Copilot CLI? Proposed: yes. A manual VS Code session before merge checks it, with the fallback in the spec.
We would like two reviewers to approve this spec before it merges.
Provider checklist
Provider package (app/cli/internal/trace/copilot/)
-
Nameconstant andvar _ trace.Provider = (*Provider)(nil). -
InstallHooks: a second call changes nothing. The hooks of the user stay. -
InstallHooksForTraceRun: all hooks except session end. -
SettingsFile: the file that install writes. -
UninstallHooks: removes only the Chainloop hooks. -
HooksInstalled: true only for the Chainloop hooks. - Hook events: session start and session end. No user prompt hook: Copilot drops its output.
- Hook events: before and after each file tool and shell tool. (No skill tool: M2.)
-
ReadHookInput: typed struct, size limit, absoluteFilePath,CwdandTranscriptPath,Command. Copilot sends no tool call ID or agent ID. -
IsFileWritingToolandIsCommandTool: one Go slice is the source of each list. - Attribution strategy selected: snapshot.
- Shell tool sends pre and post hooks with the same
ToolUseID(none on both sides, TRC-006). -
CopySessionData: safe to repeat, checks paths from the payload, does not fail the hook when the agent or the transcript is missing. -
ParseSession: reads only the copy inopts.SessionDir. -
CopySessionDataandParseSession: no control plane and no network, so that local mode works. - Trace state only through the
*state.Store. - Evidence: agent name and version, session ID and times, primary model, models used, model provider.
- Evidence: token usage (input, output, total, cache read, cache write).
- Evidence: cost from an embedded price table.
- Evidence: tools used, conversation counts. (No subagents: spec Non-Goal.)
- Evidence:
RawSession["main"]is nevernil. Each line is a JSON object. - Evidence: a warning for each data item that cannot be read.
- Session-start and post-tool responses: one JSON document each, and nothing for an empty message.
-
Supports*methods tell the truth about each channel. -
AnnounceToUserwrites the post-tooladditionalContext. - Optional:
SkillTracker,SpecCopyReplacer,PastedImageFinder(M2). - Unit tests: hooks, parse with
testdata/, announce responses, copy.
CLI wiring
- Registered in
providers/registry.go. -
traceProviderFlagsfield,any(),names(). -
--copilotflag intrace init(with help text) and intrace run. -
chainloop trace hook copilot ā¦subcommands incmd/trace_hook.go, withskipActionOptsInit. - Pre-tool response written first, if the agent blocks tools without one (not needed: Copilot does not block on an empty response).
-
providers/capabilities_test.goupdated. -
cmd/trace_init_providers_test.goandcmd/trace_init_test.goupdated. -
make generaterun for the CLI reference.
End-to-end tests and documentation
-
e2e/copilot.goimplementse2e.Harness. - Harness in the
harnessesmap ofe2e/e2e_test.go. - Version and models in
e2e/config.yaml. - Suite run for the new column, with the results checked: Copilot CLI 1.0.109 with
gpt-6.1-solpassed all 26 checked features. -
README.md: new column in each feature table, with values from the suite. -
README.md: a "Why not Yes" line for each cell that is not Yes. -
README.md: row in "How each agent is hooked in", and provider list at the top updated. - Spec in
docs/specs/, with requirement IDs cited in this PR. - License header year updated in each changed file.
-
make -C app/cli lint(new issues) andmake -C app/cli testpass.
Refs #3800
AI disclosure: Claude Code helped to research, plan, and implement this change.
š¤ Generated with Claude Code