# WO-27: Separate mutation observations from task verification

**Status:** complete; implemented, verified, and pushed to origin/main
**Priority:** P1
**Incident date:** 2026-09-04 PDT / 2026-09-05 UTC
**Program:** [September 4 Telegram long-haul repairs](TELEGRAM-LONGHAUL-2026-09-04.md)

## Observed failure

At 01:54 PDT September 4, scaffold run telegram-64ac9937dc7647a8-1788511366966-1 completed with npm install --no-audit --no-fund 2>&1 | tail -20 as its sole shell command. Its readiness had zero obligations, claims, and verifier receipts. No test/build was executed.

## Evidence

Paths are relative to /home/roko/Documents/Projects/Adjacent. Live files are
observational references; sanitized deterministic fixtures must reproduce the
failure without copying credentials or private conversation content.

- `telegram_test/.omnius/completion-finalizations/telegram-64ac9937dc7647a8-1788511366966-1.json`
- `telegram_test/.omnius/terminal-trajectories/ (matching run)`

## Root cause

postActionVerifier labels a filesystem mtime observation outcomeClass='verified'. The no-todo runner path accepts that as direct task validation, and completionAutoFinalize can then report that changed files were validated. Observation of a successful mutation is weaker evidence than verification of requested behavior.

## Code locations

- `packages/orchestrator/src/postActionVerifier.ts`
- `packages/orchestrator/src/taskValidationEvidence.ts`
- `packages/orchestrator/src/verificationInvocation.ts`
- `packages/orchestrator/src/verificationCommand.ts`
- `packages/orchestrator/src/agenticRunner.ts — no-todo validation recording and completion readiness`
- `packages/orchestrator/src/completionAutoFinalize.ts`
- `packages/orchestrator/tests/completionAutoFinalize.test.ts`
- `packages/orchestrator/tests/agenticRunner-completionReadiness.test.ts`
- `packages/orchestrator/tests/postActionVerifier.test.ts`

## Repair design

- Represent mutation observation and task verification distinctly at the producer/consumer boundary.
- Prevent install/create/edit success and recent mtimes from minting task-validation authority.
- Retain explicit declared verifiers and real successful no-todo test/build verification, scoped to the actual execution and current mutation revision.
- Keep read-only/informational completion possible without inventing test obligations.
- Require fresh verification after a subsequent mutation and preserve truthful terminal summaries.

## Acceptance checklist

- [x] Scaffold edits followed only by dependency installation do not auto-finalize as verified.
- [x] Mutation-only verifier observations cannot satisfy no-todo validation.
- [x] A declared verifier and a real successful no-todo test/build retain valid completion behavior.
- [x] Failed or stale verification cannot authorize completion; a later mutation invalidates earlier verification.
- [x] Read-only tasks do not require artificial build/test steps.
- [x] Focused completion/verifier tests and orchestrator typecheck pass.

## Implementation and verification log

- Post-action audits now explicitly carry `completionAuthority: "none"`.
  Their existing `verified` outcome remains an audit finding for telemetry;
  it cannot establish acceptance of the user's task.
- Added typed task-validation evidence sourced only from a successful declared
  verifier or an assertive validation execution. The selector excludes runtime
  replays, contradictory/mismatched receipts, masked failures, and test/build
  keywords used only as package arguments or file paths.
- No-todo automatic completion requires the typed evidence to match the
  recorded command and turn. Tool-call identity invalidates a preceding pass
  after another tool mutates files in the same turn, while preserving a build
  that writes its own verified artifacts. Later failed checks revoke prior
  validation even when no intervening mutation occurred.
- Added a mocked runner fixture with no subprocess or network execution. The
  initial integration run reproduced both installation commands minting
  `_lastBuildSuccessTurn=0`, and a subsequent same-turn edit leaving that
  validation intact. These three assertions failed before runner integration.
- The explicit custom verifier fixture also exposed an existing producer gap:
  `test -f ...` matched the declared verifier but the generic classifier
  dismissed it as a read-only command. Its successful execution must reach the
  completion ledger as declared verification; read-only tasks themselves gain
  no new test obligation.
- Runner integration now routes explicit declared verifiers into the assertion
  evidence ledger, carries typed authority into both automatic finalization
  boundaries, and invalidates stale authority after mutations or failed checks.
- Verification completed September 5, 2026 UTC, from `packages/orchestrator`:
  - `pnpm exec vitest run tests/taskValidationEvidence.test.ts tests/completionAutoFinalize.test.ts tests/postActionVerifier.test.ts tests/agenticRunner-taskValidationAuthority.test.ts tests/agenticRunner-completionReadiness.test.ts tests/verificationCommand.test.ts tests/completion-provenance-visual-evidence.test.ts` — **92 passed across 7 files**.
  - `pnpm exec vitest run tests/agenticRunner.test.ts -t 'synthesizes truth-based completion when final-turn validation passes'` — **1 passed; 174 unrelated cases skipped**.
  - `pnpm exec tsc --noEmit` — passed.
- The runner regressions use mock backends and mock shell tools. No live model
  request, package installation, service mutation, or installed-package change
  was performed. Git delivery is recorded by the parent work-order owner.

### Independent-review followup after ce40bfca

- Review found that using the filesystem-audit intent parser also rejected real
  commands with launcher options or executable paths, including `pnpm --filter
  @omnius/cli build`, `npm --prefix app run build`, a local `.bin/vitest`, and
  `npx --package typescript tsc --noEmit`. It also treated help/version and
  collection modes as validation.
- Added a literal, quote-aware stage parser on the verification receipt
  boundary and a separate invocation classifier. Launcher options consume
  their values before action classification; executable basenames and inert
  reporting suffixes are handled structurally. Unknown shell expansion stays
  unclassified. Existing historical command matching remains unchanged.
- A matched declared command now has to verify the final state. For example,
  `pnpm test && touch src/example.ts` cannot reuse the earlier test as proof of
  the subsequent edit. `pnpm test && echo done` remains valid; redirected
  reporting that writes a file does not count as an inert suffix.
- An untrusted later check or contradictory execution receipt revokes an
  earlier pass even when the outer success flag is true. Positive protocol
  text cannot override a nonzero exit receipt or restore that stale evidence.
- Final followup verification, from `packages/orchestrator`:
  - `pnpm exec vitest run tests/taskValidationEvidence.test.ts tests/verificationInvocation.test.ts tests/completionAutoFinalize.test.ts tests/postActionVerifier.test.ts tests/agenticRunner-taskValidationAuthority.test.ts tests/agenticRunner-completionReadiness.test.ts tests/verificationCommand.test.ts tests/completion-provenance-visual-evidence.test.ts` — **168 passed across 8 files**, including **25 runner cases**.
  - `pnpm exec tsc --noEmit` — passed.
- All review examples have deterministic regressions. Followup Git delivery is
  pending the parent owner's scoped commit; no runtime publication is implied.

### Full-suite compatibility followup

- The stale-review reconciliation fixture depended on the removed generic
  completion heuristic despite declaring no verifier or edited artifact. It
  now supplies a completed todo with `pnpm test` and a coherent execution
  receipt, asserts declared verification authority, and disables automatic
  finalization only to reach the explicit terminal boundary under test.
- Independent review also reproduced rejected valid Vitest `--run` and
  `--coverage` invocations. Vitest mode options now use their own arity table,
  separate from package-launcher options. Collection still remains inspection
  when mode flags precede `list`; a config file named `list` remains a value.
- Verification from `packages/orchestrator`:
  - `pnpm exec vitest run tests/verificationInvocation.test.ts tests/run-observability.test.ts tests/agenticRunner-taskValidationAuthority.test.ts` — **93 passed across 3 files** (57 invocation, 10 observability, 26 runner cases).
  - `pnpm exec tsc --noEmit` — passed.
- This followup uses mocked execution and adds no live inference or runtime
  state changes. Parent work-order owner handles the scoped commit and push.

## Delivery

- Commits: `ce40bfca, cf966ea3, dc60e5bf` on `origin/main`.
- Clean `pnpm -r build` passed for all 11 workspace packages/apps. Final aggregate suite evidence is in the linked program ledger.

## Publication boundary

Repository repair and deterministic verification are this order's completion
boundary. The user will publish the package and then perform live validation.
No package publication, installed-package replacement, runtime-state repair,
or service restart is authorized by this order.
