Skip to content

Conversation

@snimu
Copy link
Contributor

@snimu snimu commented Jan 4, 2026

Description

Instead of adding the sub-LLM TrajectorySteps and the metric during cleanup, this PR changes that to happen incrementally as the sub-LLM responses come in; and the metrics are also updated incrementally as the main model's steps come in.

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

Additional Notes


Note

Implements immediate insertion of sub-LLM turns and incremental metric tracking throughout RLM execution.

  • Adds update_rlm_metrics_from_step, _extract_tokens_from_response, and _ensure_rlm_metric_state to track sub-LLM/main turns, tokens, tool calls, batches, and REPL timing incrementally; overrides add_trajectory_step to update metrics on each step
  • _handle_sub_llm_request now constructs per-turn TrajectorySteps with extras and either immediately calls add_trajectory_step (when enabled) or updates metrics only; active_rollouts stores state for this
  • Tracks REPL execution timings via _update_rlm_repl_metrics; initializes metric fields in setup_state
  • Context warning in call_python_repl now uses the last main-model step (ignores sub-LLM steps)
  • Simplifies cleanup_rlm_state to just remove rollout and release tunnels (metrics/steps no longer computed here)
  • Tests updated/added for immediate sub-LLM trajectory insertion, disabled behavior, token/tool-turn accumulation, and main-step-only context warning

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

@snimu snimu merged commit 90fe550 into main Jan 4, 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.

2 participants