Commit 7d2d07c
committed
fix(analyze): configurable analysis timeout + analysis_failed status
Spec post-038/041 fix uncovered a SECOND hardcoded timeout (2 min in
BehaviorAnalyzer, also since spec 009) plus a UX bug where failed analysis
was reported as status: "analyzed" with a fake recommended count of 15
(the Generation.DefaultCount fallback).
Symptom on slow / reasoning models (DeepSeek-V3): the chat agent
confidently presents "I recommend generating 15 test cases" while
behaviors_found: 0 — looks like a successful run but the analysis
silently timed out at 2 minutes. The agent had no signal to retry or
warn.
AiConfig:
- New ai.analysis_timeout_minutes (default 2, minimum 1)
BehaviorAnalyzer.AnalyzeAsync:
- Reads timeout from ai.analysis_timeout_minutes
- Surfaces the configured budget in the live status message
- Writes timestamped [analyze] lines to the same .spectra-debug.log
used by the generator:
ANALYSIS START documents=N model=M provider=P timeout=Tmin
ANALYSIS OK behaviors=N response_chars=N elapsed=Ts
ANALYSIS TIMEOUT model=M configured_timeout=Tmin elapsed=Ts
ANALYSIS PARSE_FAIL response_chars=N elapsed=Ts
ANALYSIS EMPTY response_chars=0 elapsed=Ts
ANALYSIS ERROR exception=T message="..." elapsed=Ts
- Improved timeout status message names the model and points at the
new config field
- New private DebugLog helper, gated by ai.debug_log_enabled
GenerateHandler --analyze-only path:
- Sets Status = "analysis_failed" (not "analyzed") when analysisResult
is null
- Populates Message with a multi-line explanation: model name, the
fact that Recommended is a fallback default not a real analysis,
the common cause (analysis_timeout_minutes too low), the remediation
(bump to 5–10 min), and a pointer to .spectra-debug.log
- Pre-existing spec 037 oversight fixed: analyze-only result was
missing TechniqueBreakdown (the spec 037 replace_all matched
16-space indentation but the analyze-only block uses 20 spaces).
Now populated.
spectra-generate SKILL:
- Step 4 gains an analysis_failed case that tells the agent NOT to
show a recommendation, show the message verbatim, and stop for user
confirmation before proceeding to generation
Documentation:
- docs/configuration.md documents analysis_timeout_minutes alongside
the existing tuning knobs, includes a [analyze] ANALYSIS START/OK
example in the .spectra-debug.log format spec, and explains the new
analysis_failed status
- PROJECT-KNOWLEDGE.md config example shows analysis_timeout_minutes: 2
- CLAUDE.md Recent Changes entry
All 1551 tests still pass — additive config field + null-result handling,
no test changes required.1 parent 4fd4926 commit 7d2d07c
File tree
7 files changed
+105
-24
lines changed- docs
- src
- Spectra.CLI
- Agent/Copilot
- Commands/Generate
- Skills/Content/Skills
- Spectra.Core/Models/Config
7 files changed
+105
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| |||
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
314 | 323 | | |
315 | 324 | | |
316 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
| 120 | + | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
122 | 125 | | |
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
135 | 140 | | |
136 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
137 | 148 | | |
138 | 149 | | |
139 | 150 | | |
| |||
155 | 166 | | |
156 | 167 | | |
157 | 168 | | |
| 169 | + | |
158 | 170 | | |
159 | 171 | | |
160 | 172 | | |
161 | 173 | | |
162 | 174 | | |
163 | 175 | | |
164 | 176 | | |
165 | | - | |
166 | | - | |
167 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
168 | 182 | | |
169 | 183 | | |
170 | 184 | | |
| |||
0 commit comments