Skip to content

chore(life): bump aiOS for BRO-423 loop detection#455

Merged
broomva merged 1 commit intomainfrom
bro-423-loop-detection
Apr 3, 2026
Merged

chore(life): bump aiOS for BRO-423 loop detection#455
broomva merged 1 commit intomainfrom
bro-423-loop-detection

Conversation

@broomva
Copy link
Copy Markdown
Owner

@broomva broomva commented Apr 3, 2026

Summary

  • update the aiOS submodule pointer to include the BRO-423 loop detection middleware implementation
  • align the Life workspace with broomva/aiOS#5

Validation

  • cargo fmt --all
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace

Depends on: broomva/aiOS#5
Linear: BRO-423

Summary by CodeRabbit

  • Chores
    • Updated internal dependencies to latest versions. No user-facing changes or interface modifications.

@linear
Copy link
Copy Markdown

linear bot commented Apr 3, 2026

BRO-423 Three-Tier Loop Detection Middleware

What

Implement a LoopDetectionMiddleware for the turn middleware chain that detects and halts runaway tool-calling loops. Uses MD5/Blake3 hashing of normalized, sorted tool call signatures with a sliding window.

Three graduated responses:

  1. Warning (threshold=3 repetitions): Inject a message telling the agent to stop repeating
  2. Hard stop (limit=5): Strip all tool_calls from the response, forcing text-only output
  3. Per-session tracking with configurable window size (default: 20 turns)

Why

Runaway tool-calling loops waste tokens and time. Life currently has no loop detection. Autonomic's homeostasis could theoretically detect this but lacks the granularity for per-turn tool call patterns. This is a low-effort, high-safety improvement.

Implementation

Target crate: arcan-core (as a TurnMiddleware impl)

  • Hash tool call signatures (name + normalized args) per turn using Blake3 (already in workspace)
  • Sliding window of last N turn hashes
  • Compare current hash against window; count consecutive matches
  • At warning threshold: inject system message
  • At hard stop: filter tool calls from LLM response
  • Log loop events to Lago for post-mortem analysis
  • Configurable thresholds via LoopDetectionConfig

Acceptance Criteria

  • LoopDetectionMiddleware implements TurnMiddleware
  • Blake3 hashing of normalized tool call signatures
  • Warning at configurable threshold (default: 3)
  • Hard stop at configurable limit (default: 5)
  • Loop events persisted to Lago journal
  • Tests: normal flow passes through, repeated calls trigger warning then stop

Source

DeerFlow — Three-tier loop detection (§17 in research doc)

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: d40270b7-8217-4c91-948b-c35ebd0ad0f7

📥 Commits

Reviewing files that changed from the base of the PR and between 99c54f4 and bfeff88.

📒 Files selected for processing (1)
  • aiOS

📝 Walkthrough

Walkthrough

The aiOS submodule commit pointer was updated to a new version. This represents a version bump of the aiOS dependency without any direct changes to the codebase or public interfaces in this repository.

Changes

Cohort / File(s) Summary
aiOS Submodule Update
aiOS
Updated submodule commit pointer from c8e55cc02cc976fb601ad85f36754b09609e6d44 to 02401908310d7e53d707230faa601d7038ee2f86.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 A hop, a skip, aiOS takes flight,
The submodule spins to a shiny new height,
Just pointers and commits in the git-filled night,
One line changed, the dependency's right! ✨


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@broomva broomva merged commit 8a37a9a into main Apr 3, 2026
1 check passed
broomva added a commit that referenced this pull request Apr 5, 2026
chore(life): bump aiOS for BRO-423 loop detection
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