[BUG] Copilot target writes userPromptSubmit; Copilot's event is userPromptSubmitted, so prompt hooks never run
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 362
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 132
Description
Describe the bug
A package hook on UserPromptSubmit (or userPromptSubmit) installed for the
copilot target is written to .github/hooks/*.json under the key
"userPromptSubmit". Copilot CLI has no event by that name, so the hook never
runs and nothing is logged.
Copilot's hooks reference
(https://docs.github.com/en/copilot/reference/hooks-configuration) names the
camelCase event userPromptSubmitted. Its PascalCase UserPromptSubmit is the
VS Code-compatible variant, which switches the payload to snake_case.
Cause: _HOOK_EVENT_MAP["copilot"] in
src/apm_cli/integration/hook_integrator.py:
"UserPromptSubmit": "userPromptSubmit",
"userPromptSubmit": "userPromptSubmit",
tests/integration/test_hook_integrator_copilot_casing_e2e.py asserts the
same wrong name.
To Reproduce
- A package
pkgwithapm.yml(target: [copilot]) and.apm/hooks/x.json:
{"hooks":{"UserPromptSubmit":[{"hooks":[{"type":"command","command":"echo hit >> hook.log"}]}]}} - A project that depends on
pkg, withtarget: [copilot]. Runapm install.
.github/hooks/pkg-x.jsonholds"userPromptSubmit". - Start
copilotin the project and send a prompt. Nohook.logis written. - Change the key to
"userPromptSubmitted"in the deployed file, restart
copilotand send a prompt.hook.logcontainshit.
Expected behavior
apm writes userPromptSubmitted for the copilot target, and the hook runs on
every prompt.
Environment
- OS: Windows 11 (pwsh 7)
- APM Version: 0.31.0. The same map is on
mainat 98616b9. - GitHub Copilot CLI 1.0.86
Additional context
Related: #2111 (hook semantics), whose comment table already lists
userPromptSubmitted for Copilot. The reverse direction is not covered here:
a Copilot-authored userPromptSubmitted package installed for claude, codex
or kiro passes through unrenamed. That can be a separate issue if wanted.
Sending fix in a PR: map the three spellings to userPromptSubmitted for
copilot target, correct the tests and add a CHANGELOG entry.
I checked two points before you post:
- The file name in step 2 is unverified. I read the deployed file with a wildcard (.github/hooks/.json), so I never saw its actual name. pkg-x.json follows the pattern from the earlier probe, where the file was pkg-herdr-tab-label.json. Either write .github/hooks/.json in step 2, or let me rerun the install and get the real name.
- The template's "Python Version" field is left out. apm here is the installed binary, not something I ran through a Python interpreter.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/apm_cli/integration/hook_integrator.py at _HOOK_EVENT_MAP["copilot"], then read tests/integration/test_hook_integrator_copilot_casing_e2e.py. Update the Copilot event mapping, adjust the assertions, and add the requested CHANGELOG entry. Done means the generated .github/hooks/*.json uses userPromptSubmitted and the Copilot casing test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, python
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100