@@ -352,4 +352,59 @@ const agent = await swarm.spawnAgent('agent-1')
352352
353353---
354354
355- ** Status:** Awaiting Senior Architect review. 🌙
355+ ** Status:** Endorsed ✅
356+
357+ > _ "Bu RFC, Atrion'u Akıllı bir Orkestratör yapıyor."_ — Senior Architect
358+
359+ ---
360+
361+ ## Appendix B: AbortController Pattern (Architect Recommendation)
362+
363+ ### Problem: Silent Failures
364+
365+ If ` lease.release() ` is never called (e.g., process crash, infinite loop), the task continues consuming resources even after lease expires. This is a ** resource leak** .
366+
367+ ### Solution: Mandatory AbortController
368+
369+ ``` typescript
370+ // Task MUST provide an AbortController
371+ const controller = new AbortController ()
372+
373+ const lease = await atrion .startTask (' ml/training' , {
374+ profile: ' EXTREME' ,
375+ abortController: controller , // REQUIRED for HEAVY/EXTREME
376+ })
377+
378+ // If lease expires without release, Atrion calls:
379+ // controller.abort()
380+
381+ // Task code must respect abort signal
382+ async function runTraining(signal : AbortSignal ) {
383+ while (! signal .aborted ) {
384+ await trainNextBatch ()
385+ }
386+ console .log (' Training aborted by Atrion' )
387+ }
388+
389+ runTraining (controller .signal )
390+ ```
391+
392+ ### Enforcement
393+
394+ | Profile | AbortController Required? |
395+ | -------- | ------------------------- |
396+ | LIGHT | No |
397+ | STANDARD | No |
398+ | HEAVY | ** Yes** |
399+ | EXTREME | ** Yes** |
400+
401+ ### Behavior on Expiry
402+
403+ ```
404+ Lease expires →
405+ 1. Atrion calls controller.abort()
406+ 2. Scar accumulated = (overrun time / expected time) × scarFactor
407+ 3. Route marked unhealthy until recovery
408+ ```
409+
410+ This ensures Atrion has ** active termination power** , not just passive observation.
0 commit comments