Skip to content
Source on GitHub (opens in a new tab)

The rule anchors in durability.md are stable. This index names each implemented rule’s tests by repository directory and Go function, with a subtest name where needed. The index does not replace those tests’ assertions. core/driver/TestM1FaultMatrix enumerates every actual append in twelve scenarios and runs eight boundary outcomes, followed by repeated crashes during recovery. core/testkit/crashtest validates attempt closure, settlement arithmetic, observation groups, and atomic timer registration without importing the reducer.

Run make check for the full gate across the root, examples, and eval modules. Real process and filesystem tests additionally run under -tags=integration.

Rules Named verification
E1 core/loop/TestEffectID; replay and state restoration in core/loop/FuzzFold
E2, E3, E4 core/loop/TestE2AttemptMustCloseBeforeRestart, core/loop/TestB4AttemptLedger, core/loop/TestE4ClosedAttemptCannotCarryAnotherCharge, core/testkit/crashtest/TestIndependentChecker, core/driver/TestM1FaultMatrix
E5 core/driver/TestRunRecordsFailedModelCalls, core/driver/TestRunRecordsFailedToolCalls
E6 core/driver/TestR4ToolRecoveryTable, examples/external-driver/TestExternalDriverKillAndRecover
E7 core/loop/TestE7LateCompletionDoesNotSettle, core/driver/TestRunWaitsForItsTools
B1, B4, B6 core/loop/TestB4AttemptLedger, core/provider/openaicompat/TestB4IncompleteUsage, core/driver/TestM1FaultMatrix, core/TestX1X3ResultRecovery
B2 core/provider/TestB2Reservation, core/loop/TestB2MissingReservationRefused, core/TestB2HardBudgetRequiresBounds, core/provider/openaicompat/TestB2ReservationMatchesWire, core/TestB2RenderedReservationFitsHardLimit, core/TestB2RenderedReservationRefusalIsReplayable
B3, B5 core/TestB5Budgets, core/loop/TestB5ReservationCannotOverflowLimit, core/driver/TestM1FaultMatrix
B7 core/loop/TestSubagentLinks, core/TestSubagentCannotStartSubagents
C1, C2 core/TestSessionIsExclusive, core/driver/TestRunAdoptsBeforeFolding, core/driver/TestM1FaultMatrix
C3 core/driver/TestRunRecordsIntentBeforeAction, core/driver/TestStartAfterTerminationDoesNotAppend, core/driver/TestM1FaultMatrix, examples/external-driver/TestExternalDriverKillAndRecover
C4, O1 core/driver/TestRunFaultsAtEverySplitAppend, core/testkit/crashtest/TestIndependentAtomicGroups, core/driver/TestM1FaultMatrix
C5 core/driver/TestBeginFaults, core/driver/TestRunFaultsAtEveryAppend, core/driver/TestL4LeaseLossCancelsAmbiguousRead, core/driver/TestM1FaultMatrix
C6 core/driver/TestRecordsAfterCancelAreBounded, core/driver/TestRunWaitsForItsTools, core/driver/TestS1StopPreservesCompletedResponseWithoutFinishingRun, core/driver/TestS1StopPreservesCompletedFailures
C7, O2, O3 core/driver/TestR4ToolRecoveryTable, core/driver/TestM1FaultMatrix, core/loop/FuzzFold
C8 examples/external-driver/TestOwnExecutor, examples/external-driver/TestExternalDriverKillAndRecover; separate-module examples/apicheck/TestUse
L1, L2, L7, L12 core/lease/TestLocalConformance, core/lease/file/TestConformanceOnFakeFS, core/lease/file/TestConformanceOnRealFS, core/lease/file/TestLeaseAcrossProcesses; the wall-clock stepping assumption remains explicit in L7
L3, L4, L5 core/driver/TestAcquireRefusesALateGrant, core/driver/TestAuthorityWatchdog, core/driver/TestLateRenewalDoesNotRevive, core/driver/TestRunStopsWhenAuthorityEnds, core/driver/TestL4LeaseLossCancelsAmbiguousRead, core/TestL4LeaseLossDuringConfiguration, core/driver/TestM1FaultMatrix
L6 core/driver/TestAuthorityRelease, core/driver/TestReleaseCancelsARenewal, core/TestReleaseFailuresAreReported, core/TestCleanupIsBounded
L8, L9, L10 core/store/file/TestConformanceOnFakeFS/FenceSurvivesCrash, core/store/file/TestFailedFencePersistBreaksTheSession, core/store/file/TestWriterLockIsPerAppend, core/store/file/TestHandoffWhileTheOldWriterLives, examples/external-driver/TestExternalDriverKillAndRecover
L11 core/store/file/TestAdoptMakesTheTailDurable, core/driver/TestRunAdoptsBeforeFolding, core/driver/TestRunStopsWhenAdoptionFails
R1, R3 core/loop/TestR3TerminationWinsOverRetry, core/driver/TestR3RecoveryHonorsInterrupt, examples/external-driver/TestStartCommandPrecedesRecovery, core/loop/TestR3InterruptWinsOverFailedCompletion, core/driver/TestT7OverdueRecovery, core/driver/TestM1FaultMatrix
R2 core/driver/TestRunRefuses, core/driver/TestRunRefusesAMissingTool, core/driver/TestRunRefusesAChangedTool, core/driver/TestR2SchemaComparisonPreservesIntegers
R4, R6 core/driver/TestR4ToolRecoveryTable, core/driver/TestM1FaultMatrix (overflow: compaction calls recovered at every boundary, applied once); uncertain calls reconcile as unknown
R5 core/driver/TestR5RecoveryBatches, core/driver/TestM1FaultMatrix
S1, X2 core/TestCancel, core/TestAgentClose, core/TestStartContextOwnsTheExecution, core/driver/TestS1StopWhileInterruptJoins, core/driver/TestS1StopPreservesCompletedResponseWithoutFinishingRun, core/driver/TestS1StopPreservesCompletedFailures
S2 core/TestS2InterruptInFlight, core/driver/TestR3RecoveryHonorsInterrupt, cmd/zelk/TestFirstCtrlCInterrupts
S3 core/TestSubscribeDetach, core/TestSubscribeCancelled
S4 core/driver/TestRunRetriesModelCalls, core/driver/TestRunRetryBackoffIsCapped, core/driver/TestRunStopsWaitingWhenCancelled, core/driver/TestM1FaultMatrix
K1, K2 core/TestK1SendValidatesBeforeAdmission, core/driver/TestRunRefuses, core/driver/TestM1FaultMatrix
K3, K4 core/TestK3CommandDeduplication, core/loop/TestK3DuplicateAcceptanceIsInconsistent, core/driver/TestK5QueueAndDuplicateAcks, core/driver/TestM1FaultMatrix
K7 core/loop/TestPlanModeCeiling, core/loop/TestModeChangeBoundaries, core/loop/TestModeChangeAtIdleAndRejections, core/loop/TestRecordedPolicyIsChecked, core/driver/TestUnauthorizedModeIsNotAccepted, core/driver/TestModeChangeSurvivesReopen, core/TestPlanModeSession, core/driver/TestM1FaultMatrix (plan, mode_switch)
K5, K6 core/driver/TestK5QueueAndDuplicateAcks, core/TestK5AckCancellationDoesNotWithdrawCommand, core/driver/TestK5SendRacesWithClosure, core/TestS2InterruptInFlight
T1, T2, T3 core/loop/TestT2TimerSurvivesMissingSet, core/loop/TestT3RefusedRunDropsTimerEffect, core/testkit/crashtest/TestIndependentAtomicGroups, core/driver/TestM1FaultMatrix
T4, T5, T6, T7 core/TestT4WallTimer, core/loop/TestT5StaleTimer, core/driver/TestT7OverdueRecovery, core/driver/TestM1FaultMatrix
T8, T9 core/TestT8ProviderDeadline, core/TestT8ToolDeadlineAndNextWake, core/driver/TestT8DeadlineUsesIntentTimestamp, core/TestT4WallTimer, core/driver/TestM1FaultMatrix
X1, X3 core/TestX1X3ResultRecovery, core/TestX3UsageAfterCommandAppendFailure, core/TestX3UsageAfterTimerAppendFailure, core/TestResultTextIsTheRunsOwn, core/TestResultTextIgnoresCutOffText
O4 core/driver/TestRunToolCallSeesAndRecordsSessionState, core/internal/builtin/files/TestInstructionDiscovery, core/internal/builtin/files/TestInstructionsAreRecordedOnce, core/loop/TestInstructionsReachTheModel, core/TestProjectInstructions, core/loop/TestBadObservationsAreInconsistent, core/loop/TestTodosFold, core/driver/TestM1FaultMatrix

Compaction (trap 5) is covered by core/loop/TestMicrocompaction, core/loop/TestFullCompaction, core/loop/TestReactiveCompaction, core/loop/TestCompactionFailures, core/loop/TestNativeWindow, core/loop/TestNoCompactionWithoutConfig, core/driver/TestNativeCompaction, core/driver/TestOverflowIsClassified, core/TestContextOverflowCompacts and core/loop/TestCacheStablePrefix.

Q1, P1 and P2 for questions and plan exit are covered by core/TestSuspendForAnswer, core/TestInputCallback, core/TestInputDenied, core/TestEnterPlanMode, core/TestExitPlanMode, core/TestInputExpiry, core/loop/TestSuspendedTimeIsExcluded and core/driver/TestM1FaultMatrix (question: a request answered exactly once across a crash at every boundary). The integration test core/TestSuspensionEndsOnlyTheRunsProcesses checks the recorded states and live PIDs of execution-owned and conversation-owned processes at suspension. P3 for trees is covered by core/TestTreeSuspension: a child’s question comes up through its parent’s report and the parent’s own request suspends the root, and the answer goes back down through TaskOutput, marked as relayed, exactly once. The rule’s depth-1 tree rests on the child’s tool set, which never includes the Task tools (core/TestSubagentCannotStartSubagents).

Plan-mode entry also has reducer coverage in core/loop/TestEnterPlanModeDeniesLaterCall, core/loop/TestEnterPlanModeQueuedState (JSON checkpoint while a tool holds the mode change), and core/loop/TestEnterPlanModeInvalidatesApproval.

The external-driver integration test is the kill-and-recover process proof. The CLI integration test exercises a real shell under first-interrupt semantics; the second-stop join race uses the deterministic driver harness. No paid provider evaluation is part of these checks.

Worktree host lifecycle boundaries are covered separately from the session log: cmd/zelk/internal/host/TestWorktreeFaults interrupts creation after its intent, checkout and include copy; cmd/zelk/internal/host/TestWorktreeRemovalFaults interrupts removal before and after the removing record, after git removes the checkout and after branch deletion. Each attempts a reopen or second exit, asserting reconciliation or an explicit refusal with recovery instructions, never silent recreation or loss of ownership. These tests use real temporary repositories under -tags=integration and make no provider calls. Sweeping unused worktrees is covered by cmd/zelk/internal/host/TestSweepWorktrees and cmd/zelk/internal/host/TestSweepKeepsWhatIsntZelks.

Completion decision coverage includes core/loop/TestDecisionRecords, core/TestCompletionDecisionRecords, core/loop/TestTaskAttributionSnapshot, core/loop/TestTaskAttemptsAcrossDifferentActions, core/loop/TestTimerRecordsAfterStateRoundTrip and core/loop/FuzzDecisionRecords. core/driver/TestM1FaultMatrix includes completion, report and task_attempt groups, exercising explicit completion/continuation records, shortcut flags and task attempts through repeated crash recovery. Context stress includes core/loop/TestLongRunningCompaction, core/loop/TestLongNativeCompaction and integration core/loop/TestLongCompactionFileReopen (200 cycles each), plus native protected-handoff and irreducible-overflow regression tests.

Hook and approval coverage exercises H1 (hooks) and approvals under Q1. core/driver/TestM1FaultMatrix adds three groups: hook (each invocation decided exactly once across a crash at every boundary, run only after its intent is durable, and re-run only as a new attempt with the same invocation ID), approval (each approval answered exactly once) and classify (each action’s verdict recorded exactly once, with attempt settlement checked by crashtest). K7 decisions from the folded log alone are covered by core/loop/TestDecisionsInTheReducer, core/loop/TestApprovalResponses, core/loop/TestSessionGrant, core/loop/TestApprovalBinding and core/loop/TestApprovalDoesNotSurviveAPolicyChange. Replay without re-running hooks is covered by core/TestPreToolUseDeny and core/TestDeferredApprovalResumes, and integration core/TestDeferredApprovalNewProcess proves a deferred approval answered by a second process: the action runs exactly once and the hook isn’t run again. The persisted circuit breaker is covered by core/TestAutoModeBreaker.

The output group of core/driver/TestM1FaultMatrix checks that a rejected and an accepted StructuredOutput call, faulted at every append boundary, leave exactly one recorded verdict each, and the folded output is the accepted value. Validators run only after the call’s intent is durable. The reducer’s own checks are core/loop/TestStructuredOutputLifecycle, core/loop/TestStructuredOutputInvalidated, core/loop/TestStructuredOutputPerRun and core/loop/TestStructuredOutputInconsistent.

The records fault-matrix group submits a rejected call and two accepted records in one model response. Every append boundary and a second crash during recovery must leave exactly records 1 and 2 with their corresponding values, with no duplicate numbering or gap. core/loop/TestOutputRecordWaves checks serialization of calls whose numbers depend on earlier verdicts.