Repository navigation
fix(hooks): keep the Copilot skip guard text fixed across bundler ren… - #1357
Merged
jeff-r2026 merged 1 commit intoOct 24, 2026
Merged
Conversation
…ames Fixes Tencent#1356 Signed-off-by: Arnav Singh <arnavsingh08@outlook.com>
|
No findings in the current PR diff.
The shallow checkout prevented the literal three-dot diff. Commit metadata identifies |
jeff-r2026
approved these changes
Oct 24, 2026
5 of 9 tasks
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
The Copilot skip guard embedded
copilotRunsEntries.toString(), so every Claude team hook command (and its hash) was whatever the bundler printed for that function. When another module in the chunk declares a top-levelentries, esbuild renames the local toentries2and every hook changes even though none did. The guard now embeds a fixed string,COPILOT_RUNS_ENTRIES_SOURCE, that is byte-identical to what the current build emits, so existing hooks and hashes stay unchanged.Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest runpasses: I ran the related files only.claude-hook-host.test.ts(13) andhooks-team.test.tspass.hook-dispatch-cli.test.ts(5) andhooks-reconcile-scope.test.ts(2) have Windows-only failures and timeouts that fail the same way on unmodifiedmain. I'm leaving the full run to CI.src/__tests__/claude-hook-host.test.tsruns the guard's copy andcopilotRunsEntrieson the same 13 inputs (version ≠ 1,disableAllHooks, non-object/non-array shapes, non-command hooks, null entries, every command field, non-string commands, several events) and expects the same entries.Reproduced the rename. I added a throwaway
export async function entries()tosrc/hooks.ts, rannpm run build, and inspecteddist/cli.js:copilotRunsEntriesmainentries2toString(), getsentries2❌entries2[event, entries]✅The throwaway change is not part of this PR.
Byte-identical check.
COPILOT_RUNS_ENTRIES_SOURCEequals the function text indist/cli.jsbuilt frommainat d790b2c.Real CLI (after
npm run build, Windows 11 / Node 24):npm run test:e2e -- src/__tests__/e2e/scope-isolation-issue85.test.ts: 7 passed.hooks-project-isolation-issue373.test.ts: 29 passed, 1 failed.injects both projects, gates execution by cwd…fails at itssh -cstep and fails the same way on unmodifiedmainhere (Windowssh/$PWD).hooks-team-e2e.test.ts(e2e config): 6 passed, 1 failed.lists and removes standalone Copilot hooks…expects~/…and gets~\…, and also fails on unmodifiedmainhere.Only Windows was available to me. Other providers and agents are left to CI.
Related Issues
Fixes #1356
Notes for Reviewers
mainis fine today. But any future top-levelentries(orevent,entry,command,file) in the chunk would bring the bug back. This PR removes that hazard.Function.prototype.toString(). I greppedsrc/for.toString(), and the remaining uses are on Buffers, URLs and YAML docs.