Agent hint for `gh event listen`: add an opt-out, and show it only when the caller polls

Ouverte
#15,113 8 commentaires 10 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
46/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
go
Domaine
cli

Piste de recherche

Start by tracing where gh prints the agent hint for API and pull request reads, then check how GH_NO_UPDATE_NOTIFIER is defined and documented in gh help environment. The issue proposes an opt-out, polling-aware display, and a shorter hint, but does not name the relevant files or tests; identify those entry points and existing tests first. Done means the hint can be disabled and is limited to polling use, with coverage for the chosen behavior.

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

Description

enhancement gh-api gh-event
Describe the feature or problem you'd like to solve

Since 2.105.0 (#15077), gh api repos/O/R/pulls/N/..., gh pr view and gh pr create print a nine-line gh event listen hint on stderr whenever an agent is detected. Nothing turns it off: gh help environment and gh config have no key for it, so the only escape is to unset AI_AGENT, CLAUDECODE and friends for every gh call, which also removes the agent from the User-Agent.

We don't poll. Our agents wait on pull requests through a self-hosted service (below), and they call gh api .../pulls/N/comments or gh pr view for one-off reads: listing unanswered review threads, fetching a comment id to reply to, checking a field. Every one of those reads now carries the hint. An agent's stderr goes straight into its context window, where it stays and is re-read on each later model call until the context is compacted.

Measured from our Claude Code transcripts between installing 2.105.0 (2026-11-18 10:54 UTC) and 2026-11-20 07:50 UTC, about 45 hours:

Transcripts containing the hint 38 (9 sessions and their subagents)
Hints printed 162
One hint ~810 characters, ~195 tokens
Tokens added to context ~32,000
Tokens re-read by later model calls before compaction ~8.0 million

The five sessions with the most hints, each counted with its subagents:

Session Hints Tokens added Tokens re-read
A 62 12,300 2.6M
B 51 10,100 3.5M
C 26 5,100 1.0M
D 8 1,600 0.34M
E 6 1,200 0.15M

Method: each hint's length times the number of distinct model requests after it in the same transcript, up to the next compaction. Token counts use o200k_base as a stand-in tokenizer. Most re-reads are prompt-cache hits, so the bigger costs are context-window room and earlier compaction.

Proposed solution
  1. An opt-out, in the style of GH_NO_UPDATE_NOTIFIER: for example GH_NO_AGENT_HINTS=1 or gh config set agent_hints disabled, listed in gh help environment.
  2. Show the hint for polling, not for the first read. Print it only when the same pull request has been read several times within a few minutes, or at most once per pull request per day, using the cache directory to remember. A single GET of /pulls/N/comments is not a wait loop.
  3. Make it one line, such as hint: to wait for this pull request, see gh event listen --help. The details are already in that help text.
Additional context

We wait on pull requests through our own watcher rather than gh event listen. What the Events API would need for us to switch is platform feedback, so it is in the Event Streams preview discussion (https://github.com/orgs/community/discussions/211595), not here. This issue is only about the hint gh prints.

Langage dominant
Go
Étoiles
47.4k
Forks
9.5k
Merge moyen
18 h 34 min
PR mergées (30 j)
70

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de cli/cli

Toutes les issues de cli/cli

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

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