Skip to content

feat(agent): Phase 36 - Agent Self-Healing, Plan Drift Detection & Auto-Rollback - #74

Merged
De-pitcher merged 2 commits into
mainfrom
feat/phase36-agent-self-healing-rollback
Sep 7, 2026
Merged

De-pitcher merged 2 commits into
mainfrom
feat/phase36-agent-self-healing-rollback

Conversation

@De-pitcher

Copy link
Copy Markdown
Owner

Summary

Implements Phase 36: Agent Self-Healing, Plan Drift Detection & Auto-Rollback for agentcli.

Core Capabilities

  • Plan Drift & Cycle Detector (\PlanDriftDetector\ in \�gentcli/agent/drift_detector.py):
    • Continuous action recording and execution signature tracking.
    • Multi-heuristic loop detection: consecutive repeated errors on identical actions, ping-pong / oscillating step sequences (\A <-> B), and repeated identical tool invocations.
    • Quantified drift score calculation (0.0 to 1.0) and classification into \LOW, \MODERATE, and \CRITICAL\ drift severities.
  • Auto-Healing & Rollback Manager (\AutoHealingManager\ in \�gentcli/agent/rollback.py):
    • Pre-step multi-file state snapshotting before mutative operations.
    • Automatic rollback upon step failure, consecutive errors, loop detection, or critical drift.
    • Contextual recovery strategy synthesis to guide the planner away from failing patterns and propose alternative tool paths.
  • Loop Lifecycle Events (\�gentcli/agent/events.py):
    • \DriftDetectedEvent: Emitted when drift severity elevates or cycles are detected.
    • \AutoHealingRollbackEvent: Emitted when filesystem rollbacks occur.
    • \StrategyRecoveryEvent: Emitted when dynamic recovery prompt instructions are synthesized.
  • AgentLoop & Session Integration (\�gentcli/agent/loop.py, \�gentcli/session.py):
    • Wired drift detection and auto-healing into the Plan → Act → Reflect execution pipeline.
    • Integrated synthesized recovery prompts into re-planning loops.
  • CLI & TUI Commands (\�gentcli/cli.py, \�gentcli/ui/prompt.py, \�gentcli/ui/tui_app.py):
    • /healing\ command support (\status,
      ollback [id],
      eset, \enable, \disable) with argument completion.
    • Rich and plain-text visual rendering in console renderer.
  • Test Suite:
    • Comprehensive unit and integration test suite in \ ests/test_phase36_self_healing.py\ (17 tests passing).

Verification

  • \python -m ruff check agentcli tests: Passed (0 errors)
  • \python -m mypy .: Passed (0 errors across 130 source files)
  • \python -m pytest tests/test_phase36_self_healing.py tests/test_session.py tests/test_agent_loop.py tests/test_cli.py: Passed (119/119 tests passing)

@De-pitcher
De-pitcher merged commit 64e9eca into main Sep 7, 2026
10 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.

1 participant