Skip to content

test: a child-session test closes its session, and the page driver's owner check counts only its own - #727

Merged
earakely-scale merged 1 commit into
mainfrom
edgararakelyan/child-session-test-closes-its-session
Nov 17, 2026
Merged

earakely-scale merged 1 commit into
mainfrom
edgararakelyan/child-session-test-closes-its-session

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Why

unit (2/2) failed on #725 with tst/unit/drivers/page_driver_test.py::test_a_call_is_bounded_from_when_it_asks_for_its_session_and_leaves_no_session_half_open. The test found one session owner still running, but that owner wasn't one of its own. It was a gateway child session (ChildSessions._own, parked on close.wait()).

The unit tier's event loop is shared across the session (asyncio_default_test_loop_scope = "session"), and two tests interact through it:

  • child_sessions_test.py::test_a_reported_transport_failure_retires_the_session_once_and_the_next_call_reopens never closes its second session, unlike every other test in the file. Its owner keeps running for the rest of the worker's run.
  • The page driver's test counts every _own task in the loop. It fails whenever xdist runs it on the same worker after that test.

Which tests share a worker depends on how the tier is split, so a PR that adds unrelated tests can surface it. Running the two in that order fails every time on main.

What changes

  • The child-session test closes its sessions in a finally, as the rest of its file does.
  • The page driver's _owners_left counts only owners started since its test began, so an owner another test leaves running can't fail it.

Tests only.

Testing

  • tst/unit/env/gateway then tst/unit/drivers in one process, the order that failed: 1275 passed. A hook that reports any session owner left running after each test reported none (before: one, after the child-session test).
  • Each change alone makes the failing pair pass.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

This PR fixes test interference on a shared event loop.

  • The gateway test closes its child sessions even when an assertion fails.
  • The page-driver test counts only session owners it starts.

Reviews (1) · Last reviewed commit: "test: a child-session test closes its se..." · Reviewed by Greptile

…owner check counts only its own

The unit tier's event loop is shared across the session. One child-session test left its second session open, so
its owner ran for the rest of the worker's run, and the page driver's bounded-call test, which counts every session
owner in the loop, failed whenever xdist ran it after that test on the same worker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale marked this pull request as ready for review November 17, 2026 00:38
@earakely-scale
earakely-scale requested a review from a team as a code owner November 17, 2026 00:38
@earakely-scale
earakely-scale merged commit 681b606 into main Nov 17, 2026
35 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/child-session-test-closes-its-session branch November 17, 2026 01:25
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