(6/7) test(session): InloopSessionServer replaces the in-process SessionServer test harness#1566
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces InloopSessionServer, an in-thread session server designed to replace the process-spawning SessionServer and UvicornThreadServer across various test suites, thereby reducing test execution overhead. The review feedback focuses on improving robustness and preventing resource leaks by ensuring that server startup and channel setup are safely enclosed within try...finally blocks. Additionally, a minor type annotation mismatch in rollout_fixtures.py was identified.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
6a97c87 to
bc6f752
Compare
996fd19 to
c2af32a
Compare
c2af32a to
0fd7c91
Compare
bc6f752 to
736dd29
Compare
0fd7c91 to
d7d0a7d
Compare
2fac59c to
e87eab4
Compare
…tation - _router_env / router_env: server.start() moves inside the try so a readiness-timeout failure still runs stop() — the uvicorn thread may be alive with the port bound; matches _with_session_server's existing idiom - _with_session_server yields InloopSessionServer, not UvicornThreadServer (annotation was a stale copy from _with_miles_router) Addresses Gemini review comments 3-5 on #1566. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ver test harness Fixtures that served an in-process SessionServer app from a thread now use InloopSessionServer (miles/utils/test_utils/): the production router app (build_router_app) served on a real port, with N SessionWorker shards wired as in-loop IPC handlers on the server thread's event loop — real socketpair framing and worker dispatch, none of the OS-process spawn cost. Process lifecycle (spawn, readiness, fail-fast, teardown) is the supervisor's job, covered by its own test. Assertions are unchanged across the migrated suites — the evidence that the router-app topology preserves the behavior the old harness pinned. test_session_dataplane's equivalence reference becomes the same topology with one shard, and the transport-error test asserts the 502 shape directly instead of comparing against SessionServer.do_proxy. The in-process chassis itself is still in place; it goes away with the launch switchover. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tation - _router_env / router_env: server.start() moves inside the try so a readiness-timeout failure still runs stop() — the uvicorn thread may be alive with the port bound; matches _with_session_server's existing idiom - _with_session_server yields InloopSessionServer, not UvicornThreadServer (annotation was a stale copy from _with_miles_router) Addresses Gemini review comments 3-5 on #1566. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same comment-only sweep as the lifecycle branch, applied to the docstrings this branch introduces. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ee3eeeb to
e755326
Compare
Shi-Dong
left a comment
There was a problem hiding this comment.
LGTM. But it seems that you are deleting the tests for the original session server before it is retired (presumably in the next PR).
No problem for this PR chain, but ideally this PR should only introduce new tests, and the next PR should delete the old tests.
Summary
Migrates every test fixture off the in-process
SessionServerapp ontoInloopSessionServer— the production router app (build_router_app) served on a real port, with NSessionWorkershards wired as in-loop IPC handlers on the server thread's event loop (real socketpair framing and worker dispatch, none of the OS-process spawn cost). Assertions are unchanged across the migrated suites — this PR is the migration-equivalence evidence that the router-app topology preserves the behavior the old harness pinned, which is what licenses deleting the single-process chassis in #1519.What's here
miles/utils/test_utils/inloop_session_server.py— router app +n_workersin-loop worker shards served from one thread; process lifecycle (spawn, readiness, fail-fast, teardown) stays the supervisor's job, covered by its own test in (5/7) feat(session): process-lifecycle layer — supervisor spawns N session workers + router #1565.generation_fixtures.py/rollout_fixtures.py/session_pretokenized_test_utils.py/test_session_race_conditions.py/test_sessions.py— harness swap only; assertions untouched.test_session_dataplane.py— the equivalence reference becomes the same topology with one shard, and the transport-error test asserts the 502 shape directly instead of comparing againstSessionServer.do_proxy.Testing
pytest tests/fast/router— 96 passed at this commit, with the in-process chassis still present: proves no remaining coverage depends on it before (7/7) feat(session): launch the supervisor topology; delete the single-process chassis #1519 deletes it.🤖 Generated with Claude Code