Skip to content

fix(runtime): honor provider stop reasons - #136

Merged
yanpgwang merged 1 commit into
mainfrom
codex/fix-provider-stop-reasons
Aug 11, 2026
Merged

fix(runtime): honor provider stop reasons#136
yanpgwang merged 1 commit into
mainfrom
codex/fix-provider-stop-reasons

Conversation

@yanpgwang

Copy link
Copy Markdown
Owner

Summary

  • classify every successful Messages API response before advancing or completing the agent loop
  • continue pause_turn with the exact provider content, replacing the prior continuation payload when pauses repeat
  • recover max_tokens with a bounded internal continuation prompt while keeping CMA public events unchanged
  • reject missing, unsupported, and contradictory stop reasons instead of reporting a false end_turn
  • terminate honestly when the per-turn loop safety bound is exhausted
  • protect existing Temporal histories with a version gate

end_turn, stop_sequence, refusal, and model_context_window_exceeded remain valid completed provider responses. tool_use must contain a client tool call; pause_turn and max_tokens must not.

The continuation behavior follows the Anthropic stop reason guidance, while the public terminal state remains within the Managed Agents session event contract.

Verification

  • make verify
  • make test-service
  • focused regressions for repeated pause_turn, raw server-tool content, max_tokens recovery and bounds, and contradictory provider responses

@yanpgwang
yanpgwang merged commit 3e0b253 into main Aug 11, 2026
6 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.

1 participant