Skip to content

Fix session start subscription ordering tests - #2737

Merged
stephentoub merged 1 commit into
mainfrom
stephentoub-fix-capi-event-ordering
Sep 21, 2026
Merged

stephentoub merged 1 commit into
mainfrom
stephentoub-fix-capi-event-ordering

Conversation

@stephentoub

Copy link
Copy Markdown
Collaborator

Managed settings resolution can legitimately emit a live, ephemeral event before session.start. The C# and Python E2E tests assumed the start event would always be the first subscription callback, causing the CAPI test failure reported in github/copilot-agent-runtime#21956.

This updates the live-subscription tests to wait specifically for SessionStartEvent/SessionStartData while preserving their preallocated and server-assigned session ID assertions. Persisted event-log ordering assertions remain unchanged.

Generated by Copilot

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 21, 2026 01:27
@stephentoub
stephentoub requested a review from a team as a code owner September 21, 2026 01:27

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.

Copilot review overview

🟢 Approval recommended

The changes consistently remove the invalid first-event assumption while retaining the intended session ID checks.

Review effort: Balanced
Findings: None

What changed in this PR

Updates Python and .NET E2E tests to tolerate ephemeral events preceding session-start callbacks.

Changes:

  • Wait specifically for session-start events.
  • Preserve session ID and event-data assertions.
  • Rename tests to reflect updated semantics.
File Description
python/​e2e/​test_scenario_session_setup_e2e.py Filters for preallocated session-start events.
python/​e2e/​test_scenario_cloud_e2e.py Filters for cloud session-start events.
dotnet/​test/​E2E/​ScenarioTestingSessionSetupE2ETests.cs Waits specifically for SessionStartEvent.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Consistency Review

This PR (#2737) fixes a race-condition assumption in the .NET and Python E2E tests: managed settings resolution can emit a live ephemeral event before session.start, so the tests previously assumed the very first subscription callback would always be the start event. The fix makes both tests wait specifically for SessionStartEvent/SessionStartData instead of the first event received, while preserving the preallocated- and server-assigned-session-ID assertions. Persisted event-log ordering assertions are untouched.

Cross-SDK check: I compared the equivalent scenario/E2E tests in Go, Rust, Node.js, and Java:

  • go/internal/e2e/scenario_testing_cloud_e2e_test.go and go/internal/e2e/session_config_e2e_test.go already assert specifically on SessionStartData/SessionEventTypeSessionStart rather than assuming the first received event is the start event.
  • rust/tests/e2e/client_options.rs (cloud_create_routes_first_event_for_server_assigned_session_id) already filters for SessionEventType::SessionStart / SessionStartData rather than relying on "first callback = start event".
  • No equivalent bug pattern (blind first-event assumption) was found in the Java or Node.js E2E suites.

So this is a targeted bugfix that only needed correction in the .NET and Python test harnesses — the other SDKs' tests were already written correctly and don't need changes. No cross-SDK inconsistency is introduced by this PR. ✅

Generated by SDK Consistency Review Agent for #2737 · copilot · sonnet50 · 60 AIC · ⌖ 11.5 AIC · ⊞ 7.8K ·

@stephentoub
stephentoub merged commit cb2a8cc into main Sep 21, 2026
65 checks passed
@stephentoub
stephentoub deleted the stephentoub-fix-capi-event-ordering branch September 21, 2026 01:49
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