github / github/copilot-cli

copilot cli hooks not firing for background agent

Ouverte
#2,293 0 commentaires 2 réactions 0 personnes assignées Voir sur GitHub
area:agents
Langage dominant
Shell
Étoiles
11.2k
Forks
1.9k
Merge moyen
14 h 16 min
PR mergées (30 j)
6

Description

### Describe the bug

Copliot CLI hooks do not fire (none of them) when copilot starts an agent as a background agent.

I used:
`copilot --allow-all --autopilot --model claude-sonnet-4.6`

I saw hooks that used for logs firing only when the copilot was working in foreground but once a background agent started, no hooks fired.

### Affected version

GitHub Copilot CLI 1.0.11.

### Steps to reproduce the behavior

I exercised the copilot cli with a custom agent that has some directions how to built an app, in my case a spa app.

I have it configured to use hooks for logging.

I used `copilot --allow-all --autopilot --model claude-sonnet-4.6`

I ran it twice with same directions except for once it asks me for the app id and some description and second case I provided them in the prompt and asked it to run in background.

First time it ran all the steps in foreground and all hooks fired properly.

Second time it started in foreground and then in continued all app creation with tests in background and for all the background agent that is spawned it never fired any hooks.

I captured the hook output and the also the copilot logs in debug mode.

Hooks not firing for background process is a big problem. Logs is not as bad but I am planning to use them for preventing some unwanted behavior for tool use.

Hook file and the logs attached.

[hook-logs-background.log](https://github.com/user-attachments/files/26253147/hook-logs-background.log)
[hook-logs-foreground.log](https://github.com/user-attachments/files/26253148/hook-logs-foreground.log)
[process-1774458031414-26320-foreground.log](https://github.com/user-attachments/files/26253150/process-1774458031414-26320-foreground.log)
[process-1774458987890-52184-background.log](https://github.com/user-attachments/files/26253149/process-1774458987890-52184-background.log)

[hooks.json](https://github.com/user-attachments/files/26253157/hooks.json)

### Expected behavior

Hooks should fire when background agents are executing

### Additional context

- Log using "log_level": "debug" in config.json
- Operating System: MacOS Tahoe 26.3
- CPU Architecture: ARM M1
- Terminal Emulator: iTemr2
- Shell: bash

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start by reproducing the issue with the provided Copilot CLI command and custom agent, comparing foreground and background behavior using hooks.json and the attached foreground/background hook and process logs. Trace where background-agent execution is started and verify that hooks fire during it; done means the same configured hooks run for background agents as they do in the foreground.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
bash
Domaine
cli
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.