Skip to content

Stream a run's pieces through RunSetup::streaming, and delete RunBroker - #38

Merged
vinniefalco merged 3 commits into
cppalliance:masterfrom
vinniefalco:master
Nov 25, 2026
Merged

vinniefalco merged 3 commits into
cppalliance:masterfrom
vinniefalco:master

Conversation

@vinniefalco

@vinniefalco vinniefalco commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Workshop streams a reply's live pieces through the Harness's RunSetup::streaming, and its per-run broker is gone. The launch code sets a callback on each run's setup that publishes each piece into the conversation under the round's id. WorkshopBroker takes the Harness's new on_piece argument, hands it to the Gateway broker, and says that it streams. Both come with the Harness at 5d9c7bf8, the head of cppalliance/runvil-harness#76.

Merge order: this pull request merges after cppalliance/runvil-harness#76. Its pin names a commit that only that pull request holds until then. The Harness merge is a fast-forward, so the commit keeps its id.

The commits

  • Add the plan for streaming a reply to the Host. The plan file alone.
  • Stream a run's pieces through RunSetup, not RunBroker. The pin and the cutover in one commit. The changed InferenceBroker breaks Workshop's two brokers, so the pin cannot move alone.
  • Pin the Harness at 5d9c7bf8. The pin moves again, and Cargo.lock with it, after a review fix to the docs of the Harness's streaming setter. No code changes.

Each of the two commits that follow the plan copy passes Workshop's whole verification list by itself, on its pin. Each commit message ends with a Plan: line that names the plan file in this repository.

What changes

setup_for, before:

let recorder = conversation.recorder(self.inner.recorder.for_agent(conversation.agent()));
let broker = RunBroker::new(self.inner.broker.clone(), conversation.clone());
RunSetup::new(recorder, broker, TokioTimer)
    .vfs(language_guide::run_vfs())
    .has_user(true)

After:

let recorder = conversation.recorder(self.inner.recorder.for_agent(conversation.agent()));
RunSetup::new(recorder, self.inner.broker.clone(), TokioTimer)
    .vfs(language_guide::run_vfs())
    .has_user(true)
    .streaming(live_pieces(conversation.clone()))

The callback:

fn live_pieces(conversation: Conversation) -> impl Fn(Round, runvil::harness::Delta) + Send + Sync + 'static {
    move |round, piece| {
        let (kind, content) = match piece {
            runvil::harness::Delta::Text(text) => (DeltaKind::Text, text),
            runvil::harness::Delta::Reasoning(text) => (DeltaKind::Reasoning, text),
            _ => return,
        };
        conversation.publish_delta(round.id, kind, content);
    }
}
  • RunBroker and the private WorkshopBroker::chat_streaming are deleted. WorkshopBroker::chat takes on_piece and hands it to the Gateway broker's chat, and supports_streaming returns true.
  • The Harness picks the rounds that stream, so the callback does not check a round's origin. A nested models.infer round never reaches it.
  • The callback sends on the conversation's broadcast and returns, and it calls nothing of the Harness. It ignores a variant of the non-exhaustive Delta that it does not know.
  • with_host_state needed no change. It rebuilds the setup with struct update syntax, so the callback carries through.
  • Cargo.lock changes its 14 source lines of the Harness packages and nothing else.

What a person will notice

Nothing. The window, the transcript, and the run log get the same pieces and events in the same order as before. The two socket tests that stream deltas over the real launch path pass unchanged.

Call sites

  • setup_for passes the server's WorkshopBroker straight to RunSetup::new, and it takes two handles for the setup: one to the broker and one to the conversation, which the callback owns.
  • broker-tests.rs calls chat with None, and with a callback where it checks the pieces.

Tests

The two test groups run 706 and 354 tests on Windows, all passing. Those are the counts of before.

  • The callback. A piece that is handed to live_pieces under round 3 reaches a receiver from subscribe_deltas with its kind, its content, and the reply id 3. This replaces the test of RunBroker. Its nested Infer half is the Harness's test now, since the Harness hands that round no callback.
  • The broker. chat with a callback hands it the pieces of the reply and returns the whole reply, the broker says that it streams, and a round with no gateway fails as Unavailable and streams nothing.
  • The path to a client. a_full_turn_streams_deltas_and_indexed_events_sharing_the_reply_id and gate_streaming_delivers_text_and_reasoning_deltas_then_the_reply run over the real launch path and are unchanged.

Checks

Every command in AGENTS.md passed on the new pin before the code commit, with --locked: the format check, clippy in its two groups with CARGO_BUILD_WARNINGS=deny, nextest in its two groups, the docs build with RUSTDOCFLAGS="-D warnings", cargo dylint, the structural checks, and the wording scan. The private-item docs of workshop-server build with warnings denied, which refuses a link to the deleted RunBroker. The pre-push hook passed on the push.

Before the Harness was pushed, the same list also passed on the Harness head that was upstream, with no change of Workshop's own.

The checks ran on Windows.

Follow-up

  • seq on agent_delta, the per-round sequence number that lets the browser detect a gap in a round's pieces, gets its own plan.

Summary by CodeRabbit

  • New Features
    • Text and reasoning output now appears in the conversation as it streams, with each piece associated with its corresponding round.
    • Streaming responses are now supported through the same chat flow used for non-streaming responses.
    • Other types of streaming updates are not displayed in the conversation.

The plan moves streaming from `RunBroker` to the Harness callback set with `RunSetup::streaming`. Workshop deletes `RunBroker`, forwards `on_piece` from `WorkshopBroker`, and publishes each live piece into its conversation from the callback. The file holds the commits in three repositories and the order of the pushes and the merges.

- Workshop pins the Harness commit that holds the callback in the same commit as the code, because the changed trait breaks its two brokers.
- `seq` on `agent_delta` and `runvil-classroom` are outside the plan.

Plan: /plan/2026-11-24-1-streaming-callback.plan.md
The launch code sets the `streaming` callback of `RunSetup` to a function that publishes each live piece into the conversation, and `RunBroker` is deleted. `WorkshopBroker` takes `on_piece`, hands it to the Gateway broker, and answers `true` from `supports_streaming`. The pin moves to the Harness commit that holds the callback, because the changed trait breaks both brokers.

- `live_pieces` is a free function beside `setup_for`. It moves the text of each `Delta` into `publish_delta` under the round's id, and it ignores a variant it does not know.
- The callback does not check a round's origin, because the Harness hands it only a section's own rounds.
- The tests in `broker-tests.rs` run `chat` with `None` and with a callback, and check that the broker says it streams. A new test feeds `live_pieces` two pieces under round 3 and reads them from `subscribe_deltas`. The test of `RunBroker` goes with the type.
- `Cargo.lock` changes its 14 source lines for the Harness packages and nothing else.
- The two socket tests that stream deltas are unchanged.

Plan: /plan/2026-11-24-1-streaming-callback.plan.md
Copilot AI balanced review requested due to automatic review settings November 25, 2026 04:35

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

WorkshopBroker now forwards optional streaming callbacks to GatewayBroker. AgentSessions passes the shared broker to RunSetup and publishes text and reasoning deltas to conversations with their round IDs. The change removes RunBroker, updates three workspace dependency revisions, and adds an implementation plan.

Changes: Workshop streaming callback

Layer / File(s) Summary
Broker callback and Gateway forwarding
crates/workshop/server/src/agents/broker.rs, crates/workshop/server/src/agents/broker-tests.rs, Cargo.toml, plan/2026-11-24-1-streaming-callback.plan.md
WorkshopBroker reports streaming support and forwards an optional PieceSink to GatewayBroker.chat. The separate chat_streaming path and RunBroker are removed. Broker tests use the callback API. The three workspace dependency revisions change to 5d9c7bf86539401382aa5187c1b1873ceac38fb6. The plan describes the callback API and related Harness work.
Run setup and conversation publication
crates/workshop/server/src/agents.rs, crates/workshop/server/src/agents/tests.rs
AgentSessions passes the shared WorkshopBroker to RunSetup and configures a streaming callback. The callback publishes text and reasoning deltas with their round IDs. Tests check the published kind, content, and round ID.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AgentSessions
  participant WorkshopBroker
  participant GatewayBroker
  participant live_pieces
  participant Conversation
  AgentSessions->>WorkshopBroker: configure run with streaming callback
  WorkshopBroker->>GatewayBroker: chat with PieceSink
  GatewayBroker->>live_pieces: deliver text or reasoning Delta
  live_pieces->>Conversation: publish Delta with round ID
Loading

Suggested reviewers: gregjkal

Merge Risk: Minimal · up to 1b33d · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Workshop now streams a run's pieces through the Harness RunSetup::streaming callback, and the per-run RunBroker wrapper is deleted. The raw summary confirms both parts…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: Workshop now streams a run's pieces through the Harness RunSetup::streaming callback, and the per-run RunBroker wrapper is deleted. The raw summary confirms both parts: setup_for installs a streaming callback that publishes text and reasoning deltas under the round ID, and RunBroker is removed from broker.rs. The title is specific and accurate.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: e151a7be-4219-4795-869e-617982c14341
Commits

Reviewing files that changed from the base of the PR and between 411e665 and 1b33d9f.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 1

  • Cargo.toml

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

The three `rev` values of `runvil-harness` in `Cargo.toml` move to the Harness commit that holds the corrected docs of the streaming setter. `Cargo.lock` changes its 14 `source` lines for the Harness packages, and no code changes.

- The commit holds no test, because it moves a pin and nothing else.

Plan: /plan/2026-11-24-1-streaming-callback.plan.md
Copilot AI balanced review requested due to automatic review settings November 25, 2026 04:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@vinniefalco
vinniefalco merged commit 1b33d9f into cppalliance:master Nov 25, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants