<!-- task=m-node-provider-execution-liveness-recovery/14+11,12,13_observability_contracts plan=1 tag=REVIEW_REFACTOR milestone-task=ops-evidence -->

# Observability Contract Fidelity Follow-up

## For the Implementing Agent

Correct only the three declared documentation surfaces, run every verification command with fresh output, and fill all implementation-owned sections of `CODE_REVIEW-cloud-G05.md`. Keep the active pair in place and report ready for review; finalization belongs to the code-review skill. If blocked, record exact blocker evidence, attempted commands/output, and resume conditions only. 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 first implementation pass synchronized the shared observability documents and all product verification passed, but official review found that two timing statements do not match the synchronous production call order. The OpenAI safe-log value contract and the living spec's structured S06 evidence/verification matrix are also incomplete. This follow-up corrects documentation fidelity only; product code and tests remain unchanged.

## Archive Evidence Snapshot

- Prior pair: `agent-task/m-node-provider-execution-liveness-recovery/14+11,12,13_observability_contracts/plan_local_G05_0.log` and `agent-task/m-node-provider-execution-liveness-recovery/14+11,12,13_observability_contracts/code_review_cloud_G05_0.log`; final verdict `FAIL` with Required R1, R2, and R3, zero Suggested/Nit findings.
- R1 requires source-faithful synchronous observer and terminal-construction ordering; R2 requires the complete bounded OpenAI safe-log value contract; R3 requires structured S06 source/test evidence and deterministic living-spec verification.
- Fresh reviewer evidence passed the dependency gate, all selected package tests, all focused producer tests, the metric/event name scan, the declared diff inspection, and `git diff --check`; `evidence_integrity_failure=false`.
- Roadmap carryover remains `milestone-task=ops-evidence`, SDD Acceptance Scenario S06 and its bounded/raw-free Evidence Map. This pair does not assert Milestone Task completion.

## Finding Resolution Map

| Finding | Mode | Exact fix | Changed precondition |
|---------|------|-----------|----------------------|
| Required R1 | `direct-fix` | Correct observer timing in `agent-contract/inner/execution-runtime.md` and `agent-contract/inner/edge-node-runtime-wire.md` to match synchronous post-unlock Edge delivery and pre-terminal-construction Node observation. | The inaccurate asynchronous/after-assembly wording is removed and deterministic negative scans can pass. |
| Required R2 | `direct-fix` | Add the current OpenAI safe-log value schema to `agent-contract/inner/execution-runtime.md`, including phase values, empty lifecycle fields, and current `provider_health=unknown` behavior. | The log contract becomes complete and source-verifiable instead of implying unavailable evidence. |
| Required R3 | `direct-fix` | Add all three S06 observability code/test pairs and focused commands to `agent-spec/runtime/edge-node-execution.md`. | The living spec's S06 claim becomes directly reproducible from structured evidence and its verification section. |

## Analysis

### Files Read

- `agent-task/m-node-provider-execution-liveness-recovery/14+11,12,13_observability_contracts/plan_local_G05_0.log`
- `agent-task/m-node-provider-execution-liveness-recovery/14+11,12,13_observability_contracts/code_review_cloud_G05_0.log`
- `agent-roadmap/phase/operational-observability-provider-management/PHASE.md`
- `agent-roadmap/phase/operational-observability-provider-management/milestones/node-provider-execution-liveness-recovery.md`
- `agent-roadmap/sdd/operational-observability-provider-management/node-provider-execution-liveness-recovery/SDD.md`
- `agent-contract/inner/execution-runtime.md`
- `agent-contract/inner/edge-node-runtime-wire.md`
- `agent-spec/runtime/edge-node-execution.md`
- `apps/node/internal/node/liveness_observability.go`
- `apps/node/internal/node/liveness_observability_test.go`
- `apps/node/internal/node/liveness_watchdog.go`
- `apps/edge/internal/service/provider_health_observability.go`
- `apps/edge/internal/service/provider_health_observability_test.go`
- `apps/edge/internal/service/model_queue_release.go`
- `apps/edge/internal/openai/liveness_recovery_observability.go`
- `apps/edge/internal/openai/liveness_recovery_observability_test.go`
- `agent-task/archive/2026/08/m-node-provider-execution-liveness-recovery/11+06_node_liveness_observability/complete.log`
- `agent-task/archive/2026/08/m-node-provider-execution-liveness-recovery/12+08_health_overlay_observability/complete.log`
- `agent-task/archive/2026/08/m-node-provider-execution-liveness-recovery/13+10_recovery_observability/complete.log`

### SDD Criteria

- SDD: `agent-roadmap/sdd/operational-observability-provider-management/node-provider-execution-liveness-recovery/SDD.md`; status `[승인됨]`; lock released; task header `milestone-task=ops-evidence`.
- Target: Acceptance Scenario S06 and Evidence Map S06. They require distinct liveness/fence/health/commit/recovery evidence, stale rejection, snapshot recovery, and no high-cardinality/raw content.
- R1/R2 make the shared contract accurately describe producer timing and bounded values. R3 makes the living spec point directly to the deterministic Node, Edge overlay, and OpenAI evidence that satisfies S06.

### Verification Context

- No external handoff was supplied. Repository-native fallback used the current contracts/spec, the three reviewed producer sources/tests, and the three archived dependency `complete.log` files.
- Fresh reviewer commands passed: exact dependency resolution for indices 11/12/13; selected package tests; focused producer tests; deterministic `rg --sort path`; declared-file diff; and `git diff --check`.
- No external runner, service, credential, device, or live provider is required. Fresh Go execution uses `-count=1`; cached output is not acceptable.
- Confidence: high. R1 is directly proven by synchronous calls in `model_queue_release.go`/`provider_health_observability.go` and observer-before-terminal calls in `liveness_watchdog.go`; R2/R3 are visible schema/evidence omissions.

### Test Coverage Gaps

- No product behavior changes are planned, so no new Go test is warranted.
- Existing `TestNodeLivenessObservability`, `TestProviderHealthObservability*`, `TestOpenAILivenessObservationSink`, and `TestOpenAILivenessRecoveryObservability` cover the documented timing-adjacent behavior, bounded values, raw/high-cardinality guards, and producer lifecycle.
- The only gap is documentation reproducibility, closed by exact source/test entries, focused commands, positive schema scans, and stale-wording negative scans.

### Symbol References

None. No symbol is renamed or removed.

### Split Judgment

- Keep one compact documentation packet. R1 and R2 share the operational-projection contract, while R3 must cite that corrected contract in the matching living spec; splitting would permit an inconsistent intermediate documentation state.
- Dependency 11 is satisfied by `agent-task/archive/2026/08/m-node-provider-execution-liveness-recovery/11+06_node_liveness_observability/complete.log`.
- Dependency 12 is satisfied by `agent-task/archive/2026/08/m-node-provider-execution-liveness-recovery/12+08_health_overlay_observability/complete.log`.
- Dependency 13 is satisfied by `agent-task/archive/2026/08/m-node-provider-execution-liveness-recovery/13+10_recovery_observability/complete.log`.

### Scope Rationale

Modify only `execution-runtime.md`, `edge-node-runtime-wire.md`, `edge-node-execution.md`, and implementation evidence in the active review stub. Do not change Go code/tests, protobuf/config schemas, metrics, recovery behavior, roadmap/SDD state, other contracts/specs, rules, skills, or archived evidence.

### Final Routing

- `evaluation_mode=isolated-reassessment`; finalizer=`finalize-task-policy.sh pair`.
- Build closures are all true; scores `(2,0,1,1,1)`, grade `G05`, base/final route `local-fit`, filename `PLAN-local-G05.md`.
- Review closures are all true; scores `(2,0,1,1,1)`, grade `G05`, route `official-review`, filename `CODE_REVIEW-cloud-G05.md` (`codex`, `gpt-5.6-sol`, `xhigh`).
- `large_indivisible_context=false`; matched positive risks: `boundary_contract`, `variant_product`; count `2`.
- `review_rework_count=1`; `evidence_integrity_failure=false`; no recovery boundary, capability gap, or unresolved ownership/decision.

## Dependencies and Execution Order

1. Dependencies 11, 12, and 13 are already satisfied by the exact archived `complete.log` paths recorded above.
2. Apply REVIEW_REFACTOR-1 before REVIEW_REFACTOR-2 so the living spec cites the corrected contract semantics.

## Implementation Checklist

- [ ] REVIEW_REFACTOR-1 resolves Required R1 and R2 by correcting the two source-inaccurate timing statements and documenting the complete current OpenAI safe-log value contract.
- [ ] REVIEW_REFACTOR-2 resolves Required R3 by adding structured S06 observability source/test evidence and deterministic focused commands to the living spec.
- [ ] Run every command in Final Verification with fresh output and confirm the write set contains only the three declared documents plus the active review evidence.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_REFACTOR-1] Correct operational-projection timing and value contracts

**Problem:** `agent-contract/inner/execution-runtime.md:93` implies that Edge does not wait for observer delivery, although the post-unlock observer call is synchronous and can delay handler return. `agent-contract/inner/edge-node-runtime-wire.md:107` says Node observes after terminal assembly, but both paths observe finalized stall evidence before constructing the terminal. `agent-contract/inner/execution-runtime.md:100-103` also omits the OpenAI safe-log phase/empty-field/current-health semantics.

**Solution:** Preserve the post-decision/post-unlock correctness boundary while stating synchronous delivery precisely. State that Node observes finalized stall evidence before constructing and delivering the terminal, with observer failure unable to suppress terminal delivery. Define safe-log `phase` as `idle|eligible_pending`, explain empty `eligibility`/`recovery_result` lifecycle rows, and state that current immutable observations yield `provider_health=unknown` while the closed classifier reserves available/unavailable.

Before (`agent-contract/inner/execution-runtime.md:93`, `agent-contract/inner/edge-node-runtime-wire.md:107`):

```text
The queue does not wait for observer delivery.
Node emits ... after the stall terminal is assembled.
```

After:

```text
Edge delivery is synchronous after decision/release/pump and after the queue lock is released; observer latency can delay handler return but cannot retain the lock or change the finalized transition.
Node observes finalized stall evidence before constructing and delivering the terminal; recovered observer failure cannot suppress terminal delivery.
```

**Modified Files and Checklist:**

- [ ] `agent-contract/inner/execution-runtime.md`: correct Edge delivery timing and add the exact OpenAI safe-log value schema.
- [ ] `agent-contract/inner/edge-node-runtime-wire.md`: correct Node observation/terminal ordering without adding a wire semantic.

**Test Strategy:** No new test. Existing producer tests are the authoritative executable behavior; rerun them and use deterministic positive/negative documentation scans.

**Verification:** Final Verifications 2-5 must pass.

### [REVIEW_REFACTOR-2] Complete the living S06 evidence matrix

**Problem:** `agent-spec/runtime/edge-node-execution.md:5` lacks structured source/test entries for the three S06 observability producers, and `agent-spec/runtime/edge-node-execution.md:153` does not include the focused OpenAI observability verification. The change-history prose alone is not the reproducible evidence matrix required by REFACTOR-2.

**Solution:** Add code and test `source_evidence` entries for Node liveness observability, Edge provider-health observability, and Edge OpenAI recovery observability. Extend `## 검증` with the exact focused Node/Edge/OpenAI selectors, including the provider-health sentinel test via the existing prefix selector, while retaining the broader current regression commands.

Before (`agent-spec/runtime/edge-node-execution.md:153`):

```text
The verification list covers execution, Node, service, and transport packages but not the complete S06 producer matrix.
```

After:

```text
Structured source_evidence and focused fresh commands cover all three S06 producers and their raw/high-cardinality guards.
```

**Modified Files and Checklist:**

- [ ] `agent-spec/runtime/edge-node-execution.md`: add exact S06 code/test evidence and focused deterministic commands.

**Test Strategy:** No new test. Reuse the existing deterministic producer tests and assert their exact names/paths remain in the living spec.

**Verification:** Final Verifications 2, 3, and 6 must pass.

## Modified Files Summary

| File | Item |
|------|------|
| `agent-contract/inner/execution-runtime.md` | REVIEW_REFACTOR-1 |
| `agent-contract/inner/edge-node-runtime-wire.md` | REVIEW_REFACTOR-1 |
| `agent-spec/runtime/edge-node-execution.md` | REVIEW_REFACTOR-2 |
| `agent-task/m-node-provider-execution-liveness-recovery/14+11,12,13_observability_contracts/CODE_REVIEW-cloud-G05.md` | REVIEW_REFACTOR-1, REVIEW_REFACTOR-2 |

## Final Verification

Fresh output is required; cached Go test output is not acceptable.

1. `bash -O nullglob -c 'for index in 11 12 13; do matches=(agent-task/m-node-provider-execution-liveness-recovery/${index}_*/complete.log agent-task/m-node-provider-execution-liveness-recovery/${index}+*/complete.log agent-task/archive/*/*/m-node-provider-execution-liveness-recovery/${index}_*/complete.log agent-task/archive/*/*/m-node-provider-execution-liveness-recovery/${index}+*/complete.log); ((${#matches[@]} == 1)) || exit 1; done'` — exactly one completion exists for every predecessor.
2. `go test -count=1 ./packages/go/execution ./apps/node/internal/node ./apps/edge/internal/service ./packages/go/streamgate ./apps/edge/internal/openai` — all affected runtime packages pass.
3. `go test -count=1 ./apps/node/internal/node -run '^TestNodeLivenessObservability' && go test -count=1 ./apps/edge/internal/service -run '^TestProviderHealthObservability' && go test -count=1 ./apps/edge/internal/openai -run '^(TestOpenAILivenessObservationSink|TestOpenAILivenessRecoveryObservability)$'` — every S06 producer selector executes matching tests and passes.
4. `rg --sort path -n 'synchronous|before constructing and delivering|eligible_pending|provider_health=unknown|empty.*eligibility|empty.*recovery_result' agent-contract/inner/execution-runtime.md agent-contract/inner/edge-node-runtime-wire.md` — the corrected timing and bounded safe-log semantics are present.
5. `if rg -n 'queue does not wait for observer delivery|after the stall terminal is assembled' agent-contract/inner/execution-runtime.md agent-contract/inner/edge-node-runtime-wire.md; then exit 1; fi` — exits zero with no stale timing statement.
6. `rg --sort path -n 'liveness_observability.go|provider_health_observability.go|liveness_recovery_observability.go|TestNodeLivenessObservability|TestProviderHealthObservabilityDoesNotExposeSentinels|TestOpenAILivenessRecoveryObservability' agent-spec/runtime/edge-node-execution.md` — structured/current evidence and verification references cover all three producers.
7. `git diff -- agent-contract/inner/execution-runtime.md agent-contract/inner/edge-node-runtime-wire.md agent-spec/runtime/edge-node-execution.md agent-task/m-node-provider-execution-liveness-recovery/14+11,12,13_observability_contracts/CODE_REVIEW-cloud-G05.md` — only declared documentation and implementation-evidence edits appear.
8. `git diff --check` — no whitespace errors.

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