Skip to content

fix(streaming): project structured output live - #7352

Closed
TheodoreSpeaks wants to merge 3 commits into
stagingfrom
fix/stream-structured-output-live
Closed

fix(streaming): project structured output live#7352
TheodoreSpeaks wants to merge 3 commits into
stagingfrom
fix/stream-structured-output-live

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • project selected structured string outputs into the live agent event sink as JSON arrives
  • forward projected text through nested workflows, deployed chat/API protocol streams, and Slack without duplicating byte-stream output

Type of Change

  • Bug fix

Testing

  • 203 focused streaming tests pass across executor, nested workflows, deployed streaming, and Slack
  • lint and focused repository audits pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 1, 2026 11:26am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR projects selected structured string fields into live agent-event sinks while keeping sink and byte-stream forwarding coordinated.

  • Adds incremental JSON string-field projection with per-turn state reset.
  • Marks transformed event sinks so nested workflows, deployed streams, and Slack can forward projected text live without duplicating byte-stream output.
  • Adds focused coverage for projection, encoded selectors, JSON escapes, nested forwarding, deployed streaming, and Slack.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/executor/utils.ts Adds incremental top-level JSON string projection, selector handling, escape decoding, and per-turn reset behavior.
apps/sim/executor/execution/block-executor.ts Connects projected subscriptions to streaming executions and explicitly records when sink events match the transformed client stream.
apps/sim/lib/workflows/streaming/forward-agent-stream-events.ts Allows answer text to come from a transformed sink only when its projection matches the transformed byte stream.
apps/sim/lib/workflows/streaming/streaming.ts Reuses the sink-selection contract for negotiated deployed agent-event streams.
apps/sim/lib/webhooks/slack-execution-stream.ts Streams matching projected sink text through Slack while preserving its acknowledged append-only turn behavior.
apps/sim/lib/workflows/streaming/streaming.test.ts The previously reported contract bypass is fixed; the new fixture is contextually checked against production streaming types.

Sequence Diagram

sequenceDiagram
  participant P as Provider stream
  participant X as Block executor
  participant J as JSON field projector
  participant S as Event sink
  participant C as Client or Slack
  P->>X: Structured text_delta events
  X->>J: Raw JSON chunks
  J->>S: Selected string-field deltas
  S->>C: Live projected answer text
  P->>X: turn_end
  X->>J: Reset projection state
  X-->>C: Drain transformed byte stream without duplicate forwarding
Loading

Reviews (3): Last reviewed commit: "fix(streaming): match encoded output sel..." | Re-trigger Greptile

Comment thread apps/sim/lib/webhooks/slack-execution-stream.ts
Comment thread apps/sim/lib/workflows/streaming/streaming.test.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 12 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/webhooks/slack-execution-stream.ts
Comment thread apps/sim/executor/utils.ts Outdated
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

Closing in favor of a simpler streaming contract: unstructured agent text may stream, while structured outputs remain terminal values after complete validation. Tool and thinking events can continue streaming independently.

@waleedlatif1
waleedlatif1 deleted the fix/stream-structured-output-live branch September 1, 2026 19:23
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.

1 participant