Support VS Code-compatible Copilot hook payloads#888
Open
peyton-alt wants to merge 4 commits intomainfrom
Open
Support VS Code-compatible Copilot hook payloads#888peyton-alt wants to merge 4 commits intomainfrom
peyton-alt wants to merge 4 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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.jsoncommands.
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. |
e307d71 to
7dbe3a7
Compare
Entire-Checkpoint: 8a4fafbfc826
Entire-Checkpoint: 73d1f5733517
- Add VS Code hookEventName constants from official docs - Validate hookEventName matches the invoked CLI hook for VS Code payloads; silently skip mismatches instead of processing them - Fix test fixtures: VS Code sends "Stop" (not "SessionEnd") for both agent-stop and session-end hooks - Strengthen assertNoParseFailure to catch warning text in stderr - Refactor ParseHookEvent to read envelope once and dispatch to builders Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: b42218d939a1
9f9a5da to
b4792a4
Compare
Contributor
Author
|
@BugBot review |
- Guard parseTimestamp against JSON null and millis==0, both of which produced epoch time instead of triggering the time.Now() fallback - Guard isJSONNumber against null so detectHookHost doesn't misclassify null-timestamp payloads as HostCopilotCLI - Add regression tests for null, zero, and missing timestamp cases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: da55307ea9df
Contributor
Author
|
@BugBot review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e0a2c6b. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
timestamptranscriptPathandtranscript_pathcopilot-clihook commands and generated.github/hooks/entire.jsoncommandsVerification
go test ./cmd/entire/cli/agent/copilotcli -run 'TestDetectHookHost|TestParseHookEnvelope_AcceptsAlternateTranscriptPathAndTimestampFormats|TestParseHookEvent_.*VSCode|TestParseHookEvent_PassthroughHooks_VSCodePayload_ReturnNil' -count=1go test -tags=integration ./cmd/entire/cli/integration_test -run 'TestCopilotVSCodeHooks_' -count=1mise run test:ciUser impact
Note
Medium Risk
Medium risk because it changes how Copilot hook stdin is parsed and how lifecycle events are constructed, which can affect session/checkpoint creation across agents. Behavior is guarded by host detection/validation and covered by new unit + integration tests.
Overview
Adds a normalized Copilot hook envelope (
compat.go) that accepts both Copilot CLI and VS Code payload variants (RFC3339 or millistimestamp,transcriptPathortranscript_path) and classifies the payload source.Refactors
CopilotCLIAgent.ParseHookEventto parse this envelope once, use the provided timestamp (withtime.Now()fallback), and silently skip VS Code payloads whosehookEventNameis unknown or doesn’t match the invoked hook subcommand.Expands coverage with new unit tests for host/timestamp parsing and VS Code lifecycle cases, plus new integration tests that run
copilot-clihooks directly and via generated.github/hooks/entire.jsoncommands; updates the integrationHookRunnerto support agent-specific hooks and running installed shell hook commands.Reviewed by Cursor Bugbot for commit e0a2c6b. Configure here.