Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Problem
fix_hint strings are templated per failure type (workers/src/assertions/failure-hints.ts), so they can't reflect what the captured evidence actually shows. We already have exactly one evidence-aware hint — appendStaleStateHint() scans the network log for a 401/403 on an auth-ish endpoint and appends context — but it's hardwired string concatenation. A second detector would be another ad-hoc append* call; a fifth would be unmaintainable.
Proposal
Promote that pattern into a small deterministic failure-analyzer pipeline, mirroring how assertion validators are registered:
EvidenceBundle— one typed input assembled on failure: the failing assertion + failure type, all step results so far, console log, network log,state_restored, DOM snapshot path, failure-time facts (once available — see tracking issue). Everything already exists; this just formalizes it.- Analyzers — pure functions
(failure, evidence) => Finding | null, registered in an ordered list, run only on the failure path. Finding— typed output:{ code: string, // stable, governed vocabulary — like the failure taxonomy summary: string, // one sentence naming concrete evidence evidence: {...}, // the specific log lines / elements that triggered it suggestion?: string }
- Contract — new additive
findings: Finding[]array on each failure object in the JSON output. The single highest-priority finding is also rendered into thefix_hintprose so humans see it without parsing JSON. No existing fields change (the JSON contract is stable and agent-facing — see CLAUDE.md). - First analyzer = refactor, not new behavior: move
appendStaleStateHint()into the pipeline as thestale_sessionanalyzer. Output prose for that case should stay effectively identical — this PR proves the pipeline shape with zero behavior change.
Design rules
- Deterministic only. No LLM calls anywhere in this pipeline — selectors, timestamps, status codes. ("Deterministic first", see CONTRIBUTING.md.)
- Precision over recall. An analyzer that isn't sure stays silent; a wrong confident hint is worse than no hint. Findings use hypothesis language ("may be intercepting"), never "the cause is".
- Capped. At most 2–3 findings per failure, priority-ordered.
- Testable. Analyzers are pure over recorded data — each gets fixture-based standalone
ts-nodetests like the rest ofworkers/test/. codevalues are governed like the failure taxonomy inworkers/src/assertions/types.ts: new codes need a GitHub Discussion first.
Acceptance criteria
-
EvidenceBundle+Findingtypes; analyzer registry inworkers/src/assertions/(or a sibling module) -
appendStaleStateHintrefactored into the pipeline; its existing behavior preserved - Failure JSON gains additive
findings[]; top finding reflected infix_hint - Fixture-based tests for the pipeline and the stale-session analyzer
- Analyzer errors never crash a run (log with context, skip the analyzer)
Follow-up analyzers (separate issues): blocking-overlay detection, prior-console-error correlation.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
feat(workers): deterministic failure-analyzer pipeline with additive …
feat(workers): deterministic failure-analyzer pipeline with additive …