feat(autonomy): implement semantic escalation with confidence scoring and threshold comparison #558

Merged
freemo merged 1 commits from feature/m6-semantic-escalation into master 2026-03-04 17:31:35 +00:00
Owner

Summary

Implements the semantic escalation system with confidence scoring as specified in docs/specification.md § Automation & Safety > Semantic Escalation.

Changes

  • AutonomyController class with should_proceed_automatically(operation, context) -> EscalationDecision
  • Confidence scoring from 4 weighted factors: past_success_rate (0.30), codebase_familiarity (0.20), risk_assessment (0.30 inverted), invariant_complexity (0.20 inverted)
  • EscalationDecision model: proceed: bool, confidence: float, factors: dict, explanation: str
  • Historical success tracking: thread-safe per-operation-type success rates for future past_success_rate computation
  • Integration with 8 built-in automation profiles via auto_threshold comparison
  • DI container integration as singleton service

Testing

  • Behave BDD scenarios for confidence computation, threshold comparison per profile, history tracking, escalation explanations
  • Robot Framework integration tests for end-to-end escalation
  • ASV benchmarks for confidence computation throughput

Quality Gates

  • nox -s lint — passes
  • nox -s typecheck — 0 errors (Pyright strict)
  • nox -s unit_tests — 8182 scenarios pass, 0 failures
  • nox -s integration_tests — 10/10 Robot tests pass
  • nox -s coverage_report — >= 97%

Closes #546

## Summary Implements the semantic escalation system with confidence scoring as specified in docs/specification.md § Automation & Safety > Semantic Escalation. ### Changes - **`AutonomyController`** class with `should_proceed_automatically(operation, context) -> EscalationDecision` - **Confidence scoring** from 4 weighted factors: `past_success_rate` (0.30), `codebase_familiarity` (0.20), `risk_assessment` (0.30 inverted), `invariant_complexity` (0.20 inverted) - **`EscalationDecision`** model: `proceed: bool`, `confidence: float`, `factors: dict`, `explanation: str` - **Historical success tracking**: thread-safe per-operation-type success rates for future `past_success_rate` computation - **Integration** with 8 built-in automation profiles via `auto_threshold` comparison - **DI container integration** as singleton service ### Testing - Behave BDD scenarios for confidence computation, threshold comparison per profile, history tracking, escalation explanations - Robot Framework integration tests for end-to-end escalation - ASV benchmarks for confidence computation throughput ### Quality Gates - `nox -s lint` — passes - `nox -s typecheck` — 0 errors (Pyright strict) - `nox -s unit_tests` — 8182 scenarios pass, 0 failures - `nox -s integration_tests` — 10/10 Robot tests pass - `nox -s coverage_report` — >= 97% Closes #546
freemo added this to the v3.5.0 milestone 2026-03-04 04:57:12 +00:00
freemo added the
Type
Feature
label 2026-03-04 04:57:13 +00:00
freemo scheduled this pull request to auto merge when all checks succeed 2026-03-04 15:37:39 +00:00
freemo force-pushed feature/m6-semantic-escalation from 647e69427e to db5e5c974f 2026-03-04 17:19:07 +00:00 Compare
freemo merged commit db5e5c974f into master 2026-03-04 17:31:35 +00:00
freemo deleted branch feature/m6-semantic-escalation 2026-03-04 17:31:36 +00:00
Sign in to join this conversation.
No Reviewers
No Label
Type
Feature
1 Participants
Notifications
Due Date
No due date set.
Reference: cleveragents/cleveragents-core#558