coordinator
coordinator
¶
Self-healing coordinator.
Orchestrates the healing process: 1. Collect error context 2. Run diagnosis pipeline 3. Apply automatic remedies 4. Prompt for suggested remedies 5. Generate healing report
Classes¶
HealingReport
dataclass
¶
HealingReport(error_context, diagnoses=list(), actions_taken=list(), actions_skipped=list(), diagnostic_outputs=list())
Report of a self-healing attempt.
Captures what was diagnosed, what actions were taken, and what issues remain for manual intervention.
Attributes¶
diagnoses
class-attribute
instance-attribute
¶
All diagnoses found by the engine.
actions_taken
class-attribute
instance-attribute
¶
(remedy_name, result) for each action attempted.
actions_skipped
class-attribute
instance-attribute
¶
(remedy_name, reason) for each skipped action.
diagnostic_outputs
class-attribute
instance-attribute
¶
(remedy_name, diagnostic_text) for guidance-only remedies.
any_remedies_applied
property
¶
Check if any remedies were successfully applied.
should_retry
property
¶
Whether a retry should be attempted after healing.
Returns True if any automatic remedies succeeded.
Functions¶
format
¶
Generate human-readable report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbose
|
bool
|
Include full diagnostic output. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted healing report string. |
Source code in src/marianne/healing/coordinator.py
SelfHealingCoordinator
¶
SelfHealingCoordinator(registry, auto_confirm=False, dry_run=False, disabled_remedies=None, max_healing_attempts=2)
Orchestrates the self-healing process.
Takes an error context and coordinates: 1. Finding applicable remedies 2. Applying automatic remedies 3. Prompting for suggested remedies 4. Collecting diagnostic output
Example
registry = create_default_registry() coordinator = SelfHealingCoordinator(registry)
context = ErrorContext.from_execution_result(...) report = await coordinator.heal(context)
if report.should_retry: # Retry the sheet
Initialize the coordinator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
RemedyRegistry
|
Registry of available remedies. |
required |
auto_confirm
|
bool
|
Auto-approve suggested remedies (--yes flag). |
False
|
dry_run
|
bool
|
Show what would be done without changes. |
False
|
disabled_remedies
|
set[str] | None
|
Set of remedy names to skip. |
None
|
max_healing_attempts
|
int
|
Maximum healing cycles before giving up. |
2
|
Source code in src/marianne/healing/coordinator.py
Functions¶
heal
async
¶
Run the self-healing process.
- Find applicable remedies
- Apply automatic remedies
- Prompt for suggested remedies (unless auto_confirm)
- Display diagnostic output for manual-fix issues
- Return report of what was done
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
ErrorContext
|
Error context with diagnostic information. |
required |
Returns:
| Type | Description |
|---|---|
HealingReport
|
HealingReport with actions taken and results. |
Source code in src/marianne/healing/coordinator.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
reset
¶
Reset healing attempt counter.
Call this before starting a new healing cycle for a different error.