8.5 KiB
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. Execute the plan's selected root cause, scope, files, and dependency decisions as written. Do not choose another owner, narrow/expand the write boundary, or replace a fix with another verification attempt. 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-06 task=m-iop-owned-single-request-agent-execution/13+12_workspace_cleanup, plan=1, tag=API
Archive Evidence Snapshot
- The first-pass pair is preserved at
agent-task/m-iop-owned-single-request-agent-execution/13+12_workspace_cleanup/plan_cloud_G09_0.logandagent-task/m-iop-owned-single-request-agent-execution/13+12_workspace_cleanup/code_review_cloud_G10_0.log; it contains no implementation evidence or review verdict. - Self-review found that blind
os.Root.RemoveAllcan cross a mounted subtree and cannot distinguish Node-owned artifacts from injected/unowned entries. Plan 1 uses the immutablerequest_id, an in-memory ownership inventory, no-follow descriptor traversal, and deepest-first non-recursive removal that fails closed on any ownership or filesystem-boundary mismatch.
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 the following steps are finished:
- Append verdict and
review_rework_count/evidence_integrity_failurerouting signals. - Archive
CODE_REVIEW-cloud-G10.md→code_review_cloud_G10_1.logandPLAN-cloud-G09.md→plan_cloud_G09_1.log. - If PASS, write
complete.logand move active task directory toagent-task/archive/YYYY/MM/m-iop-owned-single-request-agent-execution/13+12_workspace_cleanup/. If WARN/FAIL, fully write the next filesystem state required by the code-review skill. - If PASS, preserve the first-line
milestone-task=cleanup-observationmetadata incomplete.logand report it for runtime aggregation. Roadmap state evaluation belongs tosync-milestone-workstate. - Check applicable
Review-Only Checklistitems at the final.loglocation before reporting.
Implementation Item Completion
| Item | Status |
|---|---|
| API-1 Reclaim only Node request-owned state | [ ] |
| API-2 Complete typed cleanup handling and coordinator finalization | [ ] |
Implementation Checklist
- Create and validate only
.iop/job/<request_id>from the immutable coordinator identity, inventory every Node-owned artifact, and preserve every user or unowned result. - Cancel/wait all process groups and remove only inventoried artifacts plus empty owned directories exactly once per request with bounded concurrent/idempotent result ownership.
- Make coordinator success/error/cancel/disconnect paths converge on one typed cleanup before terminal commit, with fail-closed success handling.
- Prove cleanup races, symlink/mount/unowned-entry refusal, user-result preservation, cross-request isolation, failure handling, and synchronize cleanup contract/spec claims.
- Run dependency, focused race, package, vet, Darwin compile, documentation, and whitespace verification.
- 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/check this section.
- Append verdict, routing signals, dimensions, and findings.
- Archive the active pair to routed suffix
1logs and verify.gitignore. - On PASS write
complete.log, preserve/report Milestone metadata, move this directory, and keep the active parent while siblings remain. - On WARN/FAIL write only the required next loop state.
Deviations from Plan
Record deviations and rationale.
Key Design Decisions
Record implemented decisions.
Reviewer Checkpoints
- Confirm no recursive removal is used: the exact
.iop/job/<request_id>tree is no-follow enumerated against the ownership inventory and removed deepest-first with non-recursive descriptor operations. - Confirm symlink, mount/device change, inode replacement, special file, and unowned entry fail closed without deleting suspect/user/sibling content.
- Confirm every process group for one request is cancelled/waited and foreign request processes are untouched.
- Confirm duplicate/racing cleanup shares one result without unbounded state growth.
- Confirm final success waits for cleanup and cleanup failure cannot yield partial success.
- Confirm user result files survive success, error, cancel, and runtime close.
Verification Results
Paste actual stdout/stderr for every command; record replacements under deviations.
1. Dependency
test -f agent-task/m-iop-owned-single-request-agent-execution/12+05,06,08,11_internal_tool_loop/complete.log || test "$(compgen -G 'agent-task/archive/*/*/m-iop-owned-single-request-agent-execution/12+05,06,08,11_internal_tool_loop/complete.log' | wc -l)" -eq 1
[fill]
2. Node cleanup race tests
go test -race ./apps/node/internal/workspace -run 'TestWorkspaceCleanup' -count=1
[fill]
3. Handler/coordinator race tests
go test -race ./apps/node/internal/node ./apps/edge/internal/service -run 'Test(NodeWorkspaceCleanup|SingleRequestCleanup)' -count=1
[fill]
4. Package regression
go test ./apps/node/internal/workspace ./apps/node/internal/node ./apps/edge/internal/service -count=1
[fill]
5. Vet
go vet ./apps/node/internal/workspace ./apps/node/internal/node ./apps/edge/internal/service
[fill]
6. Darwin compile
GOOS=darwin GOARCH=arm64 go test -c -o /tmp/iop-workspace-cleanup-darwin.test ./apps/node/internal/workspace
[fill]
7. Contract/spec search
rg --sort path -n 'cleanup|request_id|\.iop/job|inventory|no-follow|user result|finalizing|exactly' agent-contract/inner/edge-node-runtime-wire.md agent-spec/runtime/edge-node-execution.md
[fill]
8. Whitespace
git diff --check
[fill]
[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 | Implementing agent must not modify or execute these (archive, complete.log, and task-directory archive move are review-agent only) |
| Archive Evidence Snapshot | Fixed at stub creation from plan when present | Implementing agent uses it as default prior-loop context; read only the specific archive files cited there when more detail is required |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementing agent checks [ ] → [x] only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementing agent checks [ ] → [x] only |
| Review-Only Checklist | Review agent only | Implementing agent 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 (section headings + commands) | Fixed at stub creation | Implementing agent fills in command output only; command changes require a Deviations from Plan entry |
| Code Review Result | Review agent appends | Not included in stub |