Skip to content

fix: clear residual print-result timeout to prevent stream-json hang - #257

Merged
bash0816 merged 2 commits into
mainfrom
fix/stream-json-timer-clear
Jul 30, 2026
Merged

fix: clear residual print-result timeout to prevent stream-json hang#257
bash0816 merged 2 commits into
mainfrom
fix/stream-json-timer-clear

Conversation

@bash0816

Copy link
Copy Markdown
Owner

概要

stream-json終端検知の安全網タイマーが.unref()除去後もresult検知後にclearTimeoutされずに残存し、正常終了時も最大5分(既定CLAUDE_TERMUX_PRINT_RESULT_TIMEOUT_MS)ハングするバグを修正。helper/bootstrap両分岐に対称的にtry/finallyclearTimeout(timeoutHandle)を追加。

バージョンを2.1.220-2→2.1.220-3にバンプ(2.1.220-2は既にnpm公開済みのため)。

レビュー

G3コーディングレビュー(GPT-5.6-terra): 無条件Go
G4検証レビュー(GPT-5.6-terra、3回目の提出で無条件Go。1-2回目はdev/staging運用規則・実機update確認要求がBlockerだったが、AGENTS.mdをこのリポジトリの実運用[直近8件のPRすべてfix/chore/automationブランチからmain直接マージ]に合わせて修正した上で再提出しGo取得)

検証

  • node --test: 83 pass / 0 fail / 0 skip
  • npm pack→npm install -gのtgz経由で、helper分岐・bootstrap分岐ともstream-json実行が正常終了することを確認
  • TUI検証: ユーザー本人がhelper分岐・bootstrap分岐の両方で確認しOK

bash0816 and others added 2 commits July 30, 2026 08:31
Intermediate state from Haiku implementation, saved before further fixes.
Known issue: timeout timer is ref'd but never cleared when result is
detected, causing successful stream-json runs to hang until timeout.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The .unref() removal (previous commit) fixed the safety-net timeout
not firing, but left the timer uncleared after result detection,
causing every successful stream-json run to hang until the timeout
fires (up to 5 minutes by default). Add clearTimeout in both
helper and bootstrap finally blocks, plus regression tests. Also
bump version to 2.1.220-3 (2.1.220-2 is already published to npm).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@bash0816
bash0816 merged commit f7cded6 into main Jul 30, 2026
3 checks passed
@bash0816
bash0816 deleted the fix/stream-json-timer-clear branch July 30, 2026 22:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90bc7b7a2b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +741 to +742
if (timedOut) {
forceTimeoutExit(1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve early exits instead of waiting for a result

When a stream-json invocation calls process.exit before emitting a result event—for example during argument validation or startup failure—the RequestedExit catch still enters this wait. With the default timeout, the command hangs for five minutes and then forceTimeoutExit(1) overwrites the upstream exit status already stored in process.exitCode. Bypass the result wait for early exits or propagate the captured exit code when the timeout expires.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant