Shell tool: no upper bound on the timeout a model can ask for, so one call can hold a turn for hours
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- tooling
調査の方向性
v1 のタイムアウト処理については packages/opencode/src/tool/shell.ts を、MAX_TIMEOUT_MS については packages/core/src/tool/bash.ts を読んでください。v2 のパスは packages/core/src/tool/plugin/shell.ts と比較してください。sleep 3000 や timeout: 14400000 のような遅いコマンドで再現し、そのうえでフォアグラウンドのタイムアウトを既存の上限または設定値に制限してください。要求された長いタイムアウトが上限を超えてブロックしなくなり、かつコマンドが境界で引き続きバックグラウンドに移行すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 227k
- フォーク
- 30.7k
- 平均マージ
- 3時間 57分
- マージ済み PR(30日)
- 484
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anomalyco/opencode のほかの issue
-
[Site] Active section detection should respect scroll-margin-top対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea/web reproduced type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
anomalyco/opencode#65384 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area/cli type/feature version/v2
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anomalyco/opencode#65379 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
inference/go type/feature
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
anomalyco/opencode#65148 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area/providers type/feature version/v2
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anomalyco/opencode#64845 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area/providers platform/macos status/repro-simulated type/bug version/v2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
anomalyco/opencode#64723 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
anomalyco/opencode の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
swc-project/swc-ai-issues#1001 ·
-
check:passed streams:add
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
fix(table): CollapseColumn uses wrong caret icon for expandable row toggle対応中かも @redhat-chai-bot が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
patternfly/patternfly-react#12727 ·
メンテナーはふだん 1 日以内に返信
-
CLI OAuth login fails behind an authenticating proxy: GET /api/v1/user omits Proxy-Authorizationオープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
lightdash/lightdash#33086 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
assessment bug course exercise programming
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信