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

# Repeat guard review follow-up: execute S07 on the declared dev SSH runner

## For the Implementing Agent

Filling the implementation-owned sections in `CODE_REVIEW-*-G??.md` is mandatory. Run every verification command from the current workspace so that each Darwin command crosses the declared `ssh toki@toki-labs.com` boundary, 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, invocation count, 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 prior active pair correctly named the Darwin dev runner but invoked `command -v zsh` and `zsh -lic` on the Linux caller, so it could only reproduce the same local host mismatch. The user explicitly directed this task to use the remote environment. A fresh read-only SSH preflight now proves that the declared Darwin/arm64 runner, reviewed source delta, Go toolchain, Edge listeners, four connected nodes, `ornith:35b` aggregate capacity 4, prompt, observation sink, and isolated artifact path are available.

## Archive Evidence Snapshot

- Dependency `01_resume_notice_builder` is satisfied by `agent-task/archive/2026/07/m-openai-compatible-output-validation-filters/01_resume_notice_builder/complete.log`.
- The latest reviewed failure remains `agent-task/m-openai-compatible-output-validation-filters/02+01_repeat_guard/code_review_cloud_G08_44.log`: FAIL; Required=1, Suggested=0, Nit=0; live invocation count 0.
- The user-directed environment correction preserved the superseded no-verdict pair as `agent-task/m-openai-compatible-output-validation-filters/02+01_repeat_guard/plan_cloud_G08_45.log` and `agent-task/m-openai-compatible-output-validation-filters/02+01_repeat_guard/code_review_cloud_G08_45.log`.
- The superseded pair's local checks passed, but its Darwin source preflight ran on Linux and exited before SSH; the sole live authorization was not consumed.
- Fresh SSH evidence on 2026-07-30: `ssh toki@toki-labs.com` reaches Darwin/arm64 with `/bin/zsh`, Go 1.26.3, repo `/Users/toki/agent-work/iop-dev`, source HEAD `d1e32b6e06f7153a4db5a5a08b7026d6dd49fcfb`, and only `apps/edge/internal/openai/stream_gate_vertical_slice_test.go` modified at SHA-256 `8f0c767d6fb69175c6856fcd58f1398e89b9e13c6597dc950672b14b4013bd21`.
- The remote source tip `213eee4e28dfa69ff1e412faf23978ee9a9a3b9f` differs from the deployed runtime baseline only by the nine Agent-Ops policy files from the immediately preceding policy commit; no Go runtime or live-oracle source differs.
- Remote deterministic tests passed. Ports `18001`, `18083`, `18084`, and `19093` are open; all four nodes are connected; `onexplayer-lemonade` and `rtx5090-lemonade` are healthy and idle at capacity `3+1`; the prompt and observation files are present; the review-46 artifact directory is absent; and no live harness is running.

## 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: provided `AGENTS.md` instructions, `agent-ops/rules/project/rules.md`, `agent-ops/rules/common/rules-roadmap.md`, `agent-ops/skills/common/router.md`, `agent-ops/skills/common/plan/SKILL.md`, `agent-ops/skills/common/code-review/SKILL.md`, `agent-ops/skills/common/finalize-task-routing/SKILL.md`, `agent-ops/skills/common/plan/templates/review-stub-template.md`, and `agent-ops/skills/project/orchestrate-agent-task-loop/SKILL.md`.
- Domain and dev verification: `agent-ops/rules/project/domain/edge/rules.md`, `agent-ops/rules/project/domain/testing/rules.md`, `agent-test/dev/rules.md`, `agent-test/dev/edge-smoke.md`, and `agent-ops/skills/project/dev-runtime-deploy/SKILL.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`.
- Task state: active plan 45 and review 45 before preservation, `agent-task/m-openai-compatible-output-validation-filters/02+01_repeat_guard/code_review_cloud_G08_44.log`, and the exact predecessor completion log.
- Reviewed oracle evidence: current diff, SHA-256, relevant live evidence structures and validation helpers in `apps/edge/internal/openai/stream_gate_vertical_slice_test.go`.

### SDD Criteria

- SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/openai-compatible-output-validation-filters/SDD.md`; status `[승인됨]`; SDD lock released; no active SDD `USER_REVIEW.md`.
- `repeat-guard` maps to S03, S04, and S09-S12. Completion also requires the S07 capacity+1 `ornith:35b` live observation.
- S07 requires three 5-concurrent runs with sanitized provider response identity, Edge lifecycle correlation, accepted capacity, final result, and cleanup evidence.
- Deterministic S03/S04/S09-S12 evidence is green. This packet is limited to the missing S07 Evidence Map row and post-run cleanup proof.

### Verification Context

- The user's instruction supplies the environment decision: use the declared remote `dev` environment. Repository-native fallback is `agent-test/dev/rules.md`, `agent-test/dev/edge-smoke.md`, the approved SDD, the active task evidence, and fresh read-only SSH probes.
- Declared runner and workdir: `ssh toki@toki-labs.com`, `/Users/toki/agent-work/iop-dev`.
- Runner identity: Darwin/arm64, `/bin/zsh`, Go 1.26.3, GOMOD `/Users/toki/agent-work/iop-dev/go.mod`.
- Source identity: branch `feature/openai-compatible-output-validation-filters`, HEAD `d1e32b6e06f7153a4db5a5a08b7026d6dd49fcfb`, exactly one reviewed test delta, and live-oracle SHA-256 `8f0c767d6fb69175c6856fcd58f1398e89b9e13c6597dc950672b14b4013bd21`. The newer feature tip changes Agent-Ops policy only, so this evidence-only run keeps the proven runtime/test baseline instead of resetting away the reviewed oracle delta.
- Runtime identity: the listening Edge executable and `build/dev-runtime/bin/edge` have matching SHA-256; `edge config check` passes; ports `18001`, `18083`, `18084`, and `19093` are open.
- Provider identity: four nodes are connected. Selected providers `onexplayer-lemonade` and `rtx5090-lemonade` are healthy and idle with capacities 3 and 1.
- Isolation identity: non-empty `/tmp/iop-repeat-guard-live/repeat-prompt.txt`, writable `/tmp/iop-repeat-guard-live/edge-observations.jsonl`, absent `/tmp/iop-repeat-guard-live/repeat-guard-review-46`, and zero competing harnesses.
- External Verification Preflight: every Darwin/source/test/runtime/provider/isolation check is executed inside an SSH-fed remote zsh script. No local `zsh` command is allowed. The first command reruns all assertions and deterministic tests immediately before the live invocation.
- One started live Go test consumes the sole authorization. A preflight failure consumes none. Do not retry after the live test starts.
- Raw prompt, SSE, output, credentials, tokens, and private endpoint material remain under the remote task-specific `/tmp` paths and must not appear in tracked artifacts or stdout.
- Gap: S07 live evidence is still absent until the single SSH-wrapped live command finishes. Confidence is high that the declared runner is currently ready because the non-live remote preflight passed.

### Test Coverage Gaps

- Deterministic S03/S04/S09-S12 behavior is covered by the focused and package tests executed on the Darwin runner.
- S07 integrated evidence remains the only gap. No source change or local substitute can replace the one remote live invocation.

### Symbol References

- None; this evidence-only replan renames or removes no symbol.

### Split Judgment

- Keep one packet. Provider response identity, Edge lifecycle correlation, capacity pressure/recovery, final result, and cleanup must come from the same isolated invocation.
- Dependency `+01` is satisfied by `agent-task/archive/2026/07/m-openai-compatible-output-validation-filters/01_resume_notice_builder/complete.log`.

### Scope Rationale

- Modify only the active review evidence artifact.
- Do not change production source, tests, contracts, specs, tracked configuration, deployed binaries/configuration, provider selection, queue behavior, or filter thresholds.
- Remote writes are limited to the existing environment-gated test's task-specific `/tmp/iop-repeat-guard-live/repeat-guard-review-46` artifacts.
- If SSH access or another user-controlled prerequisite becomes unavailable, record exact evidence. The official reviewer must apply the `external-execution` USER_REVIEW gate instead of generating another identical inaccessible-host follow-up.

### 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 basis `local-fit`; final 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`; basis `official-review`; lane `cloud`; grade `G08`; canonical file `CODE_REVIEW-cloud-G08.md`; adapter `codex`; model `gpt-5.6-sol`; reasoning effort `xhigh`.
- `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=44`, `evidence_integrity_failure=true`; recovery boundary matched.
- Capability gap: none; the declared SSH runner is reachable and passed the non-live preflight.

## Implementation Checklist

- [ ] [REVIEW_OFR-REPEAT-45-1] Through `ssh toki@toki-labs.com`, rerun the complete remote preflight, execute exactly one fresh `ornith:35b` 5-concurrent × 3 live invocation, and record 15 provider responses, 15 Edge correlations, three accepted capacity rows, the sanitized final result, and cleanup evidence; if the remote preflight blocks execution, record exact output, invocation count 0, and the resume condition.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_OFR-REPEAT-45-1] Produce S07 evidence through the dev SSH runner

#### Problem

`agent-task/m-openai-compatible-output-validation-filters/02+01_repeat_guard/code_review_cloud_G08_45.log` records that the prior plan called `zsh` on the Linux caller and therefore never crossed the declared remote runner boundary. The required live evidence remains absent even though a fresh direct SSH probe proves the Darwin runner is available.

Before:

```text
local Linux shell -> command -v zsh -> exit 1 -> invocation count 0
```

After:

```text
caller -> ssh toki@toki-labs.com -> remote Darwin zsh -> preflight PASS -> invocation count 1 -> S07 summary and cleanup PASS
```

#### Solution

- Run every environment-specific command through `ssh -o BatchMode=yes -o ConnectTimeout=15 toki@toki-labs.com`.
- Feed the script to `'/bin/zsh -lc "exec /bin/zsh -s"'` so command resolution and execution both occur on Darwin.
- Reprove source, live-oracle hash, deterministic tests, Edge binary/listeners/config, four connected nodes, selected provider health/capacity, prompt, observation quiescence, absent artifact directory, and zero competing harnesses.
- Start `TestDevRepeatGuardOrnithSmoke` exactly once with review-46 artifacts. Do not retry a started invocation.
- Validate sanitized `summary.json`, provider idle recovery, zero remaining harnesses, unchanged source/runtime identities, and containment of raw evidence 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 the SSH preflight, invocation count, sanitized summary cardinality/result, cleanup evidence, or exact blocker/resume evidence.
- [ ] No production, test, contract, spec, tracked configuration, or deployed runtime change.

#### Test Strategy

- Do not add or modify tests. The existing environment-gated live harness is the S07 integrated oracle.
- Execute the deterministic verification on the same Darwin checkout immediately before the live command; fresh `-count=1` output is required.

#### Verification

Remote preflight and deterministic verification:

```bash
ssh -o BatchMode=yes -o ConnectTimeout=15 toki@toki-labs.com '/bin/zsh -lc "exec /bin/zsh -s"' <<'REMOTE'
set -euo pipefail
repo=/Users/toki/agent-work/iop-dev
expected_head=d1e32b6e06f7153a4db5a5a08b7026d6dd49fcfb
expected_test_hash=8f0c767d6fb69175c6856fcd58f1398e89b9e13c6597dc950672b14b4013bd21
test_file=apps/edge/internal/openai/stream_gate_vertical_slice_test.go
artifact_dir=/tmp/iop-repeat-guard-live/repeat-guard-review-46
prompt_file=/tmp/iop-repeat-guard-live/repeat-prompt.txt
observation_file=/tmp/iop-repeat-guard-live/edge-observations.jsonl
cd "$repo"
go_bin=$(command -v go)
jq_bin=$(command -v jq)
test "$(uname -s)" = Darwin
test "$(uname -m)" = arm64
test "$("$go_bin" env GOMOD)" = "$repo/go.mod"
test "$(git branch --show-current)" = feature/openai-compatible-output-validation-filters
test "$(git rev-parse HEAD)" = "$expected_head"
test "$(git diff --name-only)" = "$test_file"
test "$(/usr/bin/shasum -a 256 "$test_file" | /usr/bin/awk '{print $1}')" = "$expected_test_hash"
git diff --check
"$go_bin" test -count=1 ./apps/edge/internal/openai -run 'TestDevRepeatGuard(SmokeEvidence|ObservationCorrelation|ObservationQuiescence|CapacityEvidence)'
"$go_bin" test -count=1 ./packages/go/streamgate ./apps/edge/internal/openai
"$go_bin" test -count=1 ./packages/go/config
build/dev-runtime/bin/edge --config build/dev-runtime/edge.yaml config check >/dev/null
/usr/bin/grep -q '^    - filter: repeat_guard$' build/dev-runtime/edge.yaml
/usr/bin/grep -q '^        key: ornith:35b$' build/dev-runtime/edge.yaml
for port in 18001 18083 18084 19093; do /usr/bin/nc -z 127.0.0.1 "$port"; done
test -s "$prompt_file"
test -f "$observation_file"
test -w "$observation_file"
test ! -e "$artifact_dir"
observation_size_before=$(/usr/bin/stat -f %z "$observation_file")
sleep 2
observation_size_after=$(/usr/bin/stat -f %z "$observation_file")
test "$observation_size_before" = "$observation_size_after"
! /usr/bin/pgrep -fl '[T]estDevRepeatGuardOrnithSmoke' >/dev/null
edge_pid=$(/usr/sbin/lsof -tiTCP:18083 -sTCP:LISTEN)
test -n "$edge_pid"
edge_exe=$(/usr/sbin/lsof -a -p "$edge_pid" -d txt -Fn | /usr/bin/sed -n 's/^n//p' | /usr/bin/head -1)
test -n "$edge_exe"
test "$(/usr/bin/shasum -a 256 "$edge_exe" | /usr/bin/awk '{print $1}')" = "$(/usr/bin/shasum -a 256 build/dev-runtime/bin/edge | /usr/bin/awk '{print $1}')"
status_file=$(/usr/bin/mktemp -t iop-repeat-status.XXXXXX)
trap '/bin/rm -f "$status_file"' EXIT
/usr/bin/curl -fsS http://127.0.0.1:18001/edges/edge-toki-labs-dev/status > "$status_file"
"$jq_bin" -e '
  def provider($id): first(.nodes[].provider_snapshots[] | select(.id == $id));
  (.edge_id == "edge-toki-labs-dev") and
  ((.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)
' "$status_file" >/dev/null
printf 'remote_preflight=PASS head=%s test_hash=%s edge_pid=%s observation_size=%s providers=3+1_idle\n' "$expected_head" "$expected_test_hash" "$edge_pid" "$observation_size_after"
REMOTE
```

Expected: SSH exits 0; all fresh tests pass; the final line reports the reviewed HEAD/hash, one Edge PID, stable observation size, and idle `3+1` providers. This command does not start the live harness.

After the preflight passes, launch exactly once:

```bash
ssh -o BatchMode=yes -o ConnectTimeout=15 toki@toki-labs.com '/bin/zsh -lc "exec /bin/zsh -s"' <<'REMOTE'
set -euo pipefail
cd /Users/toki/agent-work/iop-dev
go_bin=$(command -v go)
artifact_dir=/tmp/iop-repeat-guard-live/repeat-guard-review-46
test ! -e "$artifact_dir"
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="$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 \
"$go_bin" test -timeout 90m -count=1 -v ./apps/edge/internal/openai -run '^TestDevRepeatGuardOrnithSmoke$'
REMOTE
```

Expected: invocation count 1 and exit 0.

Sanitized summary and cleanup verification:

```bash
ssh -o BatchMode=yes -o ConnectTimeout=15 toki@toki-labs.com '/bin/zsh -lc "exec /bin/zsh -s"' <<'REMOTE'
set -euo pipefail
cd /Users/toki/agent-work/iop-dev
summary=/tmp/iop-repeat-guard-live/repeat-guard-review-46/summary.json
jq_bin=$(command -v jq)
test -f "$summary"
"$jq_bin" -e '
  (.model == "ornith:35b") and (.concurrency == 5) and (.runs == 3) and
  ((.provider_responses | length) == 15) and
  (([.provider_responses[].provider_response_id] | unique | length) == 15) 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
status_file=$(/usr/bin/mktemp -t iop-repeat-cleanup.XXXXXX)
trap '/bin/rm -f "$status_file"' EXIT
/usr/bin/curl -fsS http://127.0.0.1:18001/edges/edge-toki-labs-dev/status > "$status_file"
"$jq_bin" -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)
' "$status_file" >/dev/null
! /usr/bin/pgrep -fl '[T]estDevRepeatGuardOrnithSmoke' >/dev/null
test "$(git rev-parse HEAD)" = d1e32b6e06f7153a4db5a5a08b7026d6dd49fcfb
test "$(git diff --name-only)" = apps/edge/internal/openai/stream_gate_vertical_slice_test.go
test "$(/usr/bin/shasum -a 256 apps/edge/internal/openai/stream_gate_vertical_slice_test.go | /usr/bin/awk '{print $1}')" = 8f0c767d6fb69175c6856fcd58f1398e89b9e13c6597dc950672b14b4013bd21
printf 'remote_cleanup=PASS provider_responses=15 edge_correlations=15 capacity_runs=3 providers=idle\n'
REMOTE
```

Expected: exit 0 and one sanitized PASS line. Do not paste raw prompt, SSE, model output, credentials, token values, or full status/config payloads into the review.

## 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-45-1 remote evidence |

## Dependencies and Execution Order

1. Dependency `01_resume_notice_builder` is satisfied by `agent-task/archive/2026/07/m-openai-compatible-output-validation-filters/01_resume_notice_builder/complete.log`.
2. Run the SSH remote preflight and deterministic verification.
3. If and only if every preflight assertion passes, run the live SSH command exactly once.
4. Run the sanitized summary/cleanup SSH command and fill every implementation-owned review section.

## Final Verification

Run the three SSH commands above in order. PASS requires remote preflight exit 0, one started live invocation that exits 0, 15 unique provider response IDs, 15 unique Edge correlations, three accepted capacity rows, a valid sanitized final result, idle providers, no harness process, unchanged source/runtime identity, and no tracked raw evidence. Fresh execution is required; Go test cache output is not acceptable.

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

## Superseded Task Record

This plan was archived incomplete at the user's direction on 2026-07-30 and was replaced by independent task `03_repeat_guard_s07_remote_evidence`. It does not claim PASS or roadmap completion.
