<!-- task=m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence plan=11 tag=REVIEW_OFR-S07-MODULE-ROOT-11 -->

# Run the remaining S07 attempt from the module root

## For the Implementing Agent

Filling implementation-owned sections in `CODE_REVIEW-cloud-G08.md` is mandatory. Execute only the scoped remote evidence recovery, run every applicable verification command, record actual notes and output, 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`.

This plan authorizes no product code, checkout, overlay, runtime, configuration, credential, provider, Control Plane, Node, roadmap, prior log, attempt-1, or attempt-2 mutation. It authorizes only the fresh unused attempt 3 artifact under the existing ignored remote campaign root.

## Background

Plan 10 preserved attempt 2 with an atomic non-retryable terminal record, but its wrapper invoked a relative Go package from the login-shell working directory and never entered the verified overlay module. Fresh reviewer evidence confirms the exact `go.mod file not found` exit, an unused attempt-3 path, an unchanged deployed candidate, and healthy idle capacity. This follow-up adds the missing module-root transition and uses the campaign's final ordinal once.

## Archive Evidence Snapshot

- `plan_cloud_G08_10.log` / `code_review_cloud_G08_10.log`: FAIL with one Required finding; the attempt-2 terminal evidence and reviewer recheck are trusted.
- Attempts 1 and 2 are immutable. Attempt 1 retains its structurally valid summary but is not accepted; attempt 2 retains `run_rc=1`, `state=stopped`, `class=non-retryable`, no summary, and the exact one-line Go module-root error.
- Accepted local and isolated-remote profiles, overlay identity, channel-aware evidence, runtime identity, and zero-restart evidence remain valid.
- Reviewer preflight on 2026-07-30 confirmed clean base HEAD `750cb1d1cb88066a10d3c703c99f1326306d8e15`, overlay integrity, module root and smoke symbol presence, runtime hash `e0eff854e5c6841e6dd5cafcd7242254c91ece26b4ad328a2b937acca42122e5`, Edge PID `20646`, five listeners, four connected nodes, idle healthy `3+1` capacity, authenticated `/v1/models` HTTP 200, absent harness, absent accepted marker, and a fresh attempt-3 path.
- Immutable pins: attempt-1 summary `399701df68103a59738f5683c6ef4e5ce193c2fb2105757d11c0661f1d453697`; attempt-2 foreground-start `d0a354a7a571ef3ebbc672ac0a776ec93446b61ff5691c62a78d72c1a0fe67c0`; attempt-2 foreground log `f718031b71a6eb82bab59b71d6f3fe40fc7744ce7bfb810d8499a7ac0b9e304c`; terminal-attempt-2 `718614208731ba42d92086d93707e9b4cff875d9a32981f80a4895a118ee2c31`.

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

- `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/PLAN-cloud-G08.md`
- `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/CODE_REVIEW-cloud-G08.md`
- `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/plan_cloud_G08_9.log`
- `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/code_review_cloud_G08_9.log`
- `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`
- `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/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 `[승인됨]`, lock released, no active user review.
- S03 maps to `repeat-guard` and retains the accepted deterministic channel-safe continuation and single-terminal evidence.
- S07 maps the live `ornith:35b` capacity+1 three-run smoke to operational evidence. This subtask supplies only that live-smoke evidence for `repeat-guard`; it must not claim the broader `ops-evidence` task.
- Evidence Map S03/S07 requires the accepted immutable summary to prove 15 logical provider responses, 15 unique lifecycle correlations, three capacity rows, a sanctioned `reproduced` fingerprint/offset or `not_reproduced` result, idle cleanup, and raw-free tracked evidence. Those rows define the sole implementation item and PASS oracle below.

### Verification Context

- No separate verification handoff was supplied. Repository-native sources are the local Edge smoke profile, approved SDD, active verdict, immutable overlay, and fresh reviewer preflight.
- Fresh local commands passed on 2026-07-30: Go `go1.26.2`, module `/config/workspace/iop-s1/go.mod`, the focused repeat-guard profile, and `go test -count=1 ./packages/go/streamgate ./apps/edge/internal/openai`.
- The only remaining gap is an accepted integrated attempt. Summary presence alone is not success.
- Raw token, Authorization header, prompt, model output, raw SSE, status payload, and foreground log content remain only in the remote ignored artifact path.

#### External Verification Preflight

- Runner: `ssh toki@toki-labs.com`; Darwin/arm64; Go `/opt/homebrew/bin/go`; base checkout `/Users/toki/agent-work/iop-dev`.
- Source workdir: `/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9-source/iop`; it contains `go.mod`, module `iop`, the verified three-file overlay, and `TestDevRepeatGuardOrnithSmoke`.
- Runtime: Edge PID `20646`; binary/config under `/Users/toki/agent-work/iop-dev/build/dev-runtime`; five expected listeners; Control Plane status at `127.0.0.1:18001`.
- Identity: clean base HEAD `750cb1d1cb88066a10d3c703c99f1326306d8e15`; deployed runtime matches the preserved plan-7 candidate hash; four connected nodes; idle healthy `3+1` providers.
- Credential: host-local SOPS token ref `toki-dev-pi`; decrypt only in the remote shell, never print it, and require protected `/v1/models` HTTP 200 before the attempt.
- State: attempts 1 and 2 plus terminal-attempt-2 are pinned; attempt 3, terminal-attempt-3, and accepted-attempt are absent; no smoke harness is running.
- Required correction: execute `cd "$source_root"` and prove `go list -m` returns `iop` immediately before the relative `go test` invocation.

### Test Coverage Gaps

- No deterministic product-code gap remains; focused and full local profiles pass.
- No new unit test is needed because this packet changes no product source.
- The only gap is the final live S07 production-path execution and its atomic accepted record.

### Symbol References

- None. No source symbol is added, removed, or renamed.

### Split Judgment

Keep one packet. The final attempt, atomic terminal ownership, accepted summary hash, structural validation, and cleanup form one evidence transaction and cannot independently PASS if split.

### Scope Rationale

- Modify only the active review evidence file.
- Preserve attempt 1, attempt 2, terminal-attempt-2, the base checkout, overlay, deployed candidate, runtime process/config, credentials, providers, and prior task logs.
- Do not authorize attempt 4 or any retry after attempt 3. A failed attempt 3 is durable terminal evidence for review, not permission to extend the campaign.
- Do not report `ops-evidence`; PASS may report only `repeat-guard`.

### 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=11`
- `evidence_integrity_failure=true`

## Implementation Checklist

- [ ] [REVIEW_OFR-S07-MODULE-ROOT-11-1] Preserve attempts 1 and 2; revalidate the immutable overlay, runtime, authentication, and idle capacity; run only fresh attempt 3 from the verified overlay module root; accept only one atomic success record and validate its immutable summary plus cleanup, or preserve terminal-attempt-3 and stop.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_OFR-S07-MODULE-ROOT-11-1] Run the final attempt from the verified module root

#### Problem

`agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/plan_cloud_G08_10.log:272` invokes `go test ./apps/edge/internal/openai` without changing to `source_root`. The login shell starts outside the Go module, so attempt 2 terminated before `TestDevRepeatGuardOrnithSmoke` executed.

#### Solution

Preserve attempts 1 and 2 and consume only attempt 3. Prove the overlay module with `go list -m`, then change to `source_root` before invoking the relative package:

Before:

```bash
/opt/homebrew/bin/go test -timeout 90m -count=1 -v ./apps/edge/internal/openai \
  -run '^TestDevRepeatGuardOrnithSmoke$'
```

After:

```bash
cd "$source_root"
test "$(/opt/homebrew/bin/go list -m)" = iop
/opt/homebrew/bin/go test -timeout 90m -count=1 -v ./apps/edge/internal/openai \
  -run '^TestDevRepeatGuardOrnithSmoke$'
```

Keep the atomic success/failure record. Attempt 3 is the final ordinal; no result authorizes another attempt.

#### Modified Files and Checklist

- [ ] `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/CODE_REVIEW-cloud-G08.md` - record raw-free preflight, module-root proof, attempt-3 terminal outcome, accepted summary evidence when present, cleanup, invocation count, and zero-restart count.
- [ ] No product source, checkout, overlay, runtime binary/process/config, credential, provider, Control Plane, Node, roadmap, prior log, attempt-1, or attempt-2 mutation.

#### Test Strategy

No new unit test is needed because there is no product-code change. The required integrated test is the existing `TestDevRepeatGuardOrnithSmoke` with `concurrency=5`, `runs=3`, `request timeout=25m`, capacity+1 providers, and the existing immutable plan-9 overlay.

#### Verification

Run exactly this remaining attempt:

```bash
ssh -o BatchMode=yes -o ConnectTimeout=15 toki@toki-labs.com '/bin/zsh -lc "exec /bin/zsh -s"' <<'REMOTE'
set -euo pipefail
set +x
attempt=3
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"
artifact_root=/tmp/iop-repeat-guard-live/repeat-guard-task-03-plan-9
artifact_dir="$artifact_root/attempt-$attempt"
terminal_record="$artifact_root/terminal-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=''

test ! -e "$artifact_root/accepted-attempt"
test ! -e "$artifact_dir"
test ! -e "$terminal_record"
test "$(/usr/bin/shasum -a 256 "$artifact_root/attempt-1/summary.json" | /usr/bin/awk '{print $1}')" = 399701df68103a59738f5683c6ef4e5ce193c2fb2105757d11c0661f1d453697
test "$(/usr/bin/shasum -a 256 "$artifact_root/attempt-2/foreground-start" | /usr/bin/awk '{print $1}')" = d0a354a7a571ef3ebbc672ac0a776ec93446b61ff5691c62a78d72c1a0fe67c0
test "$(/usr/bin/shasum -a 256 "$artifact_root/attempt-2/foreground.log" | /usr/bin/awk '{print $1}')" = f718031b71a6eb82bab59b71d6f3fe40fc7744ce7bfb810d8499a7ac0b9e304c
test "$(/usr/bin/shasum -a 256 "$artifact_root/terminal-attempt-2" | /usr/bin/awk '{print $1}')" = 718614208731ba42d92086d93707e9b4cff875d9a32981f80a4895a118ee2c31
/usr/bin/grep -qx 'attempt=2' "$artifact_root/terminal-attempt-2"
/usr/bin/grep -qx 'run_rc=1' "$artifact_root/terminal-attempt-2"
/usr/bin/grep -qx 'state=stopped' "$artifact_root/terminal-attempt-2"
/usr/bin/grep -qx 'class=non-retryable' "$artifact_root/terminal-attempt-2"

test "$(cd "$remote_repo" && git rev-parse HEAD)" = 750cb1d1cb88066a10d3c703c99f1326306d8e15
test -z "$(cd "$remote_repo" && git status --porcelain)"
test "$(<"$stage_root/base-head")" = 750cb1d1cb88066a10d3c703c99f1326306d8e15
(cd "$source_root" && /usr/bin/shasum -a 256 -c "$stage_root/overlay.sha256" >/dev/null)
test -f "$source_root/go.mod"
test "$(cd "$source_root" && /opt/homebrew/bin/go list -m)" = iop
/usr/bin/grep -q 'func TestDevRepeatGuardOrnithSmoke' "$source_root/apps/edge/internal/openai/stream_gate_vertical_slice_test.go"
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 "$(( $(/bin/ps -p 20646 -o pid= | /usr/bin/wc -w) ))" -eq 1
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,'
! /usr/bin/pgrep -fl '[T]estDevRepeatGuardOrnithSmoke' >/dev/null

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

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

/bin/mkdir "$artifact_dir"
print -r -- "attempt=$attempt" >"$artifact_dir/foreground-start"
run_rc=125
terminal_class=wrapper-incomplete
accepted=0

write_terminal_record() {
  trap - EXIT HUP INT TERM
  unset api_key
  if (( accepted == 0 )) && [[ ! -e "$terminal_record" ]]; then
    tmp="$artifact_root/.terminal-attempt-$attempt.$$"
    {
      print -r -- "attempt=$attempt"
      print -r -- "run_rc=$run_rc"
      print -r -- "state=stopped"
      print -r -- "class=$terminal_class"
    } >"$tmp"
    /bin/mv "$tmp" "$terminal_record"
  fi
}
trap write_terminal_record EXIT
trap 'run_rc=129; terminal_class=interrupted; write_terminal_record; exit 129' HUP
trap 'run_rc=130; terminal_class=interrupted; write_terminal_record; exit 130' INT
trap 'run_rc=143; terminal_class=interrupted; write_terminal_record; exit 143' TERM

cd "$source_root"
test "$(/opt/homebrew/bin/go list -m)" = iop
print -r -- "remote_live_start invocation_count=3 attempt=3 ownership=foreground module_root=verified artifact=plan-9/attempt-3 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$' >"$artifact_dir/foreground.log" 2>&1
run_rc=$?
set -e
unset api_key

if (( run_rc == 0 )); then
  summary="$artifact_dir/summary.json"
  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
  /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}')" = "$candidate_hash"
  test -z "$(cd "$runtime_root" && git status --porcelain)"
  (cd "$source_root" && /usr/bin/shasum -a 256 -c "$stage_root/overlay.sha256" >/dev/null)
  summary_hash=$(/usr/bin/shasum -a 256 "$summary" | /usr/bin/awk '{print $1}')
  accepted_tmp="$artifact_root/.accepted-attempt.$$"
  {
    print -r -- "attempt=3"
    print -r -- "run_rc=0"
    print -r -- "state=accepted"
    print -r -- "summary_sha256=$summary_hash"
  } >"$accepted_tmp"
  /bin/mv "$accepted_tmp" "$artifact_root/accepted-attempt"
  accepted=1
  terminal_class=accepted
  trap - EXIT HUP INT TERM
  print -r -- "remote_live_finish=PASS invocation_count=3 accepted_attempt=3 durable_terminal=accepted-attempt edge_restart_count=0"
  exit 0
fi

transient_classes=0
if /usr/bin/grep -Eqi 'HTTP[^0-9]*(429|502|503|504)|status[^0-9]*(429|502|503|504)' "$artifact_dir/foreground.log"; then
  transient_classes=$((transient_classes + 1))
fi
if /usr/bin/grep -Eqi 'connection reset|unexpected EOF|connection.*EOF' "$artifact_dir/foreground.log"; then
  transient_classes=$((transient_classes + 1))
fi
if /usr/bin/grep -Eqi 'context deadline exceeded|Client\.Timeout exceeded|request deadline' "$artifact_dir/foreground.log"; then
  transient_classes=$((transient_classes + 1))
fi
if (( transient_classes == 1 )) &&
   ! /usr/bin/grep -Eqi 'released repeated downstream content|provider response identit|correlat|capacity evidence|terminal grammar|duplicate|summary validation|checkout|runtime hash|overlay|panic:|WARNING: DATA RACE' "$artifact_dir/foreground.log"; then
  terminal_class=retryable-transient
else
  terminal_class=non-retryable
fi
print -r -- "remote_live_finish=FAIL invocation_count=3 terminal_class=$terminal_class durable_terminal=terminal-attempt-3 retry_authorized=false edge_restart_count=0"
exit "$run_rc"
REMOTE
```

Expected: the preflight reaches `module_root=verified`. Attempt 3 atomically writes either `accepted-attempt` or `terminal-attempt-3`. No result authorizes attempt 4.

After `accepted-attempt` exists, run:

```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
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
accepted_record="$artifact_root/accepted-attempt"

test "$(/usr/bin/shasum -a 256 "$artifact_root/attempt-1/summary.json" | /usr/bin/awk '{print $1}')" = 399701df68103a59738f5683c6ef4e5ce193c2fb2105757d11c0661f1d453697
test "$(/usr/bin/shasum -a 256 "$artifact_root/attempt-2/foreground-start" | /usr/bin/awk '{print $1}')" = d0a354a7a571ef3ebbc672ac0a776ec93446b61ff5691c62a78d72c1a0fe67c0
test "$(/usr/bin/shasum -a 256 "$artifact_root/attempt-2/foreground.log" | /usr/bin/awk '{print $1}')" = f718031b71a6eb82bab59b71d6f3fe40fc7744ce7bfb810d8499a7ac0b9e304c
test "$(/usr/bin/shasum -a 256 "$artifact_root/terminal-attempt-2" | /usr/bin/awk '{print $1}')" = 718614208731ba42d92086d93707e9b4cff875d9a32981f80a4895a118ee2c31
test -f "$accepted_record"
test "$(/usr/bin/awk -F= '$1=="attempt"{print $2}' "$accepted_record")" = 3
test "$(/usr/bin/awk -F= '$1=="run_rc"{print $2}' "$accepted_record")" = 0
test "$(/usr/bin/awk -F= '$1=="state"{print $2}' "$accepted_record")" = accepted
accepted_hash=$(/usr/bin/awk -F= '$1=="summary_sha256"{print $2}' "$accepted_record")
summary="$artifact_root/attempt-3/summary.json"
test -f "$summary"
test "$(/usr/bin/shasum -a 256 "$summary" | /usr/bin/awk '{print $1}')" = "$accepted_hash"
/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));
    ((.nodes // []) | length == 4) and (all(.nodes[]; .connected == true)) and
    (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
(cd "$source_root" && /usr/bin/shasum -a 256 -c "$stage_root/overlay.sha256" >/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)"
print -r -- "accepted_summary=PASS attempt=3 run_rc=0 $result_evidence logical_provider_responses=15 edge_correlations=15 capacity_runs=3 configured_capacity=4 peak_in_flight=4 queued_pressure=present providers=idle harness=absent overlay=valid candidate=unchanged checkout=clean attempt1=preserved attempt2=preserved edge_restart_count=0"
REMOTE
```

Expected: exit `0` and one raw-free `accepted_summary=PASS` line.

## Modified Files Summary

| File | Items |
|------|-------|
| `agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/CODE_REVIEW-cloud-G08.md` | REVIEW_OFR-S07-MODULE-ROOT-11-1 |

## Dependencies and Execution Order

1. Revalidate immutable attempts 1 and 2, overlay/module identity, checkout, runtime hash/PID/listeners, absent harness, authentication, and two idle capacity samples.
2. Change to the verified overlay module root and run attempt 3 once.
3. On success, validate the accepted marker, summary hash/structure, idle cleanup, absent harness, immutable prior artifacts, unchanged candidate, clean checkout, and overlay.
4. On failure, preserve terminal-attempt-3 and stop without another attempt.
5. Fill the active review with raw-free evidence only.

## Final Verification

Run:

```bash
go version
go env GOMOD
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
git status --short
git grep -lE 'sk-[A-Za-z0-9_-]{16,}|Authorization: Bearer [^$]' -- . \
  ':(exclude)agent-task/archive/**' \
  ':(exclude)agent-task/m-openai-compatible-output-validation-filters/03_repeat_guard_s07_remote_evidence/*.log'
```

Expected: all Go tests and `git diff --check` exit `0`; status preserves unrelated changes; the path-only secret-like scan does not name the active review or scoped source. Fresh uncached output is required.

PASS additionally requires: immutable attempts 1 and 2; verified overlay/base/module/runtime identity; exact five listeners; four connected nodes; idle healthy `3+1` capacity; authenticated `/v1/models` HTTP 200; no concurrent harness; exactly one fresh attempt 3 from `source_root`; an atomic accepted record with `run_rc=0`; matching summary hash; 15 logical provider responses with globally disjoint bounded identity lists; 15 unique lifecycle correlations; three capacity rows at configured capacity 4 with peak in-flight 4 and queue pressure; `reproduced` fingerprint/offset or `not_reproduced`; idle cleanup; absent harness; unchanged candidate; clean checkout; prior artifacts preserved; zero Edge restarts; no raw secret/prompt/output in tracked evidence; and no attempt 4.

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