docs(agent-task): 실행 프리셋 작업 계획을 정리한다

IOP 실행 프리셋과 Hot Path 마일스톤을 구현 가능한 단계로 분할하고 각 단계의 검토 및 검증 기준을 공유하기 위해 계획과 코드 리뷰 참조 문서를 추가한다.
This commit is contained in:
toki 2026-08-02 18:55:01 +09:00
parent c3a24ec5fe
commit dfe466187e
30 changed files with 3665 additions and 0 deletions

View file

@ -0,0 +1,111 @@
<!-- task=m-iop-hot-path-one-shot-execution/01_preset_schema plan=1 tag=API milestone-task=preset-schema,hot-preset -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in.
> Complete the `Implementation Checklist`; the final checklist item is mandatory before saving.
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
> If implementation is blocked, record the exact blocker, attempted commands/output, and resume condition only in implementation-owned evidence fields.
> Do not ask the user directly, present choices, call user-input tools, create control-plane stop files, or classify the next state.
> Finalization (`Code Review Result`, log rename, `complete.log`, archive moves, `Review-Only Checklist`) is review-agent-only, even after compaction/resume.
> Follow the ownership table at the bottom of this file for which sections you own.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/01_preset_schema, plan=1, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** The finalization steps below are review-agent only. Implementing agents must not execute this section.
Compare implementation of each item against source files and verify that output in `Verification Results` matches code. Review completion means: append verdict and routing signals; archive the active review and plan; on PASS write `complete.log`, preserve milestone metadata, archive the task directory, and update the final `.log` review checklist; on WARN/FAIL write the exact next state required by the code-review skill.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Define the preset schema and hot-mode registry | [ ] |
## Implementation Checklist
- [ ] Define the execution preset catalog, selector/stage/workspace binding shapes, and registered direct/light descriptors.
- [ ] Fail closed on invalid ids, routes, options, binding shapes, and unsupported handlers while preserving provider-only compatibility.
- [ ] Run focused, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** This checklist is used only by the review agent. Implementing agents must not modify or check this section.
- [ ] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified `review_rework_count`, `evidence_integrity_failure` to `Code Review Result`.
- [ ] Verify that verdict, `Dimension Assessment`, and Required/Suggested/Nit classifications match.
- [ ] Archive active `CODE_REVIEW-*-G??.md` to `code_review_cloud_G03_1.log`.
- [ ] Archive active `PLAN-*-G??.md` to `plan_local_G03_1.log`.
- [ ] Verify that the Agent-Ops managed block in `.gitignore` unignores `agent-task/**/*.md` and `agent-task/**/*.log` and ignores `agent-roadmap/current.md`.
- [ ] If PASS, write `complete.log` based on `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md` files.
- [ ] If PASS, move this active task directory to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/01_preset_schema/` and update this checklist at the final archive path.
- [ ] If PASS, preserve and report `milestone-task=preset-schema,hot-preset` without modifying roadmap state directly.
- [ ] If PASS for split work, remove the empty active parent or verify it was kept due to remaining siblings/files.
- [ ] If WARN/FAIL, write the next filesystem state matching the verdict and do not write `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Config descriptors contain no executable callbacks or provider dependencies.
- Direct/light shapes are exact and unsupported modes fail closed.
- Existing provider-only configs remain compatible.
## Verification Results
### API-1 item verification
```bash
go test -count=1 ./packages/go/config
```
_Actual stdout/stderr:_
### Race tests
```bash
go test -race -count=1 ./packages/go/config
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./packages/go/config
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?**
> If anything is blank, go back and fill it in before saving this file.
> Leave review-agent-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Header comment, Overview, Review Agent Instructions | Fixed at stub creation | Implementer must not modify or execute these |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementer checks `[ ]` to `[x]` only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementer checks `[ ]` to `[x]` only |
| Review-Only Checklist | Review agent only | Implementer must not modify or check this section |
| Deviations from Plan, Key Design Decisions | Implementing agent | Replace placeholder text with actual content |
| Reviewer Checkpoints | Fixed at stub creation | Pre-filled from plan |
| Verification Results headings and commands | Fixed at stub creation | Implementer fills actual stdout/stderr; changes require a deviation entry |
| Code Review Result | Review agent appends | Not included in stub |

View file

@ -0,0 +1,108 @@
<!-- task=m-iop-hot-path-one-shot-execution/01_preset_schema plan=1 tag=API milestone-task=preset-schema,hot-preset -->
# Execution Preset Schema and Hot-Mode Registry
## For the Implementing Agent
Implement this plan, run every verification command, and fill every implementation-owned section of `CODE_REVIEW-cloud-G03.md` with actual notes and stdout/stderr. Keep the active files in place and report ready for review. If blocked, record only the exact blocker, attempted commands/output, and resume condition in implementation-owned evidence fields; finalization belongs to the code-review skill.
## Background
The Edge config has model/provider catalogs but no execution policy that can freeze selector, allowed modes, downstream stages, and workspace bindings as one declarative shape. This child adds only the compatible schema and registered `direct`/`light` vocabulary.
## Analysis
### Files Read
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `packages/go/config/config.go`
- `packages/go/config/edge_types.go`
- `packages/go/config/provider_types.go`
- `packages/go/config/load.go`
- `packages/go/config/validate.go`
- `packages/go/config/provider_catalog_config_test.go`
- `packages/go/config/provider_catalog_validation_config_test.go`
### SDD Criteria
The approved/unlocked SDD scenarios S02/S04 require preset decode/normalize behavior and registered `direct`/`light` shapes while rejecting `heavy` and custom handlers. This child covers the data-only schema and fail-closed shape validation portion.
### Verification Context
Repository-native Go tests are sufficient. Fresh and race-enabled config tests are required; no external provider, credential, port, or workspace runner is needed. Confidence: high.
### Test Coverage Gaps
Existing config tests cover provider/model catalogs but not preset shape, mode registry, or invalid stage/binding combinations. Deep-clone behavior belongs to child 02, which publishes runtime generations.
### Symbol References
No symbol is renamed or removed. The new types extend `EdgeConfig` and are consumed by the next preset-generation child.
### Split Judgment
This is the first refined child of the former preset catalog pair. Its independently verifiable contract is that valid preset shapes decode and normalize while invalid or unsupported mode shapes fail closed. Child 02 consumes these types after this directory has `complete.log`.
### Scope Rationale
Do not add model-to-preset references, runtime snapshots, live refresh, principal authorization, selector execution, request state, manifests, or defaults that activate a preset.
### Final Routing
`evaluation_mode=isolated-reassessment`; `finalizer=finalize-task-policy.sh` (`pair`). Build closures are all true; scores `(scope=1,state=0,blast=1,evidence=1,verification=0)` yield G03, base/final route `local-fit`, `large_indivisible_context=false`, matched risks `boundary_contract,variant_product` (2), rework 0, evidence-integrity failure false, no capability gap; canonical file `PLAN-local-G03.md`. Review uses the same scores and official cloud G03 with `CODE_REVIEW-cloud-G03.md` (`gpt-5.6-sol`, xhigh).
## Implementation Checklist
- [ ] Define the execution preset catalog, selector/stage/workspace binding shapes, and registered direct/light descriptors.
- [ ] Fail closed on invalid ids, routes, options, binding shapes, and unsupported handlers while preserving provider-only compatibility.
- [ ] Run focused, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
### [API-1] Define the preset schema and hot-mode registry
#### Problem
`EdgeConfig` exposes only `Models` and `ProtocolProfiles`, so the SDD preset fields cannot be decoded or validated and unsupported mode handlers have no startup rejection boundary.
#### Solution
Add a cohesive preset type file containing selector stage, ordered route stages/options, allowed modes, and declarative workspace binding alternatives. Validate unique ids, canonical model references, exact current route shapes (`direct` has no downstream stages; `light` is `local,review`), bounded options, and only registered mode descriptors. Config owns pure descriptors, not executable handlers.
#### Modified Files and Checklist
- [ ] `packages/go/config/config.go` — document the new responsibility file.
- [ ] `packages/go/config/edge_types.go` — add the top-level catalog.
- [ ] `packages/go/config/execution_preset_types.go` — define the data types, pure mode-shape descriptors, and validation; runtime-generation clone helpers belong to child 02.
- [ ] `packages/go/config/load.go` — validate and normalize presets before model admission.
- [ ] `packages/go/config/execution_preset_config_test.go` — cover valid direct/light and invalid ids, stages, options, handlers, and binding shapes.
#### Test Strategy
Write `TestLoadEdgeExecutionPresetCatalog` and `TestLoadEdgeExecutionPresetRejectsInvalidShape`. Assert ordered stages/options survive decode, `direct`/`light` pass, unsupported keys and malformed/dangling references fail deterministically, and existing provider-only fixtures still load.
#### Verification
Run `go test -count=1 ./packages/go/config`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `packages/go/config/config.go` | API-1 |
| `packages/go/config/edge_types.go` | API-1 |
| `packages/go/config/execution_preset_types.go` | API-1 |
| `packages/go/config/load.go` | API-1 |
| `packages/go/config/execution_preset_config_test.go` | API-1 |
| `agent-task/m-iop-hot-path-one-shot-execution/01_preset_schema/CODE_REVIEW-cloud-G03.md` | API-1 |
## Final Verification
```bash
go test -count=1 ./packages/go/config
go test -race -count=1 ./packages/go/config
go vet ./packages/go/config
git diff --check
```
Expected: every command exits 0; direct/light shapes load, unsupported shapes fail before runtime dispatch, and provider-only fixtures remain compatible. After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.

View file

@ -0,0 +1,130 @@
<!-- task=m-iop-hot-path-one-shot-execution/01_preset_catalog plan=0 tag=API milestone-task=preset-schema,hot-preset -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in.
> Complete the `Implementation Checklist`; the final checklist item is mandatory before saving.
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
> If implementation is blocked, record the exact blocker, attempted commands/output, and resume condition only in implementation-owned evidence fields.
> Do not ask the user directly, present choices, call user-input tools, create control-plane stop files, or classify the next state.
> Finalization (`Code Review Result`, log rename, `complete.log`, archive moves, `Review-Only Checklist`) is review-agent-only, even after compaction/resume.
> Follow the ownership table at the bottom of this file for which sections you own.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/01_preset_catalog, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** The finalization steps below are review-agent only. Implementing agents must not execute this section.
Compare implementation of each item against source files and verify that output in `Verification Results` matches code. Review completion means: append verdict and routing signals; archive the active review and plan; on PASS write `complete.log`, preserve milestone metadata, archive the task directory, and update the final `.log` review checklist; on WARN/FAIL write the exact next state required by the code-review skill.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Define the preset schema and hot-mode registry | [ ] |
| API-2 Publish immutable preset generations at startup and refresh | [ ] |
## Implementation Checklist
- [ ] Define and fail-closed validate the execution preset catalog and registered direct/light mode shapes.
- [ ] Propagate a deeply cloned preset generation through startup and live config refresh without changing active snapshots.
- [ ] Run the focused, race, vet, and diff verification commands exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** This checklist is used only by the review agent. Implementing agents must not modify or check this section.
- [ ] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified `review_rework_count`, `evidence_integrity_failure` to `Code Review Result`.
- [ ] Verify that verdict, `Dimension Assessment`, and Required/Suggested/Nit classifications match.
- [ ] Archive active `CODE_REVIEW-*-G??.md` to `code_review_cloud_G07_0.log`.
- [ ] Archive active `PLAN-*-G??.md` to `plan_local_G07_0.log`.
- [ ] Verify that the Agent-Ops managed block in `.gitignore` unignores `agent-task/**/*.md` and `agent-task/**/*.log` and ignores `agent-roadmap/current.md`.
- [ ] If PASS, write `complete.log` based on `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md` files.
- [ ] If PASS, move this active task directory to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/01_preset_catalog/` and update this checklist at the final archive path.
- [ ] If PASS, preserve and report `milestone-task=preset-schema,hot-preset` without modifying roadmap state directly.
- [ ] If PASS for split work, remove the empty active parent or verify it was kept due to remaining siblings/files.
- [ ] If WARN/FAIL, write the next filesystem state matching the verdict and do not write `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Preset cloning is deep across nested stage/options/binding maps and slices.
- Config owns data-only mode descriptors, runtime owns executable handlers, and their keys agree; direct/light load while unsupported modes fail before dispatch.
- Refresh replaces the aggregate for new reads and cannot mutate a retained snapshot.
## Verification Results
Paste actual stdout/stderr below each exact command. Record any replacement and reason in Deviations.
### API-1 item verification
```bash
go test -count=1 ./packages/go/config
```
_Actual stdout/stderr:_
### API-2 item verification
```bash
go test -count=1 ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai
```
_Actual stdout/stderr:_
### Focused tests
```bash
go test -count=1 ./packages/go/config ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai
```
_Actual stdout/stderr:_
### Common race tests
```bash
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./packages/go/config ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?**
> If anything is blank, go back and fill it in before saving this file.
> Leave review-agent-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Header comment, Overview, Review Agent Instructions | Fixed at stub creation | Implementer must not modify or execute these |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementer checks `[ ]` to `[x]` only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementer checks `[ ]` to `[x]` only |
| Review-Only Checklist | Review agent only | Implementer must not modify or check this section |
| Deviations from Plan, Key Design Decisions | Implementing agent | Replace placeholder text with actual content |
| Reviewer Checkpoints | Fixed at stub creation | Pre-filled from plan |
| Verification Results headings and commands | Fixed at stub creation | Implementer fills actual stdout/stderr; changes require a deviation entry |
| Code Review Result | Review agent appends | Not included in stub |

View file

@ -0,0 +1,169 @@
<!-- task=m-iop-hot-path-one-shot-execution/01_preset_catalog plan=0 tag=API milestone-task=preset-schema,hot-preset -->
# Execution Preset Catalog and Hot-Mode Registry
## For the Implementing Agent
Implement this plan, run every verification command, and fill every implementation-owned section of `CODE_REVIEW-cloud-G07.md` with actual notes and stdout/stderr. Keep the active files in place and report ready for review. If blocked, record only the exact blocker, attempted commands/output, and resume condition in implementation-owned evidence fields; do not ask the user, call user-input tools, create stop files, classify the next state, archive logs, or write `complete.log`. Finalization belongs to the code-review skill.
## Background
The Edge config has model/provider catalogs but no execution policy that can freeze selector, allowed modes, downstream stages, and workspace bindings as one generation. This packet adds that compatible foundation and the registered `direct`/`light` handler vocabulary; no model is routed through a preset yet.
## Analysis
### Files Read
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `packages/go/config/config.go`
- `packages/go/config/edge_types.go`
- `packages/go/config/provider_types.go`
- `packages/go/config/load.go`
- `packages/go/config/validate.go`
- `packages/go/config/provider_catalog_config_test.go`
- `packages/go/config/provider_catalog_validation_config_test.go`
- `apps/edge/internal/configrefresh/classify.go`
- `apps/edge/internal/configrefresh/node_runtime_classify_test.go`
- `apps/edge/internal/openai/server.go`
- `apps/edge/internal/input/manager.go`
- `apps/edge/internal/bootstrap/runtime.go`
### SDD Criteria
The approved/unlocked SDD is `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`. Header metadata covers `preset-schema,hot-preset`; target scenarios are S02 and S04, and Evidence Map rows S02/S04 require decode/normalize/refresh generation isolation plus `direct`/`light` success and `heavy`/custom startup rejection. Those requirements are represented directly in API-1/API-2 and the test matrix below.
### Verification Context
No external handoff was supplied. Repository-native evidence is the local test rule, `agent-test/local/edge-smoke.md`, `agent-test/local/platform-common-smoke.md`, Go 1.26.2 at `/config/.local/bin/go`, and a clean starting worktree. Fresh (`-count=1`) and race-enabled tests are required; no external provider, credential, port, or workspace runner is needed for S02/S04. Confidence: high.
### Test Coverage Gaps
Existing config tests cover provider/model catalogs but not preset shape, mode registry, deep cloning, or refresh isolation. Add focused config, refresh, and runtime propagation tests. Existing provider-only configurations must remain covered by the full package suite.
### Symbol References
No symbol is renamed or removed. New setters extend `input.Manager` and `openai.Server`; runtime assembly is their only production caller.
### Split Judgment
This is split child 01 with no runtime predecessor. Its stable contract is: valid preset catalogs load and live-apply as immutable snapshots while provider-only models behave unchanged. Child 02 may consume that contract only after this directory has `complete.log`; the remaining children and dependencies are encoded in their directory names. No active or archived sibling index for this task group existed when indices were assigned.
### Scope Rationale
Do not add `models[].execution_preset`, principal authorization, selector execution, request state, or protocol streaming here. Do not add `heavy`, future modes, manifests, revision trees, or defaults that activate a preset. `configs/edge.yaml` remains unchanged unless a test fixture proves an existing checked-in example must compile.
### Final Routing
`evaluation_mode=first-pass`; `finalizer=finalize-task-policy.sh` (`pair`). Build closures are all true; scores `(scope=2,state=1,blast=2,evidence=1,verification=1)` yield G07, base/final route `local-fit`, `large_indivisible_context=false`, matched risks `boundary_contract,variant_product` (2), rework 0, evidence-integrity failure false, no capability gap; canonical file `PLAN-local-G07.md`. Review closures are all true; scores `(2,1,2,1,1)` yield official cloud G07 with `CODE_REVIEW-cloud-G07.md` (`gpt-5.6-sol`, xhigh).
## Implementation Checklist
- [ ] Define and fail-closed validate the execution preset catalog and registered direct/light mode shapes.
- [ ] Propagate a deeply cloned preset generation through startup and live config refresh without changing active snapshots.
- [ ] Run the focused, race, vet, and diff verification commands exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
### [API-1] Define the preset schema and hot-mode registry
#### Problem
`EdgeConfig` exposes only `Models` and `ProtocolProfiles` (`packages/go/config/edge_types.go:50-60`), so the SDD fields at lines 87-95 cannot be decoded or validated. Unknown/unsupported mode handlers also have no startup rejection boundary.
#### Solution
Add a cohesive preset type file containing selector stage, ordered route stages/options, allowed modes, and declarative workspace binding alternatives. Validate unique ids, canonical model references, exact current route shapes (`direct` has no downstream stages; `light` is `local,review`), bounded options, and only registered mode descriptors. The config package owns pure shape descriptors, not executable handlers; the Edge runtime must use the same descriptor keys when it installs/looks up handlers so unsupported modes fail before dispatch.
```go
// Before: edge_types.go:50-60
Models []ModelCatalogEntry
ProtocolProfiles map[string]ProtocolProfileConf
// After
Models []ModelCatalogEntry
ExecutionPresets []ExecutionPresetConf
ProtocolProfiles map[string]ProtocolProfileConf
```
#### Modified Files and Checklist
- [ ] `packages/go/config/config.go` — document the new responsibility file.
- [ ] `packages/go/config/edge_types.go` — add the top-level catalog.
- [ ] `packages/go/config/execution_preset_types.go` — define types, clone helpers, pure mode-shape descriptors, and validation without executable runtime handlers.
- [ ] `packages/go/config/load.go` — validate/normalize presets before model admission.
- [ ] `packages/go/config/execution_preset_config_test.go` — cover valid direct/light and invalid ids, stages, options, heavy/custom modes, and binding shapes.
#### Test Strategy
Write `TestLoadEdgeExecutionPresetCatalog` and `TestLoadEdgeExecutionPresetRejectsInvalidShape` with table fixtures. Assert ordered stages/options survive decode, `direct`/`light` pass, unsupported descriptor keys and malformed/dangling stage references fail deterministically, and existing provider-only fixtures still load. Assert the descriptor layer contains no executable callback or provider dependency.
#### Verification
Run `go test -count=1 ./packages/go/config`; expect PASS.
### [API-2] Publish immutable preset generations at startup and refresh
#### Problem
Startup and refresh only call `SetModelCatalog` (`apps/edge/internal/input/manager.go:24-55`, `apps/edge/internal/bootstrap/runtime.go:273-296`), and refresh diffing only indexes `models` (`apps/edge/internal/configrefresh/classify.go:184,349-421`). An active tool round-trip could otherwise observe partially replaced policy.
#### Solution
Add a deep-cloned server snapshot containing a monotonically replaced preset catalog generation, wire it through `NewManager`/refresh, and classify preset changes as mutable for new requests. The setter must replace one immutable aggregate under the existing server lock; consumers retain the prior copied generation. At startup/refresh admission, runtime mode lookup must agree with the config descriptor keys and reject an unavailable handler before any provider dispatch.
```go
// Before: bootstrap/runtime.go:292-296
r.Service.SetRuntimeConfig(nextStore, candidate.Models, poolPolicy)
r.Input.SetModelCatalog(candidate.Models)
// After
r.Service.SetRuntimeConfig(nextStore, candidate.Models, poolPolicy)
r.Input.SetExecutionCatalog(candidate.Models, candidate.ExecutionPresets)
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/configrefresh/classify.go` — diff preset ids and classify live changes.
- [ ] `apps/edge/internal/configrefresh/execution_preset_classify_test.go` — verify applied paths and stable ordering.
- [ ] `apps/edge/internal/openai/server.go` — own atomic/deep-cloned execution catalog snapshots.
- [ ] `apps/edge/internal/input/manager.go` — provide one catalog replacement entry point.
- [ ] `apps/edge/internal/bootstrap/runtime.go` — wire startup and refresh replacement.
- [ ] `apps/edge/internal/bootstrap/runtime_execution_preset_test.go` — prove refresh affects new snapshots and not retained ones.
#### Test Strategy
Write `TestClassifyExecutionPresetLiveApply` and `TestRuntimeRefreshReplacesExecutionPresetGeneration`. Mutate caller-owned maps/slices after setting and assert snapshots do not change; retain a pre-refresh snapshot and assert only a post-refresh read sees the new generation.
#### Verification
Run `go test -count=1 ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `packages/go/config/config.go` | API-1 |
| `packages/go/config/edge_types.go` | API-1 |
| `packages/go/config/execution_preset_types.go` | API-1 |
| `packages/go/config/load.go` | API-1 |
| `packages/go/config/execution_preset_config_test.go` | API-1 |
| `apps/edge/internal/configrefresh/classify.go` | API-2 |
| `apps/edge/internal/configrefresh/execution_preset_classify_test.go` | API-2 |
| `apps/edge/internal/openai/server.go` | API-2 |
| `apps/edge/internal/input/manager.go` | API-2 |
| `apps/edge/internal/bootstrap/runtime.go` | API-2 |
| `apps/edge/internal/bootstrap/runtime_execution_preset_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/01_preset_catalog/CODE_REVIEW-cloud-G07.md` | API-1, API-2 |
## Final Verification
Run from `/config/workspace/iop-s0`; cached test output is not acceptable.
```bash
go test -count=1 ./packages/go/config ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./packages/go/config ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai
git diff --check
```
Expected: every command exits 0; preset fixtures reject unsupported modes before runtime dispatch; retained snapshots remain immutable. External Claude/Pi smoke remains the later `hot-smoke` task, not a closure condition for S02/S04. After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.

View file

@ -0,0 +1,112 @@
<!-- task=m-iop-hot-path-one-shot-execution/02+01_preset_generation plan=0 tag=API milestone-task=preset-schema,hot-preset -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in.
> Complete the `Implementation Checklist`; the final checklist item is mandatory before saving.
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
> If implementation is blocked, record the exact blocker, attempted commands/output, and resume condition only in implementation-owned evidence fields.
> Do not ask the user directly, present choices, call user-input tools, create control-plane stop files, or classify the next state.
> Finalization (`Code Review Result`, log rename, `complete.log`, archive moves, `Review-Only Checklist`) is review-agent-only, even after compaction/resume.
> Follow the ownership table at the bottom of this file for which sections you own.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/02+01_preset_generation, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** The finalization steps below are review-agent only. Implementing agents must not execute this section.
Compare implementation of each item against source files and verify that output in `Verification Results` matches code. Review completion means: append verdict and routing signals; archive the active review and plan; on PASS write `complete.log`, preserve milestone metadata, archive the task directory, and update the final `.log` review checklist; on WARN/FAIL write the exact next state required by the code-review skill.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-2 Publish immutable preset generations at startup and refresh | [ ] |
## Implementation Checklist
- [ ] Publish a deeply cloned preset generation through startup and live config refresh.
- [ ] Preserve retained snapshots and reject unavailable runtime handlers before dispatch.
- [ ] Run dependency, focused, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** This checklist is used only by the review agent. Implementing agents must not modify or check this section.
- [ ] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified `review_rework_count`, `evidence_integrity_failure` to `Code Review Result`.
- [ ] Verify that verdict, `Dimension Assessment`, and Required/Suggested/Nit classifications match.
- [ ] Archive active `CODE_REVIEW-*-G??.md` to `code_review_cloud_G07_0.log`.
- [ ] Archive active `PLAN-*-G??.md` to `plan_local_G07_0.log`.
- [ ] Verify that the Agent-Ops managed block in `.gitignore` unignores `agent-task/**/*.md` and `agent-task/**/*.log` and ignores `agent-roadmap/current.md`.
- [ ] If PASS, write `complete.log` based on `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md` files.
- [ ] If PASS, move this active task directory to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/02+01_preset_generation/` and update this checklist at the final archive path.
- [ ] If PASS, preserve and report `milestone-task=preset-schema,hot-preset` without modifying roadmap state directly.
- [ ] If PASS for split work, remove the empty active parent or verify it was kept due to remaining siblings/files.
- [ ] If WARN/FAIL, write the next filesystem state matching the verdict and do not write `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Preset cloning is deep across nested maps and slices.
- Refresh replaces one aggregate for new reads without mutating retained snapshots.
- Runtime handler keys agree with config descriptor keys before dispatch.
## Verification Results
### API-2 item verification
```bash
go test -count=1 ./packages/go/config ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai
```
_Actual stdout/stderr:_
### Dependency and race tests
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_schema/complete.log
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./packages/go/config ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?**
> If anything is blank, go back and fill it in before saving this file.
> Leave review-agent-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Header comment, Overview, Review Agent Instructions | Fixed at stub creation | Implementer must not modify or execute these |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementer checks `[ ]` to `[x]` only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementer checks `[ ]` to `[x]` only |
| Review-Only Checklist | Review agent only | Implementer must not modify or check this section |
| Deviations from Plan, Key Design Decisions | Implementing agent | Replace placeholder text with actual content |
| Reviewer Checkpoints | Fixed at stub creation | Pre-filled from plan |
| Verification Results headings and commands | Fixed at stub creation | Implementer fills actual stdout/stderr; changes require a deviation entry |
| Code Review Result | Review agent appends | Not included in stub |

View file

@ -0,0 +1,112 @@
<!-- task=m-iop-hot-path-one-shot-execution/02+01_preset_generation plan=0 tag=API milestone-task=preset-schema,hot-preset -->
# Immutable Preset Generation Startup and Refresh
## For the Implementing Agent
Start only after predecessor 01 has `complete.log`. Implement this plan, run every command, and fill `CODE_REVIEW-cloud-G07.md` with actual notes/output. Keep active files for official review; finalization belongs to the code-review skill.
## Background
The preset schema needs an immutable runtime generation that is installed consistently at startup and live refresh without changing snapshots retained by active requests.
## Analysis
### Files Read
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `packages/go/config/execution_preset_types.go`
- `apps/edge/internal/configrefresh/classify.go`
- `apps/edge/internal/configrefresh/node_runtime_classify_test.go`
- `apps/edge/internal/openai/server.go`
- `apps/edge/internal/input/manager.go`
- `apps/edge/internal/bootstrap/runtime.go`
### SDD Criteria
SDD scenarios S02/S04 require startup and refresh generation isolation and runtime agreement with the registered direct/light descriptor keys. This child covers that runtime publication boundary.
### Verification Context
Repository-native fresh/race Go tests are sufficient. No external provider, credential, port, or workspace runner is needed. Confidence: high.
### Test Coverage Gaps
No existing test covers preset refresh diffing, caller-owned mutation after set, or retained pre-refresh snapshots.
### Symbol References
New setters extend `input.Manager` and `openai.Server`; runtime assembly is their production caller.
### Split Judgment
This is the second refined child of the former preset catalog pair. It consumes the validated schema from child 01 and independently closes immutable startup/live-refresh propagation.
### Scope Rationale
Do not change preset schema semantics, add model-to-preset references, principal authorization, selector execution, or request state.
### Final Routing
`evaluation_mode=isolated-reassessment`; finalizer pair. Build closures are true; scores `(2,2,1,1,1)` yield G07/local-fit, `large_indivisible_context=false`, matched risks `concurrent_consistency,boundary_contract` (2), rework 0, evidence-integrity failure false; `PLAN-local-G07.md`. Review uses the same scores and official cloud G07 in `CODE_REVIEW-cloud-G07.md`.
## Implementation Checklist
- [ ] Publish a deeply cloned preset generation through startup and live config refresh.
- [ ] Preserve retained snapshots and reject unavailable runtime handlers before dispatch.
- [ ] Run dependency, focused, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
### [API-2] Publish immutable preset generations at startup and refresh
#### Problem
Startup and refresh only replace the model catalog, and refresh diffing does not index execution presets. Active requests could otherwise observe partially replaced policy.
#### Solution
Implement the preset deep-clone helpers with the runtime-generation owner, add a server snapshot containing a monotonically replaced cloned catalog, wire it through manager startup/refresh, classify preset changes as mutable for new requests, and ensure runtime handler keys agree with the config descriptors before dispatch.
#### Modified Files and Checklist
- [ ] `packages/go/config/execution_preset_types.go` — implement the nested preset clone helpers used by immutable generations.
- [ ] `apps/edge/internal/configrefresh/classify.go` — diff preset ids and classify live changes.
- [ ] `apps/edge/internal/configrefresh/execution_preset_classify_test.go` — verify applied paths and stable ordering.
- [ ] `apps/edge/internal/openai/server.go` — own atomic/deep-cloned execution catalog snapshots.
- [ ] `apps/edge/internal/input/manager.go` — provide one catalog replacement entry point.
- [ ] `apps/edge/internal/bootstrap/runtime.go` — wire startup and refresh replacement.
- [ ] `apps/edge/internal/bootstrap/runtime_execution_preset_test.go` — prove refresh affects new snapshots and not retained ones.
#### Test Strategy
Write `TestClassifyExecutionPresetLiveApply` and `TestRuntimeRefreshReplacesExecutionPresetGeneration`. Mutate caller-owned maps/slices after setting and assert snapshots do not change; retain a pre-refresh snapshot and assert only a post-refresh read sees the new generation.
#### Verification
Run `go test -count=1 ./packages/go/config ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `packages/go/config/execution_preset_types.go` | API-2 |
| `apps/edge/internal/configrefresh/classify.go` | API-2 |
| `apps/edge/internal/configrefresh/execution_preset_classify_test.go` | API-2 |
| `apps/edge/internal/openai/server.go` | API-2 |
| `apps/edge/internal/input/manager.go` | API-2 |
| `apps/edge/internal/bootstrap/runtime.go` | API-2 |
| `apps/edge/internal/bootstrap/runtime_execution_preset_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_generation/CODE_REVIEW-cloud-G07.md` | API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_schema/complete.log
go test -count=1 ./packages/go/config ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./packages/go/config ./apps/edge/internal/configrefresh ./apps/edge/internal/bootstrap ./apps/edge/internal/openai
git diff --check
```
Expected: every command exits 0 and retained snapshots remain immutable while new requests see the new generation.

View file

@ -0,0 +1,99 @@
<!-- task=m-iop-hot-path-one-shot-execution/03+01_preset_model_config plan=1 tag=API milestone-task=preset-model -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in. Complete the `Implementation Checklist`, fill actual notes/output, then stop with active files in place and report ready for review. If blocked, record only the exact blocker, attempts/output, and resume condition. Do not ask the user, call user-input tools, create stop files, classify state, archive, or write `complete.log`; finalization is review-agent-only.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/03+01_preset_model_config, plan=1, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare each item against source and Verification Results. Append verdict/signals, archive the active pair, and on PASS write `complete.log`, preserve milestone metadata, archive the task directory, and update the final `.log` checklist. WARN/FAIL must create the code-review skill's exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Add model-to-preset one-of validation | [ ] |
## Implementation Checklist
- [ ] Add the model execution-preset reference and enforce provider-map versus preset one-of validation.
- [ ] Resolve preset ids after normalization while preserving provider-only validation behavior.
- [ ] Run dependency, focused, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G03_1.log`.
- [ ] Archive the active plan to `plan_local_G03_1.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/03+01_preset_model_config/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=preset-model` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL write the mandated next state without `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Model config accepts exactly one of provider map or preset id.
- Preset references resolve only after catalog normalization.
- Provider-only validation and fixtures remain unchanged.
## Verification Results
### API-1 item verification
```bash
go test -count=1 ./packages/go/config
```
_Actual stdout/stderr:_
### Dependency and race tests
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_schema/complete.log
go test -race -count=1 ./packages/go/config
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./packages/go/config
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Header/Overview/instructions, item names, checklist text, checkpoints, commands | Fixed | Do not rewrite |
| Item status, Deviations, Key Design Decisions, actual output | Implementer | Must complete |
| Review-Only Checklist and Code Review Result/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,105 @@
<!-- task=m-iop-hot-path-one-shot-execution/03+01_preset_model_config plan=1 tag=API milestone-task=preset-model -->
# Virtual Preset Model Configuration Admission
## For the Implementing Agent
Start only after predecessor 01 has `complete.log`. Implement this plan, run every command, and fill `CODE_REVIEW-cloud-G03.md` with actual notes/output. Keep active files for official review; finalization is review-agent-only.
## Background
A public model currently always means a provider pool group. This child lets a model reference exactly one execution preset or provider mapping while preserving existing provider-only configuration behavior.
## Dependencies and Execution Order
- Runtime predecessor: `01_preset_schema`. Preset generation publication in child 02 is independent of this config-admission child.
## Analysis
### Files Read
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `packages/go/config/provider_types.go`
- `packages/go/config/load.go`
- `packages/go/config/provider_catalog_validation_config_test.go`
### SDD Criteria
SDD scenario S01 requires provider-versus-preset one-of admission and stable compatibility. Principal authorization and endpoint listing are reserved for child 04.
### Verification Context
Fresh repository-native config tests are sufficient; no external credential or provider is needed. Confidence: high.
### Test Coverage Gaps
Existing tests do not cover preset-only model entries, dangling preset ids, or both/neither one-of failures.
### Symbol References
`ModelCatalogEntry` gains a compatible field; no symbol is renamed or removed.
### Split Judgment
This is the first refined child of the former preset-model pair. Config admission is independently implementable and testable; child 04 consumes its accepted model shape.
### Scope Rationale
Exclude principal projection, model listing, endpoint admission, response echo, selector execution, coordinator state, and stage dispatch.
### Final Routing
`evaluation_mode=isolated-reassessment`; finalizer pair. Build closures are true; scores `(1,0,1,1,0)` yield G03/local-fit, matched risk `boundary_contract` (1), no large context/rework/evidence failure/capability gap; `PLAN-local-G03.md`. Review uses the same scores and official cloud G03 in `CODE_REVIEW-cloud-G03.md`.
## Implementation Checklist
- [ ] Add the model execution-preset reference and enforce provider-map versus preset one-of validation.
- [ ] Resolve preset ids after normalization while preserving provider-only validation behavior.
- [ ] Run dependency, focused, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
### [API-1] Add model-to-preset one-of validation
#### Problem
`ModelCatalogEntry` only accepts a non-empty provider map and `LoadEdge` validates only provider references.
#### Solution
Add `ExecutionPreset string` and enforce exactly one of a non-empty provider map or non-empty preset id. Resolve preset ids against the predecessor catalog after normalization; provider-only token/budget checks must not run against virtual entries.
#### Modified Files and Checklist
- [ ] `packages/go/config/provider_types.go` — add the field and one-of validation.
- [ ] `packages/go/config/load.go` — resolve preset references and skip provider-only checks for virtual entries.
- [ ] `packages/go/config/model_execution_preset_config_test.go` — cover one-of, dangling ids, duplicates, and compatibility.
#### Test Strategy
Write `TestLoadEdgeModelExecutionPresetOneOf` with provider-only, preset-only, neither, both, dangling, and duplicate cases. Assert stable error paths and unchanged provider fixtures.
#### Verification
Run `go test -count=1 ./packages/go/config`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `packages/go/config/provider_types.go` | API-1 |
| `packages/go/config/load.go` | API-1 |
| `packages/go/config/model_execution_preset_config_test.go` | API-1 |
| `agent-task/m-iop-hot-path-one-shot-execution/03+01_preset_model_config/CODE_REVIEW-cloud-G03.md` | API-1 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_schema/complete.log
go test -count=1 ./packages/go/config
go test -race -count=1 ./packages/go/config
go vet ./packages/go/config
git diff --check
```
Expected: all commands exit 0; exactly one model backing is accepted and existing provider-only fixtures remain unchanged.

View file

@ -0,0 +1,117 @@
<!-- task=m-iop-hot-path-one-shot-execution/02+01_preset_model plan=0 tag=API milestone-task=preset-model -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in. Complete the `Implementation Checklist`, fill actual notes/output, then stop with active files in place and report ready for review. If blocked, record only the exact blocker, attempts/output, and resume condition. Do not ask the user, call user-input tools, create stop files, classify the next state, archive, or write `complete.log`; finalization is review-agent-only.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/02+01_preset_model, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare each item against source and Verification Results. Append verdict/signals, archive the active pair, and on PASS write `complete.log`, preserve milestone metadata, archive the task directory, and update the final `.log` checklist. WARN/FAIL must create the code-review skill's exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Add model-to-preset one-of validation | [ ] |
| API-2 Resolve virtual model authorization and public identity | [ ] |
## Implementation Checklist
- [ ] Enforce the provider-map versus execution-preset one-of and reference validation at config load.
- [ ] List and admit a virtual model only when selector and every allowed stage route resolve uniquely for the principal, preserving public identity.
- [ ] Run the focused, race, vet, and diff verification commands exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G07_0.log`.
- [ ] Archive the active plan to `plan_local_G07_0.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/02+01_preset_model/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=preset-model` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL write the mandated next state without `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Model config accepts exactly one of provider map or preset id.
- Managed listing/admission requires unique selector and every-stage authorization.
- No synthetic projection/credential route exists; external model echo is stable.
## Verification Results
Paste actual stdout/stderr; replacement commands require a deviation entry.
### API-1 item verification
```bash
go test -count=1 ./packages/go/config
```
_Actual stdout/stderr:_
### API-2 item verification
```bash
go test -count=1 ./apps/edge/internal/openai -run 'Test(VirtualPreset|Managed.*Model|ModelCatalog)'
```
_Actual stdout/stderr:_
### Dependency and focused tests
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_catalog/complete.log
go test -count=1 ./packages/go/config ./apps/edge/internal/openai
```
_Actual stdout/stderr:_
### Common race tests
```bash
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./packages/go/config ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Header/Overview/instructions, item names, checklist text, checkpoints, commands | Fixed | Do not rewrite |
| Item status, Deviations, Key Design Decisions, actual output | Implementer | Must complete |
| Review-Only Checklist and Code Review Result/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,170 @@
<!-- task=m-iop-hot-path-one-shot-execution/02+01_preset_model plan=0 tag=API milestone-task=preset-model -->
# Virtual Preset Model Admission and Authorization
## For the Implementing Agent
Implement this plan only after predecessor 01 has `complete.log`, run every verification command, and fill every implementation-owned section of `CODE_REVIEW-cloud-G07.md` with actual notes/output. Keep active files for official review. If blocked, record the exact blocker, attempts, and resume condition only; do not ask the user, create stop files, classify state, archive logs, or write `complete.log`.
## Background
A public model currently always means a provider pool group. This packet makes a model point to exactly one of a provider mapping or an execution preset, while preserving the public model identity and requiring every preset stage to resolve uniquely for the authenticated principal.
## Dependencies and Execution Order
- Runtime predecessor: `01_preset_catalog`. Start only after `agent-task/m-iop-hot-path-one-shot-execution/01_preset_catalog/complete.log` exists. It was missing at plan creation because predecessor implementation had not started.
## Analysis
### Files Read
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `packages/go/config/provider_types.go`
- `packages/go/config/load.go`
- `packages/go/config/provider_catalog_validation_config_test.go`
- `apps/edge/internal/openai/server.go`
- `apps/edge/internal/openai/route_resolution.go`
- `apps/edge/internal/openai/principal_routes.go`
- `apps/edge/internal/openai/routes.go`
- `apps/edge/internal/openai/openai_auth_routes_models_test.go`
- `apps/edge/internal/openai/principal_routes_test.go`
- `agent-contract/outer/openai-compatible-api.md`
- `agent-contract/outer/anthropic-compatible-api.md`
### SDD Criteria
The approved/unlocked SDD targets `preset-model`, scenario S01, Evidence Map S01. Tests must cover provider vs preset one-of, managed zero/one/multiple matches across selector and all stages, list/admission, response model echo, and no synthetic credential projection.
### Verification Context
No handoff was supplied. Local Go 1.26.2 and repository test rules are available; fresh and race runs are required. No external credential is needed because projection fixtures provide deterministic managed-route evidence. Confidence: high.
### Test Coverage Gaps
Existing tests cover provider catalog validation and one managed route, not a virtual model whose selector/local/review references must all match uniquely. Add explicit one-of/load tests and principal list/admission tables. Existing public model echo tests remain regression coverage.
### Symbol References
No rename/removal. `resolveManagedCatalogBinding` is called only by `resolveProjectedRoute` (`principal_routes.go:106,136`) and will gain a preset-aware sibling rather than change provider semantics.
### Split Judgment
Child 02 depends only on 01. Its stable contract is that only fully authorized virtual preset ids enter model listing/dispatch and provider-backed ids retain existing behavior. It does not execute a preset stage; children 03-07 consume the resolved immutable binding.
### Scope Rationale
Exclude mode selection, coordinator state, workspace tools, and downstream execution. Do not add projection messages, credential slots, raw provider ids, or principal route ids to static preset config.
### Final Routing
`evaluation_mode=first-pass`; `finalizer=finalize-task-policy.sh` (`pair`). Build closures true, scores `(2,1,2,1,1)` => G07/local-fit; `large_indivisible_context=false`, risks `boundary_contract,variant_product` (2), rework 0, evidence-integrity failure false, no capability gap; `PLAN-local-G07.md`. Review scores `(2,1,2,1,1)` => official cloud G07, `CODE_REVIEW-cloud-G07.md`, Codex `gpt-5.6-sol` xhigh.
## Implementation Checklist
- [ ] Enforce the provider-map versus execution-preset one-of and reference validation at config load.
- [ ] List and admit a virtual model only when selector and every allowed stage route resolve uniquely for the principal, preserving public identity.
- [ ] Run the focused, race, vet, and diff verification commands exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
### [API-1] Add model-to-preset one-of validation
#### Problem
`ModelCatalogEntry` has only `Providers` and rejects an empty map (`packages/go/config/provider_types.go:167-198,229-283`). `LoadEdge` validates only provider references (`packages/go/config/load.go:153-176`).
#### Solution
Add `ExecutionPreset string` and enforce exactly one of a non-empty provider map or a non-empty preset id. Resolve the preset id against the predecessor catalog after all ids are normalized; provider-only token/budget checks must not run against a virtual entry.
```go
// Before: provider_types.go:192-198
Providers map[string]string `mapstructure:"providers" yaml:"providers"`
TokenCounter *TokenCounterConf
// After
Providers map[string]string `mapstructure:"providers" yaml:"providers,omitempty"`
ExecutionPreset string `mapstructure:"execution_preset" yaml:"execution_preset,omitempty"`
TokenCounter *TokenCounterConf
```
#### Modified Files and Checklist
- [ ] `packages/go/config/provider_types.go` — add the field and one-of validation.
- [ ] `packages/go/config/load.go` — resolve preset references and skip provider-only checks for virtual entries.
- [ ] `packages/go/config/model_execution_preset_config_test.go` — cover one-of, dangling ids, duplicates, and compatibility.
#### Test Strategy
Write `TestLoadEdgeModelExecutionPresetOneOf` as a table with provider-only, preset-only, neither, both, and dangling cases. Assert stable error paths and unchanged provider fixtures.
#### Verification
Run `go test -count=1 ./packages/go/config`; expect PASS.
### [API-2] Resolve virtual model authorization and public identity
#### Problem
Managed listing blindly publishes projected route ids (`principal_routes.go:35-55`), while admission resolves one projected route to one provider model group (`principal_routes.go:76-167`). It cannot prove unique authorization for the selector plus every preset stage or echo the virtual id independently from internal targets.
#### Solution
Represent a preset dispatch with the external model id, preset id/generation, and immutable per-role canonical references. In managed mode match each reference against the authenticated projection and require exactly one active route; in legacy mode require an existing canonical model entry. Filter virtual ids from model listing when any reference is zero/ambiguous and re-resolve the chosen stage route/credential at dispatch time.
```go
// Before: route_resolution.go:53-82
type routeDispatch struct {
ProviderPool bool
ModelGroupKey string
}
// After
type routeDispatch struct {
ProviderPool bool
Preset *resolvedExecutionPreset
ExternalModel string
}
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/route_resolution.go` — distinguish provider and preset dispatch.
- [ ] `apps/edge/internal/openai/principal_routes.go` — authorize all canonical references and filter listings.
- [ ] `apps/edge/internal/openai/routes.go` — preserve external model ids on both model list protocols.
- [ ] `apps/edge/internal/openai/openai_auth_routes_models_test.go` — cover legacy listing/admission/echo.
- [ ] `apps/edge/internal/openai/principal_routes_test.go` — cover zero/one/ambiguous managed stage matches and revoke/revision recheck.
#### Test Strategy
Add `TestVirtualPresetModelAuthorizationMatrix` and extend managed model-list tests. Fixtures must include selector/local/review matches, alias collisions, missing route, cross-principal route, and internal target mismatch. Assert public response `model` remains the requested virtual id.
#### Verification
Run `go test -count=1 ./apps/edge/internal/openai -run 'Test(VirtualPreset|Managed.*Model|ModelCatalog)'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `packages/go/config/provider_types.go` | API-1 |
| `packages/go/config/load.go` | API-1 |
| `packages/go/config/model_execution_preset_config_test.go` | API-1 |
| `apps/edge/internal/openai/route_resolution.go` | API-2 |
| `apps/edge/internal/openai/principal_routes.go` | API-2 |
| `apps/edge/internal/openai/routes.go` | API-2 |
| `apps/edge/internal/openai/openai_auth_routes_models_test.go` | API-2 |
| `apps/edge/internal/openai/principal_routes_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_model/CODE_REVIEW-cloud-G07.md` | API-1, API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_catalog/complete.log
go test -count=1 ./packages/go/config ./apps/edge/internal/openai
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./packages/go/config ./apps/edge/internal/openai
git diff --check
```
Expected: predecessor check and all commands exit 0; virtual ids are exposed only for unique all-stage authorization and provider-only behavior is unchanged. Cache is not acceptable. External agent smoke remains later `hot-smoke`. After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.

View file

@ -0,0 +1,100 @@
<!-- task=m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization plan=0 tag=API milestone-task=preset-model -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in. Complete the `Implementation Checklist`, fill actual notes/output, then stop with active files in place and report ready for review. If blocked, record only the exact blocker, attempts/output, and resume condition. Do not ask the user, call user-input tools, create stop files, classify state, archive, or write `complete.log`; finalization is review-agent-only.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare each item against source and Verification Results. Append verdict/signals, archive the active pair, and on PASS write `complete.log`, preserve milestone metadata, archive the task directory, and update the final `.log` checklist. WARN/FAIL must create the code-review skill's exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-2 Resolve virtual model authorization and public identity | [ ] |
## Implementation Checklist
- [ ] Resolve and authorize selector plus every allowed preset stage uniquely for the principal.
- [ ] Filter listing/admission failures and preserve the public virtual model identity without synthetic credentials.
- [ ] Run dependency, focused, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G07_0.log`.
- [ ] Archive the active plan to `plan_local_G07_0.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=preset-model` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL write the mandated next state without `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Managed listing/admission requires unique selector and every-stage authorization.
- No synthetic projection or credential route is created.
- Public model echo remains the requested virtual id.
## Verification Results
### API-2 item verification
```bash
go test -count=1 ./apps/edge/internal/openai -run 'Test(VirtualPreset|Managed.*Model|ModelCatalog)'
```
_Actual stdout/stderr:_
### Dependencies and race tests
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/03+01_preset_model_config/complete.log
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Header/Overview/instructions, item names, checklist text, checkpoints, commands | Fixed | Do not rewrite |
| Item status, Deviations, Key Design Decisions, actual output | Implementer | Must complete |
| Review-Only Checklist and Code Review Result/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,114 @@
<!-- task=m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization plan=0 tag=API milestone-task=preset-model -->
# Virtual Preset Model Authorization and Public Identity
## For the Implementing Agent
Start only after predecessors 02 and 03 have `complete.log`. Implement, run every command, and fill `CODE_REVIEW-cloud-G07.md` with actual notes/output. Keep active files for official review; finalization is review-agent-only.
## Background
A virtual preset model must be listed and admitted only when every selector and stage route resolves uniquely for the authenticated principal, while the external model id remains stable.
## Dependencies and Execution Order
- Required predecessors: `02+01_preset_generation` and `03+01_preset_model_config`.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/server.go`
- `apps/edge/internal/openai/route_resolution.go`
- `apps/edge/internal/openai/principal_routes.go`
- `apps/edge/internal/openai/routes.go`
- `apps/edge/internal/openai/openai_auth_routes_models_test.go`
- `apps/edge/internal/openai/principal_routes_test.go`
- `agent-contract/outer/openai-compatible-api.md`
- `agent-contract/outer/anthropic-compatible-api.md`
### SDD Criteria
SDD scenario S01 requires managed zero/one/multiple match handling across selector and all stages, model list/admission behavior, stable response model echo, and no synthetic credential projection.
### Verification Context
Fresh/race Go tests and deterministic managed-route fixtures are sufficient; no external credentials are needed. Confidence: high.
### Test Coverage Gaps
Existing tests cover one managed provider route, not a virtual model whose selector/local/review references must all match uniquely.
### Symbol References
`resolveManagedCatalogBinding` gains a preset-aware sibling rather than changing provider semantics.
### Split Judgment
This is the second refined child of the former preset-model pair. It consumes the accepted virtual model shape and independently closes principal authorization, listing, admission, and public identity.
### Scope Rationale
Exclude mode selection, coordinator state, workspace tools, downstream execution, synthetic projection messages, and credential material in static config.
### Final Routing
`evaluation_mode=isolated-reassessment`; finalizer pair. Build closures are true; scores `(2,1,2,1,1)` yield G07/local-fit, matched risks `boundary_contract,variant_product` (2), no large context/rework/evidence failure/gap; `PLAN-local-G07.md`. Review uses the same scores and official cloud G07 in `CODE_REVIEW-cloud-G07.md`.
## Implementation Checklist
- [ ] Resolve and authorize selector plus every allowed preset stage uniquely for the principal.
- [ ] Filter listing/admission failures and preserve the public virtual model identity without synthetic credentials.
- [ ] Run dependency, focused, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
### [API-2] Resolve virtual model authorization and public identity
#### Problem
Managed listing publishes projected route ids and admission resolves only one provider group. It cannot prove unique authorization for the selector plus every preset stage or echo the virtual id independently from internal targets.
#### Solution
Represent preset dispatch with the external model id, preset id/generation, and immutable per-role canonical references. In managed mode require exactly one active projected route for every reference; in legacy mode require canonical catalog entries. Filter invalid virtual ids and re-resolve the chosen route/credential revision at dispatch time.
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/route_resolution.go` — distinguish provider and preset dispatch.
- [ ] `apps/edge/internal/openai/principal_routes.go` — authorize all canonical references and filter listings.
- [ ] `apps/edge/internal/openai/routes.go` — preserve external model ids on both protocol listings.
- [ ] `apps/edge/internal/openai/openai_auth_routes_models_test.go` — cover legacy listing/admission/echo.
- [ ] `apps/edge/internal/openai/principal_routes_test.go` — cover zero/one/ambiguous matches and revision recheck.
#### Test Strategy
Add `TestVirtualPresetModelAuthorizationMatrix` and managed model-list cases for missing, ambiguous, cross-principal, alias-collision, and internal-target mismatch. Assert response `model` remains the requested virtual id.
#### Verification
Run `go test -count=1 ./apps/edge/internal/openai -run 'Test(VirtualPreset|Managed.*Model|ModelCatalog)'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/route_resolution.go` | API-2 |
| `apps/edge/internal/openai/principal_routes.go` | API-2 |
| `apps/edge/internal/openai/routes.go` | API-2 |
| `apps/edge/internal/openai/openai_auth_routes_models_test.go` | API-2 |
| `apps/edge/internal/openai/principal_routes_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/CODE_REVIEW-cloud-G07.md` | API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/03+01_preset_model_config/complete.log
go test -count=1 ./apps/edge/internal/openai -run 'Test(VirtualPreset|Managed.*Model|ModelCatalog)'
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all commands exit 0; virtual ids are exposed only for unique all-stage authorization and provider-backed behavior remains unchanged.

View file

@ -0,0 +1,100 @@
<!-- task=m-iop-hot-path-one-shot-execution/05+02,04_request_coordinator plan=1 tag=API milestone-task=request-identity -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is not complete until item statuses, Deviations, Key Design Decisions, and actual verification output are filled. Then stop with active files and report ready. Blockers belong only in those evidence fields. Do not ask the user, create control state, classify next state, archive, or write `complete.log`; review owns finalization.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/05+02,04_request_coordinator, plan=1, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare source and Verification Results, append verdict/signals, archive the pair, and on PASS write `complete.log`, preserve metadata, archive the task directory, and update the final `.log` checklist. WARN/FAIL must create the exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Build the bounded logical-request store and lineage fence | [ ] |
## Implementation Checklist
- [ ] Implement opaque request/call/stage identity, owner affinity, immutable lineage/toolset fingerprints, and bounded state.
- [ ] Enforce one active transition and exactly-once expected-frontier consumption under races.
- [ ] Run dependency, deterministic concurrency, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G08_1.log`.
- [ ] Archive the active plan to `plan_cloud_G07_1.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/05+02,04_request_coordinator/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=request-identity` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL write the mandatory next state and no `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- IDs are server-generated, path-safe, collision-resistant, and never authorization secrets.
- Lineage/toolset/principal mutation and missing state change nothing.
- Exactly one concurrent resume consumes a frontier.
## Verification Results
### API-1 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'TestLogicalRequest'
```
_Actual stdout/stderr:_
### Dependencies and common race
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/complete.log
go test -race -count=1 ./packages/go/streamgate ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Fixed structure, item names/checklist/checkpoints/commands | Fixed | Do not rewrite |
| Item status, deviations, decisions, actual output | Implementer | Must complete |
| Review checklist and verdict/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,109 @@
<!-- task=m-iop-hot-path-one-shot-execution/05+02,04_request_coordinator plan=1 tag=API milestone-task=request-identity -->
# Edge-Local Logical Request Coordinator
## For the Implementing Agent
Start only after predecessors 02 and 04 have `complete.log`. Implement, run every command, and fill `CODE_REVIEW-cloud-G08.md` with actual evidence. Keep active files for official review; finalization is review-agent-only.
## Background
Hot Path needs an Edge-local owner that correlates repeated full-history calls while preventing transcript/tool-schema mutation, cross-principal resume, duplicate frontier consumption, and concurrent stage execution.
## Dependencies and Execution Order
- Required predecessors: `02+01_preset_generation` and `04+02,03_preset_model_authorization`.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/server.go`
- `apps/edge/internal/openai/chat_decode.go`
- `apps/edge/internal/openai/chat_types.go`
- `apps/edge/internal/openai/anthropic_types.go`
- `apps/edge/internal/openai/dispatch_context.go`
- `apps/edge/internal/openai/principal.go`
- `agent-spec/runtime/stream-evidence-gate.md`
### SDD Criteria
SDD scenario S05 requires immutable lineage/toolset/principal ownership, opaque request/call/stage ids, one unconsumed frontier, duplicate/missing-state rejection, and concurrency race safety.
### Verification Context
Injected id/time sources and deterministic histories make local fresh/race tests sufficient; no external agents are needed. Confidence: high.
### Test Coverage Gaps
Existing ingress snapshots are request-local and do not span calls or prove exactly-once concurrent frontier consumption.
### Symbol References
`Server` gains an Edge-local coordinator owner; endpoint handler integration is reserved for child 06.
### Split Judgment
This is the first refined child of the former request-identity pair. The bounded store, lineage fence, and concurrency contract are independently testable before either HTTP endpoint joins it.
### Scope Rationale
Exclude handler integration, mode transitions, workspace tools, artifact binding, direct/light stages, cleanup, durable storage, and cross-Edge recovery.
### Final Routing
`evaluation_mode=isolated-reassessment`; finalizer pair. Build closures are true; scores `(1,2,1,1,2)` yield G07/local-fit base, matched risks `temporal_state,concurrent_consistency,structured_interpretation,variant_product` (4) trigger `risk-boundary`, so build is cloud `PLAN-cloud-G07.md`. Review scores `(1,2,1,2,2)` yield official cloud G08 in `CODE_REVIEW-cloud-G08.md`. No large context/rework/evidence failure/capability gap.
## Implementation Checklist
- [ ] Implement opaque request/call/stage identity, owner affinity, immutable lineage/toolset fingerprints, and bounded state.
- [ ] Enforce one active transition and exactly-once expected-frontier consumption under races.
- [ ] Run dependency, deterministic concurrency, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
### [API-1] Build the bounded logical-request store and lineage fence
#### Problem
`Server` has config/runtime locks but no cross-call state. Hot Path requires one active stage, immutable prefix/transcript/toolset, a single unconsumed frontier, and terminal exactly-once behavior.
#### Solution
Add a bounded store keyed by a cryptographically random, path-safe id with injected id/time sources. Canonicalize Chat and Messages histories into endpoint-tagged hashes, pin principal/preset generation/toolset fingerprints, map public/provider tool ids, and lock each request so only one active resume consumes the exact expected set.
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/request_coordinator.go` — identities, state enum, bounded store, collision/replay/concurrency rules.
- [ ] `apps/edge/internal/openai/request_lineage.go` — canonical Chat/Messages transcript and toolset fingerprints.
- [ ] `apps/edge/internal/openai/request_coordinator_test.go` — owner, lineage, expected-set, id collision, and exactly-once race matrix.
#### Test Strategy
Write `TestLogicalRequestContinuationMatrix`, `TestLogicalRequestConcurrentFrontierExactlyOnce`, and `TestLogicalRequestIDCollisionRegenerates`. Unknown, duplicate, missing, cross-owner, and mutated histories must never advance state.
#### Verification
Run `go test -race -count=1 ./apps/edge/internal/openai -run 'TestLogicalRequest'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/request_coordinator.go` | API-1 |
| `apps/edge/internal/openai/request_lineage.go` | API-1 |
| `apps/edge/internal/openai/request_coordinator_test.go` | API-1 |
| `agent-task/m-iop-hot-path-one-shot-execution/05+02,04_request_coordinator/CODE_REVIEW-cloud-G08.md` | API-1 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'TestLogicalRequest'
go test -race -count=1 ./packages/go/streamgate ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all commands exit 0 and exactly one concurrent continuation advances while rejected continuations change no state.

View file

@ -0,0 +1,118 @@
<!-- task=m-iop-hot-path-one-shot-execution/03+01,02_request_identity plan=0 tag=API milestone-task=request-identity -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is not complete until item statuses, Deviations, Key Design Decisions, and actual verification output are filled. Then stop with active files and report ready. Blockers belong only in those evidence fields. Do not ask the user, create control state, classify next state, archive, or write `complete.log`; review owns finalization.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/03+01,02_request_identity, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare source and Verification Results, append verdict/signals, archive the pair, and on PASS write `complete.log`, preserve metadata, archive the task directory, and update the final `.log` checklist. WARN/FAIL must create the exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Build the bounded logical-request store and lineage fence | [ ] |
| API-2 Join preset-backed endpoint ingress to the coordinator | [ ] |
## Implementation Checklist
- [ ] Implement opaque request/call/stage identity, owner affinity, immutable lineage/toolset fingerprints, and exactly-once frontier state.
- [ ] Integrate preset-backed Chat and Messages ingress without changing legacy/provider paths or trusting caller metadata as identity.
- [ ] Run deterministic concurrency, focused handler, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G10_0.log`.
- [ ] Archive the active plan to `plan_cloud_G09_0.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/03+01,02_request_identity/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=request-identity` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL write the mandatory next state and no `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- IDs are server-generated, path-safe, collision-resistant, and never authorization secrets.
- Lineage/toolset/principal mutation and missing state dispatch nothing.
- Exactly one concurrent resume consumes a frontier; legacy routes bypass the store.
## Verification Results
Paste actual stdout/stderr below.
### API-1 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'TestLogicalRequest'
```
_Actual stdout/stderr:_
### API-2 item verification
```bash
go test -count=1 ./apps/edge/internal/openai -run 'TestPresetRequestIdentity'
```
_Actual stdout/stderr:_
### Dependencies and focused race
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_catalog/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_model/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(LogicalRequest|PresetRequestIdentity)'
```
_Actual stdout/stderr:_
### Common race tests
```bash
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Fixed structure, item names/checklist/checkpoints/commands | Fixed | Do not rewrite |
| Item status, deviations, decisions, actual output | Implementer | Must complete |
| Review checklist and verdict/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,165 @@
<!-- task=m-iop-hot-path-one-shot-execution/03+01,02_request_identity plan=0 tag=API milestone-task=request-identity -->
# Edge-Local Logical Request Identity Coordinator
## For the Implementing Agent
Implement only after predecessors 01 and 02 have `complete.log`. Run all verification and fill `CODE_REVIEW-cloud-G10.md` with actual evidence. Keep active files for review. On a blocker, record exact attempts/output/resume conditions only; do not ask the user, create control files, classify state, archive, or write `complete.log`.
## Background
Current request ids and Stream Evidence Gate state are request-local. Hot Path needs an Edge-local owner that correlates repeated full-history endpoint calls without trusting caller metadata, while preventing transcript mutation, tool-schema substitution, cross-principal resume, duplicate frontier consumption, and concurrent stage execution.
## Dependencies and Execution Order
- `01_preset_catalog` and `02+01_preset_model` must each produce active `complete.log`; both were missing at plan creation.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/server.go`
- `apps/edge/internal/openai/chat_handler.go`
- `apps/edge/internal/openai/chat_decode.go`
- `apps/edge/internal/openai/chat_types.go`
- `apps/edge/internal/openai/anthropic_handler.go`
- `apps/edge/internal/openai/anthropic_types.go`
- `apps/edge/internal/openai/dispatch_context.go`
- `apps/edge/internal/openai/principal.go`
- `apps/edge/internal/openai/stream_gate_ingress_test.go`
- `apps/edge/internal/openai/openai_auth_routes_models_test.go`
- `apps/edge/internal/openai/anthropic_surface_test.go`
- `agent-spec/runtime/stream-evidence-gate.md`
- `agent-contract/outer/openai-compatible-api.md`
- `agent-contract/outer/anthropic-compatible-api.md`
### SDD Criteria
Approved/unlocked SDD; header `request-identity`; scenario/Evidence row S05. Required evidence is full-history/frontier acceptance, immutable lineage and tool schema, public/provider tool-id mapping, cross-principal and missing-state rejection, and concurrency race safety.
### Verification Context
No handoff. The local Go/race runner is sufficient; tests use deterministic ids/time sources and endpoint fixtures, not external agents. Fresh tests are mandatory. Confidence: high on boundaries, medium on final wire correlation because protocol-gate work is intentionally a later Epic.
### Test Coverage Gaps
Ingress snapshot tests prove request-local immutability only. No existing test spans HTTP calls or detects repeated committed transcript versus the next frontier. Add unit and handler tests including same-id concurrent resumes and active-id collision injection.
### Symbol References
No rename/removal. `handleChatCompletions` and `handleAnthropicMessages` become the two ingress callers of the new coordinator; legacy/provider routes bypass it unless `routeDispatch.Preset` is present.
### Split Judgment
Child 03 depends exactly on 01/02. It owns identity, ownership, lineage, frontier, and synchronization but not mode transitions or tool semantics. Its stable PASS contract is an accepted/resumed immutable `logicalRequest` handle that later children can transition without reimplementing endpoint history parsing.
### Scope Rationale
Exclude artifact binding, direct/light stage execution, cleanup, response-envelope synthesis, durable storage, cross-Edge recovery, and new public auth tokens. A missing active state must fail, never start a new logical request.
### Final Routing
`evaluation_mode=first-pass`; `finalizer=finalize-task-policy.sh` pair. Build closures true; scores `(2,2,2,1,2)` => G09 and `grade-boundary` cloud; `large_indivisible_context=false`; risks `temporal_state,concurrent_consistency,boundary_contract,structured_interpretation,variant_product` (5), rework 0, evidence-integrity false, no capability gap; `PLAN-cloud-G09.md`. Review scores `(2,2,2,2,2)` => official cloud G10, `CODE_REVIEW-cloud-G10.md`, Codex `gpt-5.6-sol` xhigh.
## Implementation Checklist
- [ ] Implement opaque request/call/stage identity, owner affinity, immutable lineage/toolset fingerprints, and exactly-once frontier state.
- [ ] Integrate preset-backed Chat and Messages ingress without changing legacy/provider paths or trusting caller metadata as identity.
- [ ] Run deterministic concurrency, focused handler, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
### [API-1] Build the bounded logical-request store and lineage fence
#### Problem
`Server` has config/runtime locks but no cross-call state (`server.go:61-74`). The SDD states at lines 52-82 require one active stage, immutable prefix/transcript/toolset, a single unconsumed frontier, and terminal exactly-once behavior.
#### Solution
Add an Edge-local store keyed by a cryptographically random, path-safe 128-bit-or-stronger id. Inject id/time sources for tests. Canonicalize Chat and Messages histories into endpoint-tagged hashes, pin principal and preset generation/toolset fingerprint, map public to provider tool ids, and lock per request so only one active resume consumes the exact expected set.
```go
// Before: no cross-call owner
type Server struct { mu sync.RWMutex /* runtime config only */ }
// After
type logicalRequestStore struct { /* bounded index + per-request transition lock */ }
func (s *logicalRequestStore) Begin(...) (*logicalRequest, error)
func (s *logicalRequestStore) Resume(...) (*logicalRequest, continuationFrontier, error)
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/request_coordinator.go` — identities, state enum, bounded store, collision/replay/concurrency rules.
- [ ] `apps/edge/internal/openai/request_lineage.go` — canonical Chat/Messages transcript and toolset fingerprints.
- [ ] `apps/edge/internal/openai/request_coordinator_test.go` — unit/race matrix for owner, lineage, expected set, and exactly-once state.
#### Test Strategy
Write `TestLogicalRequestContinuationMatrix`, `TestLogicalRequestConcurrentFrontierExactlyOnce`, and `TestLogicalRequestIDCollisionRegenerates`. Assert reordered pair results may be accepted only when expected by a later child, while duplicate/unknown/missing/cross-owner/mutated history never advances stage.
#### Verification
Run `go test -race -count=1 ./apps/edge/internal/openai -run 'TestLogicalRequest'`; expect PASS and no races.
### [API-2] Join preset-backed endpoint ingress to the coordinator
#### Problem
Chat resolves and dispatches a model directly (`chat_handler.go:23-41,76-115`); Anthropic performs its own envelope/route flow. Caller metadata already carries arbitrary `request_id`-like values and must not become authoritative.
#### Solution
At each preset-backed ingress, derive authenticated principal, decode canonical history/tools, and call Begin or Resume based only on server-issued public tool ids/history correlation. Attach internal request/call/stage ids to dispatch metadata without overwriting the caller metadata namespace. Translate coordinator errors through existing endpoint-standard error writers.
```go
// Before: chat_handler.go:40-48
dispatch, err := s.resolveRouteDispatchForPrincipal(r.Context(), env.Model)
providerNativeThinking := chatRequestHasProviderNativeThinking(rawBody)
// After
dispatch, err := s.resolveRouteDispatchForPrincipal(r.Context(), env.Model)
turn, err := s.beginOrResumePresetTurn(r.Context(), dispatch, endpointChat, rawBody)
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/server.go` — own/init the coordinator and test injection points.
- [ ] `apps/edge/internal/openai/chat_handler.go` — join preset Chat ingress.
- [ ] `apps/edge/internal/openai/anthropic_handler.go` — join preset Messages ingress.
- [ ] `apps/edge/internal/openai/request_identity_handler_test.go` — endpoint-standard begin/resume/rejection tests.
#### Test Strategy
Write `TestPresetRequestIdentityAcrossChatTurns` and `TestPresetRequestIdentityAcrossAnthropicTurns`, plus cross-principal, missing-store, caller-metadata spoof, and legacy bypass cases. Fake dispatch must remain zero on rejection.
#### Verification
Run `go test -count=1 ./apps/edge/internal/openai -run 'TestPresetRequestIdentity'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/request_coordinator.go` | API-1 |
| `apps/edge/internal/openai/request_lineage.go` | API-1 |
| `apps/edge/internal/openai/request_coordinator_test.go` | API-1 |
| `apps/edge/internal/openai/server.go` | API-2 |
| `apps/edge/internal/openai/chat_handler.go` | API-2 |
| `apps/edge/internal/openai/anthropic_handler.go` | API-2 |
| `apps/edge/internal/openai/request_identity_handler_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/03+01,02_request_identity/CODE_REVIEW-cloud-G10.md` | API-1, API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_catalog/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_model/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(LogicalRequest|PresetRequestIdentity)'
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all exit 0, exactly one concurrent continuation advances, all rejected continuations dispatch zero providers, and legacy routes are unchanged. Cache is not acceptable. After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.

View file

@ -0,0 +1,100 @@
<!-- task=m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress plan=0 tag=API milestone-task=request-identity -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is not complete until item statuses, Deviations, Key Design Decisions, and actual verification output are filled. Then stop with active files and report ready. Blockers belong only in those evidence fields. Do not ask the user, create control state, classify next state, archive, or write `complete.log`; review owns finalization.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare source and Verification Results, append verdict/signals, archive the pair, and on PASS write `complete.log`, preserve metadata, archive the task directory, and update the final `.log` checklist. WARN/FAIL must create the exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-2 Join preset-backed endpoint ingress to the coordinator | [ ] |
## Implementation Checklist
- [ ] Join preset-backed Chat and Messages begin/resume ingress to the coordinator.
- [ ] Reject caller identity spoofing, missing/cross-owner state, and mutations before provider dispatch while preserving legacy bypass.
- [ ] Run dependency, focused handler, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G07_0.log`.
- [ ] Archive the active plan to `plan_local_G07_0.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=request-identity` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL write the mandatory next state and no `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Caller metadata never becomes the authoritative logical identity.
- Missing/cross-principal/mutated state dispatches nothing.
- Both endpoint standards and provider-only bypass remain intact.
## Verification Results
### API-2 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'TestPresetRequestIdentity'
```
_Actual stdout/stderr:_
### Dependencies and common race
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/05+02,04_request_coordinator/complete.log
go test -race -count=1 ./packages/go/streamgate ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Fixed structure, item names/checklist/checkpoints/commands | Fixed | Do not rewrite |
| Item status, deviations, decisions, actual output | Implementer | Must complete |
| Review checklist and verdict/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,114 @@
<!-- task=m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress plan=0 tag=API milestone-task=request-identity -->
# Preset Request Identity Endpoint Ingress
## For the Implementing Agent
Start only after predecessors 04 and 05 have `complete.log`. Implement, run every command, and fill `CODE_REVIEW-cloud-G07.md` with actual evidence. Keep active files for official review; finalization is review-agent-only.
## Background
Preset-backed Chat and Anthropic Messages requests must join the Edge-local coordinator without trusting caller metadata and without changing legacy/provider-only ingress behavior.
## Dependencies and Execution Order
- Required predecessors: `04+02,03_preset_model_authorization` and `05+02,04_request_coordinator`.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/server.go`
- `apps/edge/internal/openai/chat_handler.go`
- `apps/edge/internal/openai/chat_decode.go`
- `apps/edge/internal/openai/chat_types.go`
- `apps/edge/internal/openai/anthropic_handler.go`
- `apps/edge/internal/openai/anthropic_types.go`
- `apps/edge/internal/openai/stream_gate_ingress_test.go`
- `apps/edge/internal/openai/anthropic_surface_test.go`
- `agent-contract/outer/openai-compatible-api.md`
- `agent-contract/outer/anthropic-compatible-api.md`
### SDD Criteria
SDD scenario S05 requires full-history/frontier acceptance on both endpoints, caller-metadata spoof rejection, internal identity attachment, cross-principal/missing-state rejection, and legacy bypass.
### Verification Context
Deterministic endpoint fixtures and fake dispatch are sufficient; no external provider is required. Fresh/race tests are mandatory. Confidence: high.
### Test Coverage Gaps
No existing handler test spans calls through the new coordinator or proves that rejected preset continuations dispatch zero providers.
### Symbol References
`handleChatCompletions` and `handleAnthropicMessages` become the two ingress callers; provider-only paths remain unchanged.
### Split Judgment
This is the second refined child of the former request-identity pair. It consumes the stable coordinator contract and independently verifies two-protocol ingress integration.
### Scope Rationale
Exclude coordinator internals, mode transitions, workspace/artifact semantics, direct/light execution, cleanup, durable storage, and response-envelope redesign.
### Final Routing
`evaluation_mode=isolated-reassessment`; finalizer pair. Build closures are true; scores `(2,1,2,1,1)` yield G07/local-fit, matched risks `boundary_contract,variant_product` (2), so no risk boundary applies and the build is local `PLAN-local-G07.md`. Review uses the same scores and official cloud G07 in `CODE_REVIEW-cloud-G07.md`. No large context/rework/evidence failure/capability gap.
## Implementation Checklist
- [ ] Join preset-backed Chat and Messages begin/resume ingress to the coordinator.
- [ ] Reject caller identity spoofing, missing/cross-owner state, and mutations before provider dispatch while preserving legacy bypass.
- [ ] Run dependency, focused handler, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
### [API-2] Join preset-backed endpoint ingress to the coordinator
#### Problem
Chat and Anthropic handlers dispatch routes directly, while caller metadata may contain arbitrary request-id-like values that cannot become authoritative.
#### Solution
At each preset-backed ingress derive the authenticated principal, decode canonical history/tools, and call coordinator Begin or Resume based only on server-issued public tool ids and history correlation. Attach internal request/call/stage ids without overwriting caller metadata and translate coordinator errors through existing endpoint-standard writers.
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/server.go` — own/init the coordinator and test injection points.
- [ ] `apps/edge/internal/openai/chat_handler.go` — join preset Chat ingress.
- [ ] `apps/edge/internal/openai/anthropic_handler.go` — join preset Messages ingress.
- [ ] `apps/edge/internal/openai/request_identity_handler_test.go` — endpoint begin/resume/rejection tests.
#### Test Strategy
Write `TestPresetRequestIdentityAcrossChatTurns` and `TestPresetRequestIdentityAcrossAnthropicTurns`, plus cross-principal, missing-store, caller-metadata spoof, and legacy bypass cases. Fake dispatch must remain zero on rejection.
#### Verification
Run `go test -count=1 ./apps/edge/internal/openai -run 'TestPresetRequestIdentity'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/server.go` | API-2 |
| `apps/edge/internal/openai/chat_handler.go` | API-2 |
| `apps/edge/internal/openai/anthropic_handler.go` | API-2 |
| `apps/edge/internal/openai/request_identity_handler_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress/CODE_REVIEW-cloud-G07.md` | API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/05+02,04_request_coordinator/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'TestPresetRequestIdentity'
go test -race -count=1 ./packages/go/streamgate ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all commands exit 0; rejected continuations dispatch zero providers and legacy routes bypass the coordinator.

View file

@ -0,0 +1,119 @@
<!-- task=m-iop-hot-path-one-shot-execution/07+02,04,06_route_selector_direct plan=0 tag=API milestone-task=route-selector,direct-flow -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> Fill item statuses, deviations, decisions, and actual output, then stop with active files and report ready. Record blockers only in evidence fields. Do not ask the user, create control state, classify, archive, or write `complete.log`; review owns finalization.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/07+02,04,06_route_selector_direct, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare source/evidence, append verdict/signals, archive the active pair, and on PASS write `complete.log`, preserve metadata, archive the task directory, and update the final `.log` checklist. WARN/FAIL must create the exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Add deterministic structural decision classification | [ ] |
| API-2 Complete the direct state path | [ ] |
## Implementation Checklist
- [ ] Classify direct/light candidates only from normalized emitted structure, preset allowlist, and deterministic capability/health gates.
- [ ] Execute direct text, high-thinking, and ordinary tool continuations with no Plan/Review artifact and stable public model identity.
- [ ] Run focused integration, common race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G08_0.log`.
- [ ] Archive the active plan to `plan_local_G07_0.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/07+02,04,06_route_selector_direct/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=route-selector,direct-flow` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL create the mandatory next state without `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Prose/hidden markers never influence mode.
- Partial/mixed/reserved-invalid shapes fail before stage dispatch.
- Direct preserves model identity, tool behavior, and creates no `.iop/job/` path.
## Verification Results
Paste actual stdout/stderr below.
### API-1 item verification
```bash
go test -count=1 ./apps/edge/internal/openai -run TestHotPathSelectorDecisionMatrix
```
_Actual stdout/stderr:_
### API-2 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(Selector|Direct)'
```
_Actual stdout/stderr:_
### Dependencies and focused race
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(Selector|Direct)'
```
_Actual stdout/stderr:_
### Common race tests
```bash
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Fixed structure, item names/checklist/checkpoints/commands | Fixed | Do not rewrite |
| Item status, deviations, decisions, actual output | Implementer | Must complete |
| Review checklist and verdict/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,155 @@
<!-- task=m-iop-hot-path-one-shot-execution/07+02,04,06_route_selector_direct plan=0 tag=API milestone-task=route-selector,direct-flow -->
# Structural Mode Selection and Direct Flow
## For the Implementing Agent
Start only after predecessors 02/04/06 complete. Implement, run every command, and fill `CODE_REVIEW-cloud-G08.md` with actual notes/output; leave active files for official review. If blocked, record exact evidence and resume condition only. Do not ask the user, create control files, classify next state, archive, or write `complete.log`.
## Background
The fused selector/planner must choose from emitted structure, not prose or hidden markers. This packet establishes the fail-closed decision boundary and completes `direct`, including high-thinking and ordinary agent tool round-trips, without creating the reserved artifact namespace.
## Dependencies and Execution Order
- Required predecessors are `02+01_preset_generation`, `04+02,03_preset_model_authorization`, and `06+04,05_request_identity_ingress`.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/route_resolution.go`
- `apps/edge/internal/openai/chat_handler.go`
- `apps/edge/internal/openai/chat_types.go`
- `apps/edge/internal/openai/anthropic_handler.go`
- `apps/edge/internal/openai/anthropic_types.go`
- `apps/edge/internal/openai/anthropic_surface_test.go`
- `apps/edge/internal/openai/stream_gate_ingress_test.go`
- `agent-spec/runtime/stream-evidence-gate.md`
### SDD Criteria
Approved/unlocked SDD. Header tasks `route-selector,direct-flow`; S03 requires direct/general-tool versus exact reserved control shapes and deterministic rejection without prose parsing; S07 requires text/high-think/tool direct completion and artifact absence. Evidence Map S03/S07 sets both the selector table and end-to-end tests.
### Verification Context
No handoff. Local fake run/tunnel services and stream fixtures are enough; fresh/race tests required. Protocol-level multi-stage re-encoding is deferred to Epic 3, but one-stage direct must retain current endpoint-native behavior. Confidence: high.
### Test Coverage Gaps
Existing handlers cover text, thinking, native/text tool calls, and stream completion, but no preset structural classifier or reserved path absence assertion. Add classifier tables and preset direct handler integration while retaining existing suites.
### Symbol References
No rename/removal. New selector/runner is called from the preset dispatch hook introduced by child 06.
### Split Judgment
This unchanged pair consumes the refined preset/model/identity closure children and owns structural selection plus direct behavior. Workspace binding and artifact frontiers remain separate. Direct and selector stay together because the accepted non-reserved shape is itself the direct entry invariant.
### Scope Rationale
Exclude workspace binding/pair validation, local/review/repair, cleanup, cross-stage envelope composition, and output observability. Do not parse natural-language reasoning or recover direct failure as light.
### Final Routing
`evaluation_mode=first-pass`; `finalizer=finalize-task-policy.sh` pair. Build closures true, scores `(2,1,2,1,1)` => local-fit G07; `large_indivisible_context=false`, risks `boundary_contract,structured_interpretation,variant_product` (3), rework 0, evidence-integrity false, no gap; `PLAN-local-G07.md`. Review scores `(2,1,2,2,1)` => official cloud G08, `CODE_REVIEW-cloud-G08.md`, Codex `gpt-5.6-sol` xhigh.
## Implementation Checklist
- [ ] Classify direct/light candidates only from normalized emitted structure, preset allowlist, and deterministic capability/health gates.
- [ ] Execute direct text, high-thinking, and ordinary tool continuations with no Plan/Review artifact and stable public model identity.
- [ ] Run focused integration, common race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
### [API-1] Add deterministic structural decision classification
#### Problem
`routeDispatch` selects provider mechanics only (`route_resolution.go:53-82`) and handler output paths do not distinguish reserved artifact controls. The SDD forbids mode markers and reasoning parsing.
#### Solution
Normalize selector output into content/reasoning/general tool calls and canonical reserved controls. Exact prepare or exact pair is a light candidate; absence of reserved controls is direct; partial pair, mixed reserved/general calls, wrong reserved path, unsupported allowlist, or failed hard gate is a typed validation error with stable reason.
```go
// Before: provider result flows directly to endpoint encoding.
// After
decision, err := classifyHotPathOutput(preset, issuedPaths, normalizedEvents)
switch decision.Mode { case modeDirect: /* direct runner */; case modeLight: /* child 10 */ }
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/hot_path_selector.go` — normalized structural classifier and reason codes.
- [ ] `apps/edge/internal/openai/hot_path_selector_test.go` — shape/allowlist/capability/health table.
#### Test Strategy
Write `TestHotPathSelectorDecisionMatrix` covering content, thinking, general tools, exact prepare/pair, partial/mixed/duplicate/wrong path, light-disabled, heavy/custom, unhealthy route, and prose containing words “direct/light”. Assert prose never changes mode.
#### Verification
```bash
go test -count=1 ./apps/edge/internal/openai -run TestHotPathSelectorDecisionMatrix
```
Expect PASS.
### [API-2] Complete the direct state path
#### Problem
Chat and Anthropic handlers currently dispatch one route (`chat_handler.go:101-141` and corresponding Messages flow) and child 06 only joins the coordinator. A preset direct turn needs the selector stage to become the public response/tool continuation without downstream stages or artifact state.
#### Solution
Implement a direct runner that commits released content/reasoning/general tools, records expected tool results on the same logical request, resumes the same stage, and marks logical completion once. Reuse existing endpoint encoders and model echo; enforce that no reserved `.iop/job/` operation or artifact path can be emitted.
```go
// Before: preset dispatch hook has no executable mode.
// After
func (s *Server) runDirectTurn(ctx context.Context, turn *hotPathTurn, output normalizedStageOutput) error
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/hot_path_dispatch.go` — invoke selector and direct runner from preset turns.
- [ ] `apps/edge/internal/openai/hot_path_direct.go` — direct transitions/tool frontier/completion.
- [ ] `apps/edge/internal/openai/hot_path_direct_test.go` — Chat/Messages text, thinking, tool resume, and artifact-absence integration.
#### Test Strategy
Write `TestHotPathDirectChat` and `TestHotPathDirectAnthropic` with stream/non-stream text, high thinking, one ordinary tool round-trip, duplicate result rejection, public model echo, and an assertion that no emitted call/path contains `.iop/job/`.
#### Verification
Run `go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(Selector|Direct)'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/hot_path_selector.go` | API-1 |
| `apps/edge/internal/openai/hot_path_selector_test.go` | API-1 |
| `apps/edge/internal/openai/hot_path_dispatch.go` | API-2 |
| `apps/edge/internal/openai/hot_path_direct.go` | API-2 |
| `apps/edge/internal/openai/hot_path_direct_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/07+02,04,06_route_selector_direct/CODE_REVIEW-cloud-G08.md` | API-1, API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(Selector|Direct)'
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all exit 0; mode never depends on prose; direct has no reserved artifact calls and completes exactly once. Cache is not acceptable. After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.

View file

@ -0,0 +1,100 @@
<!-- task=m-iop-hot-path-one-shot-execution/08+02,04,06_workspace_binding plan=1 tag=API milestone-task=artifact-pair -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> Fill item statuses, deviations, decisions, and actual output, then stop with active files and report ready. Record blockers only in implementation evidence. Do not ask the user, create control state, classify, archive, or write `complete.log`; review owns finalization.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/08+02,04,06_workspace_binding, plan=1, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare source/evidence, append verdict/signals, archive the pair, and on PASS write `complete.log`, preserve metadata, archive the directory, and update the final `.log` checklist. WARN/FAIL must create the exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Compile request-local workspace operation bindings | [ ] |
## Implementation Checklist
- [ ] Select and pin a declarative workspace binding from actual Chat/Anthropic tool schemas.
- [ ] Encode safe deterministic operations, ids, paths, guards, and exact result receipts without executing tools or inspecting a workspace.
- [ ] Run dependency, focused mapping, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G06_1.log`.
- [ ] Archive the active plan to `plan_local_G06_1.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/08+02,04,06_workspace_binding/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=artifact-pair` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL create the mandatory next state without `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Bindings match actual schemas and remain immutable/fingerprinted.
- Path/command transforms are deterministic and containment is caller-executed.
- Edge never inspects the workspace or executes the tool.
## Verification Results
### API-1 item verification
```bash
go test -count=1 ./apps/edge/internal/openai -run 'TestWorkspace(Tool|Command)'
```
_Actual stdout/stderr:_
### Dependencies
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress/complete.log
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Fixed structure, item/checklist/checkpoints/commands | Fixed | Do not rewrite |
| Item status, deviations, decisions, actual output | Implementer | Must complete |
| Review checklist and verdict/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,110 @@
<!-- task=m-iop-hot-path-one-shot-execution/08+02,04,06_workspace_binding plan=1 tag=API milestone-task=artifact-pair -->
# Declarative Workspace Tool Binding
## For the Implementing Agent
Start only after predecessors 02, 04, and 06 have `complete.log`. Implement, run every command, and fill `CODE_REVIEW-cloud-G06.md` with actual evidence. Keep active files for official review; finalization is review-agent-only.
## Background
IOP must map canonical workspace operations through compatible tools already supplied by the caller, using deterministic schema matching and safe fixed-data transforms without executing tools or inspecting the workspace.
## Dependencies and Execution Order
- Required predecessors: `02+01_preset_generation`, `04+02,03_preset_model_authorization`, and `06+04,05_request_identity_ingress`.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/chat_types.go`
- `apps/edge/internal/openai/chat_decode.go`
- `apps/edge/internal/openai/anthropic_types.go`
- `apps/edge/internal/openai/tool_schema.go`
- `apps/edge/internal/openai/anthropic_surface_test.go`
- `apps/edge/internal/openai/stream_gate_ingress_test.go`
- `agent-contract/outer/openai-compatible-api.md`
- `agent-contract/outer/anthropic-compatible-api.md`
### SDD Criteria
SDD scenario S06 requires canonical-to-actual mapping, parent-capable write or prepare alternatives, exact receipt matching, safe path/command synthesis, and containment rejection before local dispatch.
### Verification Context
Unit fixtures model Chat and Anthropic schemas; no workspace or tool is actually executed. Fresh tests are sufficient. Confidence: high.
### Test Coverage Gaps
Existing validation does not cover request-local workspace roles, argument synthesis, lexical no-escape paths, deterministic guard receipts, or public/provider id mapping.
### Symbol References
New binding code consumes decoded endpoint tools without changing their wire structs.
### Split Judgment
This is the first refined child of the former artifact pair. The immutable binding compiler and codec form an independently verifiable safety boundary; child 09 consumes the selected binding for cross-call frontiers.
### Scope Rationale
Exclude prepare/pair state transitions, filesystem execution, local/review model dispatch, cleanup, generic shell evaluation, manifests, revisions, and server-side artifact fallback.
### Final Routing
`evaluation_mode=isolated-reassessment`; finalizer pair. Build closures are true; scores `(2,0,2,1,1)` yield G06/local-fit, matched risks `boundary_contract,structured_interpretation,variant_product` (3), no large context/rework/evidence failure/gap; `PLAN-local-G06.md`. Review uses the same scores and official cloud G06 in `CODE_REVIEW-cloud-G06.md`.
## Implementation Checklist
- [ ] Select and pin a declarative workspace binding from actual Chat/Anthropic tool schemas.
- [ ] Encode safe deterministic operations, ids, paths, guards, and exact result receipts without executing tools or inspecting a workspace.
- [ ] Run dependency, focused mapping, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
### [API-1] Compile request-local workspace operation bindings
#### Problem
Endpoint tools are opaque request data. No code matches configured role alternatives or guarantees deterministic workspace-relative paths, shell-safe payloads, and exact receipts.
#### Solution
Compile ordered alternatives against actual JSON Schema into an immutable binding. Provide canonical prepare/read/write/delete encoders and result matchers. Structured bindings use named fields; command bindings synthesize fixed path/content commands with shell-safe encoding and a caller-executed containment guard. Edge performs no workspace inspection or command execution.
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/workspace_tool_binding.go` — matcher/compiler/immutable selected binding.
- [ ] `apps/edge/internal/openai/workspace_tool_codec.go` — safe encoding, id mapping, lexical checks, guard synthesis, and exact result matching.
- [ ] `apps/edge/internal/openai/workspace_tool_binding_test.go` — structured/command alternatives, fingerprint, unsafe paths, and receipts.
#### Test Strategy
Write `TestWorkspaceToolBindingMatrix` and `TestWorkspaceCommandBindingSafetyGuard`. Cover parent-capable write, separate prepare, missing roles, reordered properties, schema replacement, exact/opaque receipts, quoting/newlines, traversal/absolute/sibling paths, and failed guard receipts.
#### Verification
Run `go test -count=1 ./apps/edge/internal/openai -run 'TestWorkspace(Tool|Command)'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/workspace_tool_binding.go` | API-1 |
| `apps/edge/internal/openai/workspace_tool_codec.go` | API-1 |
| `apps/edge/internal/openai/workspace_tool_binding_test.go` | API-1 |
| `agent-task/m-iop-hot-path-one-shot-execution/08+02,04,06_workspace_binding/CODE_REVIEW-cloud-G06.md` | API-1 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress/complete.log
go test -count=1 ./apps/edge/internal/openai -run 'TestWorkspace(Tool|Command)'
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all commands exit 0; unsafe bindings fail before dispatch and no test executes a real workspace operation.

View file

@ -0,0 +1,119 @@
<!-- task=m-iop-hot-path-one-shot-execution/05+01,02,03_artifact_pair plan=0 tag=API milestone-task=artifact-pair -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> Fill item statuses, deviations, decisions, and actual output, then stop with active files and report ready. Record blockers only in implementation evidence. Do not ask the user, create control state, classify, archive, or write `complete.log`; review owns finalization.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/05+01,02,03_artifact_pair, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare source/evidence, append verdict/signals, archive the pair, and on PASS write `complete.log`, preserve metadata, archive the directory, and update the final `.log` checklist. WARN/FAIL must create the exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Compile request-local workspace operation bindings | [ ] |
| API-2 Validate directory prepare and exact pair continuation frontier | [ ] |
## Implementation Checklist
- [ ] Select and pin a declarative workspace tool binding from actual Chat/Anthropic schemas with safe deterministic argument/result transforms.
- [ ] Enforce prepare and exact Plan/Review expected sets, paths, public/provider ids, and one-frontier result success before local eligibility.
- [ ] Run focused mapping/frontier, common race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G10_0.log`.
- [ ] Archive the active plan to `plan_cloud_G10_0.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/05+01,02,03_artifact_pair/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=artifact-pair` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL create the mandatory next state without `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Bindings match actual schemas and remain pinned/fingerprinted.
- Paths/commands are deterministic; Edge performs lexical checks and validates the exact receipt from a caller-executed containment guard, but never inspects the workspace or executes the tool.
- Only exact prepare or exact two-result pair advances, once and order-independently.
## Verification Results
Paste actual stdout/stderr below.
### API-1 item verification
```bash
go test -count=1 ./apps/edge/internal/openai -run 'TestWorkspace(Tool|Command)'
```
_Actual stdout/stderr:_
### API-2 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(Workspace|ArtifactPair)'
```
_Actual stdout/stderr:_
### Dependencies and focused race
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_catalog/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_model/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/03+01,02_request_identity/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(Workspace|ArtifactPair)'
```
_Actual stdout/stderr:_
### Common race tests
```bash
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Fixed structure, item names/checklist/checkpoints/commands | Fixed | Do not rewrite |
| Item status, deviations, decisions, actual output | Implementer | Must complete |
| Review checklist and verdict/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,152 @@
<!-- task=m-iop-hot-path-one-shot-execution/05+01,02,03_artifact_pair plan=0 tag=API milestone-task=artifact-pair -->
# Declarative Workspace Binding and Plan/Review Pair
## For the Implementing Agent
Start only after predecessors 01/02/03 complete. Implement, run all commands, and fill `CODE_REVIEW-cloud-G10.md` with actual evidence. Leave active files for official review. Record blockers only in implementation evidence; do not ask the user, create control files, classify state, archive, or write `complete.log`.
## Background
IOP must request workspace operations through whatever compatible tool schema the caller already supplied. It must deterministically map canonical prepare/read/write/delete calls and validate exactly the Plan/Review pair without executing tools or trusting opaque results.
## Dependencies and Execution Order
- Required predecessors: `01_preset_catalog`, `02+01_preset_model`, `03+01,02_request_identity`; their active `complete.log` files were missing at plan creation.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/chat_types.go`
- `apps/edge/internal/openai/chat_decode.go`
- `apps/edge/internal/openai/anthropic_types.go`
- `apps/edge/internal/openai/tool_schema.go`
- `apps/edge/internal/openai/anthropic_surface_test.go`
- `apps/edge/internal/openai/stream_gate_ingress_test.go`
- `agent-contract/outer/openai-compatible-api.md`
- `agent-contract/outer/anthropic-compatible-api.md`
### SDD Criteria
Approved/unlocked SDD; task/scenario/Evidence row S06. Required matrix: canonical↔actual mapping, parent-capable write or prepare, exact receipt vs opaque result, reversed pair results, missing/extra/duplicate tools, and traversal/containment rejection before local dispatch.
### Verification Context
No handoff. Unit/httptest fixtures model Chat and Anthropic schemas; no workspace or tool is actually executed. Fresh/race tests required. Confidence: high.
### Test Coverage Gaps
Existing tool validation checks provider output schemas, not request-local workspace role selection, argument synthesis, no-escape paths, or bidirectional public/provider id mapping. Add isolated binding and pair-frontier integration suites.
### Symbol References
No rename/removal. New binding code consumes decoded `chatCompletionRequest.Tools` and `anthropicMessageRequest.Tools` but does not change their wire structs.
### Split Judgment
Child 05 is parallel with child 04 after 01/02/03. Its stable contract is a pinned binding plus validated prepare/pair continuation result, without running local/review. Child 06 consumes both the direct selector integration and this artifact contract.
### Scope Rationale
Exclude filesystem execution, agent adapters, local/review model dispatch, cleanup, generic shell evaluation, manifests, revisions, sibling files, and server-side artifact fallback. Command mapping must be fixed-data synthesis, not arbitrary model-generated shell.
### Final Routing
`evaluation_mode=first-pass`; `finalizer=finalize-task-policy.sh` pair. Build closures true, scores `(2,2,2,2,2)` => G10/grade-boundary cloud; `large_indivisible_context=false`, risks `temporal_state,concurrent_consistency,boundary_contract,structured_interpretation,variant_product` (5), rework 0, evidence-integrity false, no gap; `PLAN-cloud-G10.md`. Review scores `(2,2,2,2,2)` => official cloud G10, `CODE_REVIEW-cloud-G10.md`, Codex `gpt-5.6-sol` xhigh.
## Implementation Checklist
- [ ] Select and pin a declarative workspace tool binding from actual Chat/Anthropic schemas with safe deterministic argument/result transforms.
- [ ] Enforce prepare and exact Plan/Review expected sets, paths, public/provider ids, and one-frontier result success before local eligibility.
- [ ] Run focused mapping/frontier, common race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
### [API-1] Compile request-local workspace operation bindings
#### Problem
Chat tools are generic `[]any` (`chat_types.go:17-24`) and Anthropic tools only expose name/schema (`anthropic_types.go:31-47`). No code matches configured role alternatives or guarantees workspace-relative containment and deterministic receipts.
#### Solution
Compile ordered alternatives against actual tool JSON Schema into an immutable binding. Provide canonical prepare/read/write/delete call encoders and result matchers. Structured bindings encode named fields. Command bindings synthesize only fixed path/content commands with shell-safe payload encoding and a caller-executed canonical-cwd/target containment guard; Edge does not inspect or resolve the workspace itself and accepts success only from the guard's exact receipt.
```go
// Before: tools pass through as opaque provider input.
// After
binding, err := selectWorkspaceBinding(preset.WorkspaceTools, endpointTools)
actualCall, publicID, err := binding.Encode(canonicalArtifactCall)
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/workspace_tool_binding.go` — matcher/compiler/immutable selected binding.
- [ ] `apps/edge/internal/openai/workspace_tool_codec.go` — safe argument encoding, id mapping, lexical path checks, caller-executed containment guard synthesis, and exact result matching.
- [ ] `apps/edge/internal/openai/workspace_tool_binding_test.go` — structured/command schemas, alternatives, fingerprint, unsafe path/command cases.
#### Test Strategy
Write `TestWorkspaceToolBindingMatrix` and `TestWorkspaceCommandBindingSafetyGuard`. Cover parent-capable write, separate prepare, missing roles, reordered properties, schema replacement, exact/opaque receipts, quoting/newline content, `..`, absolute path, sibling path, deterministic guard/receipt synthesis, and a failed containment receipt. Do not make the Edge test inspect a real caller workspace or execute the generated tool command.
#### Verification
Run `go test -count=1 ./apps/edge/internal/openai -run 'TestWorkspace(Tool|Command)'`; expect PASS.
### [API-2] Validate directory prepare and exact pair continuation frontier
#### Problem
The SDD permits either one prepare call or exactly two Plan/Review writes, then requires both results exactly once in the immediately following frontier (`SDD.md:121-127`). Existing tool validation does not own a cross-call expected set.
#### Solution
Build issued paths only as `.iop/job/<request_id>/{plan.md,review.md}`. If needed, emit exactly one prepare call and resume the same selector stage; then accept exactly the two mapped writes and store their expected public/internal ids. Validate the next frontier order-independently, rejecting missing, unknown, duplicate, opaque, failed, mixed work calls, alternate requests, traversal, and later replay.
```go
// Before: generic tool result validation has no reserved expected pair.
// After
expected := newArtifactExpectedSet(planCall, reviewCall)
if err := expected.ConsumeExactlyOnce(continuation.Results); err != nil { return admissionError(err) }
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/artifact_pair.go` — issued paths, prepare/pair expected sets, result consumption.
- [ ] `apps/edge/internal/openai/artifact_pair_test.go` — Chat/Messages mapping and reversed/missing/extra result integration.
#### Test Strategy
Write `TestArtifactPairFrontierMatrix` with both endpoints and all S06 cases. Assert local eligibility remains false until both exact successes are consumed and no actual filesystem call occurs.
#### Verification
Run `go test -race -count=1 ./apps/edge/internal/openai -run 'Test(Workspace|ArtifactPair)'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/workspace_tool_binding.go` | API-1 |
| `apps/edge/internal/openai/workspace_tool_codec.go` | API-1 |
| `apps/edge/internal/openai/workspace_tool_binding_test.go` | API-1 |
| `apps/edge/internal/openai/artifact_pair.go` | API-2 |
| `apps/edge/internal/openai/artifact_pair_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/05+01,02,03_artifact_pair/CODE_REVIEW-cloud-G10.md` | API-1, API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/01_preset_catalog/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/02+01_preset_model/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/03+01,02_request_identity/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(Workspace|ArtifactPair)'
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all exit 0; unsafe/malformed/opaque paths dispatch no local stage; reversed exact pair success becomes eligible once. Cache is not acceptable. After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.

View file

@ -0,0 +1,100 @@
<!-- task=m-iop-hot-path-one-shot-execution/09+06,08_artifact_pair plan=0 tag=API milestone-task=artifact-pair -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> Fill item statuses, deviations, decisions, and actual output, then stop with active files and report ready. Record blockers only in implementation evidence. Do not ask the user, create control state, classify, archive, or write `complete.log`; review owns finalization.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/09+06,08_artifact_pair, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare source/evidence, append verdict/signals, archive the pair, and on PASS write `complete.log`, preserve metadata, archive the directory, and update the final `.log` checklist. WARN/FAIL must create the exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-2 Validate directory prepare and exact pair continuation frontier | [ ] |
## Implementation Checklist
- [ ] Issue only the reserved request directory prepare and exact Plan/Review write pair through the pinned binding.
- [ ] Enforce public/provider ids, paths, receipts, and one-frontier exactly-once result consumption before local eligibility.
- [ ] Run dependency, focused frontier, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G09_0.log`.
- [ ] Archive the active plan to `plan_cloud_G08_0.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/09+06,08_artifact_pair/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=artifact-pair` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL create the mandatory next state without `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Reserved paths are derived only from the server request id.
- Only exact prepare or exact pair success advances once and order-independently.
- Missing, extra, duplicate, opaque, failed, mixed, and replayed results fail closed.
## Verification Results
### API-2 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(Workspace|ArtifactPair)'
```
_Actual stdout/stderr:_
### Dependencies and common race
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/08+02,04,06_workspace_binding/complete.log
go test -race -count=1 ./packages/go/streamgate ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Fixed structure, item/checklist/checkpoints/commands | Fixed | Do not rewrite |
| Item status, deviations, decisions, actual output | Implementer | Must complete |
| Review checklist and verdict/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,105 @@
<!-- task=m-iop-hot-path-one-shot-execution/09+06,08_artifact_pair plan=0 tag=API milestone-task=artifact-pair -->
# Exact Plan/Review Artifact Frontier
## For the Implementing Agent
Start only after predecessors 06 and 08 have `complete.log`. Implement, run every command, and fill `CODE_REVIEW-cloud-G09.md` with actual evidence. Keep active files for official review; finalization is review-agent-only.
## Background
The selected workspace binding must issue an optional directory prepare and exactly the Plan/Review write pair, then validate the immediately following result frontier exactly once without executing tools.
## Dependencies and Execution Order
- Required predecessors: `06+04,05_request_identity_ingress` and `08+02,04,06_workspace_binding`.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/chat_types.go`
- `apps/edge/internal/openai/anthropic_types.go`
- `apps/edge/internal/openai/stream_gate_ingress_test.go`
- `agent-contract/outer/openai-compatible-api.md`
- `agent-contract/outer/anthropic-compatible-api.md`
### SDD Criteria
SDD scenario S06 requires exact reserved paths, optional prepare, two-write expected sets, reversed result order acceptance, missing/extra/duplicate/opaque result rejection, and one-frontier success before local eligibility.
### Verification Context
Deterministic fake tool frontiers for both endpoints are sufficient; no filesystem or external tool is executed. Fresh/race tests are mandatory. Confidence: high.
### Test Coverage Gaps
Existing tool validation does not own a cross-call expected set for reserved prepare and pair calls.
### Symbol References
This child consumes the immutable binding selected by child 08 and the request frontier owned by child 06/05.
### Split Judgment
This is the second refined child of the former artifact pair. It owns only the cross-call prepare/pair state and can be verified independently from binding compilation and later local/review execution.
### Scope Rationale
Exclude binding compilation, filesystem execution, local/review model dispatch, cleanup, manifests, revisions, sibling files, and server-side fallback.
### Final Routing
`evaluation_mode=isolated-reassessment`; finalizer pair. Build closures are true; scores `(1,2,2,1,2)` yield G08/local-fit base, matched risks `temporal_state,concurrent_consistency,boundary_contract,structured_interpretation,variant_product` (5) trigger `risk-boundary`, so build is cloud `PLAN-cloud-G08.md`. Review scores `(1,2,2,2,2)` yield official cloud G09 in `CODE_REVIEW-cloud-G09.md`. No large context/rework/evidence failure/capability gap.
## Implementation Checklist
- [ ] Issue only the reserved request directory prepare and exact Plan/Review write pair through the pinned binding.
- [ ] Enforce public/provider ids, paths, receipts, and one-frontier exactly-once result consumption before local eligibility.
- [ ] Run dependency, focused frontier, race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual notes and output.
### [API-2] Validate directory prepare and exact pair continuation frontier
#### Problem
The SDD permits one prepare call or exactly two Plan/Review writes and requires their exact results in the immediately following frontier. Existing validation has no cross-call expected set.
#### Solution
Build paths only as `.iop/job/<request_id>/{plan.md,review.md}`. If needed emit one prepare and resume the same selector stage; then accept exactly the two mapped writes and store expected public/internal ids. Consume the next frontier order-independently and reject missing, unknown, duplicate, opaque, failed, mixed, traversal, alternate-request, and replayed results.
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/artifact_pair.go` — issued paths, prepare/pair expected sets, and result consumption.
- [ ] `apps/edge/internal/openai/artifact_pair_test.go` — Chat/Messages reversed/missing/extra/duplicate/opaque result integration.
#### Test Strategy
Write `TestArtifactPairFrontierMatrix` with both endpoints and all S06 cases. Assert local eligibility remains false until both exact successes are consumed and no filesystem call occurs.
#### Verification
Run `go test -race -count=1 ./apps/edge/internal/openai -run 'Test(Workspace|ArtifactPair)'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/artifact_pair.go` | API-2 |
| `apps/edge/internal/openai/artifact_pair_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/09+06,08_artifact_pair/CODE_REVIEW-cloud-G09.md` | API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/06+04,05_request_identity_ingress/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/08+02,04,06_workspace_binding/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(Workspace|ArtifactPair)'
go test -race -count=1 ./packages/go/streamgate ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all commands exit 0; unsafe/malformed/opaque paths dispatch no local stage and reversed exact pair success becomes eligible once.

View file

@ -0,0 +1,118 @@
<!-- task=m-iop-hot-path-one-shot-execution/10+07,09_light_flow plan=0 tag=API milestone-task=light-flow -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> Fill item statuses, deviations, decisions, and actual output, then stop with active files and report ready. Record blockers only in implementation evidence. Do not ask the user, create control state, classify, archive, or write `complete.log`; review owns finalization.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/10+07,09_light_flow, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare source/evidence, append verdict/signals, archive the pair, and on PASS write `complete.log`, preserve metadata, archive the directory, and update the final `.log` checklist. WARN/FAIL must create the exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Run the isolated local worker stage | [ ] |
| API-2 Run one review write/resolution and optional repair | [ ] |
## Implementation Checklist
- [ ] Transition exact Plan/Review pair success into an immutable local stage with visible content/tool loops and terminal correlation.
- [ ] Run one fixed cloud review stage through write, read-resolution, pass or defect repair, then stop at cleanup_pending without Edge file reads or a second review.
- [ ] Run scripted flow, isolation, common race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G10_0.log`.
- [ ] Archive the active plan to `plan_cloud_G10_0.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/10+07,09_light_flow/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=light-flow` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL create the mandatory next state without `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Local/review inputs contain immutable task/correlation/paths, not file contents or credentials.
- Pair success starts one local stage and its committed terminal starts one fixed reviewer.
- Review write/read-resolution/repair stays one stage; only completion-versus-repair-tool structure decides the path, prose verdict words have no effect, and cleanup pending is reached once.
## Verification Results
Paste actual stdout/stderr below.
### API-1 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(LightLocal|StageInput)'
```
_Actual stdout/stderr:_
### API-2 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(Review|Light)'
```
_Actual stdout/stderr:_
### Dependencies and focused race
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/07+02,04,06_route_selector_direct/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/09+06,08_artifact_pair/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(Light|Review|StageInput)'
```
_Actual stdout/stderr:_
### Common race tests
```bash
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Fixed structure, item names/checklist/checkpoints/commands | Fixed | Do not rewrite |
| Item status, deviations, decisions, actual output | Implementer | Must complete |
| Review checklist and verdict/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,161 @@
<!-- task=m-iop-hot-path-one-shot-execution/10+07,09_light_flow plan=0 tag=API milestone-task=light-flow -->
# Light Plan, Local Work, Review, and Repair Flow
## For the Implementing Agent
Start only after predecessors 07 and 09 complete. Implement, run all verification, and fill `CODE_REVIEW-cloud-G10.md` with actual notes/output. Keep active files for official review. If blocked, record exact evidence and resume condition only; do not ask the user, create control state, classify, archive, or write `complete.log`.
## Background
With identity, structural selection, and artifact mapping available, `light` can be implemented as one selector/planner stage, local worker, and one fixed cloud review stage. Stage inputs and route bindings must remain immutable, visible output must continue, and review resolution must rely on model/tool flow rather than Edge reading or parsing `review.md`.
## Dependencies and Execution Order
- `07+02,04,06_route_selector_direct` and `09+06,08_artifact_pair` must produce `complete.log`; their own predecessors are transitively satisfied.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/chat_handler.go`
- `apps/edge/internal/openai/anthropic_handler.go`
- `apps/edge/internal/openai/dispatch_context.go`
- `apps/edge/internal/openai/anthropic_surface_test.go`
- `apps/edge/internal/openai/stream_gate_ingress_test.go`
- `agent-spec/runtime/stream-evidence-gate.md`
- `agent-contract/inner/edge-node-runtime-wire.md`
### SDD Criteria
Approved/unlocked SDD; task/scenario/Evidence row S08. Evidence must prove immutable stage inputs, pair-success transition, local work/tool loops, completion terminal transition, review write then same-stage review resolution, pass and defect repair, no Edge file read/text verdict, and no second review loop.
### Verification Context
No handoff. Deterministic fake services and normalized event fixtures can drive all stages; no real agent/workspace/provider is needed for S08. Fresh and race tests required. Endpoint multi-stage codec polish remains Epic 3, but internal transition evidence must use current Stream Evidence Gate terminal semantics. Confidence: medium-high due to state/product complexity.
### Test Coverage Gaps
Current stream tests cover one provider stage and recovery, not ordered model-stage transitions or prompt isolation. Add a scripted stage service and state-machine tests for Chat/Messages pass/repair and failures.
### Symbol References
No rename/removal. Extend the `hot_path_dispatch.go` hook from child 07; add new stage/input builders rather than duplicate endpoint handlers.
### Split Judgment
This unchanged pair depends exactly on 07/09. `local` and `review` remain one packet because the committed local terminal correlation is the transaction boundary for reviewer input and a complete S08 cannot independently PASS either half. Cleanup remains pair 11 because the flow can reach `cleanup_pending` without claiming final success.
### Scope Rationale
Exclude second review loops, heavy mode, Edge filesystem reads, review text parsing, hidden provider calls after disconnect, final cleanup/TTL, cross-stage public id/usage remapping, and external agent smoke.
### Final Routing
`evaluation_mode=first-pass`; `finalizer=finalize-task-policy.sh` pair. Build closures true, scores `(2,2,2,2,2)` => G10 grade-boundary cloud; `large_indivisible_context=false`, risks `temporal_state,concurrent_consistency,boundary_contract,structured_interpretation,variant_product` (5), rework 0, evidence-integrity false, no gap; `PLAN-cloud-G10.md`. Review scores `(2,2,2,2,2)` => official cloud G10, `CODE_REVIEW-cloud-G10.md`, Codex `gpt-5.6-sol` xhigh.
## Implementation Checklist
- [ ] Transition exact Plan/Review pair success into an immutable local stage with visible content/tool loops and terminal correlation.
- [ ] Run one fixed cloud review stage through write, read-resolution, pass or defect repair, then stop at cleanup_pending without Edge file reads or a second review.
- [ ] Run scripted flow, isolation, common race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
### [API-1] Run the isolated local worker stage
#### Problem
Current dispatch contexts represent one request/provider (`dispatch_context.go` and handler flows), while SDD lines 67-71 require pair success to switch to a pinned local route and prompt without copying workspace file contents.
#### Solution
Build local input only from immutable user task, committed selector correlation, and issued plan/review paths. Resolve the pinned canonical local reference via the child-04 route authorization, revalidate current credential revision, release content/reasoning/general tools, resume tool frontiers on the same stage, and treat Stream Evidence Gate completion as transition evidence to one reviewer.
```go
// Before: artifact success only proves local eligibility.
// After
localInput := buildLocalStageInput(req.ImmutableTask, req.ArtifactPaths, req.SelectorCommit)
terminal := runPinnedStage(req.Stage(localRole), localInput)
req.CommitLocalCandidate(terminal.Correlation)
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/hot_path_stage_input.go` — isolated selector/local/review input builders.
- [ ] `apps/edge/internal/openai/hot_path_light.go` — local state transitions and pinned-stage dispatch.
- [ ] `apps/edge/internal/openai/hot_path_dispatch.go` — invoke light after exact pair success.
- [ ] `apps/edge/internal/openai/hot_path_light_test.go` — scripted local content/tool/completion and input isolation.
#### Test Strategy
Write `TestHotPathLightLocalTransition` and `TestHotPathStageInputIsolation`. Assert both pair results required, immutable task and two paths present, file contents/credentials/internal prompts absent, wrong route revision fails, tool loop resumes same stage, and one completion candidate starts one review.
#### Verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(LightLocal|StageInput)'
```
Expect PASS.
### [API-2] Run one review write/resolution and optional repair
#### Problem
No current state keeps review write, read-resolution, and repair on one cloud route/model. The Edge must not read the file or parse review prose, and repair must not trigger a second review (`SDD.md:71-73,134-143`).
#### Solution
Pin a single review stage binding and explicit subphase. Emit canonical review write, validate its mapped result, and resume the same stage with a canonical read operation. Decide only from normalized structure: a completion terminal with no repair tool frontier is pass and goes to `cleanup_pending`; ordinary repair/verification tool calls keep the same review stage active until its later completion, which then goes to `cleanup_pending`. Do not add or parse a verdict marker, review prose, hidden control text, or a second review. Reject attempts to re-enter selector/local.
```go
// Before: no review state.
// After
review_active -> review_write_wait -> review_resolution_active
review_resolution_active -> agent_tool_wait | cleanup_pending
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/hot_path_review.go` — pinned review subphases, write/read mapping, pass/repair transition.
- [ ] `apps/edge/internal/openai/hot_path_review_test.go` — pass/defect/repair/no-second-review tables for both endpoints.
#### Test Strategy
Write `TestHotPathReviewPass` and `TestHotPathReviewDefectRepair`. Use only provider events and tool results, never fixture file reads. Assert review route identity remains fixed, review write success precedes resolution, a completion-without-repair is pass, ordinary repair tools are visible and remain in the same stage, prose verdict words have no effect, and cleanup pending is reached exactly once.
#### Verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(Review|Light)'
```
Expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/hot_path_stage_input.go` | API-1 |
| `apps/edge/internal/openai/hot_path_light.go` | API-1 |
| `apps/edge/internal/openai/hot_path_dispatch.go` | API-1 |
| `apps/edge/internal/openai/hot_path_light_test.go` | API-1 |
| `apps/edge/internal/openai/hot_path_review.go` | API-2 |
| `apps/edge/internal/openai/hot_path_review_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/10+07,09_light_flow/CODE_REVIEW-cloud-G10.md` | API-1, API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/07+02,04,06_route_selector_direct/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/09+06,08_artifact_pair/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'TestHotPath(Light|Review|StageInput)'
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all exit 0; pass and defect repair each reach cleanup pending once; stage inputs remain isolated; no test permits Edge file reads or a second review. Cache is not acceptable. After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.

View file

@ -0,0 +1,118 @@
<!-- task=m-iop-hot-path-one-shot-execution/11+09,10_cleanup plan=0 tag=API milestone-task=cleanup -->
# Code Review Reference - API
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> Fill item statuses, deviations, decisions, and actual output, then stop with active files and report ready. Record blockers only in implementation evidence. Do not ask the user, create control state, classify, archive, or write `complete.log`; review owns finalization.
## Overview
date=2026-08-02
task=m-iop-hot-path-one-shot-execution/11+09,10_cleanup, plan=0, tag=API
## For the Review Agent
> **[REVIEW AGENT ONLY]** Implementers must not execute this section.
Compare source/evidence, append verdict/signals, archive the pair, and on PASS write `complete.log`, preserve metadata, archive the directory, and update the final `.log` checklist. WARN/FAIL must create the exact next state.
## Implementation Item Completion
| Item | Status |
|------|---------|
| API-1 Confirm cleanup before logical terminal | [ ] |
| API-2 Bound state TTL and report workspace orphan responsibility | [ ] |
## Implementation Checklist
- [ ] Gate light success/error completion on one exact caller-executed delete result while preserving primary terminal intent and cancellation semantics.
- [ ] Reclaim only server state by bounded TTL and emit raw-free orphan identity/path observations without hidden cleanup after disconnect.
- [ ] Run cleanup/TTL/concurrency, common race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
## Review-Only Checklist
> **[REVIEW AGENT ONLY]** Implementers must not modify or check this section.
- [ ] Append one PASS/WARN/FAIL verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [ ] Verify verdict, Dimension Assessment, and Required/Suggested/Nit classifications match.
- [ ] Archive the active review to `code_review_cloud_G10_0.log`.
- [ ] Archive the active plan to `plan_cloud_G09_0.log`.
- [ ] Verify the Agent-Ops `.gitignore` block.
- [ ] On PASS write `complete.log` from `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md`.
- [ ] On PASS archive to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/11+09,10_cleanup/` and update this checklist there.
- [ ] On PASS preserve/report `milestone-task=cleanup` without direct roadmap mutation.
- [ ] On PASS remove the active parent only if no siblings/files remain.
- [ ] On WARN/FAIL create the mandatory next state without `complete.log`.
## Deviations from Plan
_Implementer: replace with actual deviations or “None”._
## Key Design Decisions
_Implementer: replace with actual decisions._
## Reviewer Checkpoints
- Success/error terminal intent commits only after exact delete acknowledgement and at most once.
- Disconnect produces no hidden model/tool cleanup work.
- TTL removes server state only; orphan observation has fixed ids/path and no raw content.
## Verification Results
Paste actual stdout/stderr below.
### API-1 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run TestHotPathCleanup
```
_Actual stdout/stderr:_
### API-2 item verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(LogicalRequestTTL|HotPathCleanup)'
```
_Actual stdout/stderr:_
### Dependencies and focused race
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/09+06,08_artifact_pair/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/10+07,09_light_flow/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(LogicalRequestTTL|HotPathCleanup)'
```
_Actual stdout/stderr:_
### Common race tests
```bash
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
```
_Actual stdout/stderr:_
### Vet and diff
```bash
go vet ./apps/edge/internal/openai
git diff --check
```
_Actual stdout/stderr:_
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Leave review-only sections unchanged.
## Section Ownership
| Section | Owner | Note |
|---------|-------|------|
| Fixed structure, item names/checklist/checkpoints/commands | Fixed | Do not rewrite |
| Item status, deviations, decisions, actual output | Implementer | Must complete |
| Review checklist and verdict/finalization | Review agent | Implementer must not modify |

View file

@ -0,0 +1,155 @@
<!-- task=m-iop-hot-path-one-shot-execution/11+09,10_cleanup plan=0 tag=API milestone-task=cleanup -->
# Artifact Cleanup, Terminal Intent, and Coordinator TTL
## For the Implementing Agent
Start only after predecessors 09 and 10 complete. Implement, run all commands, and fill `CODE_REVIEW-cloud-G10.md` with actual evidence. Keep active files for review. If blocked, record exact attempts/output/resume condition only; do not ask the user, create control files, classify, archive, or write `complete.log`.
## Background
A successful light request is not complete until the caller agent confirms deletion of its reserved request directory. Errors may attempt best-effort cleanup while preserving the primary terminal intent; disconnects must stop hidden work, and server TTL may reclaim only transient state while reporting possible workspace orphans without raw content.
## Dependencies and Execution Order
- Required predecessors are `09+06,08_artifact_pair` and `10+07,09_light_flow`; the directory name adds no hidden dependency.
## Analysis
### Files Read
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `apps/edge/internal/openai/server.go`
- `apps/edge/internal/openai/chat_handler.go`
- `apps/edge/internal/openai/anthropic_handler.go`
- `apps/edge/internal/openai/stream_gate_ingress_test.go`
- `apps/edge/internal/openai/anthropic_surface_test.go`
- `agent-spec/runtime/stream-evidence-gate.md`
- `agent-contract/outer/openai-compatible-api.md`
- `agent-contract/outer/anthropic-compatible-api.md`
### SDD Criteria
Approved/unlocked SDD; task/scenario/Evidence row S09. Evidence must cover success only after exact delete acknowledgement, primary error plus best-effort cleanup, cleanup failure precedence, caller disconnect with no hidden work, bounded TTL, and raw-free orphan request id/path observability.
### Verification Context
No handoff. Injected clock, cancellation contexts, fake tool frontiers, and observation sinks make S09 deterministic locally. Fresh/race tests required; no actual workspace deletion occurs. Confidence: high.
### Test Coverage Gaps
Existing ingress and Anthropic surface tests cover request-local dispatch and standard errors, not cross-call state TTL or agent-confirmed cleanup. Add cleanup-state tables, fake clock eviction, concurrent terminal/delete results, and redaction assertions.
### Symbol References
No rename/removal. Extend the child-05 coordinator and child-10 light terminal transition; do not change `packages/go/streamgate` public API unless compilation proves a narrowly scoped adapter is required.
### Split Judgment
This unchanged pair depends exactly on 09/10. Cleanup and TTL stay together because removal of server state, preservation of terminal intent, and orphan reporting share one exactly-once ownership invariant. This packet closes S09 but not later protocol terminal/observability/smoke tasks.
### Scope Rationale
Exclude actual server-side filesystem deletion, background cleanup after disconnect, durable orphan queues, cross-Edge resume, protocol-wide usage/id re-encoding, new partial-success status, and full route observability fields from Epic 4.
### Final Routing
`evaluation_mode=first-pass`; `finalizer=finalize-task-policy.sh` pair. Build closures true, scores `(2,2,2,1,2)` => G09 grade-boundary cloud; `large_indivisible_context=false`, risks `temporal_state,concurrent_consistency,boundary_contract,variant_product` (4), rework 0, evidence-integrity false, no gap; `PLAN-cloud-G09.md`. Review scores `(2,2,2,2,2)` => official cloud G10, `CODE_REVIEW-cloud-G10.md`, Codex `gpt-5.6-sol` xhigh.
## Implementation Checklist
- [ ] Gate light success/error completion on one exact caller-executed delete result while preserving primary terminal intent and cancellation semantics.
- [ ] Reclaim only server state by bounded TTL and emit raw-free orphan identity/path observations without hidden cleanup after disconnect.
- [ ] Run cleanup/TTL/concurrency, common race, vet, and diff verification exactly as written.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.
### [API-1] Confirm cleanup before logical terminal
#### Problem
The child-10 flow stops at `cleanup_pending`, but current endpoint handlers can finalize as soon as provider processing ends. SDD lines 140-144 require exact delete acknowledgement before success and preservation of a primary error during best-effort cleanup.
#### Solution
Store a single pending terminal intent and emit canonical delete for `.iop/job/<request_id>/`. Validate its mapped public id/path/receipt exactly once. On success, remove coordinator state then publish the pending success/error; on cleanup failure, success becomes standard failure while an existing primary error retains its identity. Context cancellation/disconnect cancels the stage and emits no new tool/model work.
```go
// Before: cleanup_pending has no terminal owner.
// After
req.PendingTerminal = terminalIntent
req.ExpectCleanup(deleteCall)
req.CommitTerminalAfterDelete(result)
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/hot_path_cleanup.go` — terminal intent, mapped delete frontier, result/error precedence.
- [ ] `apps/edge/internal/openai/request_coordinator.go` — exactly-once terminal removal and disconnected state handling.
- [ ] `apps/edge/internal/openai/hot_path_cleanup_test.go` — success/error/delete failure/cancel/concurrent result matrix.
#### Test Strategy
Write `TestHotPathCleanupTerminalMatrix` and `TestHotPathCleanupConcurrentExactlyOnce`. Assert success is absent before receipt, duplicate results cannot complete twice, primary errors are stable, cleanup failure cannot become success, and cancelled contexts make zero subsequent calls.
#### Verification
```bash
go test -race -count=1 ./apps/edge/internal/openai -run TestHotPathCleanup
```
Expect PASS.
### [API-2] Bound state TTL and report workspace orphan responsibility
#### Problem
An Edge-local store needs bounded abandoned-state reclamation, but deleting its entry cannot claim deletion of caller-owned workspace artifacts. Raw file content and prompts must never enter orphan telemetry.
#### Solution
Use injected monotonic time and a bounded sweep path to evict inactive/disconnected state. Emit only request id, fixed reserved relative directory, prior stage/terminal class, and reason; never execute cleanup or log tool result/body/content. Active in-flight transitions must not be evicted, and finalization/sweep must race safely.
```go
// Before: no cross-call TTL ownership.
// After
store.SweepExpired(now) // removes server state only; emits redacted orphan observation
```
#### Modified Files and Checklist
- [ ] `apps/edge/internal/openai/request_coordinator_ttl.go` — bounded sweep and state-only reclamation.
- [ ] `apps/edge/internal/openai/request_coordinator_ttl_test.go` — fake-clock expiry/in-flight/finalize races and redaction.
#### Test Strategy
Write `TestLogicalRequestTTLSweep` and `TestLogicalRequestTTLObservationRedaction`. Assert inactive states expire, active locked state survives, final state is emitted once, exact reserved path is present, and secrets/raw prompt/content/tool result are absent.
#### Verification
Run `go test -race -count=1 ./apps/edge/internal/openai -run 'Test(LogicalRequestTTL|HotPathCleanup)'`; expect PASS.
## Modified Files Summary
| File | Items |
|------|-------|
| `apps/edge/internal/openai/hot_path_cleanup.go` | API-1 |
| `apps/edge/internal/openai/request_coordinator.go` | API-1 |
| `apps/edge/internal/openai/hot_path_cleanup_test.go` | API-1 |
| `apps/edge/internal/openai/request_coordinator_ttl.go` | API-2 |
| `apps/edge/internal/openai/request_coordinator_ttl_test.go` | API-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/11+09,10_cleanup/CODE_REVIEW-cloud-G10.md` | API-1, API-2 |
## Final Verification
```bash
test -f agent-task/m-iop-hot-path-one-shot-execution/09+06,08_artifact_pair/complete.log
test -f agent-task/m-iop-hot-path-one-shot-execution/10+07,09_light_flow/complete.log
go test -race -count=1 ./apps/edge/internal/openai -run 'Test(LogicalRequestTTL|HotPathCleanup)'
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
git diff --check
```
Expected: all exit 0; terminal commit is exactly once after delete receipt; disconnect triggers no hidden work; TTL observations contain no raw content and do not claim workspace deletion. Cache is not acceptable. After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.