Skip to content

fix(hooks): mirror the portable hooks under com.github.copilot - #20

Merged
LittleCoinCoin merged 12 commits into
mainfrom
agents/bug-fix-planning-agent-plugins
Nov 26, 2026
Merged

LittleCoinCoin merged 12 commits into
mainfrom
agents/bug-fix-planning-agent-plugins

Conversation

@LittleCoinCoin

Copy link
Copy Markdown
Member

Why

Copilot/VS Code reads an Agent Plugins v1 plugin's hooks only from com.github.copilot/hooks/hooks.json — the root hooks/hooks.json this repo shipped is ignored, the session shows "Some hook files could not be loaded", and no hook fires there (no search policy, no PreToolUse gate, no WorktreeRemove cleanup) while the MCP server connects fine.

Codex is untouched (extensions["com.openai"].hooks → ./hooks/hooks.json, naming = loading; source-verified, no CLI on this machine) and Claude Code is untouched (auto-loads hooks/hooks.json). The fix is a mirror, not a move, in the one namespace this plugin's Copilot family reads: com.github.copilot/hooks/hooks.json, same hooks block, ${PLUGIN_ROOT} as the root token. Root hooks/hooks.json stays byte-unchanged for Claude Code and Codex; worktree-remove.json is deliberately not mirrored (Claude-only event).

What

  • com.github.copilot/hooks/hooks.json — mirror with the token swap
  • server/tests/test_hooks.py — two guards, each named-mutation-verified red first: test_copilot_mirror_matches_the_portable_file (policy divergence / wrong-token copy / identity swap) and the manifest pin (no extensions["com.github.copilot"] key, whose exclusive form would disclaim the default dir). A third candidate guard was mutation-checked and cut as tautological (R01 section Alternatives).
  • Docs: README, AGENTS.md (legend R01 (hook_namespace)), stack-traps trap #agent-plugins-hooks
  • Reports: __reports__/hook_namespace/ (architecture, loader-probe findings, KT); __roadmap__/hook_namespace/ closed green (board via dirtree-rdm only)

Verification

  • pytest 119 passed · ruff check + format --check clean · cz check --rev-range main..HEAD clean
  • Loader probes: scratch-marketplace install lists Hooks (4): SessionStart, SubagentStart, PreToolUse, WorktreeRemove, status enabled, no "Duplicate hooks file detected" (the rule plugin validate never runs); Codex resolution re-confirmed; the mirrored command returns the policy with PLUGIN_ROOT exported.
  • Windows CI is the portability oracle for the new path com.github.copilot/hooks/hooks.json and the JSON read; please read that job's verdict, do not skim.
  • Residual: the VS Code warning may linger while root hooks/hooks.json is read (accepted; documented). The live install is 0.6.0 and ships no mirror by design (the uvx pin), so GUI quieting clears only after the next release; byte-level evidence stands as its proxy.

LittleCoinCoin and others added 12 commits November 27, 2026 00:30
Copilot/VS Code reads an Agent Plugins v1 plugin's hooks only from
com.github.copilot/hooks/hooks.json (pluginParsers.ts hardcodes the
path; verified against Copilot CLI 1.0.82 by a third party), so this
repo's hooks/hooks.json is ignored there and no hook fires in that
client while the session shows the hook-load warning. The report pins
the evidence chain and the contracts a fix may not break: the
token-per-loader rule (PLUGIN_ROOT for the v1 loader, CLAUDE_PLUGIN_ROOT
for Claude Code and Codex), one policy mirrored per loader family, a
portable-only event set, no manifest route to the hooks, and Codex's
com.openai key untouched.

Key changes:
- report: R01 architecture with contracts C1-C5, the singleton mirror
  design, alternatives incl. the deferred Phase B single-file layout,
  mutation log naming the bug each guard turns red on, risk register,
  and per-leaf file ownership
- readme: round index for the hook_namespace topic

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Three levels, authored with dirtree-rdm and validated against its BNF:
two lead-sized file-disjoint leaves (mirror_and_guards, docs_and_naming)
that run as siblings, then a read-only verify level (loader_probes) that
runs after both by the leaf-before-dir BFS rule. No dispatch round: every
leaf is smaller than its own dispatch overhead, so the lead executes them
under the same discipline (campaign-lead exception for lead-sized leaves).
Each guard in mirror_and_guards names the plausible bug it turns red on;
each probe in loader_probes names the decision its answer feeds.

Key changes:
- roadmap: campaign README with the ownership rule and gotchas
  (never move hooks/hooks.json, never name it in the Claude manifest,
  the mirror takes PLUGIN_ROOT, no WorktreeRemove mirror)
- leaves: mirror_and_guards, docs_and_naming, verify/loader_probes with
  gates, deliverable symbols and cz-checked commit subjects

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

Three corrections to the just-committed leaves before any work starts,
each from the designing-tests discipline applied to the plan itself:
extending the launcher sweep to the mirror is a tautology once G1's
hooks-block equality holds and the existing sweep covers hooks/ (every
per-command property is implied transitively), so the guard set is G1+G3
and the mirror leaf names two guards, not three; docs_and_naming's
precondition said 'mirror_and_guards has reported', which encodes a
sibling edge the tree already expresses by depth -- leaf-before-dir
BFS runs docs_and_naming before verify/ regardless, and an unchecked box
there is a dead-end rather than an ordering. The event-set assertion is
portable-set membership, not set equality (the root wires three of the
nine portable events), and the description keys stay free prose.

Key changes:
- mirror_and_guards: two guards, drop LAUNCHER_COPILOT and the sweep
  extension from deliverables, note the cut with its rationale
- docs_and_naming: precondition is R01, not its sibling
- campaign README: success gate wording matches the hooks-block rule

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot/VS Code reads an Agent Plugins v1 plugin's hooks only from
com.github.copilot/hooks/hooks.json and interpolates only ${PLUGIN_ROOT}
there while Claude Code and Codex expand ${CLAUDE_PLUGIN_ROOT}, so the
root hooks/hooks.json is ignored by that family of loaders and no hook
fires for it (hook_namespace R01 C1-C2). The mirror is the same hooks
block with the token swapped; hooks/hooks.json and hooks/worktree-remove.json
stay byte-unchanged, and WorktreeRemove is deliberately not mirrored
(C3: a v1 parser must never meet a Claude-only event).

Key changes:
- com.github.copilot/hooks/hooks.json: SessionStart, SubagentStart,
  PreToolUse (Grep|Bash) via ${PLUGIN_ROOT}/hooks/colgrep_policy.py
- tests: G1 test_copilot_mirror_matches_the_portable_file (hooks-block
  equality modulo the token swap, swap asserted non-identity, only
  portable events) and G3 (no extensions.com.github.copilot key in
  plugin.json, which could disclaim the default directory)

Mutations, each watched red then restored before this commit:
- G1 dropped PreToolUse from the mirror -> RED
- G1 verbatim copy of the root file (claude token) -> RED
- G1 root file lost its own token (identity swap) -> RED
- G3 injected extensions.com.github.copilot hooks exclusive path -> RED
A launcher-sweep extension was mutation-checked and cut as tautological
once G1's equality holds; rationale in R01 section Alternatives.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The README told one story ("Agent Plugins 1.0 defines no hooks component
and ignores the directory", "the one placeholder both ecosystems
expand") that the v1 loader disproves: it reads a v1 plugin's hooks only
from com.github.copilot/hooks/hooks.json and interpolates only
${PLUGIN_ROOT} there, so the root file is stale for it and draws the
standing "Some hook files could not be loaded" warning while no hook
fires. An agent chasing a hook failure had no way to tell which of the
three loader families was reading which file, so it could not see that
the fix is a mirror rather than a move.

Key changes:
- README Hooks: the v1 rule as a paragraph after the per-loader
  semantics, naming both paths, both tokens and the pinning guard,
  and ruling out a WorktreeRemove mirror by name
- README Troubleshooting: the "hooks do not fire" entry now carries
  the v1 symptom verbatim ("Some hook files could not be loaded") and
  says the notice is about the root file, which stays
- README repo map: three loaders, two token spellings, not one more
- AGENTS.md: the hooks/ row names the mirror and the legend gains
  R01 (hook_namespace) -- 128 of 130 lines, test_dev_plugin green

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The warning names a file and nothing else: an agent reading "hooks/hooks.json
at the plugin root is no longer read; move it there" has a wrong first fix
handed to it -- moving that file silently stops Claude Code and Codex
altogether. The trap is one symptom with two opposite repairs depending on
the loader family, which is exactly the shape of knowledge stack-traps exists
to carry.

Key changes:
- SKILL.md: symptom row pointing at the new reference anchor
- references/claude-code.md #agent-plugins-hooks: symptom verbatim, cause
  (three loaders, two hook locations, disjoint root tokens), and what to do
  (mirror under com.github.copilot/hooks with PLUGIN_ROOT; never move the
  root file; no WorktreeRemove mirror; the exclusivity bypass in
  extensions.com.github.copilot; watch for the residual notice)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…gins (docs that name each loader's hook path, and the trap in stack-traps)
Evidence that the mirror's shape is right, from each loader family or its
sources: the scratch-marketplace run clears R01 R5 (install lists all four
hooks, no Duplicate-hooks notice), Codex's resolution walk re-confirms the
root file is its only hook source, and the mirror spot-check shows one
policy in two token spellings that each expand in their own loader. What
the probes cannot show is the GUI quieting -- the live install is 0.6.0
and ships no com.github.copilot/ tree by design (the uvx pin), so that
byte-level evidence substitutes for it and the rest clears after the next
release.

Key changes:
- 01-findings_loader_probes_v0.md: four probe verdicts each with the
  decision it fed, the install-oracle record, observations vs expectation,
  the surprise that the warning's own advice ("move it there") is the
  wrong first fix, and steering for Phase B
- roadmap verify prose: the report filename is the findings shape, so the
  deliverables line and verify/README Context repoint to it

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…lugins (loader probes: mirror ships as is, GUI quieting waits on a release)
Three leaves, four commits, zero dispatches: the mirror shipped with two
guards (the third was mutation-checked and cut as tautological before it
was written), the docs name each loader's path and token, the probes left
four verdicts all passing, and the traffic/resilience verdict is byte-level
-- the live GUI install is 0.6.0 and ships no mirror by design, so the
quieting can only clear after the next release pins it.

Key changes:
- 01-knowledge_transfer_v0.md: wins (evidence-first, the probe that self-
  corrected, the cut guard), pain points (two stray cd mistakes, buried
  pytest summary, commit field vs body divergence), root causes and the
  next-cycle list with a leadership waste check
- README index: three reports at rounds 00/01, naming aligned with the
  findings-shape filename

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Board statuses written by dirtree-rdm only: both lead-sized leaves and
the probe level are done, their gates green (mutation log in the leaf,
install oracle in the probe findings).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@LittleCoinCoin
LittleCoinCoin merged commit 827d1da into main Nov 26, 2026
5 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.

1 participant