Skip to content

Comments

Propagate RLM stop errors from root and sub tools#797

Merged
snimu merged 5 commits intomainfrom
sebastian/rlm-stop-errors-2026-01-27
Jan 28, 2026
Merged

Propagate RLM stop errors from root and sub tools#797
snimu merged 5 commits intomainfrom
sebastian/rlm-stop-errors-2026-01-27

Conversation

@snimu
Copy link
Contributor

@snimu snimu commented Jan 28, 2026

Description

Make sure all tools (root_tools and sub_tools and thus also tools) propagate stop_errors to call_bash/python_repl, so that StatefulToolEnv's handling of stop_error still works.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Note

Ensures RLM stop errors raised by tools are surfaced to the REPL so StatefulToolEnv stop conditions trigger correctly.

  • In sub-tool execution and llm_batch batching, re-raise exceptions that satisfy _should_stop_for_error, instead of swallowing them as error messages
  • In interception handlers for root tools and sub-LLM requests, set state_ref["_rlm_stop_error"] when a stop error is detected
  • In REPL execution (_call_repl), pop and re-raise _rlm_stop_error after code execution to propagate the stop upstream

Written by Cursor Bugbot for commit 3c92ad5. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@snimu snimu merged commit 59d330b into main Jan 28, 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