PaaS Agent Scheduler and Self-Heal Locking
Date: 2026-02-17 Scope: WS12-08 scheduler/self-heal controls Owner: Codex1. Locking Model
Each agent run uses a context-scoped lock:contexts/<context>/agents/locks/<agent>.lock.json
agentownerpidacquired_atheartbeat_at
2. Scheduler Behavior
agent run-once now:
- acquires lock before collector/queue processing
- blocks run when lock is active
- releases lock on completion
3. Self-Heal Behavior
Stale lock policy:- lock TTL is 15 minutes
- if heartbeat/acquired timestamp is stale, lock is auto-recovered
- recovered state is surfaced as
lock_recovered=truein run output/logs
4. Blocked Run Behavior
When lock is active:- run status is
blocked - lock reason is returned to caller
- blocked run record is still appended for auditability
5. Implementation Reference
tools/si/paas_agent_scheduler.gotools/si/paas_agent_scheduler_test.gotools/si/paas_cmd_test.go(TestPaasAgentRunOnceBlockedByActiveLock)

