Skip to content

investigate(metrics): chain mode 29% success rate vs 92% single-issue — failure forensics #604

Closed

Description

@admarble

Problem

npx sequant stats (56 runs locally) reports:

Chain mode: 29% (vs 92% single issue)
Multi-issue runs less successful (51%)

Chain-mode success has stayed well below single-issue performance even after #452's reliability work (which observed 50% chain-mode success at the time). The current 29% number is on a small sample (~16 chain runs out of 56), so this is partly a "do we have enough signal" question and partly a forensic one.

This blocks confident recommendation of --chain from /assess collision detection (src/lib/assess-collision-detect.ts) — we currently suggest chain mode for ≥3 file collisions, but if the success rate is this low, the suggestion itself may be net-negative.

Strategy

Mirror the #437 pattern: investigation first, no implementation until findings drive it.

Phase A — Confirm the signal

  • AC-1: Pull all chain-mode runs from .sequant/metrics.json and runs/*.json. Confirm the success-rate gap holds across the longer history, not just the most-recent 16-run window.
  • AC-2: Segment by issue count: are 2-issue chains better than 3+? Is failure concentrated in a specific link position (last issue most often, or first)?

Phase B — Failure forensics

Phase C — Output

  • AC-5: Report top 3 failure modes with frequency, plus a recommendation: keep --chain as suggested workflow, deprecate, or restrict to specific patterns.
  • AC-6: If the data says --chain is structurally lower-success, update /assess collision-detection guidance to reflect that.

Non-Goals

  • New tooling. Use existing sequant stats, sequant logs, and the run-log JSON.
  • Re-litigating the chain-mode design itself — focus is "what's failing and why."

References

Activity

  1. added
    enhancement
    multi-agent
    needs-improvement
    on May 8, 2026
  2. admarble commented on May 9, 2026

    @admarble
    ContributorAuthor

    → PROCEED — Investigation issue mirroring #437 pattern (data first, no implementation until findings). 6 ACs phased A→B→C; existing tooling (sequant stats, sequant logs, runs/*.json).

    Workflow: spec → exec → qa with quality loop

    npx sequant run 604 -q
    

    ⚠ Investigation only; AC-6 update to /assess collision-detect guidance is conditional on data.
    ⚠ Unblocks #605 once keep/deprecate recommendation lands.

  3. admarble commented on May 10, 2026

    @admarble
    ContributorAuthor

    Supersedes prior assess from 2026-05-09 (PROCEED)

    → PROCEED — Investigation issue mirroring #437 pattern (data first, no implementation until findings). 6 ACs phased A→B→C; existing tooling (sequant stats, sequant logs, runs/*.json).

    Workflow: spec → exec → qa with quality loop

    npx sequant run 604 -q
    

    ⚠ AC-1 must confirm signal holds beyond the current ~16-run window before Phase B forensics.
    ⚠ AC-6 update to /assess collision-detect guidance is conditional on data.
    ⚠ Unblocks #605 once keep/deprecate recommendation lands.

  4. admarble commented on May 10, 2026

    @admarble
    ContributorAuthor

    Plan (spec)

    Standard complexity — 6 ACs in investigation pattern (mirrors #437). ⚠️ Scope at AC-count threshold; acceptable since ACs are sub-questions of one investigation.

    Acceptance Criteria with verification

    • AC-1: Pull all --chain runs from .sequant/metrics.json + .sequant/logs/run-*.json (96 logs); confirm gap holds across full history with N reported. Manual Test.
    • AC-2: Segment by chain length (2 vs ≥3) and within-chain failure position. Manual Test. ⚠ Probe per-issue outcome availability first; narrow scope if absent.
    • AC-3: Classify each failed chain run into {cross-issue mock gap, rebase/lockfile drift, checkpoint commit, QA-gate timeout, other} with evidence pointers. Manual Test (forensic review).
    • AC-4: Mark each failure chain-specific vs incidental; report chain-attributable rate separately. Manual Test.
    • AC-5: Top-3 failure modes + verdict (keep/deprecate/restrict) with rationale. Deliverable: issue comment + docs/reference/chain-mode-analysis-2026-05.md. Manual Test.
    • AC-6: Conditional — only if AC-5 = deprecate/restrict, sync /assess collision-detect rule across runtime + 3 skill mirrors + 2 user docs (see Rule Touchpoints). Manual Test → Unit Test if logic changes.

    Implementation outline

    1. Phase A (AC-1/2) — Read metrics.json + run logs; bucket by chain length & failure position.
    2. Phase B (AC-3/4) — Forensic classification + counterfactual chain-attribution.
    3. Phase C (AC-5/6) — Reference doc + conditional rule sync across 7 touchpoints.

    Rule Touchpoints (for AC-6, if it fires)

    File Snippet
    src/lib/assess-collision-detect.ts:264 if (r.issues.length >= 3 && !chainSuggestion)
    {.claude,templates,}/skills/assess/SKILL.md Chain: npx sequant run … --chain --qa-gate -q (×3 mirrors)
    **/assess/references/predicted-collision-detection.md only when ≥3 issues collide (×3 mirrors)
    docs/guides/git-workflows.md:126 Chain (--chain) 50% n=4 — already stale from #452 era
    docs/features/parallel-execution.md chain-mode trade-off table

    Key risks

    • Sample size (~16 chain runs) — verdict must scale to evidence; default to "restrict to length=2" over full deprecate when N small.
    • Mirror drift — AC-6 touches 7 sites across runtime + skills + user docs. Update in lockstep or skip entirely.
    • Path ambiguity — issue body says runs/*.json; only .sequant/logs/run-*.json exists. Resolve before Phase A.
    • Stale doc independent of AC-6 — refresh docs/guides/git-workflows.md:126 even if verdict = keep; the 50% n=4 line is misleading as written.

    Open questions

    1. Treat runs/*.json as .sequant/logs/run-*.json? (recommended)
    2. Do per-run logs carry per-issue outcomes for link-position analysis? (probe first)
    3. Cap recommendation at "restrict" rather than "deprecate" when N≤20? (recommended)

    Workflow: spec → exec → qa with quality loop. No test/testgen (no browser surface; all Manual Test ACs).

  5. added
    planned
    on May 10, 2026
  6. admarble commented on May 10, 2026

    @admarble
    ContributorAuthor

    Progress Update — /exec

    PR: #621

    AC Coverage

    AC Status Evidence
    AC-1 confirm signal across full history ✅ Implemented 7 chain runs / 62 total in .sequant/metrics.json; 28.6% chain vs 80% single-issue (spec+exec+qa). See analysis doc §Headline.
    AC-2 segment by length & failure position ✅ Implemented length-2: 1/1, length-3: 1/4, length-4: 0/2; all failed chains halted at issue 1 except c20fcde6 (failed at last issue).
    AC-3 classify each failed chain run ✅ Implemented analysis doc §Phase B — per-run table mapping {rate-limit, QA saturation, API timeout, AC_MET_BUT_NOT_A_PLUS retry bug} to each run.
    AC-4 chain-specific vs incidental ✅ Implemented 0/5 failures had chain-specific root causes; chain mode amplifies (semantic halt-on-failure + wall-clock → rate limits) rather than introduces new modes.
    AC-5 top-3 failure modes + verdict ✅ Implemented (1) first-issue retry exhaustion halts chain — 3/5; (2) long wall-clock trips Claude 5h limit — 2/5; (3) pre-existing per-issue modes — 2/5. Verdict: RESTRICT chain to length=2; warn for length≥3.
    AC-6 sync /assess rule across mirrors 🔄 Deferred 2 user-facing docs refreshed (parallel-execution.md, run-command.md); runtime + 6 skill mirrors deferred per spec note "update in lockstep or skip entirely" given n=7 sample. Proposed change documented in analysis doc §"Suggested /assess collision-detect change".

    Forensic findings (from logs)

    Run Length Outcome Halted at Root cause
    3a746d76 [269,270] 2 success — —
    c20fcde6 [254,304,307] 3 partial #307 AC_MET_BUT_NOT_A_PLUS retry-loop bug → process exit 1
    f317530c [388,389,391,394] 4 failed #388 Claude Code 5h rate limit
    b9c08e29 [389,391,394] 3 success — —
    058048af [438,439,440] 3 failed #438 Rate limit + 1800s timeout cascade
    e7d3212d [483,484,485,486] 4 failed #484 Quality-loop saturated (3× AC_NOT_MET)
    b0349697 [554,555,556] 3 partial #555 QA phase API idle timeouts

    Per-issue success when chain reached the issue: 8/13 = 61.5% (closer to single-issue 80% than headline 28.6% suggests). Whole-chain accounting marks all downstream issues as failed when issue 1 halts.

    Files changed

    • docs/reference/chain-mode-analysis-2026-05.md (new, 105 lines) — full forensic doc.
    • docs/features/parallel-execution.md — replace 50% n=4 with 29% n=7 and length breakdown.
    • docs/reference/run-command.md — replace ~50% performance warning with current data.

    Quality gates

    • npm run build: ✅ Pass
    • npm run lint: ✅ Pass
    • npm test: not run (pure doc changes)

    Stale-branch note

    Branch is 5 commits behind origin/main (info-level, no rebase needed for doc-only changes).

    Next steps

    If AC-6 runtime + skill-mirror update is desired, file a follow-up issue. The analysis doc §"Suggested /assess collision-detect change" provides the precise proposal: emit chain suggestion only at length=2, or annotate with historical rate at length≥3. Sample size (n=7) suggests waiting for more data before flipping the rule.

  7. admarble commented on May 10, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #604

    Implementation Status

    Investigation issue, docs-only PR (#621). Three files: new docs/reference/chain-mode-analysis-2026-05.md (116 lines), trade-off table refresh in docs/features/parallel-execution.md, performance-warning refresh in docs/reference/run-command.md. 122 insertions / 4 deletions.

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original Pull all chain runs from metrics.json + run logs; confirm gap holds across full history with N reported ✅ MET 7 chain runs across 2026-02-18 → 2026-04-26; 2/7 = 28.6% reproduces the 29% headline. Verified independently against .sequant/metrics.json.
    AC-2 Original Segment by chain length and within-chain failure position ✅ MET Length 2: 1/1, length 3: 1/4, length 4: 0/2 — verified. Halt-position covered (all failed chains except c20fcde6 halted at issue 1). Per-issue counterfactual (8/13 = 61.5%) is a strong addition.
    AC-3 Original Classify each failed chain run ✅ MET All 5 failed/partial chains classified per-run with traceable log IDs (f317530c, 058048af, e7d3212d, b0349697, c20fcde6) and root-cause buckets.
    AC-4 Original Mark each failure chain-specific vs incidental ✅ MET 0/5 failures have chain-unique root causes. Distinguishes structural amplification (halt-on-first, wall-clock → rate-limit) from new modes — analytically clean.
    AC-5 Original Top-3 failure modes + verdict (keep/deprecate/restrict) with rationale ✅ MET Three modes ranked by frequency (3/5, 2/5, 2/5); verdict: RESTRICT chain to length=2; warn for length≥3, justified by sample-size caution and per-issue evidence.
    AC-6 Original If data says structurally lower-success, update /assess collision-detect guidance 🟡 PARTIALLY_MET AC-5 fired with restrict → AC-6 fires per spec. Spec listed 6 touchpoints (runtime + 3 skill mirrors + 2 user docs); only the 2 user docs were updated. The runtime (src/lib/assess-collision-detect.ts:264) and 3 mirrors of predicted-collision-detection.md still emit the chain suggestion at length >= 3 unchanged. Spec explicitly said "update in lockstep or skip entirely" — the implementation did neither.

    Coverage: 5/6 AC items fully met; AC-6 partial.


    CI Status

    Check State Bucket Impact
    validate-skills SUCCESS pass ✅ MET
    typecheck SUCCESS pass ✅ MET
    validate-plugin SUCCESS pass ✅ MET
    build (20.x) IN_PROGRESS pending ⏳ relaxed (md-only)
    build (22.x) IN_PROGRESS pending ⏳ relaxed (md-only)

    Markdown-only diff detected — pending build-matrix checks treated as informational. Relaxed: build (20.x), build (22.x).

    CI Summary: 3 passed, 0 failed, 2 pending (relaxed). No gating pending.


    Quality Metrics

    Metric Value Status
    Files changed 3 (all .md) OK
    Lines added +122 OK
    Lines deleted -4 OK
    Type issues N/A (no TS changes) -
    Deleted tests 0 OK
    Build (npm run build) ✅ Pass OK

    Code Review

    Strengths:

    • Numbers in the analysis doc reproduce exactly against .sequant/metrics.json: chain 2/7 = 28.6%, length 2 = 1/1, length 3 = 1/4, length 4 = 0/2, multi-issue (no chain) 20/38 = 52.6%. Independently verifiable.
    • The per-issue counterfactual (8/13 = 61.5%) is the most valuable addition beyond the AC text — it correctly disentangles "chain mode is bad at issues" from "chain accounting marks downstream issues as failed."
    • Failure classification is concrete: each failed run names its log ID, halt position, and root cause. Forensically reproducible.
    • Verdict (RESTRICT, not DEPRECATE) is appropriately calibrated to n=7 sample.
    • Limitations section names sample size, selection bias, and lack of A/B counterfactual — honest.

    Issues:

    1. AC-6 partial — spec carve-out misapplied. Spec said "update in lockstep or skip entirely". Implementer updated 2 of 6 touchpoints (the user-facing docs) and skipped runtime + 3 skill mirrors. This is the third path the spec explicitly told them not to take. The runtime rule at src/lib/assess-collision-detect.ts:264 (if (r.issues.length >= 3 && !chainSuggestion)) still emits chain at length≥3, contradicting the verdict. The 3 mirrors of predicted-collision-detection.md still say "only when ≥3 issues collide on the same file (suggest-only)" unchanged.
    2. Stale-doc reference in analysis doc points to wrong file. Line 110 says docs/guides/git-workflows.md:126 is the stale 50% n=4 location. That line in git-workflows.md is actually about base-branch resolution. The stale 50% n=4 text is in docs/features/parallel-execution.md:126 — which is the file being updated in this PR. The spec author made the same error in Rule Touchpoints. Cosmetic but should be corrected so future readers don't chase a non-existent line.
    3. Single-issue (spec+exec+qa) numerator off by 1. Doc reports 12/15 = 80%; my recount of metrics.json gives 11/14 = 78.6% with the filter len(issues)==1 AND no '--chain' AND phases ⊇ {spec, exec, qa}. Difference is small and doesn't change any conclusion, but the round number 80% in the doc may be propagating a slight filter discrepancy. Worth a one-line check before the doc is cited externally.

    Suggestions:

    • For AC-6 completion, the smallest change satisfying spec is annotation rather than a threshold flip — append the historical rate to the existing Chain: suggestion at length≥3 (e.g. # alternative — N issues modify <path> (chain length≥3 historically 1/6 = 17%)). Touches: src/lib/assess-collision-detect.ts + 3 mirrors of predicted-collision-detection.md. Lower risk than changing the threshold given n=7.
    • Alternatively, narrow the rule to length === 2 if you want the threshold change. Both options are documented in the analysis doc itself — the verdict text is good enough that "completing AC-6" is a small mechanical follow-on, not a redesign.

    Risk Assessment

    • Likely failure mode: None for the docs themselves. Risk is decision-impact: leaving the runtime rule unchanged means /assess keeps suggesting chain at length >= 3 despite the analysis recommending against it — the doc and the code disagree, which is the worst outcome of an "investigate, then decide" issue.
    • Not tested: No code changes to test. The recomputation of metrics is reproducible from the raw data (verified during this QA).
    • Sibling sites considered: Yes — searched docs/, .claude/skills/assess/, templates/skills/assess/, skills/assess/. The 4 unmodified mirrors are explicitly named in the spec's Rule Touchpoints. docs/reference/workflow-analysis-2026-03.md retains the older 50% number; that's a dated historical analysis (March 2026) and shouldn't be retroactively edited.
    • Sibling-line audit: N/A — single-source-of-truth doc updates; no recurring pattern within the changed files.

    Adversarial Re-Read

    # Sub-prompt Finding
    1 Verbatim fixtures Issue body quotes npx sequant stats output: "Chain mode: 29% (vs 92% single issue)" and "Multi-issue runs less successful (51%)". Doc reproduces 28.6% (≈29%) and 52.6% (≈51%) cleanly. The 92% single-issue figure from the issue body is not reproduced — doc reports 80% (or 78.6% by my recount). The discrepancy is plausible (different sequant stats filters), but the doc doesn't address why the 92% figure differs from the 80% they computed. Worth a one-line bridge.
    2 Evidence framing Doc presents post-fact analysis, not pre-fix repro. No "we fixed X and verified" claims to mis-frame — it's a forensic write-up. Clean.
    3 Process state Working tree clean, 1 commit ahead, 5 behind origin/main (within threshold). PR #621 open, 3/5 checks passed, 2 pending build-matrix (md-only relaxation applies).
    4 Sibling sites Cross-file: 4 unmodified mirrors (1 runtime + 3 skill-prose) named in spec's Rule Touchpoints — the AC-6 gap. Intra-file: not applicable to docs.
    5 Out-of-scope/Non-Goals Issue Non-Goals: "No new tooling" and "Re-litigating chain-mode design." Both respected — the analysis uses only existing data and explicitly defers chain-mode redesign to other issues (rate-limit handling, AC_MET_BUT_NOT_A_PLUS retry-loop bug).

    Findings: AC-6 partial implementation is the principal gap. The 92%/80% bridge and the wrong-file pointer to git-workflows.md:126 are minor.

    Status: Gaps Found.


    Verdict: AC_NOT_MET

    AC-6 is PARTIALLY_MET: the conditional fires (AC-5 verdict = restrict), and the spec listed 6 touchpoints to sync. Two were updated (user docs), four were not (runtime + 3 skill mirrors). The spec's risk note explicitly named the third path ("partial") as the one to avoid — "update in lockstep or skip entirely". Per the QA literal-verification rule, this cannot be marked MET without rationalizing the divergence.

    The investigation work itself (AC-1–AC-5) is high-quality and verifiable; the gap is purely the AC-6 follow-through.

    Next Steps

    Pick one of:

    1. Complete AC-6 in this PR (recommended per feedback_fill_gaps_in_pr.md) — the lowest-risk option is annotation rather than threshold flip:
      • src/lib/assess-collision-detect.ts:264 — append historical rate to chain suggestion at length≥3.
      • 3 mirrors of predicted-collision-detection.md (.claude/, templates/, skills/) — match the runtime annotation.
      • Run npx tsx scripts/check-skill-sync.ts --fix afterward to confirm three-directory parity.
    2. Mark AC-6 explicitly N/A in the spec/issue with rationale (e.g. "n=7 too small to flip the rule; revisit at n≥20"), keep the 2 unconditional doc refreshes (parallel-execution.md, run-command.md), then re-run /qa 604.

    While here, also fix:

    • The git-workflows.md:126 reference in chain-mode-analysis-2026-05.md line 110 — the stale 50% n=4 text is in parallel-execution.md:126, not git-workflows.md:126.
    • Add a one-line bridge explaining the 92% (issue body) vs 80% (doc) single-issue figure — either reproduce the 92% with the matching filter or note why your filter gives a different number.

    Documentation: Before merging, run /docs 604 if any user-facing guidance lands in the final commit.

  8. added
    needs-work
    and removed
    needs-improvement
    on May 10, 2026
  9. added a commit that references this issue on May 10, 2026
  10. admarble commented on May 10, 2026

    @admarble
    ContributorAuthor

    Progress Update — /exec (resume after QA AC_NOT_MET)

    PR: #621 (commit dc59f78)

    Picks up from the QA review at 04:25 UTC, which flagged AC-6 as PARTIALLY_MET plus two minor doc gaps. All three issues are addressed in dc59f78 (already on the branch and pushed).

    AC Coverage (re-stated)

    AC Status Evidence
    AC-1 confirm signal across full history ✅ Met (unchanged from prior /exec)
    AC-2 segment by length & failure position ✅ Met (unchanged)
    AC-3 classify each failed chain run ✅ Met (unchanged)
    AC-4 chain-specific vs incidental ✅ Met (unchanged)
    AC-5 top-3 failure modes + verdict ✅ Met (unchanged)
    AC-6 sync /assess rule across mirrors ✅ Met Annotation route per QA recommendation: runtime + 3 skill mirrors append historical rate at length≥3. Lower-risk than flipping the threshold given n=7.

    Resume actions (dc59f78)

    Touchpoint Change
    src/lib/assess-collision-detect.ts:264 Chain: suggestion at length≥3 now appends (chain length≥3 historically 1/6 = 17%; see docs/reference/chain-mode-analysis-2026-05.md). Doc-comment on CollisionAnnotations updated to reference #604.
    .claude/skills/assess/references/predicted-collision-detection.md Prose matches new runtime output.
    skills/assess/references/predicted-collision-detection.md Mirror — diff-clean against .claude/.
    templates/skills/assess/references/predicted-collision-detection.md Mirror — diff-clean against .claude/.
    src/lib/__tests__/assess-collision-detect.test.ts New test asserts chainSuggestion contains both the 1/6 = 17% annotation and the analysis-doc reference. Existing 15-test suite still green.
    docs/reference/chain-mode-analysis-2026-05.md (L110) Stale-doc pointer corrected: git-workflows.md:126 → parallel-execution.md:126 (the file actually refreshed in this PR).
    docs/reference/chain-mode-analysis-2026-05.md (Note added) One-paragraph bridge explaining the 92% (issue body, sequant stats snapshot at filing) vs 80% (this analysis, phases ⊇ {spec, exec, qa} filter on a 62-run snapshot) gap; cites src/commands/stats.ts:422 for stats's permissive filter.

    Three-mirror parity verified by diff (all three .md files byte-identical).

    Quality gates

    • npm run build: ✅ Pass
    • npm run lint: ✅ Pass (0 errors, 0 warnings, --max-warnings 0)
    • npx vitest run src/lib/__tests__/assess-collision-detect.test.ts: ✅ 15/15 pass (incl. new AC-6 annotation test)

    CI on PR #621

    3 checks completed (typecheck, validate-skills, validate-plugin, plus 4 plugin-test jobs); build (20.x) and build (22.x) in progress at time of writing.

    Stale-branch note

    Branch is 7 commits behind origin/main (info-level, default threshold 5). No rebase needed for the small TS + 3 mirror changes; conflict probability low. Will rebase on QA re-run if any of the 7 commits touch assess-collision-detect.ts or the predicted-collision-detection mirrors.

    Pre-PR Confidence Check

    • Weakest part: The annotated rate (1/6 = 17%) is hard-coded into the suggestion string. If the metrics shift over time (more chain runs land), the annotation will go stale and need a manual bump. This is intentional — the alternative (computing the rate at runtime) would couple /assess to metrics-file parsing and was out of scope. Followup-tracker-worthy if chain volume picks up.
    • Coverage gaps: Of changed files, only src/lib/assess-collision-detect.ts is code; it has tests. The 3 markdown mirrors and the analysis doc are content-only and don't have unit tests (they're lockstep-verified by the existing skill-mirror sync rule and a diff check).

    Next steps

    PR #621 is ready for /qa 604 re-run. AC-6 is now MET on all spec-listed touchpoints; the two minor QA findings are also closed.

  11. added 2 commits that reference this issue on May 10, 2026
  12. added a commit that references this issue on May 11, 2026
  13. added 2 commits that reference this issue on Jul 15, 2026
  14. added 2 commits that reference this issue on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementmulti-agentneeds-workplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions