Implement ratatoskr.sse_client — SSE consumer, reconnect, cancel #1
Closed
opened 2026-05-20 20:56:35 -07:00 by vh
·
1 comment
No Branch/Tag Specified
main
diag/r30-gap-injection-harness
diag/r30-phi0-step-response
diag/r29-pad-series
graphify-tooling
v0.22.3
v0.22.2
v0.22.1
v0.22.0
v0.21.20
v0.21.19
v0.21.18
v0.21.17
v0.21.16
v0.21.15
v0.21.14
v0.21.13
v0.21.12
v0.21.11
v0.21.10
v0.21.9
v0.21.8
v0.21.7
v0.21.6
v0.21.5
v0.21.4
v0.21.3
v0.21.2
v0.21.1
v0.21.0
v0.20.17
v0.20.16
v0.20.15
v0.20.14
v0.20.13
v0.20.12
v0.20.11
v0.20.10
v0.20.9
v0.20.8
v0.20.7
v0.20.6
v0.20.5
v0.20.4
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.9
v0.19.8
v0.19.7
v0.19.6
v0.19.5
v0.19.4
v0.19.3
v0.19.2
v0.19.1
v0.19.0
v0.18.11
v0.18.10
v0.18.9
v0.18.8
v0.18.7
v0.18.6
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.17
v0.17.16
v0.17.15
v0.17.14
v0.17.13
v0.17.12
v0.17.11
v0.17.10
v0.17.9
v0.17.8
v0.17.7
v0.17.6
v0.17.5
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.1
v0.16.0
v0.15.1
v0.15.0
v0.14.2
v0.14.1
v0.14.0
v0.13.0
v0.12.0
v0.11.0
v0.10.0
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.1
v0.7.0
v0.6.5
v0.6.4
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.1
v0.5.0
v0.4.1
v0.4.0
v0.3.0
v0.2.1
v0.2.0
v0.1.0
Labels
Clear labels
blocked-needs-contract
blocked-needs-dependency
bug
cli
documentation
duplicate
enhancement
invalid
needs-architect-decision
needs-info
needs-triage
observability
ready-for-agent
sse-client
task
tui
wontfix
Sleipnir refuses dispatch — issue-scoped contract missing
Sleipnir holds dispatch — INV-029 dependency-aware gate
Something is not working
Command-line surface (--send, --new, --session, etc.)
Docs / contract / spec work
Duplicate of another issue
New feature or improvement
Not a real issue
Escalated for a design call
More info required from reporter
Newly filed, not yet sorted
Log-pane / debug-surface work (persona, admin events, Bifrost, tools)
Gates AFK dispatch via Sleipnir (applied by /sleipnir-preflight)
SSE consumer module (src/ratatoskr/sse_client.py)
Implementation task
Textual app shell + presenters
Accepted as not-fixing
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vh/ratatoskr#1
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
Ratatoskr needs a Python SSE consumer module for the Worldtree Conversation API. This module is the integration seam between Ratatoskr (separate-repo, separate-team, spec-only-consumer) and Worldtree — every higher feature (Textual TUI,
--sendnon-interactive mode, two-stage Ctrl-C, scripted CI probes) lands on top of it.The Worldtree spec emits SSE events with a composite
{turn_id}:{seq}id:wire field (spec INV-014) that is load-bearing for:POST /sessions/{id}/turns/{turn_id}/cancel—turn_idis parsed from the SSE wireid:).Last-Event-IDHTTP header.turn_idprefix).Hand-rolled
data:-only SSE parsing (the skaldsong pattern) silently drops theid:line and breaks both flows invisibly.docs/design-brief.md§3 names this as the foot-gun this module must close.Solution
Implement
src/ratatoskr/sse_client.pyper the contract atdocs/contracts/issues/1.contract.md. The contract specifies four functions and the typedEventenvelope:stream_turn(client, session_id, content) -> AsyncIterator[Event]— POST a user message and consume the SSE response stream.reconnect_turn(client, session_id, last_event_id) -> AsyncIterator[Event]— re-attach to an in-flight turn viaLast-Event-ID.cancel_turn(client, session_id, turn_id, *, persist_partial=False) -> CancelResult— server-side cancel._parse_sse_id(raw) -> SseId— strict parser for the composite wireid:field.Hard invariants (per contract):
Eventcarries a parsedSseId(turn_id, seq)— impossible to silently drop theid:line.turn_idis stable across events; a mid-stream flip raisesTurnIdFlip.core.*/worldtree.*imports (boundary already enforced bytests/test_no_worldtree_imports.py).TDD via tracer tests per function block. Recommended vertical slice:
_parse_sse_id→stream_turn→reconnect_turn→cancel_turn. Each function's first listed test (tagged[..,tracer]) is the RED test for that function; remaining tests follow one at a time per thetddskill.Benefits
docs/design-brief.md§3 names (silentid:drop).--sendstdout) — neither forks the SSE parsing.cancel_turnis GREEN.Acceptance
uv run pytest tests/).tests/test_no_worldtree_imports.pycontinues to pass.tests/snapshots/README.md); fixture recording can land in a follow-up issue.docs/SPEC-PIN.md) unchanged; this module is built against Worldtree v0.19.0 / repo SHA55101e909abcd2219833266b6f905c5bc956e0f0.Dependencies
None. This is the first module in the dependency graph — every other module imports
Eventand/or invokes the three entry points.Closed — shipped. ratatoskr.sse_client implemented via TDD (commit
02f2a04, Volva-reviewed inc17af18). Live against personal Worldtree since v0 milestone.