Shell tool: no upper bound on the timeout a model can ask for, so one call can hold a turn for hours
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 75/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- tooling
Direção de pesquisa
Leia packages/opencode/src/tool/shell.ts para o tratamento de timeout da v1 e packages/core/src/tool/bash.ts para MAX_TIMEOUT_MS; compare com o caminho da v2 em packages/core/src/tool/plugin/shell.ts. Reproduza com um comando lento como sleep 3000 e timeout: 14400000, e então limite o timeout em primeiro plano ao máximo existente ou a um valor configurado. Está concluído quando um timeout longo solicitado não bloqueia mais além do limite e o comando ainda passa para segundo plano nessa fronteira.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description
The shell tool takes whatever timeout the model sends. There's no upper bound, so one call can hold the turn for hours.
We run opencode headless for coding agent evals, with a 60 minute limit per run. In four runs the model (Kimi K3 and K3.1 Pro) started a full Gradle test suite with timeout set to 3600000, 7200000 and 14400000 ms. That suite takes about an hour in our environment, so the call never came back and the run got cut at the limit with no answer. Before that call each run had made 44 to 110 tool calls and all of them completed.
The timeout message also tells the model to "retry with a larger timeout value", so it pushes models toward big numbers. In one run the model went from 120 s to 30 minutes on the retry.
In 1.19.6, packages/opencode/src/tool/shell.ts only rejects a negative value and then uses params.timeout ?? defaultTimeoutMs. packages/core/src/tool/bash.ts has MAX_TIMEOUT_MS = 10 * 60 * 1_000 and checks it in its schema, but the shell tool doesn't use it.
From reading dev (fe8def685) a foreground call looks the same: packages/core/src/tool/plugin/shell.ts takes a NonNegativeInt and uses input.timeout || DEFAULT_TIMEOUT_MS. A command that's still running at its timeout moves to the background now, which is the behavior we want, but a model that asks for 4 hours still blocks for 4 hours first.
What I'd like is a maximum for the foreground timeout: 10 minutes like MAX_TIMEOUT_MS, or a setting for it. Past the maximum, move the command to the background on v2 or stop it on v1. For v1, just applying the existing MAX_TIMEOUT_MS in the shell tool would fix it for us.
Related: #63748 asks for a configurable default. This one is about the upper bound.
Plugins
A small internal hooks plugin. It doesn't change the timeout.
OpenCode version
1.19.5 (where we saw it). 1.19.6 and dev fe8def685 from reading the source.
Steps to reproduce
- Have the model call the shell tool with a slow command and a long timeout, for example
sleep 3000withtimeout: 14400000. - The call blocks until the command ends. Nothing gives the turn back to the model before that.
Screenshot
No response
Operating System
Linux (container)
Terminal
none, headless
- Linguagem predominante
- TypeScript
- Estrelas
- 227k
- Forks
- 30.7k
- Merge médio
- 3h 57min
- PRs com merge (30d)
- 484
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de anomalyco/opencode
-
[Site] Active section detection should respect scroll-margin-topTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertaarea/web reproduced type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
anomalyco/opencode#65384 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
area/cli type/feature version/v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
anomalyco/opencode#65379 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
inference/go type/feature
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 72/100
anomalyco/opencode#65148 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
area/providers type/feature version/v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
anomalyco/opencode#64845 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
area/providers platform/macos status/repro-simulated type/bug version/v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
anomalyco/opencode#64723 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de anomalyco/opencode
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
swc-project/swc-ai-issues#1001 ·
-
Add: Da Vinci Asia VietnamAbertacheck:passed streams:add
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
fix(table): CollapseColumn uses wrong caret icon for expandable row toggleTalvez já em andamento @redhat-chai-bot assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
patternfly/patternfly-react#12727 ·
Mantenedores costumam responder em até 1 dia
-
CLI OAuth login fails behind an authenticating proxy: GET /api/v1/user omits Proxy-AuthorizationAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
lightdash/lightdash#33086 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
assessment bug course exercise programming
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
Mantenedores costumam responder em até 1 dia