Skip to content

Fix stale-session in-process Node E2E teardown stall#1984

Closed
roji wants to merge 4 commits into
mainfrom
roji-investigate-windows-node-e2e-teardown-st
Closed

Fix stale-session in-process Node E2E teardown stall#1984
roji wants to merge 4 commits into
mainfrom
roji-investigate-windows-node-e2e-teardown-st

Conversation

@roji

@roji roji commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remove disconnected session entries from the Node E2E client's private registry immediately before in-process teardown
  • ensure the shared E2E teardown reports cleanup errors only after proxy and temporary-directory cleanup complete
  • preserve all production SDK behavior: CopilotClient.stop() and session lifecycle code are unchanged

CopilotSession.disconnect() leaves disconnected objects in the client registry. In-process stop() then aborts every registry entry; aborting an already-destroyed session can leave the outer Promise.allSettled waiting indefinitely. This test-harness-only change prevents that stale-session fan-out in the affected E2E teardown path.

This complements #1983's containment by removing the known test teardown trigger. It does not mask cleanup failures returned by stop().

Validation

  • cd nodejs && COPILOT_SDK_DEFAULT_CONNECTION=inprocess npm test -- test/e2e/session.e2e.test.ts (36 passed, 2 skipped)

Bound in-process per-session abort/disconnect teardown in CopilotClient.stop and skip already-disconnected sessions to avoid unbounded teardown awaits. Adds shutdown coverage for connected-session filtering.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 05955426-95a4-4f54-b05f-1b14cc3099bc
Copilot AI review requested due to automatic review settings July 14, 2026 15:53
@roji
roji requested a review from a team as a code owner July 14, 2026 15:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Bounds Node.js in-process session teardown to prevent CopilotClient.stop() stalls.

Changes:

  • Adds abort and disconnect timeouts.
  • Skips teardown calls for disconnected sessions.
  • Adds connected-session filtering coverage.
Show a summary per file
File Description
nodejs/src/client.ts Adds bounded session teardown.
nodejs/src/session.ts Exposes internal disconnected state.
nodejs/test/client.test.ts Tests connected-session filtering.

Review details

  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Medium

Comment thread nodejs/src/client.ts Outdated
Comment thread nodejs/src/client.ts Outdated
@github-actions

This comment has been minimized.

Keep existing non-in-process disconnect behavior while adding fake-timer coverage for stalled in-process abort and disconnect cleanup.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 05955426-95a4-4f54-b05f-1b14cc3099bc
@github-actions

This comment has been minimized.

Report abort timeout failures from client teardown and make the shared E2E harness fail after completing proxy and directory cleanup.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 05955426-95a4-4f54-b05f-1b14cc3099bc
@roji
roji marked this pull request as draft July 14, 2026 16:18
@github-actions

This comment has been minimized.

Revert product cleanup behavior changes and remove stale disconnected sessions only from the Node E2E harness before teardown.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 05955426-95a4-4f54-b05f-1b14cc3099bc
@roji roji changed the title Fix Node in-process teardown stall from unbounded stop awaits Fix stale-session in-process Node E2E teardown stall Jul 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR modifies only nodejs/test/e2e/harness/sdkTestContext.ts — a test harness file with no production SDK code changes and no new public API surface.

Findings:

  • No new features or API changes are introduced that would require mirroring in other SDKs (Python, Go, .NET, Java, Rust).
  • The fix is specific to Node.js's in-process teardown behavior (CopilotClient.stop() + disconnected session registry cleanup), which is an implementation detail of the Node.js E2E test infrastructure.
  • All production SDK behavior is explicitly preserved per the PR description.

No cross-SDK consistency issues found. 🎉

Generated by SDK Consistency Review Agent for issue #1984 · sonnet46 269.8K ·

@roji roji closed this Jul 14, 2026
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.

2 participants