Make block-pr-poller's no-skill fallback work without the Event Streams preview

Aperta Adatta ai principianti
#21,021 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bash, github, shell

Direzione di ricerca

Leggi prima plugins/guardrails/hooks/block-pr-poller.sh e i test guard esistenti; controlla come vengono creati i messaggi per entrambi i rifiuti alle righe 29 e 85. Aggiorna le indicazioni di fallback in entrambi i punti e aggiungi un test che verifichi il testo, preservando le decisioni attuali del guard. Infine, esegui i test guard e aggiorna il frammento del changelog di guardrails.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

When block-pr-poller.sh refuses a sleep-and-poll loop over a pull request, its only fallback for a
session without the source-control skill is gh event listen (plugins/guardrails/hooks/block-pr-poller.sh:17,
used in the refusal at :85 and in the event-set refusal at :29). gh event listen needs GitHub's
Event Streams preview. On an account without it, the command the message gives exits at once:

event subscriptions are in preview and not enabled for this account: HTTP 403: Event subscriptions are not enabled for this account (https://api.github.com/event-subscriptions)

So on such an account the hook's no-skill path is a dead end, and the session has to invent a third
way. The reported session used gh run watch <run-id> --exit-status --interval 120, which watches one
workflow run but not review threads, labels or other check suites.

Evidence

  • Verified on origin/main this pass: the hint text at block-pr-poller.sh:17 and both refusals
    (:29, :85) name gh event listen as the only non-skill wait, with no note that it needs the
    preview.
  • Reported, not reproduced here (2026-12-03, a session on an account without the preview): the
    refusal of a while true; gh pr checks <n>; sleep 60 Monitor command, then the 403 above from
    gh event listen run with the exact --event list and --timeout 30m.
  • gh itself prints a hint on gh pr view saying event subscriptions "are in preview and may not be
    enabled for your account", so the preview gate is documented upstream.
  • /source-control:pull-request monitor does not depend on the preview: monitor-poll.sh falls back
    to --interval polling when gh event is absent, returns an error, or fails to attach
    (plugins/source-control/CHANGELOG.md:589). Inferred from that entry, not run here against an
    account without the preview.
  • Inferred, not verified: that every account without the preview gets the same 403.

Proposed approach

Change the hint so the no-skill path still works without the preview. Recommended: keep
gh event listen as the first choice, and add that if it fails with "not enabled for this account",
the session should wait on CI with gh run watch <run-id> --exit-status run in the background, then
read the checks, labels and review threads once when it ends. Alternatives:

  • Say /source-control:pull-request monitor is the only supported path (simplest, but leaves a
    session without that plugin with nothing).
  • Detect the preview in the hook (an API call per refused command; costs latency on a hot guard, so
    not recommended).

Files: plugins/guardrails/hooks/block-pr-poller.sh, its tests, the guardrails changelog fragment.

Acceptance criteria

  • The refusal at block-pr-poller.sh:85 names a wait that works on an account without the Event
    Streams preview, or states that the source-control monitor is the only path.
  • The event-set refusal at :29 gets the same treatment.
  • No verdict changes: every command blocked today is still blocked and every command allowed
    today is still allowed (existing guard tests pass unchanged apart from message text).
  • A test asserts the new fallback text is in the refusal.

Constraints and gotchas

  • Message-only change; never loosen the guard (owner rule for guardrails changes).
  • The suggested fallback must itself pass block-pr-poller.sh and block-foreground-wait.sh
    (a backgrounded gh run watch is allowed today; re-check before naming it).
  • Test guards by feeding command text as JSON on stdin only.

Context

Source: local handoff item 20261203-063155-guardrails-pr-poller-fallback-unavailable.md (retired into
this issue). Related: #20138 (closed; named the fixed event set), #19450 (closed; source-control
monitor's 403 fallback), #20298 (open; per-PR event streams in the multi-PR watch).

Lingua principale
Shell
Stelle
22
Fork
2
Merge medio
3h 4m
PR unite (30g)
941

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di melodic-software/claude-code-plugins

Tutte le issue di melodic-software/claude-code-plugins

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.