Skip to content

Send back helpful message instead of raising when action is plain Message - #344

Merged
sidnarayanan merged 4 commits into
mainfrom
better-trm-message
Mar 17, 2026
Merged

Send back helpful message instead of raising when action is plain Message#344
sidnarayanan merged 4 commits into
mainfrom
better-trm-message

Conversation

@sidnarayanan

Copy link
Copy Markdown
Collaborator

#342 was way too harsh - better to send back a non-fatal Message.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adjusts environment stepping behavior so non-tool-call Message inputs no longer trigger server-side 500s, instead returning a consistent, non-fatal “no tool calls” observation.

Changes:

  • Add a shared default “no tool calls received” step response on Environment.
  • Update multiple Environment.step() implementations to return the default response when action is not a ToolRequestMessage.
  • Update server-level tests to expect HTTP 200 and validate the default observation for plain Message / ToolResponseMessage actions.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_envs.py Updates TaskDatasetServer step tests to assert 200 + default “No tool calls” observation; adds direct DummyEnv tests for default behavior.
src/aviary/functional.py FunctionalEnvironment now short-circuits to the default response when action isn’t a ToolRequestMessage.
src/aviary/env.py Introduces DEFAULT_NO_TOOL_CALLS_RESPONSE on Environment and updates DummyEnv.step() to use it for non-tool-request actions.
packages/notebook/src/aviary/envs/notebook/env.py Notebook environment step now returns the default response for non-tool-request actions.
packages/lfrqa/src/aviary/envs/lfrqa/env.py LFRQA environment step now returns the default response for non-tool-request actions.
packages/labbench/src/aviary/envs/labbench/env.py Labbench environment step now returns the default response for non-tool-request actions.
packages/hotpotqa/src/aviary/envs/hotpotqa/env.py HotpotQA environment step now returns the default response for non-tool-request actions.
packages/gsm8k/src/aviary/envs/gsm8k/env.py GSM8K environment step now returns the default response for non-tool-request actions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/aviary/env.py
Comment thread src/aviary/env.py Outdated

@jamesbraza jamesbraza left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work thanks

Comment thread src/aviary/env.py Outdated
DEFAULT_NO_TOOL_CALLS_RESPONSE: ClassVar[tuple[Messages, float, bool, bool]] = (
[
Message(
content="No tool calls received. Please call one or more tools to proceed."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Technically a tool request message with 0 tool calls is valid, but also it makes Environment.step a no-op then so just wastes tokens

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

can chat in person, I don't think this one's a concern

Comment thread tests/test_envs.py Outdated
@sidnarayanan
sidnarayanan merged commit 08a4cba into main Mar 17, 2026
5 checks passed
@sidnarayanan
sidnarayanan deleted the better-trm-message branch March 17, 2026 17:38
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.

3 participants