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

Offen
#15,113 8 Kommentare 10 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
46/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
go
Bereich
cli

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Go
Sterne
47.4k
Forks
9.5k
Ø Merge
18 Std. 34 Min.
Gemergte PRs (30 T.)
70

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus cli/cli

Alle Issues in cli/cli

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.