Repository navigation
Description
Epic: graph-2026-10-fundamentals Tier: judgment Execution: sequant_run Blocked by: #1502
Problem
119 catch clauses in non-test source have empty bodies; 25 are in src/lib/workflow/batch-executor.ts. Each is deliberate and commented ("State tracking errors shouldn't stop execution", "progress errors must not halt"), and the policy is right: a run should not die because a status write failed. What is missing is the other half of the rule. A dropped error leaves no debug line and no count, so when .sequant/state.json drifts it drifts invisibly, and reconcile.ts repairs symptoms whose cause was never recorded. #1469 was the same shape one layer down: a failed git worktree add was absorbed and the run continued in the main checkout; the fix added a failure side-channel so the caller could learn what happened.
Design: src/lib/workflow/suppressed.ts exports noteSuppressed(scope: "state" | "progress" | "cleanup" | "platform" | "other", err: unknown, context?: string). It never throws, writes one debug line through the existing run-log debug path, and increments a per-run counter. log-writer.ts persists suppressed: { total, byScope: Record<scope, number> } as an optional field in run-log-schema.ts (the schema stays version: 1, as its own comments require for optional additions). Display in sequant logs is F-04, because commands/logs.ts is in #1471's scope.
Acceptance Criteria
- AC-1: The helper counts by scope and never throws. Evidence:
npx vitest run src/lib/workflow/suppressed.test.ts→≥ 3 passed, 0 failed(new file: two calls in scopestateand one inprogressyield{total: 3, byScope: {state: 2, progress: 1}}; a sink that throws does not propagate; the counter resets per run) - AC-2: The run log carries the count without a schema version bump. Evidence:
grep -c 'suppressed' src/lib/workflow/run-log-schema.ts→≥ 1 - AC-3: The persisted schema version is unchanged (constraint: holds today, must still hold after AC-2). Evidence:
grep -c 'version: z.literal(1)' src/lib/workflow/run-log-schema.ts→1 - AC-4: batch-executor has no empty catch left. Evidence:
npx tsx scripts/qa/health-report.ts --json | jq '.emptyCatch.byFile["src/lib/workflow/batch-executor.ts"] // 0'→0 - AC-5: Fault injection against the real filesystem. Evidence:
npx vitest run src/lib/workflow/batch-executor.suppressed.integration.test.ts→≥ 2 passed, 0 failed(new file; the.integration.name puts it in the 30 s vitest project; a realStateManageron a temp dir whosestate.jsonischmod 0444so the write fails on the real fs: the issue result is still produced and the written run log has.suppressed.byScope.state >= 1; a throwingonProgresscallback yields.suppressed.byScope.progress >= 1; nofsmock) - AC-6: The baseline moves down with the PR. Evidence:
npx tsx scripts/qa/health-report.ts --check > /dev/null 2>&1 && jq '.emptyCatch.total' scripts/qa/health-baseline.json→≤ 94
Prior fixes / producers
- Prior fixes on this class: fix(run): a failed git worktree add must fail the issue, not run its phases in the main checkout (two CLIs race on .git/config) #1469 (worktree-add failure absorbed → side-channel),
recordWorktreeBaseRef"reports, rather than swallows" (fix(run): a failed git worktree add must fail the issue, not run its phases in the main checkout (two CLIs race on .git/config) #1469 AC-3). Two prior fixes, so this is a class: the AC states the outcome (every dropped error is counted) rather than a call site. - Producers of the run log:
src/lib/workflow/log-writer.ts(writer,writeFileSync:448),run-log-schema.ts(shape). Readers:commands/logs.ts,mcp/tools/logs.ts,mcp/tools/run.ts,run-logs.ts— all owned by refactor(logs): one run-log module — parseLogFile, listLogFiles, resolveLogDir, formatDuration defined once #1471, untouched here.log-rotation.tsreads only filenames.
May touch
src/lib/workflow/suppressed.ts (new), src/lib/workflow/suppressed.test.ts (new), src/lib/workflow/batch-executor.suppressed.integration.test.ts (new, integration project by filename), src/lib/workflow/batch-executor.ts (the 25 catch bodies only; no other change — F-06 splits the function), src/lib/workflow/log-writer.ts, src/lib/workflow/run-log-schema.ts, scripts/qa/health-baseline.json (I-4), CHANGELOG entry.
Non-Goals
- Converting the other 94 empty catches (F-04).
- Showing the count in
sequant logsor the MCP logs tool (F-04, after refactor(logs): one run-log module — parseLogFile, listLogFiles, resolveLogDir, formatDuration defined once #1471). - Changing what any of the 25 sites does after the error; they still continue.
- No edits under
plugin/,.claude/skills/,templates/skills/(I-1).
Done when
A run whose state write fails finishes and its run log says how many errors were dropped and where.
Activity
admarble commentedon Oct 19, 2026
Runner context, 2026-10-19, before launch (fundamentals W2, beside #1509 and #1512; judgment tier, all phases on Opus; stop-at-PR). main = 23a60b3.
Changed since filing:
batch-executor.tsgained the QA verdict attribution in feat(qa): the verdict comment names its reviewer — separate session, driver and model, author's driver and model beside it — and the docs namephases.qa.agentas the independence knob #1521 (ace33fc):attributionFromPhasesand an optionalattributionargument onbuildQaVerdictComment/postQaVerdictComment. Keep it.runIssueWithLoggingis the longest function (1050 lines). Don't grow it: new logic goes insuppressed.ts.Notes:
batch-executor.suppressed.integration.test.ts(vitest project membership, see the graph doc).batch-executor.test.tshas a known timing flake (test(workflow): the #533 label-shortcut tests take ~850 ms with every phase mocked — one hit 5785 ms on CI and turned main red at da9c4fd49 #1560). Don't add timing-sensitive assertions there.batch-executor.tsandlog-writer.ts) is held until this merges.For every phase, and the qa phase by name: run the full suite at most once, in the foreground, under
timeout, after a WIP commit. Each MCP-dispatched phase has a 30-minute wall. Prefer the targetednpx vitest run <files>for the ACs.CHANGELOG: add
[Unreleased]lines under the existing### Added/### Changedheadings, notchangelog.d/fragments, and never add a second heading of the same name.Lint: #1503 made
no-unused-vars,no-empty-object-typeandprefer-consterrors, and knip counts unused exports. Don't export what nothing imports.Health baseline: regenerate
scripts/qa/health-baseline.json(npx tsx scripts/qa/health-report.ts --write-baseline) only to record a metric that went down. Ifnpm run lint:healthreports a rise, restructure so it holds. Otherwise leave the baseline alone and name the rise in the PR body. Owner ruling: aproseGate.linesrise caused by tests in files that mentionSKILL.mdonly as a path may be absorbed, and must be said so.Freeze: nothing under
plugin/,.claude/skills/ortemplates/skills/.admarble commentedon Oct 19, 2026
Complexity: Standard (6 ACs, 3 directories)
AC Quality Check
Every AC is one line and has an
Evidence:clause. I ran each command-shaped Evidence againstmain(23a60b3):grep -c suppressed→ 0.emptyCatch.byFile[batch-executor]→ 25.emptyCatch.total→ 118 (the issue says 119; #1473 changed it)StateManager.saveState(src/lib/workflow/state-manager.ts:243-253) writes a temp file inos.tmpdir()and thenrenameSyncs it overstate.json. On POSIX, renaming over a0444file works when the directory is writable, sochmod 0444 state.jsondoes not make the write fail. I checked this on this machine: renaming over a 0444 file succeeded. With the directory atchmod 0555, the lockopenSync(…".lock","wx")failed withEACCES.acquireLockrethrows anything that isn'tEEXIST(state-manager.ts:113), so everywithLockwrite (updatePhaseStatus,updateIssueStatus, …) throws right away, with no lock-timeout wait. The requirement still holds: the write fails on the real fs, and there is nofsmock. Only the prescribed chmod target is wrong. See Open Question 1.Scope Assessment
Non-Goals: present. Excluded: the other 93 catches (F-04), display in
sequant logs/MCP, changes to what each site does after the error, and the plugin/skills freeze (I-1).src/lib/workflow,scripts/qa, root)Verdict: ✅ SCOPE_OK
Blocker: #1502 is CLOSED, and
scripts/qa/health-report.tsexists on main.Conflict risk: the in-flight #1473 worktree also edits
scripts/qa/health-baseline.json(emptyCatch 118→117) andCHANGELOG.md. Whichever PR merges second regenerates the baseline after merging main (--write-baseline; both changes lower the number). No overlap onbatch-executor.ts/log-writer.ts/run-log-schema.ts. #1509 and #1512 haven't diverged from main.Acceptance Criteria
AC-1: Helper counts by scope and never throws
Verification: Unit Test (
src/lib/workflow/suppressed.test.ts, new)Scenario: Given a fresh run (reset) → When
noteSuppressed("state",…)×2 +("progress",…)×1 → Then the counts are{total:3, byScope:{state:2, progress:1}}. A throwing sink doesn't propagate. A reset zeroes the counts.Assumptions:
byScopehas keys only for scopes that occurred (the AC's expected object has no zero keys). UsetoEqualon exactly that shape.AC-2: Run log carries the count, no version bump
Verification: Unit Test + grep
Scenario: Given
RunLogSchema→ Whensuppressed: z.object({ total: z.number().int().nonnegative(), byScope: z.record(…) }).optional()is added → Then old logs without the field still parse.AC-3: Version stays
z.literal(1)Verification: grep (constraint)
AC-4: No empty catch left in batch-executor
Verification:
health-report.ts --jsonScenario: Every one of the 25 sites gets one call,
noteSuppressed(scope, err, "<context>"), and keeps its existing comment. Control flow doesn't change.AC-5: Fault injection on the real fs
Verification: Integration Test (
src/lib/workflow/batch-executor.suppressed.integration.test.ts, new; the.integration.name puts it in the 30 s project)Scenario: Given a temp dir with a real
StateManagerwhosestate.jsondir ischmod 0555, a realLogWriter(templogPath), and./phase-executor.jsmocked to return success → WhenrunIssueWithLoggingruns and thenlogWriter.finalize()→ Then anIssueResultcomes back and the written JSON has.suppressed.byScope.state >= 1. Case 2: anonProgressthat throws →.suppressed.byScope.progress >= 1.Assumptions: Mocking phase execution is allowed. "No
fsmock" means only fs. CI is ubuntu, non-root. Restore the mode inafterEachso the temp dir can be removed.AC-6: Baseline moves down
Verification:
health-report.ts --check+jq. Regenerate with--write-baseline(allowed, because the metric goes down).Implementation Plan
Phase 1: Helper (
src/lib/workflow/suppressed.ts, new)export type SuppressedScope = "state" | "progress" | "cleanup" | "platform" | "other".counts, plus an optionalsink: ((line: string) => void) | undefined.noteSuppressed(scope, err, context?)increments the count, then callssink?.(\suppressed[${scope}]${context ?${context}: ""}: ${message(err)}`). The whole body is wrapped intry { … } catch { /* never throw */ }`. That catch is non-empty (counting comes first, outside the sink try), or split it so health-report doesn't count a new empty catch.resetSuppressed(sink?)andsuppressedCounts()return a copy. Export only whatlog-writer.tsand the tests import (knip, chore(lint): end the 2026-01 "temporarily relaxed" rules, add knip as an advisory job with a numeric baseline #1503).Phase 2: Persist (
log-writer.ts,run-log-schema.ts)suppressedfield next tosequantVersion, with a doc comment ("optional, so version stays 1").LogWriter.initialize()callsresetSuppressed(this.verbose ? (l) => console.error(l) : undefined).finalize()setsfinalLog.suppressed = suppressedCounts()before writing. Write it every time, even whentotal: 0: a 0 shows "counted and none", and an absent field means an older log (OQ 2).Phase 3: Convert the 25 sites (
batch-executor.ts, catch bodies only)Scope map, taken from the AST walk:
withActivityHook), :1470, :1538, :1559, :1892, :2070, :2094, :2326, :2427, :2435deactivateRelayonPhasePlan(renderer wiring)Change
catch {tocatch (err) {and add one call. Keep the feat(qa): the verdict comment names its reviewer — separate session, driver and model, author's driver and model beside it — and the docs namephases.qa.agentas the independence knob #1521 attribution code. Add no logic torunIssueWithLogging(1050 lines) beyond the one-line calls.Phase 4: Tests, baseline, docs
suppressed.test.ts(AC-1) and the integration test (AC-5). Add no assertions tobatch-executor.test.ts(flake test(workflow): the #533 label-shortcut tests take ~850 ms with every phase mocked — one hit 5785 ms on CI and turned main red at da9c4fd49 #1560). Note that it mocks./log-writer.js, so nothing there changes.npx tsx scripts/qa/health-report.ts --write-baseline. Merge main first if refactor(lib): one definition each for ensureDir, escapeRegex, formatTimestamp, truncateToWidth, parseIssueNumber #1473 has landed.[Unreleased]→ existing### Addedheading. Write ADRdocs/adr/0018-suppressed-error-counter.md.Design Review
src/lib/workflow/suppressed.ts, a leaf module with no imports from batch-executor.LogWriterowns the per-run lifecycle (it already marks run start and end), so it does the reset and the read.LogWriter.initialize(). Rejected: a counter on theLogWriterinstance passed into each site. The issue fixes the signature asnoteSuppressed(scope, err, context?)with no handle, andlogWritercan benullat those sites (logging disabled), which would needlogWriter?.at all 25. A module singleton is safe because each process runs one run (MCP spawnssequant runas a subprocess,mcp/tools/run.ts:106). Concurrent issues inside one run correctly share one count. → The exec PR includes an ADR (docs/adr/0018-…, shape perdocs/adr/README.md).recordWorktreeBaseRef"reports, rather than swallows"). That makes two prior fixes, so this is a class. The plan fixes the class with a reusable helper, and F-04 rolls it out to the remaining 93.git log -S noteSuppressedfinds only the tracker: graph-2026-10-fundamentals — ratchets for function size, dropped errors, the gh seam, prose gates, deprecations and knowledge location #1501 graph doc. No divergence.src/has no debug logger. The only nearby channels areverboseconsole.logandSEQUANT_DEBUG_RENDERER, which belongs to the renderer. The plan uses a verbose-gated stderr sink. The count gets persisted either way (OQ 3).initialize()resets it, and AC-1 asserts the reset.console.error?" stdout is what the renderer draws. The MCP runId capture parses stderr only for its ownrunIdline pattern.createEmptyRunLog/finalizeRunLog(run-log-schema.ts:503,599) feeding the single writerLogWriter.writeLogFile(log-writer.ts:448). There is one writer path, so no parity test is needed. Consumers:commands/logs.ts,mcp/tools/logs.ts,mcp/tools/run.ts,lib/run-logs.ts(owned by refactor(logs): one run-log module — parseLogFile, listLogFiles, resolveLogDir, formatDuration defined once #1471, untouched). The schema isn't.strict(), and the field is optional, so readers are unaffected.log-rotation.tsreads filenames only.Feature Quality Planning
All standard checks pass. Notable items:
Mutation-verified: AC-5 — removed noteSuppressed call from the :1904 state catch; batch-executor.suppressed.integration.test.ts > … failed; restored.plus theSEQUANT_MUTATIONmarker, with the file path first.err instanceof Error ? err.message : String(err), inside the never-throw guard, becauseString()of a hostile object can throw.Open Questions
.sequant/directory ischmod 0555" instead of "whosestate.jsonischmod 0444", because the literal mechanism leaves the write succeeding (shown above). Impact if unchanged: exec implements the directory form to meet the stated outcome, and a literal-reading/qaflags the mismatch.suppressedwhen the total is 0? — Recommendation: yes, always write it. Impact: minimal, because no exact-shape tests on finalized logs exist (grep found none).verbose, otherwise no line (the count is still kept). Impact: if the owner wants a line in every run, add a boundedlastErrorsarray to the log. That is scope growth, better left to F-04.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: SCOPE_OK, one feature, and the AC text already names exact test files and shapes. I skip testgen on purpose, even though AC-1 and AC-5 declare test evidence: the issue fixes the file names and assertions, and an extra phase eats into the 30-minute-per-phase budget without adding information. There is no
/assesscomment to reconcile.Label Review
Current: graph-2026-10-fundamentals
Recommended: +
planned, +enhancementReason: new helper plus a schema field. No UI, so no
testphase.Quality Loop: won't auto-enable (SCOPE_OK).
admarble commentedon Oct 19, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 6/6 met
Gaps:
batch-executor.ts:1262:stateManager.updateAutoWait(...).catch(() => { /* Never let state bookkeeping disturb a live wait. */ })is the same defect class, a dropped state error, and it is still uncounted.health-reportcounts only emptycatch {}clauses, not.catch(() => {})callbacks, so AC-4 passes literally. But the issue's "Done when" ("its run log says how many errors were dropped and where") is not fully true for an auto-wait run on a read-only state dir. The issue limits the change to "the 25 catch bodies only", so this is a scope decision for the owner, not an exec defect.Suggestions:
--verbose, thesuppressed[...]lines go to stderr. When a run fails, the MCP tool returnsstderr.slice(-1000)as the error (run.ts:457), so on a verbose run these lines can push the real error out of that tail. Minor, and it only happens with verbose on.fix(#1504): count the dropped updateAutoWait state error (QA finding;…
admarble commentedon Oct 19, 2026
Execution Verification (runner, 2026-10-19), PR #1564 @ 25639b5
The runner re-ran AC-1..AC-6 verbatim:
11092(≤ 94)AC-5 mutation repeated: deleting every
noteSuppressed("state"…)call fails "a state write that fails on the real fs still yields a result, and the log counts it under state". Restored.Runner fix from QA's open finding:
updateAutoWait(...).catch(() => {})atbatch-executor.ts:1262dropped a state error uncounted, the same defect class. It now callsnoteSuppressed("state", err, "updateAutoWait"). There is no direct test, because the auto-wait path needs a live wait; the 159 tests in the three affected files pass.For the owner — baseline:
functions.longest.lines(runIssueWithLogging) rises from 1050 to 1071 in exec's regenerated baseline, plus 1 line from the runner's fix, so 1072 on the tree.emptyCatch.totalfalls from 117 to 92.lint:healthreads 'rose 1071 → 1072' until you rule.New ADR-0018 is 'Proposed'; accepting it is yours (D-4).
chore(#1504): baseline records longest 1072 (owner-accepted: 21 conve…
chore(#1512): merge main (#1504); baseline keeps proseGate 63 / 29533
chore(#1509): merge main (#1504, #1512); baseline over200 7 / over400 2
fix(#1525): the QA hook reports ids the QA output names but the issue…
feat(#1525): one producer for per-AC status — parse the QA phase outp…