Fix daemon socket-transport accuracy and Windows test-cleanup flake - #10
Merged
wheresoli merged 6 commits intoJul 10, 2026
Merged
Conversation
…s test-cleanup flake
The package ships a loopback-TCP socket transport (serve_socket / `daemon
serve` / `daemon start` / LiveShellClient.connect) alongside stdio, but
capability discovery and the docs still described it as stdio-only. This
corrects the contract and the documentation, and fixes a Windows test flake.
capabilities.py:
- `daemon.protocol` advertised `{"transport": "stdio", "network": False}`,
which is false — a loopback socket transport exists. Now advertises
`{"transports": ["stdio", "socket"], "socket_scope": "loopback",
"remote_network": False}`, preserving the true "no remote server" guarantee.
- Added a test asserting the accurate shape.
docs (README.md, PROTOCOL.md):
- Removed the inaccurate claims that a socket/network transport "is not
included", that the protocol is "local-only stdio", and that there is no
network server. There is an opt-in, loopback-only socket daemon.
- Documented `daemon serve`/`start`/`stop` in the CLI list and how to attach
with LiveShellClient.connect; added a Transports section to PROTOCOL.md.
- Kept the accurate posture: loopback-only, opt-in, no remote/auto-started
listener, no URL handlers.
tests (Windows flake):
- The suite intermittently errored during TemporaryDirectory cleanup when a
daemon-held WAL sqlite file raced rmtree (NotADirectoryError / WinError 267).
- Added `ignore_cleanup_errors=True` to the strict-cleanup TemporaryDirectory
sites (62 across 6 files), consistent with the existing rmtree_retry
workaround in test_persistent_daemon.py.
Verification: `python -m unittest discover -s tests` → 90 passing (was 89),
3 consecutive green runs on Windows. ruff not run locally (dev extra not
installed); CI will lint.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR corrects the daemon transport “contract” by updating capability discovery and documentation to reflect that LiveShell supports both stdio and a loopback-only TCP socket transport, and it hardens the Windows test suite against intermittent temp-dir cleanup failures.
Changes:
- Update
daemon.protocolcapability details to advertise bothstdioandsockettransports, and add a regression test. - Update README + protocol docs to remove stdio-only claims and document the socket-based daemon workflow (
daemon serve/daemon start/LiveShellClient.connect). - Reduce Windows cleanup flakes by setting
TemporaryDirectory(ignore_cleanup_errors=True)across affected tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/liveshell/capabilities.py |
Updates daemon.protocol capability details to report both transports. |
tests/test_capabilities.py |
Adds a test that locks the new daemon.protocol capability shape. |
README.md |
Updates docs to describe both stdio + socket transports and relevant CLI commands. |
docs/PROTOCOL.md |
Updates protocol docs to be transport-agnostic and adds a “Transports” section. |
tests/test_store.py |
Uses ignore_cleanup_errors=True to avoid Windows temp cleanup flakes. |
tests/test_production_readiness.py |
Same cleanup hardening across production-readiness tests. |
tests/test_handles.py |
Same cleanup hardening across handle tests. |
tests/test_daemon.py |
Same cleanup hardening across daemon/protocol tests. |
tests/test_client.py |
Same cleanup hardening across client tests. |
tests/test_cli.py |
Same cleanup hardening across CLI tests (including prefixed temp dirs). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
LiveShell ships a loopback-TCP socket transport (
serve_socket/liveshell daemon serve/daemon start/LiveShellClient.connect) alongside stdio, but capability discovery and the docs still described it as stdio-only. That's a false contract for any consumer that negotiates oncapability.discover, and the docs actively tell readers a socket transport "is not included." This PR corrects the contract and the documentation, and fixes a related Windows test flake found while verifying.1.
capabilities.py—daemon.protocolwas lyingdaemon.protocoladvertised{"transport": "stdio", "network": False}despite the shipping socket transport. Now:{ "transports": ["stdio", "socket"], "socket_scope": "loopback", "remote_network": false }This still asserts the true guarantee (no remote/auto-started server) while telling the truth about the two supported transports. Added a test locking the shape.
2. Docs (
README.md,PROTOCOL.md) — removed false statementsCorrected claims that contradicted the code:
"Local named pipe or Unix socket daemon transport is not included in this slice. The stdio protocol is the supported live transport""The protocol is local-only stdio"/"does not ... expose a default network server"Now: documents both transports, the
daemon serve/start/stopCLI commands (previously undocumented), attaching viaLiveShellClient.connect(state_dir), and a new Transports section inPROTOCOL.md. The accurate security posture is preserved: loopback-only, opt-in, no remote/auto-started listener, no URL handlers.3. Windows test-cleanup flake
The suite intermittently errored during
TemporaryDirectorycleanup when a daemon-held WAL sqlite file racedrmtree(NotADirectoryError/WinError 267). Addedignore_cleanup_errors=Trueto the 62 strict-cleanupTemporaryDirectorysites across 6 test files — consistent with the existingrmtree_retryworkaround intest_persistent_daemon.py.Verification
python -m unittest discover -s tests→ 90 passing (was 89), 3 consecutive green runs on Windows (the flake no longer reproduces).ruffnot run locally (dev extra not installed); CI will lint.Not in scope (noted for follow-up)
command.exit_code.native: trueis reported for all shells, butcmd/bashexit codes are parsed from a sentinel (only hosted PowerShell is truly native). Left as-is to keep this PR focused on the transport inaccuracy; worth a separate look.🤖 Generated with Claude Code