Repository navigation
v7.205.6
fix(sast): a non-code-only scope with a phase baseline no longer fails SAST with failure_kind: coverage
What changed
sast_scanhard-failed withfailure_kind: 'coverage'("SAST requires at least one file to scan; zero files were scanned") whenever EVERY input in the scope had no SAST language profile ("non-code") and a phase baseline had been captured earlier in the same phase. Markdown is the headline case (e.g. a documentation task editing onlyAGENTS.md), but any input with no language profile qualifies:.json,.yml,.toml,.tf,.sql, and so on.- The non-code-only pass now applies in legacy AND baseline diff mode (legacy mode already passed; baseline mode is now aligned). It passes with
summary.files_skipped_non_code, emptynew_findings, and noerror/failure_kind. - The hard fail remains for empty input, for capture mode with nothing scannable, and for scopes containing a scannable file that was oversized or binary. A missing or deleted input is counted as skipped, not as non-code, so a scope containing one (including a deleted
.md) still hard-fails.
Why
The issue #2271 bug 3 fix (non-code-only diffs are a legitimate nothing-to-scan PASS) was guarded by !baselineUsed. pre_check_batch always passes phase to sast_scan, so as soon as any earlier task in the phase captured a SAST baseline, every subsequent non-code-only task fell into the zero-coverage hard fail instead of the non-code pass. A baseline cannot make non-code files scannable, and zero scannable inputs cannot produce new findings, so the guard had no protective value. Secrets scanning is a separate hard gate and is unchanged.
Found in the Wirtschaftssimulation loop (session 43d6d1c3-a28f-42f0-851c-056ecc216587, task 1.8): the task's scope was exclusively AGENTS.md, earlier phase-1 code tasks had captured a SAST baseline, and pre_check_batch scanned 0 files, giving failure_kind: coverage and gates_passed: false.
Migration steps
None required.
Known caveats
- Documentation tasks in a swarm loop no longer wedge in
workflow.state: rework_requiredonce a phase SAST baseline exists. - Pinned by tests in
tests/unit/tools/sast-scan-zero-coverage-error.test.ts(baseline-mode non-code pass; mixed Markdown + missing code file failing closed in baseline mode; capture mode with only non-code inputs still hard-failing withfailure_kind: invalid_input; a deleted.mdstill hard-failing withfailure_kind: coverage).
fix(workflow): test-engineer-exempt tasks no longer wedge at reviewer_run with "all required proof exists"
What changed
- A task carrying the durable
test_engineer_exemptevidence flag could never complete. The flag is set at coder settlement from the declared+observed Markdown-only classification (isMarkdownOnlyTaskChangeinsrc/gate-evidence-classification.ts). The task's dispatch-time review route receipt still demanded the complexity-routed test-engineer count (routeReviewalways routes at least 1), the Stage-B completeness barrier (requireCompleteEvidence) then permanently failed withROUTE_RECEIPT_INCOMPLETE, and the durable workflow pinned atreviewer_run.update_task_statusreportedMissing gates: []/Contradictions: [all required proof exists but workflow state is reviewer_run], and even the human-only/swarm recovercould not advance the wedge (Stage A was already passed, soskipped_not_wedged). - Route allocation (
delegation-gate.ts) now routes zero test-engineer slots for a durably exempt task. Observed attribution alone still cannot grant the exemption: only the durable flag can. enforceReviewRouteReceipt/enforcePersistedReviewRouteReceiptaccepttestEngineerExempt; the completeness barrier then covers only the reviewer identities (identity, role, and duplicate validation stays fully authoritative). The settlement barriers (stage-b-gates.tspersistence and advancement,delegation-gate.tsforeground settlement,update-task-status.tscompletion and recovery sync) all pass the flag, and the(testEngineerExempt && agent === 'reviewer')advancement clause now fires.- All consumption sites now share one predicate,
isTestEngineerDurablyExemptinsrc/gate-evidence.ts(flag set ANDtest_engineernot inrequired_gates). Scenario: a task is exempt when its reviewer is dispatched (the route receipt has zero test-engineer slots), thenrequired_gatesgrows to includetest_engineer(for example a designer gate is recorded) while the flag stays true. A reviewer-only settlement is no longer accepted:enforceReviewRouteReceiptnow treats a zero-test-engineer receipt asROUTE_RECEIPT_INCOMPLETEunless the caller passes the exemption (the router always routes at least one test engineer, so a zero-slot receipt for a non-exempt task can only be a stale exempt-time receipt). The task stays atreviewer_run; re-dispatching the reviewer rebuilds the receipt with a test-engineer slot, and the test engineer can then bind, settle and complete the task. - Separately,
sast_scanpasses (nothing to scan) when every input has no SAST language profile, in legacy and baseline diff mode. See the SAST fragment for scope.
Why
Found in the Wirtschaftssimulation loop (session 29b8ccea-6226-4e7d-821a-4486276d1f20, task 1.8): the task's scope was exclusively AGENTS.md, the durable evidence recorded test_engineer_exempt: true with required_gates: ["reviewer"] (both satisfied), but the persisted route receipt for the dispatching session demanded 1 reviewer + 1 test engineer, so routeCompleteForPersistence was false and the workflow stayed at reviewer_run after the reviewer's APPROVED verdict.
Trust note: the exemption is read from the unauthenticated .swarm/evidence/<task>.json (no MAC); it is not backed by the route receipt chain. The dispatch site MACs the route receipt after zeroing the test-engineer slots from that flag.
Migration steps
None required. Route receipts already on disk that list test-engineer slots for an exempt task are honored by the exemption-aware completeness barrier at Stage-B ingest and foreground settlement. For a task already wedged at reviewer_run, re-dispatching the reviewer rebuilds the route receipt at dispatch and overwrites the persisted one (persistReviewRouteReceipt, an atomic overwrite in src/review/routing-enforcement.ts), and Stage-B ingest reads the exemption from the durable evidence, so the reviewer-only completion can then advance the state.
Known caveats
REVIEW_ROUTE_RECEIPT_VERSIONis unchanged, so a zero-test-engineer receipt is schema- and MAC-valid for a pre-fix build, which would still accept reviewer-only completion as complete (mixed-version window only).- Residual stuck state (disclosed, no evidence bypass): if a gate that requires
test_engineer(for example a designer gate) is recorded AFTER a legitimate reviewer-onlytests_run, the task stays attests_runwithtest_engineermissing and completion remains blocked (no test-engineer evidence is bypassed). Every same-task dispatch is then refused (TASK_COMPLETION_GATE_VIOLATION). Exit:update_task_statuswithstatus=blocked, then the audited forced repair back toin_progress, then a coder re-dispatch, which recomputes the exemption as false and runs a full reviewer + test-engineer cycle. It is reachable only when a gate-growing dispatch (for example a designer) settles after the reviewer-only completion. Before this change exempt tasks on the routed path wedged earlier, atreviewer_run; the same stuck state was reachable only through paths that skip route completeness (a fail-open router-error receipt, orreview_routing.enforce_receipts: false). Tracked in the follow-up issue linked from the PR description. recoverTaskStateFromDelegationsis only reached when the registeredupdate_task_statustool is called without a fallback directory, which the registered tool never does, so the recovery clause is exercised by direct callers and tests only; it changes session state only and completion stays gated on the durable evidence.- Regression coverage:
tests/unit/review/routing-enforcement-test-engineer-exempt.test.ts,tests/unit/hooks/review-route-exempt-allocation.test.ts,tests/unit/background/stage-b-doc-only.test.ts,tests/unit/tools/update-task-status-exempt-recovery.test.ts, plus the predicate-pinning and foreground-settlement suites added in the PR-feedback round. - Test stability (no runtime change): the
#3509/#3516route suites flaked withINVALID_TASK_STATE_TRANSITION: ... coder_delegated -> coder_delegatedbecauseensureAgentSession(..., dir)fires an asyncrehydrateSessionFromDiskthat can land mid-fixture. The fixtures now drainswarmState.pendingRehydrationsafter session creation and before durable seeding.