research: RLM-RESEARCH-336 text streaming through the completion boundary #349

Merged
nsaspy merged 4 commits from research/text-streaming into main 2026-09-04 15:28:18 +00:00
Owner

Summary

ADADR research slice for issue #336 (prolog-rlm should support text streaming). Research only — no implementation. Implementation begins after operator approval per prolog-rlm.research-approval.v1.

  • Adds research/RLM-RESEARCH-336-text-streaming.org (approval state PENDING) and indexes it in research/README.md.
  • Refreshes the tracked .prolog/ verification ledger for the new task (issue-336-text-streaming) with recorded observations.

Findings (from the record)

The issue's claim "streaming is not currently implemented" is only true above the chain layer:

  • Exists: OpenAI-compatible SSE transport with incremental stream_event{} delivery, include_usage, [DONE] sentinel enforcement, cancellation propagation, validated stream_result{}; chain model_stream/model_stream_async/chain_stream* through the canonical rlm_async scheduler; UI v1 streaming_text capability, message_started/text_delta/message_completed reducers, and facade mapping for canonical agent_event(model_delta, ...); live OpenRouter streaming gate at the chain layer.
  • Missing: any producer of text deltas above the chain boundary. rlm_completion (call_planner/call_model) dispatches only model_complete_execute; agent trace vocabulary carries no deltas; conversation runtime has no event plumbing; agent_event(model_delta, ...) has zero producers (UI fixtures are hand-authored).

Enumerated methods

  • A (recommended): opt-in trusted text_delta_handler completion option dispatching through model_stream_execute inside the existing async worker; validated stream_result.response stays authoritative; delta-aggregate-vs-final consistency; usage recorded exactly once; cancellation stays conservative.
  • Rejected: post-hoc replay (contradicts the documented no-replay contract), new event-bus subsystem (second scheduler), model-controlled stream flag (reserved native session control), durable raw-delta persistence (collapses semantic classes).

Non-goals

No scheduler/event-bus changes, no SSE transport changes, no direct-mode native streaming, no trajectory-shape or UI protocol changes.

Verification evidence

prolog-verify gate green at the pushed HEAD: make research-approval PASS (21 tracked records), static load PASS, complete deterministic suite PASS (1179 tests), git diff --check clean, slice scope (no files outside research/ + .prolog/ changed) — all machine-recorded in .prolog/facts.kb.

Follow-up

Operator approval of RLM-RESEARCH-336 authorizes the design phase; design approval authorizes implementation.

## Summary ADADR research slice for issue #336 (prolog-rlm should support text streaming). Research only — no implementation. Implementation begins after operator approval per `prolog-rlm.research-approval.v1`. - Adds `research/RLM-RESEARCH-336-text-streaming.org` (approval state PENDING) and indexes it in `research/README.md`. - Refreshes the tracked `.prolog/` verification ledger for the new task (`issue-336-text-streaming`) with recorded observations. ## Findings (from the record) The issue's claim "streaming is not currently implemented" is only true above the chain layer: - Exists: OpenAI-compatible SSE transport with incremental `stream_event{}` delivery, `include_usage`, `[DONE]` sentinel enforcement, cancellation propagation, validated `stream_result{}`; chain `model_stream`/`model_stream_async`/`chain_stream*` through the canonical `rlm_async` scheduler; UI v1 `streaming_text` capability, `message_started`/`text_delta`/`message_completed` reducers, and facade mapping for canonical `agent_event(model_delta, ...)`; live OpenRouter streaming gate at the chain layer. - Missing: any producer of text deltas above the chain boundary. `rlm_completion` (`call_planner`/`call_model`) dispatches only `model_complete_execute`; agent trace vocabulary carries no deltas; conversation runtime has no event plumbing; `agent_event(model_delta, ...)` has zero producers (UI fixtures are hand-authored). ## Enumerated methods - **A (recommended):** opt-in trusted `text_delta_handler` completion option dispatching through `model_stream_execute` inside the existing async worker; validated `stream_result.response` stays authoritative; delta-aggregate-vs-final consistency; usage recorded exactly once; cancellation stays conservative. - Rejected: post-hoc replay (contradicts the documented no-replay contract), new event-bus subsystem (second scheduler), model-controlled `stream` flag (reserved native session control), durable raw-delta persistence (collapses semantic classes). ## Non-goals No scheduler/event-bus changes, no SSE transport changes, no direct-mode native streaming, no trajectory-shape or UI protocol changes. ## Verification evidence `prolog-verify` gate green at the pushed HEAD: `make research-approval` PASS (21 tracked records), static load PASS, complete deterministic suite PASS (1179 tests), `git diff --check` clean, slice scope (no files outside `research/` + `.prolog/` changed) — all machine-recorded in `.prolog/facts.kb`. ## Follow-up Operator approval of RLM-RESEARCH-336 authorizes the design phase; design approval authorizes implementation.
Enumerates methods for text streaming above the chain layer for #336:
opt-in trusted delta handler through completion options (recommended),
with rejected alternatives (replay, event bus, model-controlled stream,
durable delta persistence). Records verified gap evidence: SSE transport,
chain model_stream, UI v1 text_delta reducers exist; completion, agent,
conversation runtimes are complete-only with zero model_delta producers.

ADADR research slice. Implementation waits for operator approval per
the prolog-rlm.research-approval.v1 gate (PENDING).
verify: record issue-336 research-slice observations at final HEAD
Some checks failed
Tree-sitter FFI / Direct SWI-Prolog Tree-sitter FFI (pull_request) Failing after 20s
CI / Deterministic unit and load checks (pull_request) Successful in 1m38s
CI / REAL OpenRouter integration (pull_request) Has been skipped
Nix flake / Flake package and clean runtime load (pull_request) Failing after 5m34s
Clean SWI pack install / Install and load copied pack (pull_request) Successful in 35s
Paid OpenRouter / Pinned paid OpenRouter integration (pull_request) Failing after 39s
bd457a546f
aprovved research
Some checks failed
Tree-sitter FFI / Direct SWI-Prolog Tree-sitter FFI (pull_request) Failing after 24s
CI / REAL OpenRouter integration (pull_request) Has been skipped
Clean SWI pack install / Install and load copied pack (pull_request) Successful in 1m5s
CI / Deterministic unit and load checks (pull_request) Failing after 1m34s
Paid OpenRouter / Pinned paid OpenRouter integration (pull_request) Failing after 1m22s
Nix flake / Flake package and clean runtime load (pull_request) Failing after 5m39s
d96d5cb864
nsaspy merged commit c37acbdd89 into main 2026-09-04 15:28:18 +00:00
Sign in to join this conversation.
No description provided.