Repository navigation
Conversation
The post-run SUMMARY header built its duration with `results.reduce((s, r) => s + r.durationSeconds)`. That equalled wall clock only while `sequant run` executed issues serially; #419 switched to `Promise.allSettled` + `p-limit` (default concurrency 3) and left the summation untouched, so from then on every multi-issue run over-reported by ~the concurrency factor (a 36m 18s run printed 1h 12m). The stored log was always correct, so `sequant logs` and the live summary disagreed ~2×. The orchestrator now owns a single wall-clock value: - `RunOrchestrator.run()` captures `runStartedAt` before any log setup, so the value is independent of the log writer (AC-3: --no-log, log-init failure) and computes the run wall clock once (AC-2). - New `RunResult.wallClockDurationSeconds` carries it to the display; `displaySummary` reads it instead of re-summing (AC-1). - `recordMetrics` derives its `duration` from the same value (sibling site, same double-count bug under --parallel). - The run origin is threaded into the LogWriter → createEmptyRunLog, so the log's stored wall clock and the summary share one start; `sequant logs --last 1` and the SUMMARY header report the same number (AC-7). Regression test drives `displaySummary` from a RunResult through the bug site (AC-6), not `renderSummary({totalDurationSeconds})`: a 3-concurrent fixture whose per-issue sum (3600s) is 3× the wall clock (1200s), the verbatim measured run (36m 18s vs 1h 12m), and a shared-origin cross-check that the log and summary agree (AC-7). A sequential fixture pins the fix as a no-op there (AC-4). Mutation-verified (AC-8): restoring the `reduce` sum at run-display.ts fails exactly the gate test ("prints wall clock for a >2× parallel fixture; logs and SUMMARY agree" — expected 3600 to be 1200) while the AC-4 sequential test stays green. Closes #867 Entire-Checkpoint: 7e42ef01892f
8 tasks
… test QA on #867 surfaced two gaps in the open PR. Both are filled here rather than farmed out as follow-ups. Cross-file sibling (§5). `src/lib/ci/outputs.ts` carried the identical `results.reduce((sum, r) => sum + (r.durationSeconds ?? 0), 0)` in two places: `formatMultiOutputs` (the GitHub Actions `duration` output) and `formatSummary` (the step summary's "Total duration"). Same root cause, different consumer — the issue body's "blast radius is limited to the CLI display" was incomplete. Both now take the run wall clock as a required argument. Required rather than optional-with-sum-fallback because a fallback leaves the defect exactly where it is today, and no-fallback-to-sum is the discipline the rest of this fix already follows. No in-repo callers; `src/index.ts` does not re-export `lib/ci` and the package `exports` map is "."-only, so nothing external can be reached through it either. Producer coverage. There was no `run-orchestrator.test.ts` at all — the code that *produces* `wallClockDurationSeconds` was verified by review only, while the display seam was tested from a hand-built `RunResult`. The empty-issue early return is a hermetic seam (returns before services, git, log writer, or network; passing `baseBranch` skips `detectDefaultBranch`), so the real `RunOrchestrator.run()` can now be driven and the bracket asserted directly, including the `--no-log` path from AC-3. Also collapses the wall-clock subtraction, which this PR had restated at each of the seven `return` sites, into one `wallClock()` closure. Mutation verification --------------------- Each new gate test was mutation-verified by restoring the `reduce` it exists to catch, confirming exactly the expected tests fail, then restoring. Results as actually observed: 1. `formatMultiOutputs` -> restore the sum. Exactly 1 of 14 fails: "reports run wall clock, not the sum of overlapping per-issue durations" (AssertionError: expected '3600' to be '1200'). 2. `formatSummary` -> restore the sum. Exactly 1 of 14 fails: "reports run wall clock in Total duration, not the per-issue sum" (AssertionError: expected '## Sequant Workflow Results…' to contain '**Total duration:** 1200s'). 3. `wallClock()` -> derive from per-issue data instead of the run bracket (empty at this seam, so 0). All 3 of 3 orchestrator producer tests fail: expected +0 to be 2178.334 / 45 / 600. All three assert the bracket, so all three are expected to catch this — noting it because the count is 3, not 1. The AC-4 sequential test stays green throughout all three mutations, pinning the fix as a no-op for serial runs. After restoring: 37 tests pass across run-orchestrator, ci/outputs, and run-display; npm run lint and npm run build clean.
admarble
deleted the
feature/867-fix-cli-post-run-summary-duration-sums-per-issue-t
branch
July 30, 2026 01:55
4 tasks
admarble
added a commit
that referenced
this pull request
Jul 30, 2026
CHANGELOG conflict: both PRs prepended to `### Fixed`. Kept both entries, newest-first, matching the section's existing merge-recency ordering. run-orchestrator.ts auto-merged cleanly and is semantically disjoint: #867's work is run-level wall clock in `run()`/`RunResult`, mine is per-issue `state.completedAt` in `applyProgressEvent`. Verified #868 reads `completedAt` nowhere — the only readers are the #866 code and `cloneIssueState`. Post-merge the tautology detector started failing (3 tests, exit 1). Cause is scope, not quality: `git diff main...HEAD` now includes run-state.test.ts — my new #866 block pulled the whole file in — exposing 16 pre-existing blocks plus mine at 58.6%. Every block there drives production via a helper-built RunOrchestrator and its captured `onProgress` callback, which the detector's imported-name body scan cannot follow. Same limitation and same pragma as run-renderer-672.test.ts; the #866 block is mutation-verified, so its production coverage is proven rather than asserted. App.test.tsx and ElapsedTimer.test.tsx pass the detector unskipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The post-run
SUMMARYheader duration wasresults.reduce((s, r) => s + r.durationSeconds). That was wall clock only whilesequant runexecuted issues serially; #419 replaced the loop withPromise.allSettled+p-limit(default concurrency 3) and left the summation untouched, so every multi-issue run has since over-reported by ~the concurrency factor — a 36m 18s run printed1h 12m. The stored log was always correct (finalizeRunLoguses(end - start)/1000), sosequant logsand the live summary disagreed ~2×.The orchestrator — the only component that brackets the whole run — now owns a single wall-clock value; both consumers derive from it rather than each recomputing.
Changes
run-orchestrator.ts—RunOrchestrator.run()capturesrunStartedAtbefore any service/log setup, computes the run wall clock once, and surfaces it on a newRunResult.wallClockDurationSeconds.recordMetricsderives itsdurationfrom the same value (sibling site with the identical double-count bug under--parallel). The run origin is threaded into theLogWriter.run-display.ts—displaySummaryreadsresult.wallClockDurationSeconds; thereducesum is deleted.log-writer.ts/run-log-schema.ts—LogWriterOptions.startTime/createEmptyRunLog({ startTime })let the log's stored wall clock share the orchestrator's origin, sosequant logs --last 1and theSUMMARYheader report the same number.AC coverage
run-display.ts:196readswallClockDurationSecondsrunStartedAtorigin →RunResult+ log + metrics--no-log/ log-init failurerunStartedAtcaptured before log setup, independent oflogWriterdisplaySummaryfrom aRunResultcaptureSummaryInput/captureStdout, notrenderSummary({...})sequant logsand SUMMARY agree, one fixturefinalizeRunLogMutation verification (AC-8)
Restoring the
reducesum atrun-display.tsfails exactly the gate test —prints wall clock for a >2× parallel fixture; logs and SUMMARY agree(AssertionError: expected 3600 to be 1200) — while the AC-4 sequential test stays green (sum ≈ wall clock there). Fix restored after verifying.Test plan
npm run build— cleannpm run lint— cleannpx vitest runonrun-display,run-orchestrator,log-writer,run-log-schema— 130 passedCloses #867
QA gap closure (second commit)
QA surfaced two gaps against the first commit. Both are filled here rather than deferred to follow-ups.
1. Cross-file sibling:
src/lib/ci/outputs.tsThe issue body's "blast radius is limited to the CLI display" was incomplete.
formatMultiOutputs(the GitHub Actionsdurationoutput) andformatSummary(the step summary's Total duration) each carried the identicalresults.reduce((sum, r) => sum + (r.durationSeconds ?? 0), 0)— same root cause, a third recompute site in a different consumer.Both now take the run wall clock as a required argument. Required rather than optional-with-sum-fallback: a fallback leaves the defect exactly where it is today, and no-fallback-to-sum is the discipline the rest of this fix follows. Safe to make required — there are no in-repo callers,
src/index.tsdoes not re-exportlib/ci, and the packageexportsmap is"."-only, so deep imports are blocked.Per-phase durations in the summary tables are untouched — phases within an issue run sequentially, so only the run-level roll-up was wrong.
2. Orchestrator producer coverage
There was no
run-orchestrator.test.tsat all. The display seam was tested from a hand-builtRunResult, so the code that produceswallClockDurationSecondswas verified by review only. The empty-issue early return is a hermetic seam — it returns before any services, git, log writer, or network, and passingbaseBranchskipsdetectDefaultBranch's shell-out — so the realRunOrchestrator.run()can now be driven and the run bracket asserted directly, including AC-3's--no-logpath.3. Duplication cleanup
The wall-clock subtraction had been restated at each of the seven
returnsites; collapsed into onewallClock()closure.Mutation verification — gap-closure gate tests
Each new gate test was mutation-verified by restoring the
reduceit exists to catch, confirming exactly the expected tests fail, then restoring. Results as actually observed:formatMultiOutputs→ restore the sumexpected '3600' to be '1200'formatSummary→ restore the sumexpected '## Sequant Workflow Results…' to contain '**Total duration:** 1200s'wallClock()→ derive from per-issue data instead of the run bracket (empty at this seam ⇒ 0)expected +0 to be 2178.334 / 45 / 600. All three assert the bracket, so all three are expected to catch this; noted because the count is 3, not 1.The AC-4 sequential test stays green through all three mutations, pinning the fix as a no-op for serial runs. All mutations reverted after verifying.
Test plan — after gap closure
npm run build— cleannpm run lint— cleannpm test(full suite) — 225 files, 4643 passed, 1 expected fail, 2 skipped