<!-- task=m-iop-agent-chronos-extraction-decoupling/12+10,11_node_boundary_closure plan=0 tag=REFACTOR -->

# Node consumers·contract 중립화와 boundary closure

## For the Implementing Agent

`CODE_REVIEW-cloud-G08.md`의 implementation-owned 섹션 작성은 필수다. encoded predecessor의 exact PASS를 확인하고 이 child 범위만 구현·검증한다. active pair를 유지해 review 준비 완료를 보고하며 finalization은 code-review agent만 수행한다. 차단되면 질문하거나 상태를 분류하지 말고 blocker, 실제 명령/출력, 재개 조건만 evidence 필드에 기록한다.

## Background

Node와 provider-smoke consumers를 neutral packages로 전환하고 living contract/spec/rules 및 semantic audit로 S04 retain-node를 닫는다.

## Roadmap Targets

- Milestone: `agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md`
- Milestone link: [Milestone 문서](agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-chronos-extraction-decoupling.md)
- Task ids:
  - `retain-node`: non-Agent generic execution/provider package와 Edge-Node control boundary 유지
- Completion mode: check-on-pass

## Analysis

### Files Read

- `apps/node/internal/node/runtime_bridge.go`
- `apps/node/internal/bootstrap/module.go`
- `agent-contract/index.md`
- `agent-contract/inner/agent-runtime.md`
- `agent-contract/inner/execution-runtime.md`
- `agent-spec/runtime/edge-node-execution.md`
- `agent-task/m-iop-agent-chronos-extraction-decoupling/12+10,11_node_boundary_closure/node-boundary-audit.log`

### SDD Criteria

- S04 Evidence Map의 generic Node execution/control focused tests, contract regression, forbidden workflow semantics 부재를 최종 증명한다.

### Verification Context

- 기존 retain-node PLAN의 REFACTOR-3/4 consumer list와 검증만 유지한다.
- 기존 parent PLAN의 scope, 수정 파일, 검증 명령을 분할했으며 source/test 재조사나 검증 실행은 하지 않았다.

### Test Coverage Gaps

- wire compatibility는 기존 in-process Node tests로, 부정 의미는 deterministic semantic scan으로 검증한다.

### Symbol References

- 모든 old imports를 execution/provider로 전환하고 active agent-runtime contract를 execution-runtime으로 중립화한다.

### Split Judgment

- 이 closure child만 retain-node Roadmap Task를 닫는다.

### Scope Rationale

- Edge-Node protobuf AgentUsageStatus와 operational domain-agent commands는 compatibility 예외로 유지한다.

### Final Routing

- `evaluation_mode=isolated-reassessment`, finalizer=`finalize-task-policy.sh`, mode=`pair`.
- Build closures 모두 true. Scores=`2,1,2,1,2`, grade=`G08`, base/route=`local-fit`, lane=`local`.
- Review closures 모두 true. Scores=`2,1,2,1,2`, route=`official-review`, lane=`cloud`, grade=`G08`.
- `large_indivisible_context=false`; positive loop risks=`concurrent_consistency, boundary_contract` (2); `review_rework_count=0`; `evidence_integrity_failure=false`; capability gap 없음.
- Canonical files: `PLAN-local-G08.md`, `CODE_REVIEW-cloud-G08.md`.

## Dependencies and Execution Order

1. `10+09_neutral_execution` and `11+09_neutral_provider` must each have exactly one matching PASS `complete.log`; all are currently missing.
2. Resolve only those exact predecessor completion artifacts, then implement this child scope.

## Implementation Checklist

- [ ] Refuse to start until 10+09_neutral_execution and 11+09_neutral_provider each have an exact PASS complete.log.
- [ ] Update every original Node/provider-smoke consumer to neutral packages while preserving Edge-Node wire behavior.
- [ ] Reconcile contract, spec, domain, README, and readability pointers through update-contract/update-spec.
- [ ] Run focused, race, vet, full, old-path, Chronos-import, and forbidden-workflow audits and record node-boundary-audit.log.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REFACTOR-3] Node consumers와 living contract/spec 중립화

**Problem**

Node/router/adapters/bootstrap와 active contract/spec/rules가 old paths와 Common Agent Runtime 명칭을 import/source-of-truth로 사용한다.

```go
// apps/node/internal/node/runtime_bridge.go:3-5
+runtime "iop/packages/go/agentruntime"
```

**Solution**

모든 exact consumer import를 `iop/packages/go/execution` 또는 `iop/packages/go/provider/cli`로 바꾼다. `runtime` alias는 generic local readability를 위해 유지할 수 있다. `agent-runtime.md`는 `execution-runtime.md`로 이동해 Node execution/control contract만 남기고 index/spec/domain pointers를 갱신한다. wire `iop.AgentUsageStatus` 변환은 보존한다.

```go
// after: apps/node/internal/node/runtime_bridge.go
+runtime "iop/packages/go/execution"
```

**Modified Files and Checklist**

- [ ] Update every REFACTOR-3 path in Modified Files Summary.
- [ ] Ensure active contract/spec indexes contain only the neutral runtime path.
- [ ] Do not add Chronos import, workflow state, retry, review, or integration fields.

**Test Strategy**

- Node adapters/router/handler/bootstrap suites and provider smoke compile/test.
- Edge-Node wire DTO values are asserted unchanged by existing runtime bridge/command/tunnel tests.

**Verification**

- `go test -count=1 ./apps/node/... ./cmd/iop-provider-smoke`
- `go test -race -count=1 ./apps/node/internal/node ./apps/node/internal/router ./apps/node/internal/adapters/...`
- `go vet ./packages/go/execution ./packages/go/provider/cli/... ./apps/node/...`

### [REFACTOR-4] Neutral-boundary semantic audit

**Problem**

컴파일 성공만으로 Node에 hidden task/review/selection semantics가 없는지 증명할 수 없다.

```text
# SDD.md:79,89
Node must not interpret Chronos work/state semantics.
```

**Solution**

old path/import, forbidden workflow vocabulary, Chronos application import를 deterministic scan하고 allowed protobuf/domain-agent terms는 exact rationale와 함께 audit log에 기록한다.

```text
# after: node-boundary-audit.log
old_agent_paths=0
chronos_imports=0
forbidden_workflow_symbols=0
wire_compatibility_exceptions=<exact list>
```

**Modified Files and Checklist**

- [ ] `agent-task/m-iop-agent-chronos-extraction-decoupling/12+10,11_node_boundary_closure/node-boundary-audit.log` — exact commands/output and allowed wire exceptions.
- [ ] `agent-task/m-iop-agent-chronos-extraction-decoupling/12+10,11_node_boundary_closure/CODE_REVIEW-cloud-G08.md` — actual evidence.

**Test Strategy**

- fresh full Go suite and deterministic semantic scans; cache 불허.

**Verification**

- `test -z "$(rg --sort path -n 'packages/go/agentruntime|packages/go/agentprovider' apps packages cmd agent-contract agent-spec agent-ops/rules/project README.md)"`
- `test -z "$(rg --sort path -n 'agenttask|SelectionPolicy|review_rework|integration queue|Plan/Review|Milestone|Roadmap lifecycle|git\.toki-labs\.com/toki/chronos' apps/node packages/go/execution packages/go/provider)"`
- `go test -count=1 ./...`

## Modified Files Summary

| File | Item |
|------|------|
| `apps/node/cmd/node/quota_probe.go` | REFACTOR-3 |
| `apps/node/cmd/node/quota_probe_test.go` | REFACTOR-3 |
| `apps/node/internal/adapters/adapters_blackbox_test.go` | REFACTOR-3 |
| `apps/node/internal/adapters/config_set.go` | REFACTOR-3 |
| `apps/node/internal/adapters/factory.go` | REFACTOR-3 |
| `apps/node/internal/adapters/mock/mock.go` | REFACTOR-3 |
| `apps/node/internal/adapters/ollama/chat.go` | REFACTOR-3 |
| `apps/node/internal/adapters/ollama/command.go` | REFACTOR-3 |
| `apps/node/internal/adapters/ollama/ollama.go` | REFACTOR-3 |
| `apps/node/internal/adapters/ollama/ollama_test.go` | REFACTOR-3 |
| `apps/node/internal/adapters/ollama/provider.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/capabilities_test.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/execute.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/execute_test.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/openai_compat_test_support_test.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/provider.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/provider_tunnel.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/provider_tunnel_test.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/request.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/stream.go` | REFACTOR-3 |
| `apps/node/internal/adapters/openai_compat/thinking_policy_test.go` | REFACTOR-3 |
| `apps/node/internal/adapters/vllm/provider.go` | REFACTOR-3 |
| `apps/node/internal/adapters/vllm/provider_tunnel.go` | REFACTOR-3 |
| `apps/node/internal/adapters/vllm/request.go` | REFACTOR-3 |
| `apps/node/internal/adapters/vllm/stream.go` | REFACTOR-3 |
| `apps/node/internal/adapters/vllm/vllm_test.go` | REFACTOR-3 |
| `apps/node/internal/adapters/vllm/vllm_tunnel_test.go` | REFACTOR-3 |
| `apps/node/internal/bootstrap/module.go` | REFACTOR-3 |
| `apps/node/internal/node/cancel_handler.go` | REFACTOR-3 |
| `apps/node/internal/node/command_handler.go` | REFACTOR-3 |
| `apps/node/internal/node/command_test.go` | REFACTOR-3 |
| `apps/node/internal/node/concurrency_gate_test.go` | REFACTOR-3 |
| `apps/node/internal/node/gate_refresh_test.go` | REFACTOR-3 |
| `apps/node/internal/node/node.go` | REFACTOR-3 |
| `apps/node/internal/node/node_concurrency_integration_test.go` | REFACTOR-3 |
| `apps/node/internal/node/node_test_support_test.go` | REFACTOR-3 |
| `apps/node/internal/node/provider_tunnel_test.go` | REFACTOR-3 |
| `apps/node/internal/node/registry_refresh_test.go` | REFACTOR-3 |
| `apps/node/internal/node/run_cancel_test.go` | REFACTOR-3 |
| `apps/node/internal/node/run_handler.go` | REFACTOR-3 |
| `apps/node/internal/node/runtime_bridge.go` | REFACTOR-3 |
| `apps/node/internal/node/runtime_bridge_test.go` | REFACTOR-3 |
| `apps/node/internal/node/runtime_sink.go` | REFACTOR-3 |
| `apps/node/internal/node/sink_test.go` | REFACTOR-3 |
| `apps/node/internal/node/tunnel_handler.go` | REFACTOR-3 |
| `apps/node/internal/router/router.go` | REFACTOR-3 |
| `apps/node/internal/router/router_test.go` | REFACTOR-3 |
| `cmd/iop-provider-smoke/main.go` | REFACTOR-3 |
| `README.md` | REFACTOR-3 |
| `agent-contract/index.md` | REFACTOR-3 |
| `agent-contract/inner/agent-runtime.md` | REFACTOR-3 |
| `agent-contract/inner/execution-runtime.md` | REFACTOR-3 |
| `agent-spec/index.md` | REFACTOR-3 |
| `agent-spec/runtime/edge-node-execution.md` | REFACTOR-3 |
| `agent-ops/rules/project/rules.md` | REFACTOR-3 |
| `agent-ops/rules/project/domain/node/rules.md` | REFACTOR-3 |
| `agent-ops/rules/project/domain/platform-common/rules.md` | REFACTOR-3 |
| `scripts/readability_baseline.json` | REFACTOR-3 |
| `scripts/readability_read_sets.json` | REFACTOR-3 |
| `agent-task/m-iop-agent-chronos-extraction-decoupling/12+10,11_node_boundary_closure/node-boundary-audit.log` | REFACTOR-4 |
| `agent-task/m-iop-agent-chronos-extraction-decoupling/12+10,11_node_boundary_closure/CODE_REVIEW-cloud-G08.md` | REFACTOR-4 |

## Final Verification

1. Confirm exact PASS `complete.log` for `10+09_neutral_execution` and `11+09_neutral_provider`.
2. `go test -count=1 ./apps/node/... ./cmd/iop-provider-smoke`
3. `go test -race -count=1 ./apps/node/internal/node ./apps/node/internal/router ./apps/node/internal/adapters/...`
4. `go vet ./packages/go/execution ./packages/go/provider/cli/... ./apps/node/...`
5. `test -z "$(rg --sort path -n 'packages/go/agentruntime|packages/go/agentprovider' apps packages cmd agent-contract agent-spec agent-ops/rules/project README.md)"`
6. `test -z "$(rg --sort path -n 'agenttask|SelectionPolicy|review_rework|integration queue|Plan/Review|Milestone|Roadmap lifecycle|git\.toki-labs\.com/toki/chronos' apps/node packages/go/execution packages/go/provider)"`
7. `go test -count=1 ./...`

All commands use the cache policy stated in the original plan.

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