Repository navigation
Description
Context
Session-log analysis (Jun 20–Jul 26) shows the post-PR step is pure polling toil: "merge after green", "merge if green", "push then merge the pr when green" appear repeatedly, plus a whole session dedicated to "Check CI on PR #764 and report final verdict." The human's job here is watching a spinner — the judgment (merge or not) only starts once checks are terminal and merge-check has run.
sequant merge already does the judgment half: --check/--scan/--review phases with READY=0 / NEEDS_ATTENTION=1 / BLOCKED=2 exit codes. What's missing is the wait: today you either poll by hand or run merge-check too early against incomplete checks.
Proposal
A --watch mode on sequant merge <issue> that polls the PR's check rollup until all checks reach a terminal state, then runs the normal merge-check phases and reports exactly as today. Terminal-output only — the deliverable is "when this command exits, the verdict is real."
Design constraints:
- It never merges. Same contract as today;
--watchonly moves when the existing report runs. - No daemon, no OS notifications. Foreground poll with a configurable interval and timeout; cross-platform by construction (plain terminal output + exit codes). Users who want notification can chain on the exit code.
- Reuse
GitHubProvider, not rawghcalls in a loop (the Consolidate remaining gh CLI calls into GitHubProvider #443 consolidation). UsestatusCheckRollup(the--json checksfield is known-broken). - Handle the zero-checks trap explicitly. 0 checks after a push often means
mergeable: CONFLICTINGblocked CI dispatch entirely —--watchmust detect that and exit BLOCKED with the reason, not wait forever on checks that will never start.
Acceptance Criteria
-
sequant merge <issue> --watchpolls the PR check rollup until every check is terminal, then runs the standard merge-check phases and prints the normal report. - Exit codes are preserved (READY=0, NEEDS_ATTENTION=1, BLOCKED=2) and a watch timeout exits non-zero with a distinct message; the command never merges.
- A PR whose
mergeablestate is CONFLICTING (or that has zero checks after a dispatch-blocking condition) is detected and reported as BLOCKED with the cause instead of polling until timeout. - Polling uses
GitHubProviderwithstatusCheckRollup; interval and timeout are configurable with sensible defaults, and the implementation is a foreground loop (no background process, no OS-specific notifiers). -
--watchcomposes with the existing--check/--scan/--reviewdepth flags and--post. - Documentation covers the flag in the main README, marketplace README, and docs/.
Out of scope
Auto-merge on READY (human merge gate stays); watching multiple PRs concurrently; desktop/push notifications; re-running or triggering CI.
References
- fix(merge-check): combined-branch-test runs npm test/build without reinstalling deps after a lockfile change → false BLOCKED #803 — recent merge-check correctness fix (same subsystem)
- Known gotcha:
gh pr view --json checksfails;statusCheckRollupis the working field - Known gotcha: 0 checks after push → check
mergeable(CONFLICTING blocks CI dispatch)
Activity
admarble commentedon Jul 26, 2026
Scope note for AC-3, from a live incident (admarble/ad-motion, 2026-07-26): there is a third dispatch-blocked case beyond CONFLICTING/zero-checks — checks exist but runners are never allocated (Actions billing/spending-limit lockout).
Signature: every check concludes
failure~2s after starting with 0 steps, and the only statement of the cause is a check-runs annotation invisible togh pr checks/gh run view:Without handling this,
--watchwould see all checks terminal-failed, run merge-check, and report a red verdict whose cause the user cannot see anywhere. AC-3's contract ("detected and reported as BLOCKED with the cause instead of polling until timeout") should cover it: when all checks fail near-instantly, query the head SHA's check-runs annotations; on ajob was not startedmatch, exit BLOCKED with the annotation text verbatim. All-fail-fast is the trigger condition, so healthy and partially-failing repos never pay the extra API call.Skill-side sibling (same signature,
/qaPhase 1 mapping +/loopexclusion): #820. Fixture JSON captured there — the live evidence disappears once the account's billing is fixed.admarble commentedon Jul 27, 2026
#818 — feat(merge): --watch — wait for CI checks to finish, then run merge-check and report
Open · enhancement, cli
────────────────────────────────────────────────────────────────
→ PROCEED — GitHubProvider confirmed (
src/lib/workflow/platforms/github.ts:72); requirements clear, no existing branch/PRCommands:
sequant run 818 -Q
spec → exec → qa · 6 ACs
────────────────────────────────────────────────────────────────
⚠ AC-3 scope grew via 2026-07-26 comment: third dispatch-blocked case (billing-lockout annotation, all-checks-fail-fast signature) — spec should treat it as in-scope
────────────────────────────────────────────────────────────────
admarble commentedon Jul 27, 2026
Complexity: Standard (6 ACs, ~5 directories)
AC Quality Check
Issue checkboxes have no
AC-N:labels, so the parser stored 0 — IDs assigned inline below (AC-1..AC-6). AC text is otherwise measurable (terminal state, exit codes, named field). No vague/unmeasurable patterns.Scope Assessment
Non-Goals: Present ✅ ("Out of scope": auto-merge on READY, multi-PR concurrent watch, desktop/push notifications, re-running/triggering CI).
--watch+ dispatch-block detection)src/commands,src/lib/merge-check,src/lib/workflow/platforms,docs/,scripts/,bin/Verdict:⚠️ SCOPE_WARNING — cohesive single feature, but new poll-loop module + a new
GitHubProvidersurface + 3 doc sites. Quality loop auto-enabled.Key architectural finding (read before AC verification)
The current
sequant mergedoes not poll CI at all. It runs local batch checks (combined-branch-test,mirroring,overlap-detection,residual-pattern-scan) on feature branches resolved from run logs (src/lib/merge-check/index.ts). It is multi-issue/batch by design, yet AC-1 says singularsequant merge <issue>.--watchis a new pre-step gate layered before the existing checks: resolve issue→PR, poll that PR'sstatusCheckRollupto terminal (or detect a dispatch-block → BLOCKED), then run the existing report unchanged. See Open Questions for multi-issue semantics.Acceptance Criteria
AC-1:
--watchpolls the PR check rollup to terminal, then runs standard merge-check and prints the normal reportVerification: Integration Test
Scenario: Given a PR whose rollup returns PENDING then COMPLETED on a later poll → When
sequant merge <issue> --watchruns → Then it loops until every entry is terminal, then invokesrunMergeChecksand prints the existing report.Assumptions: "Terminal" = CheckRun
status===COMPLETED, StatusContextstate ∈ {SUCCESS,FAILURE,ERROR}(not PENDING/EXPECTED/QUEUED/IN_PROGRESS).AC-2: Exit codes preserved; watch timeout exits non-zero with a distinct message; never merges
Verification: Unit Test
Scenario: Given the timeout elapses before checks are terminal → Then the process exits with a distinct non-zero code (propose 3, reserving 0/1/2 for READY/NEEDS_ATTENTION/BLOCKED) and a "watch timed out after Ns" message; no
gh pr mergeis ever invoked.Assumptions:
getExitCode(merge.ts:27) stays authoritative for the verdict path; timeout is a separate exit before checks run.AC-3: CONFLICTING / zero-checks / billing-lockout dispatch-blocks → BLOCKED with cause, not timeout
Verification: Unit + Integration
Scenario: Three dispatch-block signatures each short-circuit the poll and exit BLOCKED with the cause: (a)
mergeable===CONFLICTING; (b) zero checks after a dispatch-blocking condition; (c) all checks fail-fast → query head-SHA check-run annotations, onjob was not startedexit BLOCKED with the annotation verbatim.Assumptions: Reuse
src/lib/qa/infra-blocked-ci.ts(allChecksFailing,detectInfraBlockedCi,NOT_STARTED_SIGNATURE) — do NOT reimplement. All-fail-fast is the trigger gate so healthy/partial boards never pay the extra annotation API call.AC-4: Polling via
GitHubProvider+statusCheckRollup; configurable interval/timeout; foreground loop onlyVerification: Unit Test
Scenario: Given
--watch→ Then rollup is fetched through a newGitHubProvidermethod usingstatusCheckRollup(never--json checks);--interval/--timeoutdefault sensibly (propose 30s / 30min); the loop is a plain in-processawait sleep— no child process, no OS notifier.Assumptions: New
.option()entries in themergeblock ofbin/cli.ts+ fields onMergeCommandOptions.AC-5:
--watchcomposes with--check/--scan/--reviewdepth flags and--postVerification: Integration Test
Scenario: Given
--watch --scan --post→ Then watch gates first, then the Phase 1+2 checks run and--postpublishes — identical output to a non-watch invocation once checks are terminal.AC-6: Documentation in main README, marketplace README, and docs/
Verification: Manual Test (grep-verified content, not file existence)
Scenario:
--watch/--interval/--timeoutdocumented in:README.md(command table ~L242),scripts/prepare-marketplace.tsREADME_CONTENTtemplate (the marketplace README is generated here, not a standalone file), anddocs/reference/merge-command.md(options table + a usage section).Implementation Plan
Phase 1: GitHubProvider surface (
src/lib/workflow/platforms/github.ts)getStatusCheckRollupSync(prNumber)→gh pr view N --json statusCheckRollup; return typed entries + amapRollupToTerminal/isTerminalhelper.getMergeableStateSync(prNumber)→--json mergeable(MERGEABLE/CONFLICTING/UNKNOWN).getCheckRunAnnotationsSync(headSha)→gh api repos/{owner}/{repo}/commits/{sha}/check-runs→ per-runannotations_url; returnAnnotatedCheck[]shaped fordetectInfraBlockedCi. Head SHA viagh pr view N --json headRefOid.Phase 2: Watch loop module (new
src/lib/merge-check/watch.ts)waitForChecks(prNumber, {intervalMs, timeoutMs}, gh): resolve rollup each tick; classify →{ status: 'terminal' | 'blocked' | 'timeout', reason? }. Dispatch-block order per tick: mergeable CONFLICTING → zero-checks-after-dispatch-block → all-fail-fast annotation scan (reuseinfra-blocked-ci.ts).prNumber; elseviewPRByBranchSyncon the resolved feature branch (both already exist).Phase 3: Wire command + flags
bin/cli.tsmerge block: add--watch,--interval <seconds>,--timeout <seconds>(parseInt). Add fields toMergeCommandOptions(types.ts).mergeCommand(merge.ts): when--watch, runwaitForChecksbeforerunMergeChecks; onblockedprint BLOCKED report + exit 2; ontimeoutprint distinct message + exit 3; onterminalfall through to existing path unchanged.Phase 4: Docs (AC-6) — all three sites in one pass.
Rule Touchpoints
AC-4 ("foreground loop, no background process") and the "it never merges" contract are behavior rules with a single touchpoint — runtime TS only (no SKILL.md duplication, since
mergeis a CLI command, not a skill-driven phase). No skill/runtime split risk here; noted so QA doesn't hunt for a phantom second site.Design Review
src/lib/merge-check/watch.ts; allghaccess inGitHubProvider(honors the Consolidate remaining gh CLI calls into GitHubProvider #443 consolidation the issue mandates).merge.tsonly orchestrates.whileloop withawait sleep(interval), a monotonic deadline, and a per-tick classifier. Rejected: any daemon/notifier (explicit non-goal); rejected reimplementing the billing detector (reuseinfra-blocked-ci.ts).spawnSyncghwrappers onGitHubProvider(matches every sibling method);infra-blocked-ci.tspure predicates for the annotation scan.--watch?" — see Open Questions. (c) "statusCheckRollup terminal detection for mixed CheckRun/StatusContext entries" — must handle both shapes.Feature Quality Planning
All standard checks pass. Notable items:
gh apifailure resilience: annotation fetch must degrade to "not blocked" on 404/rate-limit (the reused detector already guards non-array payloads — preserve that).Derived ACs
Open Questions
--watchsemantics.mergeaccepts[issues...]; AC-1 says<issue>. Recommendation: watch all resolved PRs — proceed only when every PR's rollup is terminal; any PR dispatch-blocked → BLOCKED naming that PR. Impact if wrong: a batchmerge --watcheither errors or silently watches only the first PR.--interval/--timeoutoverridable (AC-4).Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled (SCOPE_WARNING)
Reasoning: New logic module +
GitHubProvidersurface with Unit + Integration verification ACs → testgen stubs the poll/classify + dispatch-block tests before exec. No UI → notestphase. Matches the/assessrecommendation (spec,exec,qa) plus testgen given the unit-test-heavy AC set.Label Review
Current: enhancement, cli
Recommended: enhancement, cli (+
plannedon post)Reason: Accurate — CLI feature enhancement, no breaking/refactor. No
uilabel (no.tsx/.jsx).Quality Loop: Will auto-enable via SCOPE_WARNING.
admarble commentedon Jul 28, 2026
/exec Progress Update — PR #831
Implementation complete.
sequant merge <issue> --watchwaits for CI to reach a terminal state, then runs the standard merge-check report. Never merges.AC Coverage
watch.ts:waitForChecks→merge.ts:runWatchGatefalls through torunMergeChecksgh pr mergein the pathclassifyTickreusesqa/infra-blocked-ci.tsfor the all-fail-fast annotation scanGitHubProvider+statusCheckRollup; configurable; foreground--interval/--timeoutinbin/cli.ts;await sleeploop--postrunMergeChecks, sameoptionsobjectREADME.md,scripts/prepare-marketplace.tstemplate,docs/reference/merge-command.md[]/UNKNOWN/nullon errorKey files
src/lib/merge-check/watch.ts— poll/classify loop (pure core, DI-injectedsleep/now/gh)src/lib/merge-check/watch.test.ts— 20 unit tests (classify, poll, dispatch-blocks, timeout, degrade)src/lib/workflow/platforms/github.ts—getStatusCheckRollupSync,getMergeableStateSync,getPRHeadShaSync,getCheckRunAnnotationsSyncsrc/commands/merge.ts—runWatchGateorchestration;bin/cli.ts+types.ts— flags/fieldsChecks
npm run build✅ ·npm run lint✅ (0 warnings) ·npm test(merge-check + merge) ✅ 96 passedQuality Plan Alignment
Known gaps / notes
--watchwatches PRs sequentially under one shared wall-clock deadline (per spec Open Question feat: Complete remaining v1.0 features (AC-10, AC-13, AC-14) #1).GitHubProviderare thinspawnSyncshells (integration-only, matching every sibling method); the testable logic lives inwatch.tsand is unit-covered.admarble commentedon Jul 28, 2026
QA Review for Issue #818
Reviewed PR #831 @
2d9204a. Core logic reviewed inline; 20 unit tests + build + lint verified locally.AC Coverage
waitForChecksloops until every entry terminal;runWatchGatereturns false → falls through torunMergeChecksunchanged (merge.ts:230,284). Unit-tested (settles after N polls).getExitCodeuntouched (READY=0/NA=1/BLOCKED=2); timeout → exit 3 distinct message; blocked → 2. Nogh pr mergeanywhere in the diff (grep-verified).classifyTick: CONFLICTING short-circuits regardless of check count (covers zero-checks-because-conflicting); all-fail-fast → head-SHA annotation scan reusingqa/infra-blocked-ci.ts. All three unit-tested.GitHubProvider+statusCheckRollup; configurable; foregroundgetStatusCheckRollupSyncuses--json statusCheckRollup(not the brokenchecks);--interval/--timeoutregistered inbin/cli.ts+--helpverified; plainawait sleeploop, no daemon/child/notifier.--check/--scan/--review+--postrunMergeCheckswith the sameoptionsobject; depth flags and--postflow through unchanged.prepare-marketplace.tsdedicated section;docs/reference/merge-command.mdoptions table + exit codes + dispatch-block explanation.[]/UNKNOWN/nullon any error; null-SHA path unit-tested to degrade to terminal, not crash.Coverage: 7/7 AC items met (6 original + 1 derived)
CI Status
CI Summary: 4 passed, 1 pending (build still running — not failing). This is the sole reason the verdict is NEEDS_VERIFICATION rather than READY_FOR_MERGE.
Quality Metrics
any)Test Coverage Analysis
src/lib/merge-check/watch.tswatch.test.ts(20 tests)src/lib/workflow/platforms/github.ts(4 gh wrappers)spawnSyncshells — matches every sibling method; degradation paths unit-covered viawatch.test.tsfakessrc/commands/merge.ts(runWatchGate)watch.tssrc/lib/merge-check/index.tsexportofresolveLogDir(no behavior change)src/lib/merge-check/types.tsCritical-tier (auth/payment/security) files: none.
Code Review
Strengths:
classifyTick,waitForChecks) with injectedsleep/now/gh→ deterministic, fast, well-tested.infra-blocked-ci.tsfor the billing-lockout detector instead of reimplementing it — no sibling divergence.--timeoutbounds the whole gate.Suggestions (non-blocking):
resolveWatchTargetsreusesresolveBranches, which also computes per-issue git-difffilesModified(unused by watch) and prints "No branch found" to stderr. Cosmetic/efficiency only — no correctness impact.Risk Assessment
ghspawnSync wrappers andrunWatchGateconsole/exit-code plumbing have no direct unit test (integration-only). Acceptable — all classification/timing logic lives in the unit-testedwatch.ts./qaviainfra-blocked-ci.tsrather than duplicated.Adversarial Re-Read
Findings: No blocking gaps. (1) Billing-lockout fixture from the issue's 2026-07-26 comment is mirrored by
watch.test.tsBILLING_ANNOTATIONand passes. (2) Exec's evidence (build/lint/20 tests green) is post-implementation validation, not a pre-fix repro. (3) Process state clean — committed, 0 behind main, PR open. (4) No cross-file sibling divergence (detector reused, gh wrappers follow sibling pattern). (5) Non-Goals honored: no auto-merge, multi-PR is watched sequentially not concurrently (concurrent watch is the out-of-scope item), no notifications, no CI triggering.Status: Clean
Verdict: NEEDS_VERIFICATION
All 7 ACs are MET with high code quality and strong unit coverage of the core logic. The only outstanding item is the
build (22.x)CI check, stillIN_PROGRESS(4/5 green, not failing). Per the gating-pending-CI rule, re-run/qa 818once CI completes — expected to flip to READY_FOR_MERGE with no code changes.Documentation
docs/reference/merge-command.mdupdated (AC-6)[Unreleased]entry present (feat(merge): --watch — wait for CI checks to finish, then run merge-check and report (kills the merge-after-green polling loop) #818)Next Steps
build (22.x)to finish, then re-run/qa 818(or merge if green — human merge gate)./docs 818.admarble commentedon Jul 28, 2026
QA Review for Issue #818 (re-run — CI now terminal)
Prior QA at this same SHA (
2d9204a) returnedNEEDS_VERIFICATIONsolely on a pendingbuild (22.x). That check has since gone green, so this is the full-weight re-run rather than a short-circuit. It surfaced one finding the first pass did not.AC Coverage
--watchpolls rollup until terminal, then runs standard phases + normal reportmerge 818 --watch --checkagainst PR #831):Watching PR #831 … all checks terminal after 1 poll(s)→ merge-check ran all 3 phases → normal READY report.getExitCodeuntouched (0/1/2); timeout → distinct exit 3 + distinct message. Diff grep forpr merge/--squash/--rebase: no merge invocation added.classifyTickshort-circuits onCONFLICTINGregardless of check count, which is exactly the zero-checks-because-conflicting trap; plus billing-lockout via head-SHA annotations reusingqa/infra-blocked-ci.ts. All three unit-tested.GitHubProvider+statusCheckRollup; configurable; foregroundgh:--json statusCheckRollup -q .statusCheckRollupreturns the array,mergeable/headRefOidreturn raw strings — all three contracts confirmed, and the known-broken--json checksis not used.--interval/--timeoutpresent inmerge --help. Plainawait sleeploop; no daemon/child/notifier.--check/--scan/--reviewand--postrunMergeCheckson the sameoptionsobject; the live run above used--watch --checktogether successfully.README.md:242;prepare-marketplace.tsdedicated section;docs/reference/merge-command.mdoptions table + exit-code table incl.3+ dispatch-block explanation.ghwrappers return[]/UNKNOWN/nullon any error; null-SHA path unit-tested.Coverage: 7/7 met (6 original + 1 derived).
CI Status
CI Summary: 5 passed, 0 pending, 0 failed. The prior run's sole blocker is resolved.
Quality Metrics
any)tsc)watch.test.ts)Execution Evidence
node dist/bin/cli.js merge 818 --watch --checkmerge --help--watch,--interval,--timeoutlistednpm run buildvitest run watch.test.tsghfield contractsstatusCheckRollup/mergeable/headRefOidEvidence status: Complete
Code Review
Strengths:
sleep/now/gh— deterministic and genuinely fast to test.infra-blocked-ci.tsfor the billing lockout instead of reimplementing it, so/qaandmerge --watchcannot diverge.Issue — unvalidated
--interval/--timeoutproduce an unbounded, un-slept poll loop:bin/cli.tscoerces both flags with a bare(v) => parseInt(v, 10), andmerge.tsapplies defaults withoptions.interval ?? DEFAULT.NaNis not nullish, so a malformed value flows straight through:deadline = start + NaNmakesnowFn() >= deadlinepermanently false, andsetTimeout(NaN)degrades to 0 delay. The result is an infinite tight loop spawningghsubprocesses with no delay and no exit.Reproduced against the real
waitForCheckswith a fake provider:Reachable by ordinary typos (
--timeout abc,--timeout m30). Note--timeout 30msilently parses to30seconds — bounded, but wrong in a way the user won't notice.This also quietly defeats AC-2's guarantee: with a
NaNtimeout there is no timeout exit at all.Not a generic hardening nitpick — it diverges from this repo's own convention. The sibling numeric-input paths all validate:
src/lib/workflow/batch-executor.ts:360—if (!isNaN(maxIter))src/lib/workflow/batch-executor.ts:384—if (!isNaN(autoWait) && autoWait >= 0)src/commands/merge.ts:249—.filter((n) => !isNaN(n))(same file as the new code)Suggested fix (small, belongs in PR #831 rather than a follow-up): clamp in
runWatchGatewhere the defaults are applied —Suggestion (non-blocking, carried from the prior pass):
resolveWatchTargetsreusesresolveBranches, which also computes unused per-issuefilesModifiedand prints "No branch found" to stderr. Cosmetic only.Test Coverage Analysis
src/lib/merge-check/watch.tswatch.test.ts(20 tests)src/lib/workflow/platforms/github.ts(4ghwrappers)spawnSyncshells — matches every sibling method; degradation covered via fakessrc/commands/merge.ts(runWatchGate)types.ts/index.tsCritical-tier (auth/payment/security) files: none.
Risk Assessment
--interval/--timeoutturns the gate into an unbounded zero-delayghspawn loop — plausibly tripping GitHub rate limiting/abuse detection, with no timeout to stop it. Second: a genuinely no-CI PR polls to timeout rather than exiting fast, which is by design and named in the timeout message.runWatchGate's option handling, console output, and exit-code plumbing (the defect above sits in that untested seam); the rawspawnSyncwrappers are integration-only./qaviainfra-blocked-ci.tsrather than duplicated — no divergence. The numeric-flag-validation siblings inbatch-executor.tsandmerge.ts:249do diverge from the new code (finding above).Adversarial Re-Read
Findings: (1) The unvalidated-flag runaway loop above — found by probing
waitForCheckswith malformed values rather than reading the diff, and confirmed as a convention divergence via the sibling scan. (2) Evidence audited: the e2e run, build, and 20 unit tests are post-implementation validations, not pre-fix repros — the one repro I produced (the runaway) is my own and is disclosed as such. (3) Process state inspected: worktree clean, 0 commits behind main, single commit, PR open and MERGEABLE. (4) Sibling sites cited explicitly above, not hand-waved. (5) Non-Goals honored: no auto-merge (grep-verified), multiple PRs are watched sequentially on a shared deadline — the out-of-scope item is concurrent watching — no notifications, no CI triggering.Status: Gaps Found
CHANGELOG Verification
feat(#818):[Unreleased]entry(#818)Sections N/A
Skill Command Verification, Detection Pattern Verification, Skill Change Review (no
skills/**/*.mdchanged) · Build Verification (build passed) · Manual Test ACs (none in spec) · Browser testing (no.tsx) · Quality Plan (none in comments).Verdict: AC_MET_BUT_NOT_A_PLUS
All 7 ACs are literally met and verified at runtime against live GitHub, CI is 5/5 green, and the core logic is well-factored and well-tested. Held back from
READY_FOR_MERGEby one concrete defect:--interval/--timeoutaccept malformed values that produce an unbounded, zero-delay polling loop which never times out — diverging from the numeric-validation convention used elsewhere in this very file, and silently voiding AC-2's timeout guarantee. The fix is a few lines inrunWatchGate.Next Steps
runWatchGate(PR feat(#818): merge --watch — wait for CI checks to finish, then run merge-check and report #831 — fill the gap in the open PR rather than farming a follow-up), ideally with arunWatchGateunit test covering malformed input./qa 818after the fix — expected to flip toREADY_FOR_MERGE.AC_MET_BUT_NOT_A_PLUS, so it breaks to PR review — do not run/loopon it.fix(#818): validate --interval/--timeout so a malformed value cannot …
admarble commentedon Jul 28, 2026
QA Re-Review for Issue #818 — gap fixed
The
AC_MET_BUT_NOT_A_PLUSfinding from the previous review is fixed ina73c820(PR #831). This is the adversarial pass over the fix itself, since gap-fixes introduce their own gaps.What was fixed
--interval/--timeoutwere coerced with a bareparseIntand defaulted with??.NaNis not nullish, so a malformed value reached the loop:deadline = start + NaNmadenow >= deadlinepermanently false andsetTimeout(NaN)degraded to zero delay — an unbounded, no-sleepghspawn loop that also silently voided AC-2's distinct-timeout-exit guarantee.Fixed at two layers, each with a distinct job:
bin/cli.tsparsePositiveSecondsrejects non-integers viaInvalidArgumentError, following the existingvalidatePhasesFlagpattern--timeout 30m→ 30 seconds misparsewatch.tsresolveWatchTimingowns defaults + sanitisation;waitForChecksnormalises its own interval/deadlineMergeCommandOptionscallers get the same guarantee, and the loop becomes structurally incapable of running awaytimeoutMs: 0is deliberately preserved —runWatchGateuses it to mean "shared multi-PR deadline exhausted, poll once then give up." A naive "reject falsy" guard would have broken that; the existing test atwatch.test.tscovering it still passes.Verification — before vs after
Re-ran the exact probe that produced the original finding against the real
waitForChecks:--timeout abc(NaN interval + NaN timeout)status=timeout polls=1801 zeroSleeps=0status=timeout polls=61 zeroSleeps=0status=timeout polls=61 zeroSleeps=0timeout polls=3timeout polls=3(unchanged)CLI layer, verified live:
Dogfooded on its own PR —
merge --watchwaited for the fix commit's CI, then reported:Quality Metrics
merge-check,commands,qa)tsc)a73c820The regression tests are non-vacuous by construction: the fake clock only advances via the injected sleep, so an unguarded loop hangs rather than passing — hence the explicit poll ceiling and the
ms >= 1000floor assertion.Adversarial re-read of the fix
intervalMs: 1000— exactly at the floor, unaffected) before being chosen.timeoutMs: 0: preserved deliberately; the shared-deadline semantic inrunWatchGatedepends on it and remains covered.Math.min(intervalMs, remaining)is unchanged, so the floor cannot push a poll past the deadline.Number.isSafeIntegerrejects absurd values that would overflow the deadline arithmetic.mergeflags changed;run's--timeoutregistrations are untouched (see sibling finding below).Sibling finding → filed as #833
The cross-file sibling scan found the same root cause on
run --timeout, which #818 does not touch:bin/cli.ts:286/:527use a bareparseInt,config-resolver.ts:242applies the same?? default, andphase-executor.ts:982consumes it assetTimeout(..., phaseTimeout * 1000). ANaNthere clamps to0, sorun --timeout abcshould abort every phase instantly — a worse failure than the #818 symptom, and one that will look like an agent problem rather than a bad flag.Filed as #833 rather than folded in here:
runis a different command and tightening its accepted input range needs its own check (notably whether--timeout 0is meaningful there). #833's first AC is to reproduce it before fixing, since I read the call sites but did not execute that path.Gap deliberately not fixed
resolveWatchTargetsreusesresolveBranches, which also computes a per-issuegit diff(filesModified) that watch never reads. I left it as-is: fixing it means adding an option parameter to a function shared with the merge-check report path, trading a real regression risk for one redundant subprocess per issue thatrunMergeChecksperforms moments later anyway. TheNo branch found for issue #Nstderr line it inherits is accurate and useful in watch mode too. Flagging rather than silently skipping — say the word if you'd rather have it changed.Verdict: READY_FOR_MERGE
All 7 ACs met and verified at runtime, the blocking finding is fixed with before/after evidence and non-vacuous regression coverage, CI is 5/5 green on the fix commit, and the feature has now been exercised end-to-end on its own PR. The one remaining known gap is cosmetic and explicitly scoped out above; the sibling defect is tracked in #833.
Next Steps
--watchnever merges, by design).feat(#818): merge --watch — wait for CI checks to finish, then run me…
chore: merge origin/main into feature/817
fix(#833): reject malformed numeric CLI flags instead of coercing the…
docs: 2.10 release-notes section + coverage gaps found by release audit
feat(#818): merge --watch — wait for CI checks to finish, then run me…
fix(#818): validate --interval/--timeout so a malformed value cannot …
chore: merge origin/main into feature/817