Skip to content

Fix stream fallbacks for conversation responses#105

Draft
nmaguiar wants to merge 1 commit intomainfrom
codex/fix-mini-a-options-for-usestream=true
Draft

Fix stream fallbacks for conversation responses#105
nmaguiar wants to merge 1 commit intomainfrom
codex/fix-mini-a-options-for-usestream=true

Conversation

@nmaguiar
Copy link
Contributor

@nmaguiar nmaguiar commented Feb 15, 2026

Motivation

  • Prevent runtime failures when usestream=true but the LLM provider implements promptStreamWithStats without promptStreamJSONWithStats, which broke JSON-structured conversation flows.
  • Ensure showthinking=true uses safe non-stream code paths so thinking logs and legacy prompt methods remain compatible with providers lacking stream-JSON support.

Description

  • Add a canStreamJson guard and use it to call promptStreamJSONWithStats only when that method exists, falling back to non-stream methods otherwise in the agent loop (mini-a.js).
  • Harden the showthinking path to prefer existing non-stream JSON/raw methods and to avoid entering streaming code paths that are incompatible with thinking logs.
  • Apply the same canStreamJson checks and fallbacks to the chatbot flow so chatbot-mode streaming behavior matches the agent flow.
  • All changes are confined to mini-a.js and preserve streaming behavior when full stream APIs are available.

Testing

  • Ran node -c mini-a.js to validate syntax and loading, which succeeded.
  • Attempted ojob tests/miniAUtils.yaml to exercise the test suite, but it could not be executed in this environment because the ojob command is not available (test run failed with command not found).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant