<!-- task=m-openai-compatible-output-validation-filters/02+01_repeat_guard plan=12 tag=REVIEW_OFR-REPEAT-11 -->

# Repeat guard review follow-up: complete the live run with a verified Go executable

## For the Implementing Agent

Filling the implementation-owned sections in `CODE_REVIEW-*-G??.md` is mandatory. Run every verification command, paste actual notes and stdout/stderr into the active review file, keep the active PLAN/CODE_REVIEW files in place, and report ready for review; only the code-review skill may finalize or archive the task. If blocked, record only the exact blocker, attempted commands/output, and resume conditions in implementation-owned evidence fields. Do not ask the user, call user-input tools, create control-plane stop files, classify the next state, archive logs, or write `complete.log`.

## Background

The eleventh review confirmed that the test-only identity split, exact observation-batch rejection, quiescence guard, deterministic regressions, race checks, related package tests, and repository suite all pass. The required external smoke did not start because its non-login `zsh` could not resolve `go`, so SDD S07 still lacks the isolated 5-concurrent × 3 result. This follow-up changes no source; it proves the login-shell Go executable first and then permits one fresh bounded live invocation.

## Archive Evidence Snapshot

- Predecessor dependency: `agent-task/archive/2026/07/m-openai-compatible-output-validation-filters/01_resume_notice_builder/complete.log` records PASS and satisfies subtask `+01`.
- Earlier same-task loops remain summarized by their active task logs. The current failed pair will be archived as `plan_cloud_G09_11.log` and `code_review_cloud_G09_11.log`.
- Current Required finding: the sole authorized command exited 127 before the Go test process started, leaving no live requests, artifacts, new observation bytes, 15-response/15-correlation summary, or capacity rows.
- Trustworthy evidence: the reviewed test-only delta has SHA-256 `8f0c767d6fb69175c6856fcd58f1398e89b9e13c6597dc950672b14b4013bd21`; fresh reviewer formatting, focused, race, package, and repository tests exited 0. The failed external attempt left the reviewed runtime idle and unchanged.
- Required follow-up: resolve and execute the runner's login-shell Go binary before consuming one fresh authorization, then require a successful isolated `ornith:35b` 5-concurrent × 3 live result.

## Roadmap Targets

- Milestone: `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/openai-compatible-output-validation-filters.md`
- Milestone link: [Milestone document](agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/openai-compatible-output-validation-filters.md)
- Task ids:
  - `repeat-guard`: rolling content/history/action repetition detection and safe continuation
- Completion mode: check-on-pass

## Analysis

### Files Read

- Workflow and rules: `agent-ops/rules/project/rules.md`, `agent-ops/rules/common/rules-roadmap.md`, `agent-ops/rules/common/rules-agent-spec.md`, `agent-ops/skills/common/router.md`, `agent-ops/skills/common/code-review/SKILL.md`, `agent-ops/skills/common/plan/SKILL.md`, `agent-ops/skills/common/finalize-task-routing/SKILL.md`, `agent-ops/skills/common/plan/templates/review-stub-template.md`, `agent-ops/rules/project/domain/edge/rules.md`, `agent-ops/rules/project/domain/platform-common/rules.md`, and `agent-ops/rules/project/domain/testing/rules.md`.
- Verification profiles: `agent-test/local/rules.md`, `agent-test/local/edge-smoke.md`, `agent-test/local/platform-common-smoke.md`, and `agent-test/local/testing-smoke.md`.
- Roadmap and design: `agent-roadmap/current.md`, `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/openai-compatible-output-validation-filters.md`, and `agent-roadmap/sdd/knowledge-tool-optimization-extension/openai-compatible-output-validation-filters/SDD.md`.
- Contracts and specs: `agent-contract/index.md`, `agent-contract/outer/openai-compatible-api.md`, `agent-contract/inner/edge-config-runtime-refresh.md`, `agent-spec/index.md`, `agent-spec/runtime/stream-evidence-gate.md`, `agent-spec/runtime/provider-pool-config-refresh.md`, and `agent-spec/input/openai-compatible-surface.md`.
- Source and tests: the current diff and relevant lifecycle, correlation, SSE, quiescence, capacity, release-sink, and terminal-observation sections of `apps/edge/internal/openai/stream_gate_vertical_slice_test.go`, `apps/edge/internal/openai/stream_gate_runtime.go`, `apps/edge/internal/openai/stream_gate_release_sink.go`, `apps/edge/internal/openai/openai_request_rebuilder.go`, `apps/edge/internal/openai/filter_observation_sink.go`, and `packages/go/streamgate/runtime.go`.
- Task evidence: the active plan/review pair, its routed same-task verdict logs, and `agent-task/m-openai-compatible-output-validation-filters/WORK_LOG.md`.

### SDD Criteria

- SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/openai-compatible-output-validation-filters/SDD.md`; status approved; SDD lock released.
- Targeted scenarios are S03, S04, S07, and S09-S12 for `repeat-guard`. Deterministic evidence for S03, S04, and S09-S12 is already implemented and freshly passing.
- The remaining Evidence Map requirement is S07: at least three capacity+1 long-Korean streaming runs with sanitized provider response, Edge lifecycle/correlation, capacity, and fingerprint/offset or `not_reproduced` evidence.
- PASS requires one isolated invocation that yields five valid provider responses and five exact Edge correlations per run, 15 globally unique identities in each domain, and three accepted capacity rows.

### Verification Context

- No separate `verification_context` handoff was supplied. The current review evidence, approved SDD, local test profiles, and fresh reviewer commands are the repository-native fallback.
- Fresh local reviewer evidence on 2026-07-29: Go `1.26.2`, module `/config/workspace/iop-s1/go.mod`; `gofmt -d`, `git diff --check`, focused Core/Edge race tests, related packages, and `make test` exited 0.
- External Verification Preflight: runner `/Users/toki/agent-work/iop-dev` on Darwin/arm64, branch `feature/openai-compatible-output-validation-filters`, reviewed production ref `d1e32b6e06f7153a4db5a5a08b7026d6dd49fcfb`, test-file-only runner delta, and Go `1.26.3` available in the login environment. The previous non-login launch failed with `zsh: command not found: go`; the new preflight must run `zsh -lic 'command -v go'`, require a non-empty executable path, and invoke that exact path in the same login shell.
- The reviewed runtime uses OpenAI loopback `127.0.0.1:18083`, Node transport `18084`, admin `19093`, and status `127.0.0.1:18001/edges/edge-toki-labs-dev/status`. Existing deployed Edge and Node binaries/processes/listeners must still identify the reviewed ref; no rebuild or config mutation is authorized.
- Immediately before launch, require the only runner source delta to be `apps/edge/internal/openai/stream_gate_vertical_slice_test.go` with the reviewed hash, both selected providers healthy and idle at capacities 3 and 1, blocking `repeat_guard` for `ornith:35b`, writable mode-0600 sanitized observation sink with no forbidden raw fields, bounded non-empty prompt, zero other harness processes, a new empty artifact path, and an unchanged observation identity/size through the quiet-window probe.
- Raw prompt, SSE, output, credentials, and tokens remain under `/tmp/iop-repeat-guard-live/` and outside tracked evidence. Only sanitized identity/lifecycle/capacity/fingerprint/offset and command status enter the review artifact.
- Confidence is high. The only known blocker is shell Go resolution, and the plan resolves it before the one authorized test invocation.

### Test Coverage Gaps

- Local deterministic, race, package, and repository coverage is complete and freshly passing.
- The only gap is the external S07 live result. A command that fails before the Go test process starts does not satisfy it.
- No new unit or source change is justified for a runner shell-path failure.

### Symbol References

- No symbol is renamed or removed in this follow-up.

### Split Judgment

- Keep one verification-only follow-up because the provider-response set, Edge lifecycle set, and capacity rows are one atomic live acceptance result. No source-only child can independently close S07.
- Dependency `+01` remains satisfied by the cited predecessor `complete.log`.

### Scope Rationale

- Modify only the active review evidence artifact. Do not modify production code, tests, contracts, specs, tracked configuration, repeat thresholds, queue behavior, provider selection, or deployed binaries/configuration.
- Do not retry a failed live test. Resolve Go and every runtime/source/isolation precondition before the authorization is consumed; once the test process is launched, any nonzero exit stops the item.
- Do not copy raw prompt, SSE, output, credentials, tokens, or private endpoints into tracked artifacts or stdout.

### Final Routing

- `evaluation_mode=isolated-reassessment`; `finalizer=finalize-task-policy.sh`; `finalizer_mode=pair`.
- Build closures: scope/context/verification/evidence/ownership/decision closed; grade scores `1/2/1/2/2`; base route `local-fit`, final route basis `recovery-boundary`; lane `cloud`; grade `G08`; canonical file `PLAN-cloud-G08.md`.
- Review closures: scope/context/verification/evidence/ownership/decision closed; grade scores `1/2/1/2/2`; route `official-review`; lane `cloud`; grade `G08`; adapter `codex`; model `gpt-5.6-sol`; reasoning effort `xhigh`; canonical file `CODE_REVIEW-cloud-G08.md`.
- `large_indivisible_context=false`.
- Positive loop risks: `temporal_state`, `concurrent_consistency`, `boundary_contract`, `structured_interpretation`, and `variant_product`; count `5`.
- Recovery signals: `review_rework_count=11`, `evidence_integrity_failure=false`; recovery boundary matched.
- Capability gap: none. The work is a bounded external verification using an existing deterministic oracle.

## Implementation Checklist

- [ ] [REVIEW_OFR-REPEAT-11-1] Prove the external login-shell Go executable and all reviewed exact-ref/isolation preconditions, then complete exactly one fresh `ornith:35b` 5-concurrent × 3 live invocation with 15 provider responses, 15 Edge correlations, and three accepted capacity rows.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_OFR-REPEAT-11-1] Complete the isolated live evidence

#### Problem

`agent-task/m-openai-compatible-output-validation-filters/02+01_repeat_guard/CODE_REVIEW-cloud-G09.md:296-330` records exit 127 before the Go process started. The existing harness at `apps/edge/internal/openai/stream_gate_vertical_slice_test.go:2438` already enforces the exact 5×3 workload, quiescent observation offset, disjoint identity validation, strict correlation cardinality, and capacity evidence, but SDD S07 has no successful live result.

Before:

```bash
zsh -c 'go test -timeout 90m -count=1 -v ./apps/edge/internal/openai -run "^TestDevRepeatGuardOrnithSmoke$"'
```

After:

```bash
zsh -lic 'go_bin="$(command -v go)"; test -n "$go_bin"; test -x "$go_bin"; "$go_bin" version; "$go_bin" env GOMOD'
```

Use the resolved executable in the same login shell for the single authorized test launch.

#### Solution

- On the external runner, use a login shell to resolve `go`, require an executable absolute path, and verify version/module output before counting an authorized live invocation.
- Revalidate the reviewed ref, test-only runner delta and hash, deployed runtime identity, listeners, gate, selected provider capacity/idle state, prompt/artifact containment, and observation quiet window. Stop before launch on any mismatch.
- Use a new empty artifact directory `/tmp/iop-repeat-guard-live/repeat-guard-G08-12`; do not delete or overwrite earlier evidence.
- Launch the live Go test exactly once through the same login shell and captured absolute executable. Record actual stdout/stderr and exit status.
- Require `summary.json` to report three runs, 15 unique provider response IDs, 15 unique Edge correlations, three accepted `4/4/>=1/0/0` capacity rows, and a sanitized `reproduced` fingerprint/offset or `not_reproduced` result.
- Prove post-run providers idle, no harness process remains, the runner non-test tree/runtime identity is unchanged, and raw artifacts remain outside the repository.

#### Modified Files and Checklist

- [ ] `agent-task/m-openai-compatible-output-validation-filters/02+01_repeat_guard/CODE_REVIEW-cloud-G08.md` — record login-shell Go preflight, exact runtime/isolation evidence, invocation count, sanitized live result, and cleanup.
- [ ] No source, test, production, contract, spec, tracked config, or deployed runtime change.

#### Test Strategy

- Do not add tests; this follow-up fixes no code. Existing deterministic regressions already cover disjoint provider/Edge identities, extra-group rejection, provider identity boundaries, terminal reconciliation, and observation append/rotation rejection.
- Re-run a fresh focused local test and `git diff --check` to prove the reviewed test-only delta remains intact.
- Execute the existing env-gated live test once after all external preconditions pass. A preflight failure consumes no live authorization; a started Go test consumes the only authorization and must not be retried.

#### Verification

```bash
git diff --check
go test -count=1 ./apps/edge/internal/openai -run 'TestDevRepeatGuard(SmokeEvidence|ObservationCorrelation|ObservationQuiescence|CapacityEvidence)'
```

Expected: both commands exit 0; no source changes are made.

On the external runner, first resolve Go without launching the test:

```bash
zsh -lic '
set -eu
cd /Users/toki/agent-work/iop-dev
go_bin="$(command -v go)"
test -n "$go_bin"
test -x "$go_bin"
"$go_bin" version
"$go_bin" env GOMOD
git rev-parse HEAD
git status --short
shasum -a 256 apps/edge/internal/openai/stream_gate_vertical_slice_test.go
'
```

Expected: Go `1.26.3` is executable, GOMOD is `/Users/toki/agent-work/iop-dev/go.mod`, HEAD is `d1e32b6e06f7153a4db5a5a08b7026d6dd49fcfb`, the only source delta is the reviewed test file, and its hash is `8f0c767d6fb69175c6856fcd58f1398e89b9e13c6597dc950672b14b4013bd21`.

After re-proving the deployed runtime, gate, provider, prompt, sink, empty new artifact directory, zero competing harness, and quiet-window conditions, launch exactly once in the same login shell:

```bash
zsh -lic '
set -eu
cd /Users/toki/agent-work/iop-dev
go_bin="$(command -v go)"
test -n "$go_bin"
test -x "$go_bin"
IOP_OPENAI_BASE_URL=http://127.0.0.1:18083 \
IOP_OPENAI_MODEL=ornith:35b \
IOP_OPENAI_SMOKE_CONCURRENCY=5 \
IOP_OPENAI_SMOKE_RUNS=3 \
IOP_OPENAI_SMOKE_PROMPT_FILE=/tmp/iop-repeat-guard-live/repeat-prompt.txt \
IOP_OPENAI_SMOKE_ARTIFACT_DIR=/tmp/iop-repeat-guard-live/repeat-guard-G08-12 \
IOP_OPENAI_SMOKE_OBSERVATION_FILE=/tmp/iop-repeat-guard-live/edge-observations.jsonl \
IOP_OPENAI_SMOKE_STATUS_URL=http://127.0.0.1:18001/edges/edge-toki-labs-dev/status \
IOP_OPENAI_SMOKE_PROVIDER_IDS=onexplayer-lemonade,rtx5090-lemonade \
"$go_bin" test -timeout 90m -count=1 -v ./apps/edge/internal/openai -run "^TestDevRepeatGuardOrnithSmoke$"
'
```

Expected: invocation count 1, exit 0, five provider responses and five exact Edge correlations per run, 15 globally unique identities in each domain, and three accepted capacity rows with `configured=4`, `peak_in_flight=4`, `peak_queued>=1`, `final_in_flight=0`, and `final_queued=0`. The result is sanitized `reproduced` with fingerprint/offset or `not_reproduced`; post-run providers are idle and raw artifacts remain outside the repository.

## Modified Files Summary

| File | Items |
|------|-------|
| `agent-task/m-openai-compatible-output-validation-filters/02+01_repeat_guard/CODE_REVIEW-cloud-G08.md` | REVIEW_OFR-REPEAT-11-1 evidence |

## Dependencies and Execution Order

1. Dependency `01_resume_notice_builder` is satisfied by the cited predecessor `complete.log`.
2. Re-run the local focused integrity checks.
3. Resolve and verify the login-shell Go executable.
4. Re-prove every exact-ref/runtime/gate/provider/prompt/artifact/observation isolation precondition.
5. Launch the live test once, validate the sanitized summary, prove cleanup, and fill every implementation-owned review section.

## Final Verification

```bash
git diff --check
go test -count=1 ./apps/edge/internal/openai -run 'TestDevRepeatGuard(SmokeEvidence|ObservationCorrelation|ObservationQuiescence|CapacityEvidence)'
```

Then run the exact external login-shell preflight and single live command from `REVIEW_OFR-REPEAT-11-1`. PASS requires exit 0, 15 unique provider response IDs, 15 unique Edge correlations, three accepted `4/4/>=1/0/0` capacity rows, a sanitized `reproduced` fingerprint/offset or `not_reproduced`, unchanged reviewed runtime/source identity, post-run idle state, and no tracked raw evidence.

After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.
