Skip to content

v7.205.6

Choose a tag to compare

@github-actions github-actions released this 23 Nov 08:36
40d3e53

fix(sast): a non-code-only scope with a phase baseline no longer fails SAST with failure_kind: coverage

What changed

  • sast_scan hard-failed with failure_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 only AGENTS.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, empty new_findings, and no error/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_required once 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 with failure_kind: invalid_input; a deleted .md still hard-failing with failure_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_exempt evidence flag could never complete. The flag is set at coder settlement from the declared+observed Markdown-only classification (isMarkdownOnlyTaskChange in src/gate-evidence-classification.ts). The task's dispatch-time review route receipt still demanded the complexity-routed test-engineer count (routeReview always routes at least 1), the Stage-B completeness barrier (requireCompleteEvidence) then permanently failed with ROUTE_RECEIPT_INCOMPLETE, and the durable workflow pinned at reviewer_run. update_task_status reported Missing gates: [] / Contradictions: [all required proof exists but workflow state is reviewer_run], and even the human-only /swarm recover could not advance the wedge (Stage A was already passed, so skipped_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 / enforcePersistedReviewRouteReceipt accept testEngineerExempt; the completeness barrier then covers only the reviewer identities (identity, role, and duplicate validation stays fully authoritative). The settlement barriers (stage-b-gates.ts persistence and advancement, delegation-gate.ts foreground settlement, update-task-status.ts completion and recovery sync) all pass the flag, and the (testEngineerExempt && agent === 'reviewer') advancement clause now fires.
  • All consumption sites now share one predicate, isTestEngineerDurablyExempt in src/gate-evidence.ts (flag set AND test_engineer not in required_gates). Scenario: a task is exempt when its reviewer is dispatched (the route receipt has zero test-engineer slots), then required_gates grows to include test_engineer (for example a designer gate is recorded) while the flag stays true. A reviewer-only settlement is no longer accepted: enforceReviewRouteReceipt now treats a zero-test-engineer receipt as ROUTE_RECEIPT_INCOMPLETE unless 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 at reviewer_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_scan passes (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_VERSION is 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-only tests_run, the task stays at tests_run with test_engineer missing and completion remains blocked (no test-engineer evidence is bypassed). Every same-task dispatch is then refused (TASK_COMPLETION_GATE_VIOLATION). Exit: update_task_status with status=blocked, then the audited forced repair back to in_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, at reviewer_run; the same stuck state was reachable only through paths that skip route completeness (a fail-open router-error receipt, or review_routing.enforce_receipts: false). Tracked in the follow-up issue linked from the PR description.
  • recoverTaskStateFromDelegations is only reached when the registered update_task_status tool 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/#3516 route suites flaked with INVALID_TASK_STATE_TRANSITION: ... coder_delegated -> coder_delegated because ensureAgentSession(..., dir) fires an async rehydrateSessionFromDisk that can land mid-fixture. The fixtures now drain swarmState.pendingRehydrations after session creation and before durable seeding.