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

Aberta
#1,191 1 comentário 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
70/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
node.js, typescript

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
481
Forks
45
Merge médio
1d 13h
PRs com merge (30d)
91

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de ai-driven-dev/framework

Todas as issues de ai-driven-dev/framework

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.