Skip to content

Support VS Code-compatible Copilot hook payloads#888

Draft
peyton-alt wants to merge 2 commits intomainfrom
vscode-copilot-compat
Draft

Support VS Code-compatible Copilot hook payloads#888
peyton-alt wants to merge 2 commits intomainfrom
vscode-copilot-compat

Conversation

@peyton-alt
Copy link
Copy Markdown
Contributor

@peyton-alt peyton-alt commented Apr 9, 2026

Summary

VS Code Insiders can auto-load .github/hooks/entire.json, but its Copilot hook payload shape differs slightly from Copilot CLI. Entire was hard-failing on those differences, which surfaced as hook warnings in VS Code.

This change adds compatibility parsing for Copilot-like hook payloads so Entire continues to track sessions and checkpoints when VS Code invokes the same hook file.

What changed

  • added a normalization layer for Copilot hook payloads
  • accepted both numeric and RFC3339 string timestamp
  • accepted both transcriptPath and transcript_path
  • switched Copilot lifecycle parsing to use the normalized envelope
  • added unit coverage for VS Code-shaped payloads
  • added integration coverage for direct copilot-cli hook commands and generated .github/hooks/entire.json commands

Verification

  • go test ./cmd/entire/cli/agent/copilotcli -run 'TestDetectHookHost|TestParseHookEnvelope_AcceptsAlternateTranscriptPathAndTimestampFormats|TestParseHookEvent_.*VSCode|TestParseHookEvent_PassthroughHooks_VSCodePayload_ReturnNil' -count=1
  • go test -tags=integration ./cmd/entire/cli/integration_test -run 'TestCopilotVSCodeHooks_' -count=1
  • mise run test:ci

User impact

  • VS Code should no longer surface schema-mismatch hook warnings for Entire’s Copilot hook file
  • Entire session tracking and checkpointing continue to work through the validated VS Code hook lifecycle path

Note

Medium Risk
Moderate risk because it changes Copilot hook input parsing and event timestamps/session refs, which directly affects session tracking and checkpoint creation; coverage is added via unit and integration tests to reduce regressions.

Overview
Copilot hook payload parsing is now schema-tolerant. The Copilot agent introduces a normalized hookEnvelope that can parse both Copilot CLI and VS Code hook shapes, including timestamp as either millis or RFC3339 string and transcript path as transcriptPath or transcript_path.

Lifecycle event parsing is updated to use the envelope. Copilot lifecycle handlers now read raw stdin once, populate Event.Timestamp from the incoming payload (falling back to time.Now()), and prefer the provided transcript path (only computing it from sessionId when missing).

Test coverage expands for VS Code invocations. Adds unit tests for host detection/envelope parsing and lifecycle parsing with VS Code payloads, plus integration tests that run both direct entire hooks copilot-cli ... and generated .github/hooks/entire.json shell commands to ensure sessions/checkpoints are still created.

Reviewed by Cursor Bugbot for commit a54f070. Configure here.

Entire-Checkpoint: 8a4fafbfc826
Copilot AI review requested due to automatic review settings April 9, 2026 05:36
Entire-Checkpoint: 73d1f5733517
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a compatibility layer so Entire can parse and handle VS Code (Insiders) Copilot hook payloads that differ slightly from Copilot CLI, preventing hard failures and preserving session/checkpoint tracking.

Changes:

  • Introduces a normalized “hook envelope” parser that accepts alternate timestamp and transcript path formats.
  • Updates Copilot CLI lifecycle hook parsing to consume the normalized envelope.
  • Adds unit + integration tests covering VS Code-shaped payloads and generated .github/hooks/entire.json commands.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cmd/entire/cli/integration_test/hooks.go Extends integration hook runner to execute agent-specific hooks and to execute generated shell hook commands.
cmd/entire/cli/integration_test/copilot_vscode_hooks_test.go Adds integration coverage for VS Code-compatible Copilot hook payloads and generated hook commands.
cmd/entire/cli/agent/copilotcli/lifecycle.go Switches Copilot lifecycle parsing to read from a normalized hook envelope (incl. timestamp/transcript variants).
cmd/entire/cli/agent/copilotcli/lifecycle_test.go Adds unit tests for VS Code-shaped payload parsing across lifecycle events and pass-through hooks.
cmd/entire/cli/agent/copilotcli/compat.go Adds hook payload normalization (host detection, alternate keys, timestamp parsing).
cmd/entire/cli/agent/copilotcli/compat_test.go Adds focused unit tests for host detection and envelope parsing of alternate fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants