Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Query deadlines can be disabled by `0`, are not capped by the run budget, and are not cancelled on session abort

オープン
#1,483 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
18/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
mongodb, sql, sqlite, typescript

調査の方向性

Start in packages/drivers/src/query-timeout.ts (parse() maps 0 to disabled) and the timeout message in packages/drivers/src/types.ts, then trace sql-materialize.ts where the deadline race and the missing ctx.abort handling live. Check packages/drivers/src/mongodb.ts for the cursor loop with no abort check. Done means a session abort returns within 2 s with the cursor closed, and per-call 0 cannot exceed the remaining budget.

索引モデルが issue の本文から書いたものです。

説明

Problem

A single long tool call can outlive the run's soft and hard time budgets. The runner then kills the process and no answer or trace span survives.

Mechanism

  1. 0 disables the deadline and the error text recommends it. parse() maps 0 to { disabled: true } (packages/drivers/src/query-timeout.ts:36-40); the timeout error says "set query_timeout_ms ... (0 disables the deadline)" (packages/drivers/src/types.ts:74-75); sql_execute, sql_materialize and sql_check advertise it (sql-execute.ts:57-66, sql-materialize.ts:557). Clients with strict JSON schemas also send 0 as a filler value for unset optional fields.
  2. No cap by remaining budget. Per-call deadlines are not clamped to the run's remaining time minus a finalization reserve.
  3. No cancellation. sql-materialize.ts never reads ctx.abort; executeSource passes no signal (:239-260); sql-execute.ts:149-155 passes none to Dispatcher.call. The run's hard abort therefore cannot stop a running read.
  4. Abandoned reads keep running. For remote sources the tool races the read against deadline + 5 s (sql-materialize.ts:252-263) and rejects with cancelled: false, but the read continues (packages/drivers/src/mongodb.ts:379 has no abort check; the cursor is closed only after the loop at :388). The error text then suggests query_timeout_ms: 0, so models start a second full read that competes with the first. Local SQLite/DuckDB engines get no outer timer at all (:247-249).
  5. The runner's kill comes 60 s after the hard deadline (840 s inside 900 s), less startup time.

Evidence

  • Retry reads with query_timeout_ms: 0 took 659.8, 658.9 and 674.8 s, started at about 143 s and ran through the soft deadline (672 s).
  • Reads that follow an abandoned attempt took a median 549 s versus 238 s for clean reads (37 vs 43 reads).
  • In 5 sessions the hard deadline fired at 841-843 s, the abort never completed and the runner killed the run; in 2 more the abort arrived 35-53 s late.
  • 19 sessions across recorded runs ended with no answer after a timeout of this shape; a scratch query with query_timeout_ms: 0 ran 428.6 s.
  • 1,095 of 2,685 (41%) of one client's SQL tool calls carried query_timeout_ms: 0.

Impact

Answer-losing every time it triggers (a total loss, not a degraded answer). Estimated recoverable: 0-3 sessions per 270, more when combined with the Mongo cursor fix (#1479).

Proposed fix

  • Clamp every tool deadline to min(requested, remaining budget - finalization reserve); treat per-call 0 as "use default", reserving "disable" for connection configuration.
  • Thread an AbortSignal (session abort plus deadline) through Dispatcher into drivers; on timeout/abort close cursors (cursor.close()), cancel statements and kill the local helper.
  • Remove "(0 disables the deadline)" from agent-facing messages.
  • Leave at least about 90 s between the hard deadline and the runner's kill.

Acceptance check

  • Test: a session abort during a long sql_materialize returns within 2 s and the cursor is closed.
  • Test: query_timeout_ms: 0 on a call does not exceed the remaining budget.
  • Test: after a timeout, no further documents are fetched from the abandoned cursor.

Related: #1479 (Mongo byte-bounded reads fetched one document per round trip; fix in #1480).

主要言語
TypeScript
スター
810
フォーク
121
平均マージ
1日 10時間
マージ済み PR(30日)
89

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AltimateAI/altimate-code のほかの issue

AltimateAI/altimate-code の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。