Fleet changelogs · dev.ecs0.net
rdmpw3275m-changelog-20260922-2242-tyrell-turn-interruption-process-tree-feat-20260905-17

rdmpw3275m-changelog-20260922-2242-tyrell-turn-interruption-process-tree-feat-20260905-17

Implemented process tree turn cancellation, pre-teardown worktree checkpointing, live git/codesign process refusal guard, and turn state disk persistence in Tyrell (FEAT-20260905-17).

Summary

Changes

  1. TurnInterruption.swift:
    • Defined TurnState enum (pending, in_progress, interrupted, completed, failed).
    • Defined TurnRecord struct capturing session identity, conversation ID, turn index, state, root PID, worktree path, checkpoint OID, interruption reason, and signalled PIDs.
    • Defined TurnCancellationResult enum (success, refusedProtectedChild, processNotFound, invalidPID, checkpointFailed).
    • Implemented TurnStateStore actor providing thread-safe durable JSON persistence to ~/.tyrell/turns/<id>.json.
  2. ProcessSafetyActor.swift:
    • Implemented isProtectedProcess(name:) identifying in-flight git and codesign processes (same guard as the orchestrator SIGSTOP rule).
    • Implemented findDescendantTree(rootPid:in:) returning all attributed child processes in depth-first post-order (leaves first).
    • Implemented cancelTurnTree capturing an out-of-band pre-teardown checkpoint via ECSWorktreeManager.captureCheckpoint before signaling, refusing if any protected process is alive, signaling descendants bottom-up followed by root with SIGINT, and persisting .interrupted state.
    • Updated cancelTurn(pid:) to delegate to cancelTurnTree(rootPid:) while maintaining full backward compatibility.
  3. AgentsPanel.swift:
    • Updated cancelTurn(_:) in AgentsRosterStore to delegate to ProcessSafetyActor.shared.cancelTurnTree.
  4. ApprovalRoutes.swift & ApprovalModels.swift:
    • Registered POST /api/turn/cancel endpoint supporting HTTP turn cancellation.
    • Updated /api/approvals/{id}/decision to trigger cancelTurnTree when decision action is .cancelTurn and PID is present.
  5. TyrellBootstrap.swift:
    • Added turnsDirectory URL pointing to ~/.tyrell/turns.
  6. TurnInterruptionTests.swift:
    • 6 comprehensive tests asserting:
      • Synthetic multi-level child tree signaling with post-order traversal and unrelated process isolation.
      • Protected git child process refusal with zero signals sent.
      • Protected codesign child process refusal with zero signals sent.
      • Pre-teardown dirty worktree checkpoint capture preserving uncommitted edits without index corruption.
      • Durable turn state persistence to disk across store reloads.
      • Live subprocess SIGINT termination.

Verification Evidence