<!-- task=m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence plan=9 tag=REVIEW_OFR-S07-CHANNEL-EVIDENCE-9 -->

# Preserve output channels and close S07 evidence

## For the Implementing Agent

Filling implementation-owned sections in `CODE_REVIEW-cloud-G08.md` is mandatory. Implement the scoped change, run every applicable verification command, record actual notes and output in the review file, keep the active pair in place, and report ready for official review.

If blocked, record the exact blocker, attempted commands/output, mutation and invocation counts, and resume condition only 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`.

The remote portion authorizes one fresh isolated source overlay and a bounded foreground S07 campaign of at most three model invocations after every gate passes. Every invocation must use the same reviewed source/overlay/runtime identity and a fresh immutable plan-9 attempt artifact. It does not authorize an Edge build, replacement, restart, rollback, config change, checkout mutation, credential mutation, or any retry that requires a code, configuration, runtime, or evidence-contract change.

## Background

Plan 8 fixed continuation-native provider identity evidence and the live request deadline, but its sole S07 invocation exposed a channel-collapsing smoke defect. The preserved raw-free audit shows that all five responses were non-repeating within content and reasoning separately, while four appeared repeating only after the smoke concatenated those channels. This follow-up changes only the test harness, preserves the deployed plan-7 candidate, and uses one bounded capacity+1 campaign so transient execution failures do not force a new plan while contract failures still stop immediately.

## Archive Evidence Snapshot

- `plan_cloud_G09_8.log` / `code_review_cloud_G09_8.log`: FAIL with two Required findings and trusted evidence.
- Fresh uncached focused and full local profiles pass. The ordered provider identity list and bounded 25-minute deadline implementation remain accepted.
- The sole plan-8 invocation exited during run 1 with `released repeated downstream content`; no accepted `summary.json` exists, and the partial artifact remains preserved.
- A reviewer-owned read-only audit found five SSE files. Each file was non-repeating when content and reasoning were evaluated separately; four were repeating only after `devRepeatGuardSmokeText` concatenated reasoning before content. No reasoning alias appeared twice in one event.
- Remote checkout `750cb1d1cb88066a10d3c703c99f1326306d8e15` is clean. Edge PID `20646` serves the unchanged deployed plan-7 candidate, listens on five Edge ports, has four connected nodes and idle healthy `3+1` capacity, and the Control Plane status surface remains available on `18001`.
- Fresh plan-9 source/campaign-root paths are absent and no live harness is running. Preserve every plan-9 attempt independently together with plan-8 and all earlier artifacts.

## 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

- `apps/edge/internal/openai/stream_gate_vertical_slice_test.go`
- `apps/edge/internal/openai/stream_gate_tunnel_codec.go`
- `apps/edge/internal/openai/stream_gate_filters.go`
- `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/plan_cloud_G09_8.log`
- `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/code_review_cloud_G09_8.log`
- `agent-ops/rules/project/domain/edge/rules.md`
- `agent-ops/rules/project/domain/testing/rules.md`
- `agent-test/local/rules.md`
- `agent-test/local/edge-smoke.md`
- `agent-spec/runtime/stream-evidence-gate.md`
- `agent-spec/input/openai-compatible-surface.md`
- `agent-contract/outer/openai-compatible-api.md`
- `agent-roadmap/phase/knowledge-tool-optimization-extension/PHASE.md`
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/openai-compatible-output-validation-filters.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/openai-compatible-output-validation-filters/SDD.md`

### SDD Criteria

- SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/openai-compatible-output-validation-filters/SDD.md`; status approved, lock released.
- S03 maps to `repeat-guard` and requires content/reasoning channel provenance, safe stream-open continuation, duplicate-prefix suppression, and one final `[DONE]`.
- S07 requires the capacity+1 `ornith:35b` stream smoke for three runs with sanitized `reproduced` fingerprint/offset or `not_reproduced` evidence.
- Evidence Map S03 requires channel-safe continuation and a single terminal. Evidence Map S07 requires the dev smoke and raw-free operational evidence.
- The checklist therefore fixes only channel-preserving downstream evidence, keeps the provider/Edge identity and terminal grammar intact, adds a deterministic cross-channel false-positive fixture, and requires one accepted summary from a bounded fresh-attempt S07 campaign before reporting only `repeat-guard`.

### Verification Context

- No separate verification handoff was supplied. Repository-native sources are `agent-test/local/rules.md`, `agent-test/local/edge-smoke.md`, the selected SDD, the current test harness, and the archived plan-8 verdict/evidence.
- Local setup is `go version && go env GOMOD`; fresh unit profile is `go test -count=1 ./packages/go/streamgate ./apps/edge/internal/openai`; lint is `git diff --check`.
- Current local runner is `/config/workspace/iop-s1`, Go `go1.26.2 linux/arm64`, module `/config/workspace/iop-s1/go.mod`. Focused and full profiles passed during review.
- Raw token, Authorization header, prompt, model output, raw SSE, and status payload content must not enter tracked evidence or chat output.

#### External Verification Preflight

- Runner/workdir: `ssh toki@toki-labs.com`; immutable base checkout `/Users/toki/agent-work/iop-dev`; Darwin/arm64; `/opt/homebrew/bin/go` `go1.26.3`.
- Base checkout is clean at `750cb1d1cb88066a10d3c703c99f1326306d8e15`; sibling module is `/Users/toki/agent-work/proto-socket/go`.
- Runtime identity: Edge PID `20646`, binary/config `build/dev-runtime/bin/edge` / `build/dev-runtime/edge.yaml`; five Edge TCP listeners are `18082`, `18083`, `18084`, `19093`, and `19101`; Control Plane status is `127.0.0.1:18001`.
- Runtime hash matches `/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-7-source/edge.candidate`. Four nodes are connected; selected provider capacity `3+1` is healthy and idle.
- Plan-8 source/result artifacts remain preserved without an accepted summary. Fresh paths are `/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9-source` and campaign root `/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9`; both are absent. Attempt artifacts must be immutable children `attempt-1` through `attempt-3`.
- No S07 harness is running. Host-local SOPS token ref `toki-dev-pi` is the only authorized credential path and must be used without printing the token, header, or hash.
- Source sync mismatch is expected. Create a fresh isolated tree from remote HEAD and overlay the two unchanged deployed-candidate source files plus the modified vertical-slice test. Do not edit the remote checkout or rebuild/restart the Edge.
- Confidence is high for the channel-collapse diagnosis and runtime identity. The live result remains probabilistic; either accepted S07 classification is valid.

### Test Coverage Gaps

- Existing SSE fixtures validate identity and terminal grammar but do not prove that downstream repeat inspection preserves content/reasoning channels.
- No deterministic fixture proves that identical 64-rune tails in two different channels are not a repeat, while duplicated content or duplicated reasoning in one channel is a repeat.
- No fixture pins the production tunnel codec precedence when both `reasoning_content` and `reasoning` are present.
- Local fixtures cannot produce final capacity and live-provider evidence; the fresh plan-9 isolated overlay and bounded S07 campaign close that gap.

### Symbol References

- `devRepeatGuardSmokeText` is defined in `apps/edge/internal/openai/stream_gate_vertical_slice_test.go` and called only by `runDevRepeatGuardSmokeAttempt` in the same file. Replace it with channel-aware test helpers and update that single call site.
- No public or production symbol changes.

### Split Judgment

Keep one packet. The compact invariant is that the same live harness must preserve content/reasoning channel provenance while validating each logical SSE response, correlate the resulting 15 request rows with Edge lifecycle evidence, and produce the accepted summary. A separate test-only evidence packet cannot independently close S07.

### Scope Rationale

- Modify no production Stream Gate, tunnel codec/sink, handler, service, config, contract, spec, roadmap, runtime, or remote checkout file.
- Do not weaken provider ID, logical terminal, global uniqueness, capacity, observation, or cleanup checks.
- Do not compare content with reasoning or concatenate channels before repetition detection.
- Remote writes are limited to the fresh plan-9 source path, campaign root, immutable attempt children, and ignored raw run artifacts. Preserve the deployed binary/process/config, credentials, and every prior artifact.

### Final Routing

- `evaluation_mode=isolated-reassessment`
- `finalizer=finalize-task-policy.sh`, `finalizer_mode=pair`
- Build closures: scope/context/verification/evidence/ownership/decision are all true; no capability gap.
- Build scores: scope coupling 2, state/concurrency 2, blast/irreversibility 0, evidence/diagnosis 2, verification complexity 2; grade `G08`; base basis `local-fit`, final basis `recovery-boundary`; lane `cloud`; filename `PLAN-cloud-G08.md`.
- Review closures are all true. Review scores are `2/2/0/2/2`; grade `G08`; basis `official-review`; lane `cloud`; filename `CODE_REVIEW-cloud-G08.md`; adapter `codex`, model `gpt-5.6-sol`, reasoning effort `xhigh`.
- `large_indivisible_context=false`
- Positive loop-risk signatures: `temporal_state`, `concurrent_consistency`, `boundary_contract`, `structured_interpretation`, `variant_product`; `loop_risk_count=5`.
- `review_rework_count=9`
- `evidence_integrity_failure=false`

## Implementation Checklist

- [ ] [REVIEW_OFR-S07-CHANNEL-EVIDENCE-9-1] Replace the flattened downstream text probe with content/reasoning channel-aware evidence that mirrors production reasoning alias precedence, and add deterministic cross-channel nonrepeat plus same-channel content/reasoning repeat fixtures; run fresh local profiles.
- [ ] [REVIEW_OFR-S07-CHANNEL-EVIDENCE-9-2] Build and test a fresh isolated plan-9 source overlay, prove the deployed candidate and idle `3+1` runtime remain unchanged, run a classified foreground 5-concurrent x 3-run S07 campaign of at most three immutable attempts, and validate one accepted sanitized summary plus cleanup evidence.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_OFR-S07-CHANNEL-EVIDENCE-9-1] Preserve downstream channel provenance

#### Problem

`apps/edge/internal/openai/stream_gate_vertical_slice_test.go:3143` calls `devRepeatGuardSmokeText`, which appends `reasoning_content`, `reasoning`, and `content` into one string at lines 3364-3366 before applying `openAIRepeatedSuffix`. This creates a false repeat across channel boundaries. The preserved plan-8 audit found no within-channel repeat in any of five responses, but the flattened probe marked four as repeated.

#### Solution

Replace the flattened helper with a small channel evidence type containing separate content and canonical reasoning builders. Mirror `decodeChatTunnelFrame`: use `reasoning_content` when present, otherwise `reasoning`; never append both aliases for one choice. Apply `openAIRepeatedSuffix(..., 64)` independently to content and reasoning, and report downstream repetition when either channel repeats.

Before:

```go
output := devRepeatGuardSmokeText(raw)
_, _, downstreamRepeated := openAIRepeatedSuffix([]rune(output), 64)
```

After:

```go
channels := devRepeatGuardSmokeChannels(raw)
downstreamRepeated := channels.contentRepeated(64) || channels.reasoningRepeated(64)
```

#### Modified Files and Checklist

- [ ] `apps/edge/internal/openai/stream_gate_vertical_slice_test.go` - channel-aware parser, per-channel repeat check, production alias precedence, and deterministic regressions.
- [ ] `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/CODE_REVIEW-cloud-G08.md` - record exact fixture coverage and fresh verification output.

#### Test Strategy

Add `TestDevRepeatGuardDownstreamRepeatEvidence` in `apps/edge/internal/openai/stream_gate_vertical_slice_test.go`. Use a 64-rune token to prove: one copy in reasoning plus one identical copy in content is not a repeat; two copies in content are a repeat; two copies in reasoning are a repeat; and simultaneous `reasoning_content`/`reasoning` uses only the production-precedence value. Keep the existing success/error/identity and batch-correlation fixtures unchanged.

#### Verification

```bash
go test -count=1 ./apps/edge/internal/openai -run '^(TestStreamGateChatTunnelRepeatRecoveryExhaustionTerminatesSSE|TestDevRepeatGuardDownstreamRepeatEvidence|TestDevRepeatGuardRequestDeadline|TestDevRepeatGuardSmokeEvidence|TestDevRepeatGuardObservationCorrelation|TestDevRepeatGuardCapacityEvidence)$'
go test -count=1 ./packages/go/streamgate ./apps/edge/internal/openai
git diff --check
```

Expected: all commands exit `0`; the focused and package tests are uncached, the cross-channel fixture is accepted, and each same-channel duplicate is rejected as downstream repetition.

### [REVIEW_OFR-S07-CHANNEL-EVIDENCE-9-2] Run one bounded plan-9 S07 campaign

#### Problem

The deployed candidate is healthy and the plan-8 artifacts diagnose a test-only false positive, but no complete three-run summary exists. Local fixtures cannot prove the required capacity+1 live evidence. Treating every transient provider, transport, or request-deadline failure as a consumed plan creates unnecessary plan/review cycles even when the reviewed source and runtime are unchanged.

#### Solution

Create a fresh isolated source tree from the clean remote HEAD, overlay exactly the three files needed to represent the deployed candidate plus the corrected test, verify hashes, and run the complete profile remotely. Do not build or deploy an Edge binary.

Use one campaign root with immutable attempt directories. Start attempt 1 after all gates pass. Attempts 2 and 3 are authorized only when the preceding failure is classified `retryable-transient`, a raw-free cleanup probe proves the harness absent and both providers idle, the source manifest/runtime PID/runtime hash/listeners/checkout remain identical, no accepted summary exists, and the next attempt has a fresh path. Retryable failures are limited to provider HTTP `429/502/503/504`, connection reset/EOF after the harness is confirmed absent, or a request deadline without any contract/assertion failure. Any validator, SSE, terminal, identity, channel, correlation, capacity, summary, panic/race, credential, source/runtime drift, or cleanup failure is `non-retryable` and stops the packet.

Do not retry the same normalized transient failure twice. Do not start a new attempt when fewer than 90 minutes remain in the 210-minute campaign budget. Never interrupt a live foreground attempt to satisfy the campaign budget; the budget only gates whether another attempt may start. Record a raw-free attempt ledger containing ordinal, source/overlay/runtime identity, exit status, failure class, cleanup result, and cumulative `invocation_count`. Perform one official review after success, a non-retryable failure, repeated transient failure, or budget/attempt exhaustion.

From the local workspace:

```bash
set -euo pipefail
remote=toki@toki-labs.com
remote_repo=/Users/toki/agent-work/iop-dev
stage_root=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9-source
source_root="$stage_root/iop"
manifest=$(/usr/bin/mktemp -t iop-plan-9-overlay.XXXXXX)
files=(
  apps/edge/internal/openai/stream_gate_release_sink.go
  apps/edge/internal/openai/stream_gate_tunnel_codec.go
  apps/edge/internal/openai/stream_gate_vertical_slice_test.go
)
sha256sum "${files[@]}" >"$manifest"

ssh -o BatchMode=yes -o ConnectTimeout=15 "$remote" '/bin/zsh -lc "exec /bin/zsh -s"' <<'REMOTE'
set -euo pipefail
remote_repo=/Users/toki/agent-work/iop-dev
stage_root=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9-source
source_root="$stage_root/iop"
test ! -e "$stage_root"
test "$(cd "$remote_repo" && git rev-parse HEAD)" = 750cb1d1cb88066a10d3c703c99f1326306d8e15
test -z "$(cd "$remote_repo" && git status --porcelain)"
/bin/mkdir -p "$source_root" "$stage_root/proto-socket"
(cd "$remote_repo" && git archive HEAD) | /usr/bin/tar -xf - -C "$source_root"
/usr/bin/ditto /Users/toki/agent-work/proto-socket/go "$stage_root/proto-socket/go"
print -r -- 750cb1d1cb88066a10d3c703c99f1326306d8e15 >"$stage_root/base-head"
REMOTE

/usr/bin/tar -cf - "${files[@]}" |
  ssh -o BatchMode=yes -o ConnectTimeout=15 "$remote" "/usr/bin/tar -xf - -C '$source_root'"
scp -q -o BatchMode=yes -o ConnectTimeout=15 "$manifest" "$remote:$stage_root/overlay.sha256"
ssh -o BatchMode=yes -o ConnectTimeout=15 "$remote" \
  "cd '$source_root' && /usr/bin/shasum -a 256 -c '$stage_root/overlay.sha256'"
```

Run the isolated profile and prove the unchanged deployed candidate:

```bash
ssh -o BatchMode=yes -o ConnectTimeout=15 toki@toki-labs.com '/bin/zsh -lc "exec /bin/zsh -s"' <<'REMOTE'
set -euo pipefail
stage_root=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9-source
source_root="$stage_root/iop"
runtime_root=/Users/toki/agent-work/iop-dev
plan7_source=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-7-source
cd "$source_root"
/usr/bin/shasum -a 256 -c "$stage_root/overlay.sha256"
/opt/homebrew/bin/go version
/opt/homebrew/bin/go test -count=1 ./packages/go/streamgate ./apps/edge/internal/openai
runtime_hash=$(/usr/bin/shasum -a 256 "$runtime_root/build/dev-runtime/bin/edge" | /usr/bin/awk '{print $1}')
candidate_hash=$(/usr/bin/shasum -a 256 "$plan7_source/edge.candidate" | /usr/bin/awk '{print $1}')
test "$runtime_hash" = "$candidate_hash"
test -z "$(cd "$runtime_root" && git status --porcelain)"
listeners=$(/usr/sbin/lsof -nP -a -p 20646 -iTCP -sTCP:LISTEN | /usr/bin/awk 'NR>1{print $9}' | /usr/bin/sort | /usr/bin/tr '\n' ',')
test "$listeners" = '*:18082,*:18083,*:18084,*:19101,127.0.0.1:19093,'
print -r -- "remote_plan9_gate=PASS base_head=$(<"$stage_root/base-head") runtime_hash=$runtime_hash edge_listeners=5 edge_restart_count=0 invocation_count=0"
REMOTE
```

After all gates pass, use one caller-owned foreground SSH session per authorized attempt. Set only the local `attempt` literal to the next unused ordinal. Attempt 1 is mandatory; attempts 2 and 3 require the retry gate above. Repeat the source/runtime/authentication and two-sample idle gates before every `remote_live_start`. Any exit after `remote_live_start` consumes that ordinal and increments `invocation_count`.

```bash
attempt=1
case "$attempt" in 1|2|3) ;; *) exit 2 ;; esac
ssh -o BatchMode=yes -o ConnectTimeout=15 toki@toki-labs.com \
  "IOP_S07_ATTEMPT=$attempt /bin/zsh -lc 'exec /bin/zsh -s'" <<'REMOTE'
set -euo pipefail
set +x
attempt=${IOP_S07_ATTEMPT:?}
source_root=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9-source/iop
stage_root=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9-source
artifact_root=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9
artifact_dir="$artifact_root/attempt-$attempt"
runtime_root=/Users/toki/agent-work/iop-dev
plan7_source=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-7-source
secret=/Users/toki/.config/iop/secrets/dev-openai-toki.sops.yaml
age_key=/Users/toki/.config/sops/age/keys.txt
api_key=''
cleanup() { unset api_key; }
trap cleanup EXIT

test ! -e "$artifact_dir"
test ! -e "$artifact_root/accepted-attempt"
! /usr/bin/pgrep -fl '[T]estDevRepeatGuardOrnithSmoke' >/dev/null
cd "$source_root"
/usr/bin/shasum -a 256 -c "$stage_root/overlay.sha256"
test "$(/usr/bin/shasum -a 256 "$runtime_root/build/dev-runtime/bin/edge" | /usr/bin/awk '{print $1}')" = \
  "$(/usr/bin/shasum -a 256 "$plan7_source/edge.candidate" | /usr/bin/awk '{print $1}')"
test -z "$(cd "$runtime_root" && git status --porcelain)"

test -x /opt/homebrew/bin/sops
test -r "$age_key"
test -r "$secret"
test "$(/usr/bin/stat -f %Lp "$secret")" = 600
api_key=$(SOPS_AGE_KEY_FILE="$age_key" /opt/homebrew/bin/sops decrypt --extract '["tokens"]["toki-dev-pi"]' "$secret")
test -n "$api_key"

for sample in 1 2; do
  /usr/bin/curl -fsS http://127.0.0.1:18001/edges/edge-toki-labs-dev/status |
    /opt/homebrew/bin/jq -e '
      def provider($id): first(.nodes[]?.provider_snapshots[]? | select(.id == $id));
      ((.nodes // []) | length == 4) and (all(.nodes[]; .connected == true)) and
      (provider("onexplayer-lemonade").capacity == 3) and
      (provider("onexplayer-lemonade").health == "healthy") and
      (provider("onexplayer-lemonade").in_flight == 0) and
      (provider("onexplayer-lemonade").queued == 0) and
      (provider("rtx5090-lemonade").capacity == 1) and
      (provider("rtx5090-lemonade").health == "healthy") and
      (provider("rtx5090-lemonade").in_flight == 0) and
      (provider("rtx5090-lemonade").queued == 0)
    ' >/dev/null
  /bin/sleep 2
done

http_status=$(
  {
    print -r -- 'silent'
    print -r -- 'show-error'
    print -r -- 'output = "/dev/null"'
    print -r -- "header = \"Authorization: Bearer $api_key\""
  } | /usr/bin/curl --config - --write-out '%{http_code}' http://127.0.0.1:18083/v1/models
)
test "$http_status" = 200

if (( attempt == 1 )); then
  test ! -e "$artifact_root"
  /bin/mkdir -p "$artifact_root"
  /bin/date +%s >"$artifact_root/campaign-start-epoch"
else
  test -f "$artifact_root/campaign-start-epoch"
  test -d "$artifact_root/attempt-$((attempt - 1))"
  campaign_start=$(<"$artifact_root/campaign-start-epoch")
  campaign_elapsed=$(( $(/bin/date +%s) - campaign_start ))
  test "$campaign_elapsed" -le 7200
fi

print -r -- "remote_live_start invocation_count=$attempt attempt=$attempt ownership=foreground artifact=plan-9/attempt-$attempt edge_restart_count=0"
set +e
IOP_OPENAI_API_KEY="$api_key" \
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_REQUEST_TIMEOUT=25m \
IOP_OPENAI_SMOKE_PROMPT_FILE=/tmp/iop-repeat-guard-live/repeat-prompt.txt \
IOP_OPENAI_SMOKE_ARTIFACT_DIR="$artifact_dir" \
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 \
/opt/homebrew/bin/go test -timeout 90m -count=1 -v ./apps/edge/internal/openai -run '^TestDevRepeatGuardOrnithSmoke$'
run_rc=$?
set -e
if (( run_rc == 0 )); then
  print -r -- "$attempt" >"$artifact_root/accepted-attempt"
  print -r -- "remote_live_finish=PASS invocation_count=$attempt accepted_attempt=$attempt"
fi
exit "$run_rc"
REMOTE
```

After each failed foreground command, preserve its attempt directory and run only a raw-free cleanup/classification probe. Record `retryable-transient` or `non-retryable` using the exact rules above; do not infer a transient class from generic nonzero exit status. A preflight exit before `remote_live_start` consumes no attempt and may rerun the same ordinal after the precondition recovers. A consumed attempt may never reuse its directory.

After one attempt succeeds, validate only its accepted summary without printing it:

```bash
ssh -o BatchMode=yes -o ConnectTimeout=15 toki@toki-labs.com '/bin/zsh -lc "exec /bin/zsh -s"' <<'REMOTE'
set -euo pipefail
artifact_root=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9
test -f "$artifact_root/accepted-attempt"
accepted_attempt=$(<"$artifact_root/accepted-attempt")
case "$accepted_attempt" in 1|2|3) ;; *) exit 2 ;; esac
summary="$artifact_root/attempt-$accepted_attempt/summary.json"
runtime_root=/Users/toki/agent-work/iop-dev
plan7_source=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-7-source
test -f "$summary"
/opt/homebrew/bin/jq -e '
  (.model == "ornith:35b") and (.concurrency == 5) and (.runs == 3) and
  ((.provider_responses | length) == 15) and
  (all(.provider_responses[];
    ((.provider_response_ids | type) == "array") and
    ((.provider_response_ids | length) >= 1) and
    ((.provider_response_ids | length) <= 4))) and
  (([.provider_responses[].provider_response_ids[]] | unique | length) ==
   ([.provider_responses[].provider_response_ids[]] | length)) and
  ((.lifecycles | length) == 15) and
  (([.lifecycles[].correlation_id] | unique | length) == 15) and
  ((.capacity_runs | length) == 3) and
  (all(.capacity_runs[];
    (.configured_capacity == 4) and (.peak_in_flight == 4) and
    (.peak_queued >= 1) and (.final_in_flight == 0) and (.final_queued == 0))) and
  ((.result == "not_reproduced") or
    ((.result == "reproduced") and
     any(.lifecycles[];
       (.result == "reproduced") and
       ((.fingerprint // "") | length > 0) and (.offset >= 0))))
' "$summary" >/dev/null
result_evidence=$(/opt/homebrew/bin/jq -r '
  if .result == "reproduced" then
    first(.lifecycles[] | select(.result == "reproduced") |
      "result=reproduced fingerprint=\(.fingerprint) offset=\(.offset)")
  else "result=not_reproduced" end
' "$summary")

/usr/bin/curl -fsS http://127.0.0.1:18001/edges/edge-toki-labs-dev/status |
  /opt/homebrew/bin/jq -e '
    def provider($id): first(.nodes[]?.provider_snapshots[]? | select(.id == $id));
    (provider("onexplayer-lemonade").in_flight == 0) and
    (provider("onexplayer-lemonade").queued == 0) and
    (provider("rtx5090-lemonade").in_flight == 0) and
    (provider("rtx5090-lemonade").queued == 0)
  ' >/dev/null
! /usr/bin/pgrep -fl '[T]estDevRepeatGuardOrnithSmoke' >/dev/null
test "$(/usr/bin/shasum -a 256 "$runtime_root/build/dev-runtime/bin/edge" | /usr/bin/awk '{print $1}')" = \
  "$(/usr/bin/shasum -a 256 "$plan7_source/edge.candidate" | /usr/bin/awk '{print $1}')"
test -z "$(cd "$runtime_root" && git status --porcelain)"
test -d /tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-8

print -r -- "remote_cleanup=PASS $result_evidence invocation_count=$accepted_attempt accepted_attempt=$accepted_attempt logical_provider_responses=15 edge_correlations=15 capacity_runs=3 configured_capacity=4 peak_in_flight=4 queued_pressure=present providers=idle harness=absent candidate=unchanged checkout=clean prior_artifacts=preserved edge_restart_count=0"
REMOTE
```

Stop for official review after an accepted summary, the first non-retryable failure, the second occurrence of the same normalized transient failure, cleanup/identity drift, three consumed attempts, or campaign-budget exhaustion. Preserve every partial attempt and never synthesize or merge summaries across attempts.

#### Modified Files and Checklist

- [ ] `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/CODE_REVIEW-cloud-G08.md` - record overlay hashes, isolated tests, unchanged runtime identity, raw-free attempt ledger, accepted summary or terminal campaign failure, and cleanup counts.
- [ ] No production, remote tracked source/config, runtime binary/process, Control Plane, Node, provider, credential, roadmap, or prior artifact change.

#### Test Strategy

Use only the fresh isolated source overlay, unchanged deployed-candidate gate, protected authentication, and one foreground S07 process at a time. Do not accept a stale checkout, changed runtime hash, degraded capacity, detached execution, reused attempt path, unclassified retry, more than three invocations, repeated normalized transient failure, raw SSE in tracked evidence, or a synthesized/merged summary.

#### Verification

The overlay/profile block and accepted-summary block must exit `0`. The foreground block runs once per authorized ordinal until success or a stop condition. Exactly one accepted attempt must produce 15 logical provider-response rows with globally disjoint bounded ID lists, 15 unique Edge correlations, three valid capacity rows, an accepted result classification, idle cleanup, absent harness, unchanged candidate, clean checkout, and preserved prior artifacts.

## Modified Files Summary

| File | Items |
|------|-------|
| `apps/edge/internal/openai/stream_gate_vertical_slice_test.go` | REVIEW_OFR-S07-CHANNEL-EVIDENCE-9-1 |
| `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/CODE_REVIEW-cloud-G08.md` | REVIEW_OFR-S07-CHANNEL-EVIDENCE-9-1, REVIEW_OFR-S07-CHANNEL-EVIDENCE-9-2 |

## Dependencies and Execution Order

1. Implement channel-aware downstream repetition evidence and deterministic fixtures.
2. Run focused and complete local profiles; stop before remote writes on failure.
3. Require fresh plan-9 source/campaign paths, unchanged candidate, clean checkout, absent harness, exact listener set, and idle capacity.
4. Create and verify the isolated overlay and run the uncached remote profile.
5. Authenticate without exposing credentials, take two idle samples, and start attempt 1 in the foreground.
6. On failure, preserve the attempt, perform raw-free cleanup/classification, and start a fresh attempt only when the bounded retry gate permits it.
7. Validate the single accepted summary and cleanup or preserve the terminal campaign evidence; fill the active review and stop.

## Final Verification

PASS requires: channel-preserving downstream evidence with production reasoning alias precedence; deterministic cross-channel nonrepeat and same-channel content/reasoning repeat fixtures; unchanged ordered provider-ID and terminal grammar; uncached local and isolated-remote profiles; a verified three-file overlay; unchanged deployed candidate and zero Edge restarts; exact five Edge listeners; four connected nodes; idle healthy `3+1` capacity; protected `/v1/models` HTTP 200; one bounded foreground campaign with one to three immutable 5-concurrent x 3-run attempts and no forbidden retry; exactly one accepted attempt containing 15 logical provider-response rows with globally disjoint bounded ID lists; 15 unique Edge correlations; three capacity rows at configured capacity 4 with peak in-flight 4 and queue pressure; accepted `reproduced` fingerprint/offset or `not_reproduced`; idle cleanup; absent harness; clean checkout; preserved prior artifacts; `git diff --check`; and no raw secret/model output in tracked evidence.

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