Skip to content

fix(analyze): keep a trace of unparseable replies and stop retrying them forever - #212

Open
Pantoria wants to merge 4 commits into
kunchenguid:mainfrom
Pantoria:fix/193-failed-analysis-trace
Open

Pantoria wants to merge 4 commits into
kunchenguid:mainfrom
Pantoria:fix/193-failed-analysis-trace

Conversation

@Pantoria

@Pantoria Pantoria commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Fix issue #193: when analysis output had no parseable JSON, the evidence record kept only status failed plus the error string, dropping the reply, and the transcript was re-analyzed every run forever. The user (issue author, Pantoria) asked to implement their own ready-for-pr backpass issues, each in its own worktree and PR. Follow AGENTS.md invariants and VISION.md. No live model calls were made while implementing.
Implemented all three proposal parts. (1) Failed records keep reply {class, chars, head, tail}: the whole reply is passed through the existing redact() before cutting 300-char head/tail (so a secret can't be split at a snippet edge); chars is measured by backpass from the raw reply. No harness stop reason is stored because acpx runs --format quiet and exposes none - deliberately not invented (never trust/invent model numbers). (2) A deterministic class empty/prose/truncated/unparsed (rules documented in classifyUnparsedReply) shows in status and in the error text. empty is unreachable today because assertNonEmptyOutput fires first, kept for completeness (open PR #183 may change that path). (3) Skip-after-N, which the maintainer allowed only if named in status and the last trace kept: MAX_UNPARSED_REPLIES = 3 constant (deliberately no config option), counted per failureKey = evidence key + answering agent/model/effort + analysis prompt hash, so any change resets; only unparseable replies count (timeouts/exec failures reset and always retry so a flaky provider can't make backpass give up); --force re-analyzes. Skips are named in a run warning, summary suffix, summary.gaveUp in --json, and status text/JSON. Skipped records stay failed, so never count as evidence. No ANALYSIS_INDEX_VERSION bump: only failure records change, not what analysis accepts; legacy failed records still load.

What Changed

  • When an analysis reply has no parseable JSON, its failed evidence record (src/analyze.js) now keeps reply: {class, chars, head, tail}. The whole reply is redacted first, then cut into a 300-char head and tail. chars is the raw reply length, counted by backpass. The class (empty / prose / truncated / unparsed) is worked out from the reply text alone, and it also appears in the error text.
  • After MAX_UNPARSED_REPLIES (3) unparseable replies in a row for the same evidence key, answering agent, model, effort and analysis prompt hash, the transcript is skipped instead of retried. Changing any of those inputs analyzes it again, and so does --force. A timeout or exec failure resets the count and is always retried. Skipped records stay failed, keep their last trace, and never count as evidence. Skips are reported in a run warning, in the analyze/run/bootstrap evidence line (skipped after 3 failures), and in summary.gaveUp in --json.
  • backpass status now reads the root evidence store plus each nested memory file's own store. Each record is checked against its own file's memory hash, and the shared layerNestedWeights helper in src/nested.js builds each nested file's hash for both analyze and status. Status shows the reply class and give-ups, and adds a MEMORY column when nested files are configured. --json gets a per-file evidence.files array. README and --force help text are updated, and test/analyze-failure-trace.test.js is new.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change only touches failure records and status reporting. The give-up streak is keyed on the evidence key plus the answering agent pick and the prompt hash, and give-ups never count as evidence. Status now reads each nested evidence store without writing anything, and it computes the same surface hashes as analyze through the shared layerNestedWeights helper.

Testing

I ran the real backpass CLI in a throwaway repo and HOME, with a stub acpx standing in for the model; no real model was called. A truncated reply containing a secret was saved with class truncated, the character count measured by backpass, and TOKEN=[redacted]; the secret never reached disk. After 3 unparseable replies the 4th run made no model call, and it printed a warning naming the skip and a skipped after 3 failures suffix. status text and --json showed the give-up for the root file and the nested file separately (MEMORY column, evidence.files). Editing either memory file put the row back to retry, and a valid JSON reply then counted as ok evidence. --force asked the model again. Four timeouts in a row never caused a skip and kept no reply trace. I also ran the targeted test file, which includes a case where the root succeeds and only the nested file gives up; all 9 tests passed. This is a CLI change, so the evidence is CLI transcripts rather than screenshots. The throwaway temp directory was deleted and the worktree is clean.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
An unparseable reply is saved in the failed evidence record with class, measured character count, and redacted head/tail; the secret never reaches disk ✅ pass live cli-transcript.txt Scenario A: record has class 'truncated', chars 561, head shows 'TOKEN=[redacted]'; grep finds the secret 0 times; the error text says '(truncated)'
After 3 unparseable replies in a row, the next analyze makes no model call and names the skip in a warning and in the summary ✅ pass live cli-transcript.txt Scenario B: model call count stays at 6; warning reads '1 transcript(s) skipped after 3 unparseable replies...'; summary line ends '1 skipped after 3 failures'
status text and --json show give-ups per memory file, including a nested file's own evidence store ✅ pass live cli-transcript.txt Scenario B: MEMORY column shows the AGENTS.md and apps/api/AGENTS.md rows; JSON evidence.files has per-file gaveUp counts; the test 'status reads a nested memory file's own evidence…
Adversarial: an edit to a memory file shows status 'retry' instead of a stale skip label, and a valid reply then counts as ok evidence ✅ pass live cli-transcript.txt Scenario D: NEXT RUN changes to 'retry' after both files are edited; analyze makes 2 model calls; status shows '2 ok · 0 skipped · 0 failed'
--force asks the model again for a transcript that was skipped ✅ pass live cli-transcript.txt Scenario C: model call count goes from 6 to 8
Adversarial: repeated timeouts never cause a skip and keep no reply trace ✅ pass live cli-transcript.txt Scenario E: 4 runs in a row each show failed=1 gaveUp=0; the record has only the timeout error, with no unparsedReplies or reply field
Evidence: CLI transcript of all scenarios (analyze/status/status --json)
=== Scenario A: root + nested both reply with truncated JSON containing a secret ===

$ backpass analyze --harness pi --since all --analysis-agent pi --jobs 1
· analyzing 1 transcript(s) with pi effort=medium at jobs=1
warn pi session 2026-10-16 00:47: analysis returned no parseable JSON (truncated)
  1/1 analyzed
· apps/api/AGENTS.md is a nested memory file: 1 of 1 session(s) worked under apps/api/
· analyzing 1 transcript(s) with pi effort=medium at jobs=1
warn pi session 2026-10-16 00:47: analysis returned no parseable JSON (truncated)
  1/1 analyzed

analyzed against AGENTS.md (1 instructions, 15 tok)
  0 newly analyzed · 0 cached · 0 skipped (too short) · 1 failed
  failed transcripts are listed by `backpass status` and retried next run
analyzed against apps/api/AGENTS.md (nested, 1 instructions, 12 tok) from 1 session(s) under apps/api/
  0 newly analyzed · 0 cached · 0 skipped (too short) · 1 failed
[exit 0] [model calls so far: 2]
--- root evidence record (persisted state) ---
{
 "status": "failed",
 "error": "analysis returned no parseable JSON (truncated)",
 "reply": {
  "class": "truncated",
  "chars": 561,
  "head": "Sorry, here you go. TOKEN=[redacted]\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz…"
 },
 "unparsedReplies": 1
}
0
secret absent from evidence: OK

$ backpass status
repo /st/tmp/tmp.mfeSFhAkSU/repo

BUDGET (always-loaded)
  AGENTS.md          [................................] 15 / 5,000 tok · 1 instructions
  apps/api/AGENTS.md [................................] 12 / 5,000 tok · 1 instructions · nested, loads under apps/api/

NESTED EVIDENCE REACH (sampled sessions at the last attribution, 2026-10-16 04:47; report-only)
  apps/api/AGENTS.md: 1 of 1 sampled session(s) worked only under apps/api/
    below minGapEvidence (2); no add, rewrite, or remove edit can reach this file

CACHE
  scan cache      1 file(s) fingerprinted
  evidence        0 ok · 0 skipped · 2 failed
  rejections      0 remembered

FAILED TRANSCRIPTS (retried on the next run unless skipped)
MEMORY              HARNESS  SESSION  REPLY                  NEXT RUN  ERROR
AGENTS.md           pi       pi-s1    truncated · 561 chars  retry     analysis returned no parseable JSON (truncated)
apps/api/AGENTS.md  pi       pi-s1    truncated · 561 chars  retry     analysis returned no parseable JSON (truncated)
  each unparseable reply's redacted head and tail are kept in its memory file's evidence/<identity>.json (.backpass/ for the root, .backpass/nested/<file>/ for a nested file)

PROPOSAL
  none yet - run `backpass`

MODELS
  analysis        auto - 7 candidates, none probed yet
  synthesis       auto - 7 candidates, none probed yet
[exit 0] [model calls so far: 2]
=== Scenario B: two more unparseable runs -> give-up; 4th run makes no model call ===
analyzed against apps/api/AGENTS.md (nested, 1 instructions, 12 tok) from 1 session(s) under apps/api/
  0 newly analyzed · 0 cached · 0 skipped (too short) · 1 failed
[exit 0] [model calls so far: 6]

$ backpass analyze --harness pi --since all --analysis-agent pi --jobs 1
warn 1 transcript(s) skipped after 3 unparseable replies in a row; `backpass status` lists them with their last reply, and a changed transcript, memory surface, analysis model, or --force analyzes them again
· apps/api/AGENTS.md is a nested memory file: 1 of 1 session(s) worked under apps/api/
warn 1 transcript(s) skipped after 3 unparseable replies in a row; `backpass status` lists them with their last reply, and a changed transcript, memory surface, analysis model, or --force analyzes them again

analyzed against AGENTS.md (1 instructions, 15 tok)
  0 newly analyzed · 0 cached · 0 skipped (too short) · 0 failed · 1 skipped after 3 failures
analyzed against apps/api/AGENTS.md (nested, 1 instructions, 12 tok) from 1 session(s) under apps/api/
  0 newly analyzed · 0 cached · 0 skipped (too short) · 0 failed · 1 skipped after 3 failures
[exit 0] [model calls so far: 6]

$ backpass status
repo /st/tmp/tmp.mfeSFhAkSU/repo

BUDGET (always-loaded)
  AGENTS.md          [................................] 15 / 5,000 tok · 1 instructions
  apps/api/AGENTS.md [................................] 12 / 5,000 tok · 1 instructions · nested, loads under apps/api/

NESTED EVIDENCE REACH (sampled sessions at the last attribution, 2026-10-16 04:47; report-only)
  apps/api/AGENTS.md: 1 of 1 sampled session(s) worked only under apps/api/
    below minGapEvidence (2); no add, rewrite, or remove edit can reach this file

CACHE
  scan cache      1 file(s) fingerprinted
  evidence        0 ok · 0 skipped · 2 failed (2 skipped after 3 failures)
  rejections      0 remembered

FAILED TRANSCRIPTS (retried on the next run unless skipped)
MEMORY              HARNESS  SESSION  REPLY                  NEXT RUN                  ERROR
AGENTS.md           pi       pi-s1    truncated · 561 chars  skipped after 3 failures  analysis returned no parseable JSON (truncated)
apps/api/AGENTS.md  pi       pi-s1    truncated · 561 chars  skipped after 3 failures  analysis returned no parseable JSON (truncated)
  each unparseable reply's redacted head and tail are kept in its memory file's evidence/<identity>.json (.backpass/ for the root, .backpass/nested/<file>/ for a nested file)

PROPOSAL
  none yet - run `backpass`

MODELS
  analysis        auto - 7 candidates, none probed yet
  synthesis       auto - 7 candidates, none probed yet
[exit 0] [model calls so far: 6]

$ backpass status --json
{
  "repo": "repo",
  "budgets": [
    {
      "path": "AGENTS.md",
      "label": "AGENTS.md",
      "capTokens": 5000,
      "current": 15,
      "projected": 15,
      "delta": 0,
      "withinBudget": true,
      "over": 0,
      "utilization": 0.003,
      "instructions": 1,
      "pointerTo": null,
      "separate": false
    },
    {
      "path": "apps/api/AGENTS.md",
      "label": "apps/api/AGENTS.md",
      "capTokens": 5000,
      "current": 12,
      "projected": 12,
      "delta": 0,
      "withinBudget": true,
      "over": 0,
      "utilization": 0.0024,
      "instructions": 1,
      "pointerTo": null,
      "separate": false,
      "nested": "apps/api",
      "missing": false
    }
  ],
  "nestedAttribution": {
    "measuredAt": "2026-10-16T04:47:23.781Z",
    "files": [
      {
        "path": "apps/api/AGENTS.md",
        "dir": "apps/api",
        "measured": true,
        "sessions": 1,
        "sampledSessions": 1,
        "minGapEvidence": 2,
        "belowMinGapEvidence": true
      }
    ]
  },
  "crossSurfaceDuplicates": [],
  "evidence": {
    "ok": 0,
    "failed": 2,
    "skipped": 0,
    "gaveUp": 2,
    "files": [
      {
        "path": "AGENTS.md",
        "ok": 0,
        "failed": 1,
        "skipped": 0,
        "gaveUp": 1
      },
      {
        "path": "apps/api/AGENTS.md",
        "ok": 0,
        "failed": 1,
        "skipped": 0,
        "gaveUp": 1
      }
    ]
  },
  "scanCacheEntries": 1,
  "hosts": {},
  "summary": null,
  "proposal": null,
  "rejections": 0,
  "skills": 0
}
[exit 0] [model calls so far: 6]
=== Scenario C: --force asks again ===
  failed transcripts are listed by `backpass status` and retried next run
analyzed against apps/api/AGENTS.md (nested, 1 instructions, 12 tok) from 1 session(s) under apps/api/
  0 newly analyzed · 0 cached · 0 skipped (too short) · 1 failed
[exit 0] [model calls so far: 8]
=== Scenario D: memory surface change -> status shows retry, run asks again; parseable reply becomes evidence ===

$ backpass status
repo /st/tmp/tmp.mfeSFhAkSU/repo

BUDGET (always-loaded)
  AGENTS.md          [................................] 11 / 5,000 tok · 1 instructions
  apps/api/AGENTS.md [................................] 17 / 5,000 tok · 2 instructions · nested, loads under apps/api/

NESTED EVIDENCE REACH (sampled sessions at the last attribution, 2026-10-16 04:47; report-only)
  apps/api/AGENTS.md: 1 of 1 sampled session(s) worked only under apps/api/
    below minGapEvidence (2); no add, rewrite, or remove edit can reach this file

CACHE
  scan cache      1 file(s) fingerprinted
  evidence        0 ok · 0 skipped · 2 failed
  rejections      0 remembered

FAILED TRANSCRIPTS (retried on the next run unless skipped)
MEMORY              HARNESS  SESSION  REPLY                  NEXT RUN  ERROR
AGENTS.md           pi       pi-s1    truncated · 561 chars  retry     analysis returned no parseable JSON (truncated)
apps/api/AGENTS.md  pi       pi-s1    truncated · 561 chars  retry     analysis returned no parseable JSON (truncated)
  each unparseable reply's redacted head and tail are kept in its memory file's evidence/<identity>.json (.backpass/ for the root, .backpass/nested/<file>/ for a nested file)

PROPOSAL
  none yet - run `backpass`

MODELS
  analysis        auto - 7 candidates, none probed yet
  synthesis       auto - 7 candidates, none probed yet
[exit 0] [model calls so far: 8]

$ backpass analyze --harness pi --since all --analysis-agent pi --jobs 1
· analyzing 1 transcript(s) with pi effort=medium at jobs=1
  1/1 analyzed
· apps/api/AGENTS.md is a nested memory file: 1 of 1 session(s) worked under apps/api/
· analyzing 1 transcript(s) with pi effort=medium at jobs=1
  1/1 analyzed

analyzed against AGENTS.md (1 instructions, 11 tok)
  1 newly analyzed · 0 cached · 0 skipped (too short) · 0 failed
analyzed against apps/api/AGENTS.md (nested, 2 instructions, 17 tok) from 1 session(s) under apps/api/
  1 newly analyzed · 0 cached · 0 skipped (too short) · 0 failed

  tier-1 tokens: not reported by pi
[exit 0] [model calls so far: 10]

$ backpass status
repo /st/tmp/tmp.mfeSFhAkSU/repo

BUDGET (always-loaded)
  AGENTS.md          [................................] 11 / 5,000 tok · 1 instructions
  apps/api/AGENTS.md [................................] 17 / 5,000 tok · 2 instructions · nested, loads under apps/api/

NESTED EVIDENCE REACH (sampled sessions at the last attribution, 2026-10-16 04:47; report-only)
  apps/api/AGENTS.md: 1 of 1 sampled session(s) worked only under apps/api/
    below minGapEvidence (2); no add, rewrite, or remove edit can reach this file

CACHE
  scan cache      1 file(s) fingerprinted
  evidence        2 ok · 0 skipped · 0 failed
  rejections      0 remembered

PROPOSAL
  none yet - run `backpass`

MODELS
  analysis        auto - 7 candidates, none probed yet
  synthesis       auto - 7 candidates, none probed yet
[exit 0] [model calls so far: 10]
=== Scenario E: timeouts never cause give-up ===
summary failed=1 gaveUp=0
summary failed=1 gaveUp=0
summary failed=1 gaveUp=0
summary failed=1 gaveUp=0
root record after timeouts: {"error":"acpx pi session prompt ended at its own timeout (exit 3)"}
Evidence: Throwaway environment driver script
#!/bin/bash
# Disposable end-to-end drive of the backpass CLI with a stub acpx standing in for the model provider.
set -u
WT=$1; T=$(mktemp -d); BIN=$T/bin; HOME_=$T/home; REPO=$T/repo
mkdir -p $BIN $HOME_ $REPO/apps/api
printf '#!%s\nprocess.exit(0)\n' "$(command -v node)" > $BIN/pi; chmod +x $BIN/pi
cat > $BIN/acpx <<JS
#!$(command -v node)
const fs=require("node:fs");const a=process.argv.slice(2);
if(a.includes("config")&&a.includes("show")){console.log(JSON.stringify({agents:{}}));process.exit(0)}
if(a.includes("--file")){fs.appendFileSync(process.env.CALLS,"call\n");const p=fs.readFileSync(a[a.indexOf("--file")+1],"utf8");
const n=process.env.NREPLY&&p.includes("## The memory file under audit: apps/");const r=fs.readFileSync(n?process.env.NREPLY:process.env.REPLY,"utf8");
if(r==="__TIMEOUT__")process.exit(3);process.stdout.write(r);process.exit(0)}
process.exit(0)
JS
chmod +x $BIN/acpx
cd $REPO; git init -q; git config user.email t@t; git config user.name t
printf '# Agent instructions\n\n- Run `make build` before every push.\n' > AGENTS.md
printf '# API memory\n\n- Handlers live in src/routes.\n' > apps/api/AGENTS.md
echo '{"nestedMemoryFiles":["apps/api/AGENTS.md"]}' > .backpassrc.json
git add -A; git commit -qm init
S=$HOME_/.pi/agent/sessions/s1; mkdir -p $S
node -e '
const [f,cwd]=process.argv.slice(1);const e=[{type:"session",version:3,id:"s1",timestamp:new Date().toISOString(),cwd},
{type:"message",message:{role:"user",content:"Please build the project."}},{type:"message",message:{role:"assistant",content:"Ran make build as instructed."}},
{type:"message",message:{role:"user",content:"Now run the tests too."}},{type:"message",message:{role:"assistant",content:"Tests pass."}}];
require("fs").writeFileSync(f,e.map(x=>JSON.stringify(x)).join("\n")+"\n")' $S/1_s1.jsonl $REPO/apps/api
export HOME=$HOME_ PATH=$BIN:$PATH BACKPASS_ACPX_BIN=$BIN/acpx REPLY=$T/reply NREPLY=$T/nreply CALLS=$T/calls NO_COLOR=1
bp(){ echo; echo "\$ backpass $*"; node $WT/bin/backpass.js "$@" 2>&1; echo "[exit $?] [model calls so far: $(wc -l < $CALLS 2>/dev/null || echo 0)]"; }
A="analyze --harness pi --since all --analysis-agent pi --jobs 1"
echo "=== Scenario A: root + nested both reply with truncated JSON containing a secret ==="
printf 'Sorry, here you go. TOKEN=supersecretvalue123\n%s\n{"positive": [' "$(printf 'z%.0s' $(seq 1 500))" > $REPLY; cp $REPLY $NREPLY
bp $A
echo "--- root evidence record (persisted state) ---"; cat .backpass/evidence/*.json | node -e 'const r=JSON.parse(require("fs").readFileSync(0));console.log(JSON.stringify({status:r.status,error:r.error,reply:{...r.reply,head:r.reply.head.slice(0,80)+"…"},unparsedReplies:r.unparsedReplies},null,1))'
grep -c supersecretvalue123 .backpass/evidence/*.json || echo "secret absent from evidence: OK"
bp status
echo "=== Scenario B: two more unparseable runs -> give-up; 4th run makes no model call ==="
bp $A >/dev/null; bp $A | tail -3
bp $A
bp status
bp status --json
echo "=== Scenario C: --force asks again ==="
bp $A --force | tail -4
echo "=== Scenario D: memory surface change -> status shows retry, run asks again; parseable reply becomes evidence ==="
printf '# Agent instructions\n\n- Always run lint.\n' > AGENTS.md
printf '# API memory\n\n- Handlers live in src/routes.\n- Run contract tests.\n' > apps/api/AGENTS.md
bp status
echo '{"positive":[],"negative":[],"gaps":[]}' > $REPLY; cp $REPLY $NREPLY
bp $A
bp status
echo "=== Scenario E: timeouts never cause give-up ==="
printf '# Agent instructions\n\n- Timeout surface.\n' > AGENTS.md; echo -n __TIMEOUT__ > $REPLY; echo -n __TIMEOUT__ > $NREPLY
for i in 1 2 3 4; do bp $A --json | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{const j=s.slice(s.indexOf("{"));try{const x=JSON.parse(j.slice(0,j.lastIndexOf("}")+1)).summary;console.log("summary failed="+x.failed+" gaveUp="+x.gaveUp)}catch(e){console.log(s.slice(-400))}})'; done
cat .backpass/evidence/*.json | node -e 'const r=JSON.parse(require("fs").readFileSync(0));console.log("root record after timeouts:",JSON.stringify({error:r.error,unparsedReplies:r.unparsedReplies,reply:r.reply}))'
cd /; rm -rf $T
Evidence: Targeted test run output
✔ each unparseable reply is classed from its text alone (1.692919ms)
✔ the saved reply trace is redacted before it is cut, and measures the raw reply (1.270306ms)
✔ a streak gives up only for the same evidence key and the same analysis call (0.938729ms)
✔ a failed analysis keeps a redacted, classed trace of the reply (357.663448ms)
✔ after 3 unparseable replies in a row a transcript is skipped by name until its key changes (1870.193109ms)
✔ status names a give-up only while the memory surface it gave up at is current (1150.517818ms)
✔ status reads a nested memory file's own evidence store and names its give-up (1188.119281ms)
✔ a timeout resets the streak and keeps no reply trace (823.073978ms)
✔ status still lists an older failed record without the trace fields (543.791738ms)
ℹ tests 9
ℹ suites 0
ℹ pass 9
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 6027.33344
Evidence: status after give-up (excerpt)
evidence 0 ok · 0 skipped · 2 failed (2 skipped after 3 failures)
MEMORY HARNESS SESSION REPLY NEXT RUN ERROR
AGENTS.md pi pi-s1 truncated · 561 chars skipped after 3 failures analysis returned no parseable JSON (truncated)
apps/api/AGENTS.md pi pi-s1 truncated · 561 chars skipped after 3 failures analysis returned no parseable JSON (truncated)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ src/commands/status.js:241 - isGivenUp in status only checks unparsedReplies &gt;= MAX_UNPARSED_REPLIES. It never checks that the record still matches the current evidence key. Here is a sequence that happens in normal use: a transcript gives up at memory hash H1, then backpass apply edits AGENTS.md so the memory surface becomes H2. backpass status still shows the record as skipped after 3 failures: in the NEXT RUN column, in the evidence summary suffix (status.js:147) and in evidence.gaveUp in --json (status.js:84). But the next run will retry it, because replyFailureKey includes evidenceKey(..., H2) and the streak resets (hasGivenUp in src/analyze.js). The label is wrong but no error is raised. The comment at status.js:236-240 accepts this for the agent dimension, since status does not resolve agents. The memory-surface and transcript-content parts of the key can be checked cheaply, though: status already resolves the memory files for its budgets. Smallest fix: treat a record as given up only when record.memoryHash equals the current memorySurfaceHash for its memory path, and optionally when record.key matches the current evidenceKey. Otherwise show it as retry. The same predicate feeds three places: status.js:31 (count), status.js:147 (text suffix) and status.js:181 (row label).

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 8 of 8 scenarios driven live against the product
Scenario Result Live Evidence
A reply with no parseable JSON is saved in the failed record as a redacted, classed trace (class, chars, head, tail), and the error text names the class ✅ pass live cli-transcript.txt: the evidence JSON has class truncated, chars 700, and ANTHROPIC_API_KEY=[redacted:ANTHROPIC_KEY]; grep for sk-ant finds 0 matches; the warning reads '(truncated)'
After 3 unparseable replies in a row, the next analyze makes no model call and names the skip in the warning, the summary and the --json gaveUp field ✅ pass live cli-transcript.txt run 4: model calls stay at 3; warning '1 transcript(s) skipped after 3 unparseable replies'; summary shows '1 skipped after 3 failures'; --json has gaveUp 1
backpass status and status --json show the skipped transcript with its reply class, size and NEXT RUN label ✅ pass live cli-transcript.txt: the status row reads 'truncated · 700 chars skipped after 3 failures'; status --json evidence has gaveUp 1
--force re-analyzes a skipped transcript ✅ pass live cli-transcript.txt: model calls go from 3 to 4 on the --force run
After AGENTS.md changes, status shows the old skipped record as 'retry' and the next analyze retries it (recorded review decision) ✅ pass live cli-transcript.txt: after the edit, the status NEXT RUN column reads retry with no '(skipped after' suffix, and analyze makes model call 5
Adversarial: timeouts (acpx exit 3) reset the count, keep no reply trace, and never lead to a skip ✅ pass live cli-transcript.txt: after a timeout the record has error 'own timeout (exit 3)' with no unparsedReplies and no reply; 4 more timeout runs still made model calls (11 in total)
A failed record from before this change (no trace fields) still shows in status and is retried ✅ pass live node --test test/analyze-failure-trace.test.js: test 'status still lists an older failed record without the trace fields' drives the real CLI
A later parseable reply turns the failed record into ok evidence ✅ pass live cli-transcript.txt: '1 newly analyzed'; status --json reports {ok:1, failed:0, gaveUp:0}
  • node --test test/analyze-failure-trace.test.js (8/8 pass; runs the real CLI end to end with a fake acpx)
  • Manual CLI session in a throwaway HOME/repo with a fake pi and a fake acpx (reply set from a file, each call logged): 3x backpass analyze --harness pi --since all --analysis-agent pi --jobs 1, then inspected the evidence JSON and grepped it for the secret
  • 4th backpass analyze (skip, model call count unchanged), --json summary, backpass status, backpass status --json
  • backpass analyze --force after the skip
  • Edited AGENTS.md, then backpass status (shows retry) and backpass analyze (re-analyzes)
  • Adversarial: 2 unparseable replies, then repeated acpx exit-3 timeouts: the count resets, no reply trace is kept, and every run still calls the model
  • Recovery: a parseable JSON reply turns the record into ok evidence; status --json reports gaveUp 0

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
An unparseable reply is saved in the failed evidence record with class, measured character count, and redacted head/tail; the secret never reaches disk ✅ pass live cli-transcript.txt Scenario A: record has class 'truncated', chars 561, head shows 'TOKEN=[redacted]'; grep finds the secret 0 times; the error text says '(truncated)'
After 3 unparseable replies in a row, the next analyze makes no model call and names the skip in a warning and in the summary ✅ pass live cli-transcript.txt Scenario B: model call count stays at 6; warning reads '1 transcript(s) skipped after 3 unparseable replies...'; summary line ends '1 skipped after 3 failures'
status text and --json show give-ups per memory file, including a nested file's own evidence store ✅ pass live cli-transcript.txt Scenario B: MEMORY column shows the AGENTS.md and apps/api/AGENTS.md rows; JSON evidence.files has per-file gaveUp counts; the test 'status reads a nested memory file's own evidence…
Adversarial: an edit to a memory file shows status 'retry' instead of a stale skip label, and a valid reply then counts as ok evidence ✅ pass live cli-transcript.txt Scenario D: NEXT RUN changes to 'retry' after both files are edited; analyze makes 2 model calls; status shows '2 ok · 0 skipped · 0 failed'
--force asks the model again for a transcript that was skipped ✅ pass live cli-transcript.txt Scenario C: model call count goes from 6 to 8
Adversarial: repeated timeouts never cause a skip and keep no reply trace ✅ pass live cli-transcript.txt Scenario E: 4 runs in a row each show failed=1 gaveUp=0; the record has only the timeout error, with no unparsedReplies or reply field
  • node --test test/analyze-failure-trace.test.js (the 9 targeted tests for this change, which run the real CLI with a stub acpx)
  • ~/.no-mistakes/evidence/01M503V3YM500JB8EM5J3KKE5C/drive.sh in a throwaway git repo and HOME with a nested apps/api/AGENTS.md: backpass analyze run repeatedly, backpass status, backpass status --json, analyze --force, editing both memory files, a valid reply, and 4 timeout runs
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Reviews (3) · Last reviewed commit: "no-mistakes(ci): Fixed the Greptile find..." · Reviewed by Greptile

Comment thread src/commands/status.js Outdated
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Thanks @Pantoria, this is solid work. I reviewed the diff against main: CI is green on both OSes, the no-mistakes attestation is bound to the current head (8d68e6f), there's live CLI evidence (8/8), and it still merges cleanly onto today's main (f24dbab, with #213 and #210 merged). I also ran the full suite locally on that merge and it passed.

contract-class: new-default (only for one part). Keeping a redacted head/tail, chars and an empty/prose/truncated/unparsed class on the failed record, and showing it in status, is a restore: it's the "failure is loud and named" path #193 asked for. The skip after 3 unparseable replies is on for every unconfigured run, though, and it replaces what the README promises today ("…listed by backpass status, and retried on the next run"). That changes a default-on behavior, so it's Kun's call. I'm holding this for his decision, not because anything is wrong with the PR. No action needed from you right now.

VISION (per rule):

  1. Evidence is the only currency: aligns (a skipped record stays failed and never counts as evidence; the trace makes the failure inspectable).
  2. The human owns the weights: aligns (no memory write path).
  3. Nothing the model says is taken on faith: aligns (chars and the class are measured from the reply itself, and no stop reason is invented since acpx doesn't give one).
  4. The budget is the constraint, not a setting: aligns (stops paying for the same failure every run).
  5. It reads what you already have and owns nothing: aligns (redacted before cutting, stored locally only).
  6. Failure is loud and named: aligns strongly (the skip shows up in the run warning, the summary, status and --json, and --force or any input change retries it).
  7. Scope / align-resist: aligns. The skip is named rather than quiet, so it isn't a degraded path, but it's still a new default.

Zexuan Liu and others added 4 commits October 16, 2026 00:44
…trying them forever

An analysis reply with no parseable JSON now records, in its failed evidence
record, the reply's length, its redacted first and last 300 characters, and a
class judged from the text alone: empty, truncated, unparsed, or prose. acpx
reports no stop reason in quiet mode, so none is recorded.

After 3 unparseable replies in a row for the same evidence key and analysis
call (agent, model, effort, prompt template), the transcript is skipped and
named in the run summary and `backpass status`, keeping its last reply trace.
A changed key or --force analyzes it again; other failures reset the streak.
A skipped transcript stays `failed` and never counts as evidence.

Fixes kunchenguid#193

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed. The broken rule: `backpass status` has to report every evidence store that analysis writes. Before this fix it read only the root store, so failures, reply classes and give-ups recorded for a nested memory file never appeared. Changes: - src/nested.js: added `layerNestedWeights(rootFile, weights, skills)`. It holds the ancestor and `nestedSurfaceHash` logic that was previously inline in `primaryMemoryFile`. - src/commands/analyze.js: now calls that helper, so analyze and status build each nested file's hash from the same code. - src/commands/status.js: builds one list of stores: the root store plus one per trained nested file (it exists, isn't a pointer, and its state is read from `nestedStateDir` without creating anything). It checks each record against that file's own memory hash. The changes show up in four places: - Evidence counts and the "skipped after N" note now include nested stores. - The failed-transcripts table gets a MEMORY column, but only when nested files are configured, so root-only output is unchanged. - The note about where reply traces are kept points to each file's own store. - `--json` `evidence` has a new `files` array of `{path, ok, failed, skipped, gaveUp}`, one entry per memory file. - README.md (line 416): one clause saying status also reads nested evidence and names the file. - test/analyze-failure-trace.test.js: the fake acpx can now give a nested file its own reply, and the harness can set up a nested `apps/api/AGENTS.md`. The new test runs the real CLI: the root analysis succeeds, the nested one gives up after 3 replies, and status text and JSON show which file it was (`1 ok · 0 skipped · 1 failed (1 skipped after 3 failures)`, an `apps/api/AGENTS.md` row marked skipped, and per-file JSON counts). Editing the nested file turns the row back to `retry`. I checked that this test fails against the old status.js and passes with the fix. Verification: `pnpm run check` passes (lint, format, typecheck, and all 937 tests)
@Pantoria
Pantoria force-pushed the fix/193-failed-analysis-trace branch from 8d68e6f to 214227c Compare October 16, 2026 04:48
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Thanks @Pantoria. I re-reviewed the new head 214227c. Since my last pass it adds status reading each nested memory file's own evidence store, through the shared layerNestedWeights helper. That part is read-only: status builds a State for each nested store but never creates a directory. CI is green on both OSes, no-mistakes is bound to this head, and the PR is still CLEAN against main.

contract-class: still new-default (only for one part), so the hold is unchanged. The redacted, classed reply trace and the per-file status reporting are restores. The skip after 3 unparseable replies is still on for every unconfigured run, and it replaces the README's "retried on the next run" promise. That's Kun's call. This is a captain-decision hold, not waiting on you, and there's nothing for you to do right now.

VISION (per rule): the same verdicts as my last stamp: aligns on all seven. The new nested-store reporting strengthens "Failure is loud and named", because nested give-ups no longer go unseen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants