Skip to content

fix(stirrup): restore tool messages for model calls#1277

Open
syadav481 wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
syadav481:sy/fix-stirrup-tool-history-model-calls
Open

fix(stirrup): restore tool messages for model calls#1277
syadav481 wants to merge 1 commit intoNVIDIA-NeMo:mainfrom
syadav481:sy/fix-stirrup-tool-history-model-calls

Conversation

@syadav481
Copy link
Copy Markdown
Contributor

Summary

  • Restore NeMoUserMessage tool results back to ToolMessage before normal OpenAI-compatible chat-completions model calls.
  • Preserve the existing agent-facing tool_response_as_user behavior while ensuring provider-facing payloads satisfy tool-call ordering rules.
  • Preserve NeMoUserMessage tool results as function_call_output in exported run history and keep call IDs stable.

Why

#1181 fixed the summarization path, but normal Stirrup generation can still replay an assistant tool_calls message followed by a user-role NeMoUserMessage tool result into an OpenAI-compatible model server. Providers reject that payload because assistant tool calls must be followed by matching tool-role responses.

Testing

  • ./.venv/bin/python -m pytest responses_api_agents/stirrup_agent/tests/test_app.py responses_api_agents/stirrup_agent/tests/test_nemo_client.py -q
  • ./.venv/bin/ruff check responses_api_agents/stirrup_agent/nemo_agent.py responses_api_agents/stirrup_agent/nemo_client.py responses_api_agents/stirrup_agent/stirrup_utils.py responses_api_agents/stirrup_agent/tests/test_app.py responses_api_agents/stirrup_agent/tests/test_nemo_client.py

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 9, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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