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

# Repeat guard review follow-up: complete bounded same-ref live evidence

## 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 ninth review confirmed that the exact reviewed ref `d1e32b6e06f7153a4db5a5a08b7026d6dd49fcfb`, both required providers, aggregate selected capacity 4, the enabled blocking repeat-guard gate, and its sanitized observation sink were restored and evidenced. Fresh focused race-enabled checks pass. The mandatory live harness nevertheless exited 1 during run 1 because the outer `go test` process retained its default 10-minute deadline even though the harness permits up to 20 minutes per HTTP request and 25 minutes per run. This verification-only follow-up authorizes one replacement harness invocation with a bounded long-Korean prompt and an explicit outer timeout compatible with all three sequential runs.

## 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`.
- Prior review loops: `plan_cloud_G10_0.log` through `plan_cloud_G10_8.log` and their matching review logs remain the bounded same-task history.
- Current failed pair after archival: `plan_cloud_G10_9.log` and `code_review_cloud_G10_9.log`; the Required finding is the missing SDD S07 live result after the first authorized harness invocation hit Go's default 10-minute timeout.
- Fresh reviewer evidence: `git diff --check`, the focused Core terminal-fidelity race test, and the focused Edge correlation/capacity race tests exit 0. The same-ref preconditions and post-timeout idle cleanup are trustworthy; no 15-correlation summary or accepted capacity row was produced.
- Required follow-up: revalidate the unchanged same-ref runtime and gate preconditions, provision a bounded long-Korean prompt, and complete exactly one replacement 5-concurrent × 3 live harness invocation with an explicit 90-minute outer test timeout.

## 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/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/PHASE.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`.
- Current 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`.
- Focused harness and runtime evidence: the complete `apps/edge/internal/openai/stream_gate_vertical_slice_test.go` and `packages/go/streamgate/runtime_test.go` test files.
- Task evidence: the active plan/review pair, its bounded prior logs, and the exact predecessor completion log cited above.

### SDD Criteria

- SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/openai-compatible-output-validation-filters/SDD.md`; status approved; SDD lock released.
- Repeat-guard scenarios S03, S04, and S09-S12 have deterministic fixture evidence. The Milestone task additionally requires the dev `ornith:35b` capacity+1 stream smoke.
- S07 and its Evidence Map require a minimum three-run live smoke with sanitized lifecycle and capacity evidence. This plan produces that repeat-guard acceptance evidence only; it does not claim completion of the separate `ops-evidence` task.
- PASS requires the existing deterministic repeat-guard evidence plus one clean same-ref live result containing exactly 15 unique request correlations and three accepted capacity rows.

### Verification Context

- No separate `verification_context` handoff was supplied. Repository rules, the approved SDD, current task evidence, and fresh reviewer commands provide the fallback context.
- Fresh local reviewer evidence on 2026-07-29: Go `1.26.2`, module `/config/workspace/iop-s1/go.mod`; `git diff --check`, the focused Core race test, and the focused Edge correlation/capacity race tests exited 0.
- External runner/workdir: `/Users/toki/agent-work/iop-dev` on macOS/arm64. The immediate preflight must record the branch, exact HEAD, empty `git status --porcelain`, source-sync state, `go version`, and the command workdir. Required endpoints are OpenAI `127.0.0.1:18083`, Node transport `18084`, admin `19093`, and status `127.0.0.1:18001/edges/edge-toki-labs-dev/status`.
- Source and artifact identity: the runner source and all participating exact-ref artifacts identify `d1e32b6e06f7153a4db5a5a08b7026d6dd49fcfb`. The prior preflight recorded Edge SHA-256 `c1dc3b13780ce2421867c2a56575b489136418b24acbae67d86dae6eba48d3cd` and Windows Node SHA-256 `fc269bf238880845c8b0f419b0857b36d34e5953a69514b59f3fbeffbef10f5a`.
- Required providers: `onexplayer-lemonade` capacity 3 and `rtx5090-lemonade` capacity 1, both healthy and advertising `output.repeat_guard`; acceptance requires selected aggregate capacity 4.
- Required gate: the private deployed Edge configuration enables `openai.stream_evidence_gate`, selects the blocking repeat-guard filter for `ornith:35b`, and writes sanitized observations to `/tmp/iop-repeat-guard-live/edge-observations.jsonl`.
- The harness uses a 20-minute request timeout and a 25-minute capacity observer deadline for each of three sequential runs. Therefore the prior outer default of 10 minutes was structurally insufficient; `go test -timeout 90m` bounds the replacement invocation while covering the harness's maximum three-run observation window plus cleanup overhead.
- The replacement prompt must remain raw and untracked under `/tmp/iop-repeat-guard-live/repeat-prompt.txt`. It must request a bounded long-Korean answer of six substantive paragraphs with five to seven sentences per paragraph and must not request recursively multiplied sections or repeated multi-paragraph subsections. Its raw contents must not appear in tracked artifacts or stdout.
- Raw prompt, SSE, output, credentials, and tokens must remain outside this workspace. Tracked evidence and stdout contain sanitized identities, correlations, decisions, fingerprints/offsets, status, and capacity counters only.
- Confidence is high for local correctness and the timeout diagnosis. No live PASS claim is possible until the replacement invocation exits 0 with all required summaries.

### Test Coverage Gaps

- Fatal terminal observation fidelity is covered by `TestRequestRuntimeTerminalFailureFidelity/fatal_filter_overrides_success_terminal`; fresh race PASS.
- Repeat correlation and capacity parsing are covered by `TestDevRepeatGuardObservationCorrelation` and `TestDevRepeatGuardCapacityEvidence`; fresh race PASS.
- Clean same-ref external lifecycle and capacity behavior remains unverified. The 15-request, three-row replacement live run is the only coverage gap.

### Symbol References

- None. This follow-up renames or removes no symbol and plans no production code change.

### Split Judgment

- Keep one verification-only follow-up. Runtime identity, gate activation, request correlation, and capacity recovery form one acceptance proof and cannot independently PASS.
- Dependency `+01` is satisfied by `agent-task/archive/2026/07/m-openai-compatible-output-validation-filters/01_resume_notice_builder/complete.log`.

### Scope Rationale

- Do not modify production code, tests, contracts, specs, tracked configuration, repeat policy, provider selection, queue semantics, correlation logic, or the live harness.
- Do not create a new code commit or publish a different source ref. Every participating runtime must remain on the already reviewed ref `d1e32b6e06f7153a4db5a5a08b7026d6dd49fcfb`.
- This plan authorizes exactly one replacement `TestDevRepeatGuardOrnithSmoke` invocation after all preconditions pass. If a precondition fails, do not invoke it; if the replacement invocation fails, record the evidence and stop without another retry.
- Worker-owned prompt and raw smoke artifacts may be updated only under `/tmp/iop-repeat-guard-live/`; tracked evidence remains sanitized.
- Current specs and contracts already describe the implemented gate and runtime boundaries. A verification-only evidence retry does not require a spec or contract update.

### 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 `2/2/1/2/2`; base and final route basis `grade-boundary`; lane `cloud`; grade `G09`; canonical file `PLAN-cloud-G09.md`.
- Review closures: scope/context/verification/evidence/ownership/decision closed; grade scores `2/2/1/2/2`; route `official-review`; lane `cloud`; grade `G09`; adapter `codex`; model `gpt-5.6-sol`; reasoning effort `xhigh`; canonical file `CODE_REVIEW-cloud-G09.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=9`, `evidence_integrity_failure=false`; risk and recovery boundaries matched without replacing the grade-boundary basis.
- Capability gap: none; the remaining work is a bounded external verification, not a model capability gap.

## Implementation Checklist

- [ ] [REVIEW_OFR-REPEAT-9-1] Revalidate the exact same-ref gate and capacity preconditions, provision a bounded long-Korean prompt, and complete one replacement `ornith:35b` 5-concurrent × 3 live run with an explicit 90-minute outer timeout and the required sanitized evidence.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_OFR-REPEAT-9-1] Complete the bounded replacement live evidence

#### Problem

`code_review_cloud_G10_9.log:54` records the live item as incomplete, and `code_review_cloud_G10_9.log:215` records its failed status because the one authorized harness invocation exited 1 at Go's default 10-minute deadline during run 1. It produced only two worker-owned raw SSE artifacts, no accepted capacity row, and no 15-correlation summary. The Milestone capacity+1 smoke and SDD S07 therefore remain unsatisfied even though the exact-ref runtime, enabled gate, aggregate capacity 4, sanitized preflight observation, and idle cleanup were evidenced.

#### Solution

- Revalidate a clean runner at the exact reviewed ref plus the Edge and both Node binary/runtime identities, process start times, required listeners, provider identities, and healthy selected aggregate capacity 4 immediately before the replacement invocation.
- Revalidate the enabled blocking repeat-guard gate for `ornith:35b` and the writable raw-free observation sink. Record a sanitized observation probe if required to prove the sink remains active.
- Replace the worker-owned prompt with a bounded instruction for six substantive Korean paragraphs of five to seven sentences each. Record only that shape and a sanitized byte count; do not copy the prompt into the review artifact or stdout.
- Ensure the prompt is non-empty and bounded to 256-2048 bytes, rotate or clear only the exact worker-owned raw artifact target for this replacement, and keep all raw evidence under `/tmp/iop-repeat-guard-live/`.
- Run the existing `TestDevRepeatGuardOrnithSmoke` command exactly once as the explicitly authorized replacement invocation, using `go test -timeout 90m`.
- Require exit 0, exactly 15 unique SSE-derived correlations, and exactly three accepted capacity rows with `configured=4`, `peak_in_flight=4`, `peak_queued>=1`, `final_in_flight=0`, and `final_queued=0`.
- Record the sanitized request lifecycle, filter outcomes, capacity rows, and post-run idle cleanup in the active review. If any precondition fails, leave the item unchecked and do not invoke the harness. If the one replacement invocation fails, record the exact failure and stop without a retry.

#### Modified Files and Checklist

- [ ] `agent-task/m-openai-compatible-output-validation-filters/02+01_repeat_guard/CODE_REVIEW-cloud-G09.md` — exact sanitized preflight, replacement command result, 15 correlations, three accepted capacity rows, and cleanup evidence, or exact blocker/failure evidence.
- [ ] No production, test, contract, spec, tracked config, or tracked raw-evidence file changes.

#### Test Strategy

- No new test is planned. Permanent terminal-fidelity, correlation, and capacity fixtures already pass; this item exercises the existing live harness against the exact same-ref dev deployment.
- The explicit outer timeout changes only the test command. The bounded prompt preserves the required long-Korean-output workload while preventing the previous 24-section multiplication.
- A harness or production correction is outside this verification-only scope and requires a recorded plan deviation plus fresh regression evidence before any later live retry can be authorized.

#### Verification

```bash
go version && go env GOMOD
git diff --check
go test -race -count=1 ./packages/go/streamgate -run '^TestRequestRuntimeTerminalFailureFidelity/fatal_filter_overrides_success_terminal$'
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(DevRepeatGuardObservationCorrelation|DevRepeatGuardCapacityEvidence)'
```

Expected: all commands exit 0; focused evidence is fresh and uncached.

After the exact same-ref, gate, prompt-bound, observation-sink, and aggregate-capacity preconditions all pass:

```bash
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 \
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 test -timeout 90m -count=1 -v ./apps/edge/internal/openai -run '^TestDevRepeatGuardOrnithSmoke$'
```

Expected: exit 0; exactly 15 unique sanitized request correlations and three accepted capacity rows satisfying `4/4/>=1/0/0`, with no raw prompt, output, credential, or token in tracked files or stdout.

## Modified Files Summary

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

## Dependencies and Execution Order

1. Dependency `01_resume_notice_builder` is satisfied by the cited predecessor `complete.log`.
2. Preserve the reviewed source and deployed runtime state; provision only the bounded worker-owned prompt and raw artifact target.
3. Revalidate same-ref identities, the enabled blocking gate and observation sink, both healthy providers, aggregate capacity 4, and the 256-2048-byte prompt bound.
4. Run the fresh local checks, then invoke the replacement live command exactly once with `-timeout 90m`.
5. Record sanitized results and post-run idle cleanup, then fill every implementation-owned review section.

## Final Verification

```bash
go version && go env GOMOD
git diff --check
go test -race -count=1 ./packages/go/streamgate -run '^TestRequestRuntimeTerminalFailureFidelity/fatal_filter_overrides_success_terminal$'
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(DevRepeatGuardObservationCorrelation|DevRepeatGuardCapacityEvidence)'
```

Before the live command, prove one clean authorized reviewed ref, exact-ref binaries and running processes for Edge and both providers, aggregate selected capacity 4, the enabled blocking repeat-guard gate, the active sanitized observation sink, and the bounded prompt without exposing raw contents. Keep raw artifacts outside this workspace. Then run the `REVIEW_OFR-REPEAT-9-1` replacement live command exactly once with `-timeout 90m` and require 15 unique correlations plus three `4/4/>=1/0/0` capacity rows. Cached output is not acceptable for focused commands.

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