Verification & Self-Healing¶
Deterministic gate execution, tamper prevention, and feedback loop.
dark_factory.verification.runner.VerificationOutcome
dataclass
¶
Outcome of running a suite of verification gates.
Source code in dark_factory/verification/runner.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
dark_factory.verification.runner.VerificationRunner
¶
Executes structured verification steps sequentially inside a sandbox.
Source code in dark_factory/verification/runner.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
Methods:¶
detect_default_gate_paths()
¶
Infer default protected gate files and directories from configured steps.
A step that invokes a linter/formatter/type-checker (ruff, mypy, ...) names its lint
targets in argv, not test/gate files — those are exactly the files the agent is expected to
edit, so such a step contributes nothing to the detected set (the fixed _DEFAULT_PROTECTED_PATHS
baseline still applies). Without this, a gate like ruff check <file> would get <file> silently
reverted to baseline before every verification pass, making the task unsolvable whenever the lint
target is the very file the agent must fix.
Source code in dark_factory/verification/runner.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
run(sandbox, deadline=None)
¶
Run all verification steps. Stops on the first failing mandatory step.
deadline is a time.monotonic() instant; each gate's timeout is clamped to the time remaining.
Source code in dark_factory/verification/runner.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
dark_factory.verification.healing.SelfHealingLoop
¶
Orchestrates the agent-verification feedback loop up to max_retries.
Source code in dark_factory/verification/healing.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 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 | |
Methods:¶
run_loop(sandbox, harness, initial_prompt, verification_runner, target_files=None, status_callback=None, deadline=None)
¶
Run initial generation and up to max_retries self-healing attempts.
deadline is a time.monotonic() instant checked at every phase boundary; when it has passed a
RunTimeoutError carrying the partial results is raised.
Returns:
| Type | Description |
|---|---|
tuple[bool, int, list[StepExecution], ModelTelemetry | None, int]
|
(passed, total_healing_attempts, all_executions, aggregated_telemetry, repeated_failure_streak) |
repeated_failure_streak counts consecutive verification failures with an identical outcome
(same gate, exit code, stdout, stderr) ending at the return point — a model that keeps re-deriving
the same wrong fix produces byte-identical verification failures attempt after attempt, which is a
distinct failure mode from trying different (still wrong) approaches each time. It's 0 on success.
Source code in dark_factory/verification/healing.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 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 | |