fix(cli): opencode run drops a Stop hook's continuation

Ouverte
#1,191 1 commentaire 0 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é
3/5
Temps estimé
1-2 jours
Accessibilité débutants
70/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
node.js, typescript

Piste de recherche

Start with opencode-hooks-bridge.ts and the shipped opencode-events.js asset, then trace how the Stop hook handles session.idle and calls client.session.promptAsync(...). Reproduce with opencode run using the issue’s described setup and compare with opencode serve plus opencode run --attach. Done when a blocking Stop hook continues the turn once under non-interactive opencode run.

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

Description

Description

Under opencode run (non-interactive), a Stop hook's continuation never reaches the session. The bridge generated into .opencode/plugin/<plugin>-hooks.js runs the Stop script on session.idle, reads its {"decision":"block","reason"}, then calls client.session.promptAsync(...) without awaiting it. opencode run exits once the session is idle, so the prompt is lost.

Affected file(s)

The OpenCode and Kilo hooks bridge generator (opencode-hooks-bridge.ts and the opencode-events.js asset it ships).

Expected behaviour

A Stop script that blocks continues the turn once, under opencode run as under opencode serve or the TUI.

Observed behaviour
  • opencode run: the session ends on the model's last message; opencode export <session> shows no follow-up message.
  • opencode serve plus opencode run --attach: the follow-up arrives (the reason is the next user message).
  • The Stop script itself answers correctly: run by hand with a Stop payload, memory.cjs hook prints the block.

Repro: a project with aidd-context translated flat for opencode, a committed aidd_docs/memory/vcs.md, then opencode run "remove one line of aidd_docs/memory/vcs.md with your edit tool".

AI tool

OpenCode (Kilo shares the bridge, not tested)

Additional context

Only the non-interactive mode is affected: scripts and CI. Fix candidates: await the prompt before the handler returns, or keep the run alive until a pending continuation is sent.

Langage dominant
TypeScript
Étoiles
481
Forks
45
Merge moyen
1 j 13 h
PR mergées (30 j)
91

Préparer son environnement

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 ai-driven-dev/framework

Toutes les issues de ai-driven-dev/framework

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

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