Skip to content

feat(observers): break preset trajectory cycle detection and loop governance (#93) - #95

Merged
rosspeili merged 1 commit into
ARPAHLS:mainfrom
rosspeili:feat/issue-93-break-loop-governance
Oct 16, 2026
Merged

rosspeili merged 1 commit into
ARPAHLS:mainfrom
rosspeili:feat/issue-93-break-loop-governance

Conversation

@rosspeili

Copy link
Copy Markdown
Contributor

Fixes #93

Description

Enhances the standard BreakObserver (preset: break) with sliding-window trajectory cycle detection, cognitive deadlock sensors, FinOps token burn guards, and cryptographic non-repudiation proofs while preserving 100% backward compatibility for legacy max_identical_intents.

What changed & why:

  • Sliding-Window Trajectory Locality ($K=8$): Replaces blunt global counts with a local rolling window, preventing false-positive trip alerts on long-running healthy agent workflows.
  • Cycle Topologies Detected:
    • Action Fixation (1-cycle): Consecutive repetition of identical tool and normalized argument signatures ($A \to A \to A$).
    • State Oscillation (2-cycle): Alternating conflicting state toggles across turns ($A \leftrightarrow B \leftrightarrow A \leftrightarrow B$).
    • Execution Choreography (3-cycle): Multi-step repetitive loop patterns ($A \to B \to C \to A \to B \to C$).
  • Cognitive Deadlock Sensors:
    • Error Status Churn: Tracks consecutive identical SHA-256 error fingerprints across tool responses.
    • Reasoning Inertia: Detects cognitive rutting when consecutive turn thoughts exhibit $\ge 85%$ text similarity ratio via difflib.SequenceMatcher.
  • FinOps Loop Burn-Velocity Guard: Accumulates wasted tokens across repeating loops and alerts on burn-rate spikes when max_cycle_token_waste is exceeded.
  • EU AI Act Art. 14 Cryptographic Proofs: Records non-repudiable SHA-256 spine hashes (cycle_entry_hash, cycle_recurrence_hash) in observer.alert payloads for verifiable algorithmic deadlock auditing.
  • Actionable Remedial Directives: Every alert emits structured remedial_directive steering strings with prompt-level recovery guidance (prefixed BREAK:).
  • Remedial Actions & Escalation Wiring: Supports action: "alert_only" (default), action: "pause" (appends break_pause rule and trips session state), and full integration with profile.escalations[] (on: observer.alert).
  • Audit Report & Scorecard: Enriches audit reports with scorecard.observers = {alerts, loop_cycles} and finding COGNITIVE_CYCLE_DETECTED (severity: warn).

Type

  • Bug fix
  • Core framework — session, spine, constraints, identity, audit report
  • CLI
  • Integration — sequencer, hosts, membrane, observers, exporters
  • Documentation
  • Examples
  • Packaging / CI

Checklist

  • Linked issue (Fixes #93)
  • pytest passes (300/300 passed)
  • black aura tests — no diff (121 files clean)
  • flake8 aura tests — clean (0 errors, 0 warnings)
  • CHANGELOG.md updated when user-visible behavior changes

Test plan

  1. Unit & Edge Case Suite (pytest tests/test_observer_break_loop.py):
    • 15/15 unit tests passed covering legacy backward compatibility, 1/2/3-cycle topologies, error churn, reasoning inertia, sliding window locality, FinOps token burn guard, cryptographic spine hashes, escalation trigger firing, audit report scorecard & findings synthesis, Tier 2 watchdog callback mode, configured pause/circuit-break enforcement actions, and observer summary metrics.
  2. Dedicated High-Throughput Stress Suite (python scripts/aura_break_loop_stress_sim.py):
    • 5/5 stress scenarios passed: 5,000 events processed at 1,936 eps with 0 memory leaks, noisy oscillation detection, choreography burn-velocity spike, error churn stress, and cryptographic hash chain verification.
  3. Full Repository Regression Suite (pytest):
    • All 300 tests across the entire repository passed in 63.72s with zero failures.
  4. Linting & Code Formatting:
    • black --check aura tests scripts: 121 files verified clean.
    • flake8 aura tests scripts: 0 errors, 0 warnings.

@rosspeili
rosspeili merged commit 09c5957 into ARPAHLS:main Oct 16, 2026
6 checks passed
@rosspeili
rosspeili deleted the feat/issue-93-break-loop-governance branch October 16, 2026 07:14
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.

[Integration]: Break observer trajectory cycle detection & loop governance

1 participant