Skip to content

feat: implement StuckLoopHook for repeated dispatch termination - #30

Merged
ForeverAngry merged 1 commit into
mainfrom
feat/stuck-loop-termination
Jun 1, 2026
Merged

feat: implement StuckLoopHook for repeated dispatch termination#30
ForeverAngry merged 1 commit into
mainfrom
feat/stuck-loop-termination

Conversation

@ForeverAngry

Copy link
Copy Markdown
Owner

What

Adds StuckLoopHook to rig_compose::reliability to detect and terminate infinite tool-dispatch loops when the model requests the exact same tool invocation repeatedly.

Why

This satisfies the final piece of the Govern tool/result reliability roadmap item: terminating repeated-loops around dispatch to prevent runway costs in cases where models are repeatedly failing to adapt to a tool outcome and re-issuing identical requests.

Adds `StuckLoopHook` to `rig-compose::reliability` to detect and terminate infinite tool-dispatch loops when the model requests the exact same tool invocation repeatedly.
Copilot AI review requested due to automatic review settings June 1, 2026 20:22

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

Adds a StuckLoopHook to rig_compose::reliability that implements ToolDispatchHook and terminates dispatch when the same tool invocation (identified via ToolCallFingerprint) is requested more than max_identical_calls times. Re-exports the new type from the crate root, updates the changelog, and adjusts the roadmap to reflect that stuck-loop, retry, and result-size policies are now covered.

Changes:

  • New StuckLoopHook with before_invocation returning Terminate { reason } once the per-fingerprint count exceeds the threshold, plus two async unit tests covering threshold and multi-tool tracking.
  • Public re-export of StuckLoopHook from src/lib.rs.
  • Documentation updates in CHANGELOG.md and ROADMAP.md.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/reliability.rs Adds StuckLoopHook struct, ToolDispatchHook impl, module-level doc bullet, and tests.
src/lib.rs Re-exports StuckLoopHook from the reliability module.
ROADMAP.md Drops retry/result-size/stuck-loop from the list of unbuilt policies.
CHANGELOG.md Adds an "Added" entry under Unreleased noting the new hook.

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

Comment thread src/reliability.rs
@ForeverAngry
ForeverAngry merged commit e0d17fb into main Jun 1, 2026
15 checks passed
@ForeverAngry
ForeverAngry deleted the feat/stuck-loop-termination branch June 1, 2026 20:26
@github-actions github-actions Bot mentioned this pull request Jun 1, 2026
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