fix(sessions): start --stream answers with the daemon's stream, not the record's
`start`'s reply was `Session.public()`, which reports what was *stored* -- and a
`url` is never stored, because naming one is the daemon's (CONTRACT-sessions.md
§3.5) and a URL on disk is a URL that lies the first time the listener moves.
So a successful `start --stream` handed back a stream with a phrase and no URL,
which no caller could tell from a stream that failed to open: the CLI printed
WARNING: the session is running but its stream was not enabled: the
broker reported no stream
over a stream the daemon had attached a second earlier, and the MCP tool's
summary said `stream: NOT enabled` for the same reason. `stream enable` was
always right, because it answers with `_stream_public` -- only the one-call path
was wrong.
Found by checks/vm-stream.nix's last subtest, which is the only place
`start --stream` runs against a real daemon. The unit test added beside it pins
the seam rather than the symptom: the reply carries a `url`, the record does
not, so anything answering from the record alone has to merge.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011ZeH65zd6pFTgBSu52W9PE
This commit is contained in:
1 parent
b4abd085cc
commit
9d33639c04
2 files changed
+40
-1
No files matched your search
@@ -217,6 +217,28 @@ def test_enabling_mints_a_phrase_the_daemon_accepts_and_publishes(harness):
|
||||
assert harness.daemon.outputs() == ["hh-foot-aaaaaa"]
|
||||
|
||||
|
||||
def test_the_url_is_the_daemon_s_and_is_not_in_the_record(harness):
|
||||
"""So anything answering with the record alone must merge the reply in.
|
||||
|
||||
REGRESSION. `start --stream` built its answer from `Session.public()`,
|
||||
which reports what was *stored* -- and a `url` is never stored, because
|
||||
naming one is the daemon's (CONTRACT-sessions.md §3.5). The result was a
|
||||
successful start whose stream had no URL, which the CLI could not tell
|
||||
from a stream that failed to open: it printed "the session is running but
|
||||
its stream was not enabled" over a stream the daemon had just attached.
|
||||
Found by checks/vm-stream.nix, which is also where the `start --stream`
|
||||
path is proven end to end -- there is no launcher here.
|
||||
"""
|
||||
|
||||
harness.add()
|
||||
reply = harness.run(harness.manager.stream_enable("foot-aaaaaa"))
|
||||
|
||||
assert reply["stream"]["url"]
|
||||
stored = harness.manager.registry.get("foot-aaaaaa").public(harness.clock.boottime())
|
||||
assert stored["stream"]["phrase"] == reply["stream"]["phrase"]
|
||||
assert "url" not in stored["stream"]
|
||||
|
||||
|
||||
def test_the_phrase_is_in_the_record_so_it_survives_a_restart(harness):
|
||||
harness.add()
|
||||
first = harness.run(harness.manager.stream_enable("foot-aaaaaa"))["stream"]
|
||||
|
||||
Reference in new issue
Block a user