Skip to content

Comments

feat(structured-output): add typed helpers for structured JSON (RunJSON, RunStreamedJSON)#21

Merged
activadee merged 12 commits intomainfrom
codex/provide-typed-helpers-to-run-a-turn-with-36
Nov 6, 2025
Merged

feat(structured-output): add typed helpers for structured JSON (RunJSON, RunStreamedJSON)#21
activadee merged 12 commits intomainfrom
codex/provide-typed-helpers-to-run-a-turn-with-36

Conversation

@activadee
Copy link
Owner

@activadee activadee commented Nov 6, 2025

Summary

  • Add typed helpers to generate and decode structured JSON directly into Go types.
  • Support both single-shot (RunJSON) and streaming (RunStreamedJSON) flows.

Details

  • Infer JSON Schema from the generic type parameter using invopop/jsonschema (overridable via options).
  • Emit SchemaViolationError when the turn fails schema validation to allow precise handling.
  • Provide a streaming result that yields typed snapshots alongside raw events.

Docs & Examples

  • README: document typed helpers with a short sample.
  • Example: examples/structured_output demonstrates RunJSON and RunStreamedJSON usage.

Tests

  • Cover happy-path decoding, streaming lifecycle, and schema violation classification.

Chore

  • Update go.mod/go.sum to include github.com/invopop/jsonschema and related indirect deps.

Notes

activadee added 4 commits November 6, 2025 18:20
…JSON) with schema inference\n\n- Decode structured output into Go types\n- Support streaming updates via typed snapshots\n- Infer JSON Schema from generic type using invopop/jsonschema\n- Surface schema violations as SchemaViolationError\n\nMotivation: simplify structured output flows and ensure type safety.
…n- Validate RunJSON happy-path decoding and schema path wiring\n- Assert SchemaViolationError classification on turn failure\n- Exercise RunStreamedJSON update lifecycle and error propagation
…- Add RunJSON / RunStreamedJSON section with sample\n- Link new structured_output example in examples list
…n\nDemonstrates RunJSON and RunStreamedJSON with a simple project update type.
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Codex Review Summary

Recommendation: ✅ Ready to merge – no blocking issues detected.

Summary:
No blocking issues found. Removing the <-raw.stream.done escape path ensures the fan‑out goroutine always reaches the post-loop turnCompleted check, so callers now observe ErrNoStructuredOutput instead of a spurious nil. The update still drops raw events when the consumer is absent thanks to the default branch, so there’s no risk of regressing into the earlier deadlock scenario.

Inline findings:

  • No inline findings.

Generated at 2025-11-06T19:05:52.662Z.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
activadee and others added 2 commits November 6, 2025 18:35
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@activadee activadee force-pushed the codex/provide-typed-helpers-to-run-a-turn-with-36 branch 3 times, most recently from 650a109 to 71b044e Compare November 6, 2025 18:07
@activadee activadee force-pushed the codex/provide-typed-helpers-to-run-a-turn-with-36 branch from 71b044e to ca324da Compare November 6, 2025 18:14
@activadee activadee merged commit 873557d into main Nov 6, 2025
2 checks passed
@activadee activadee deleted the codex/provide-typed-helpers-to-run-a-turn-with-36 branch November 6, 2025 19:12
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