ci: fix hanging sessionManager tests and speed up jobs - #43
Merged
Conversation
sessionManager teardown leaked the pty master read stream: kill() only signals the child, so a grandchild holding the slave fd kept the stream open forever and the test runner (and prod) never exited. destroySession now force-closes the pty via destroy(), and onExit no longer re-arms the 30s exited-session retention timer once the session was already removed. The 15s resume-inject fallback timer is tracked and cleared on teardown and on idle-path delivery. sessionManager.test.js alone went from hanging (300s+) to a stable 14s. CI: add timeout-minutes: 30 to every job (6h default -> 30min worst case), drop EOL Node 20 from the unit-tests matrix (README minimum now 22), cache Playwright browsers for e2e, and parallelize syntax-check with xargs -P4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
CI の遅さ・ハング問題を修正。主因は
sessionManager.test.jsのプロセス終了待ちハング (CI ジョブがデフォルト 6時間タイムアウトまで占有)。あわせてジョブ構成を高速化した。原因 (調査: tmp/ci-speedup-plan.md)
sessionManager.test.jsは単独実行で 300s+ ハング: テストは全パスするが、終了後もイベントループにハンドルが残る (pty master ReadStream / 保持タイマー)npm test(node --test) は子プロセス終了を待つため、この1ファイルのハングで CI ジョブ全体が終わらない変更内容
P0-1 ハング修正 (server/ws/sessionManager.js, sessionManager.test.js)
destroySessionでptyProcess.destroy()を追加 (master ReadStream fd のリーク解消。kill だけでは grandchild が slave fd を保持していると EOF が来ない)sessions.has(id)ガード (destroy 済みセッションに 30s タイマーを立てない)pendingInjectionTimer) をセッションに追跡し、配送時・teardown 時に clearTimeoutdestroyAllSessions()を実行し残留ハンドルを解放P0-2 全3ジョブに
timeout-minutes: 30(ハング再発時の保険)P1-1 Node 20 削除 (2026-04-30 EOL)・Node 22 固定、README の minimum を 22 に更新
P2 e2e ジョブに Playwright ブラウザキャッシュ (actions/cache)
P3 syntax-check を
xargs -P4で並列化その他
.gitignoreに/.claude/を追加検証 (ローカル)
node --test server/ws/sessionManager.test.js: 300s+ ハング → 14.2s rc=0npm test全体: 294 tests pass / 16.4s rc=0