You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(host): recover external sessions after a confirmed late idle release - #1182
An idle release that exceeds its 60-second deadline leaves the external Thread blocked even if the original shutdown later completes.
Record completion after the original session closes, its output drains, and cleanup finishes. A later request rechecks ownership and persisted history inside the Thread lifecycle before detaching the closed instance.
Keep returning -32075 while release or persistence remains unconfirmed. Concurrent retries resume the same native session once.
Related issues
Refs #1167. The causes of the Claude shutdown failures and native Codex rollout errors in the report remain unverified.
UI Demo
N/A (Host runtime and RPC behavior).
Test plan
Reproduced the failure with a fake clock and adapter on the upstream code. Both requests stayed blocked after confirmed shutdown.
npx vitest run --config tests/vitest.config.js packages/host-runtime/test/external-thread-idle-release.test.ts packages/host-runtime/test/external-thread-recovery.test.ts — 37 tests passed. The regression covers pending cleanup, persisted-history failure and concurrent resume with the original native session reference.
npx tsc -b packages/host-runtime, focused ESLint and git diff --check passed locally on macOS.
The reporter's Windows installation and live Harness processes were outside this verification.
This change lets a later request recover an external Thread after a late but confirmed idle release. Requests still receive an error until release and persisted identity are confirmed. It also moves the Windows rename retry into one shared function. No concrete defect remains, and the change is ready to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
标题“fix(host): recover external sessions after a confirmed late idle release”与变更内容一致。变更涉及空闲释放超时后的确认、后续请求对已关闭实例的移除,以及并发恢复只执行一次。标题准确描述了主要修复点,并且使用 Conventional Commits 格式。
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
Learnt from: CR
Repo: BytePioneer-AI/codex-host PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-11-17T12:08:43.655Z
Learning: Source excerpt:
# Repository Guidelines
## Testing & Completion
- Writing tests. Every test is code to maintain and CI time to pay; add one only when it earns that.
- Small, low-risk changes need no new tests. Add focused tests for high-risk or cross-package changes, or when asked.
- A new test must catch a regression the existing tests would miss. Extend the nearest existing case or `test.each` instead of adding near-duplicates.
- Assert observable behavior (inputs, outputs, protocol messages, persisted state), not internal call order, private state, or mock call counts.
- Mock only external boundaries (network, clock, real CLIs, the OS), never the code under test. Avoid large snapshots and long literal expectations that can only be updated mechanically.
- A bug-fix test must fail before the fix. Never weaken assertions or delete tests just to make a change pass; report the conflict instead.
- When a change makes existing tests redundant or ties them to removed internals...
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
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.
Summary
An idle release that exceeds its 60-second deadline leaves the external Thread blocked even if the original shutdown later completes.
-32075while release or persistence remains unconfirmed. Concurrent retries resume the same native session once.Related issues
Refs #1167. The causes of the Claude shutdown failures and native Codex rollout errors in the report remain unverified.
UI Demo
N/A (Host runtime and RPC behavior).
Test plan
npx vitest run --config tests/vitest.config.js packages/host-runtime/test/external-thread-idle-release.test.ts packages/host-runtime/test/external-thread-recovery.test.ts— 37 tests passed. The regression covers pending cleanup, persisted-history failure and concurrent resume with the original native session reference.npx tsc -b packages/host-runtime, focused ESLint andgit diff --checkpassed locally on macOS.