iop/agent-task/m-iop-owned-single-request-agent-execution/11+10_workspace_command/CODE_REVIEW-cloud-G10.md

8.3 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/11+10_workspace_command, plan=1, tag=API

Archive Evidence Snapshot

  • The first-pass pair is preserved at agent-task/m-iop-owned-single-request-agent-execution/11+10_workspace_command/plan_cloud_G08_0.log and agent-task/m-iop-owned-single-request-agent-execution/11+10_workspace_command/code_review_cloud_G10_0.log; it contains no implementation evidence or review verdict.
  • Self-review found that assigning cmd.Dir to the configured path re-resolves that path at process start and can leave the admitted workspace after a rename/replacement. Plan 1 requires an internal child-launch shim to fchdir packet 10's opened root descriptor before executing the fixed template and fails before target start when identity cannot be preserved.

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:

  1. Append verdict and review_rework_count / evidence_integrity_failure routing signals.
  2. Archive CODE_REVIEW-cloud-G10.mdcode_review_cloud_G10_1.log and PLAN-cloud-G09.mdplan_cloud_G09_1.log.
  3. If PASS, write complete.log and move active task directory to agent-task/archive/YYYY/MM/m-iop-owned-single-request-agent-execution/11+10_workspace_command/. If WARN/FAIL, fully write the next filesystem state required by the code-review skill.
  4. If PASS, preserve the first-line milestone-task=tool-executor metadata in complete.log and report it for runtime aggregation. Roadmap state evaluation belongs to sync-milestone-workstate.
  5. Check applicable Review-Only Checklist items at the final .log location before reporting.

Implementation Item Completion

Item Status
API-1 Implement exact-template process execution [ ]
API-2 Activate typed command and cancel handling [ ]

Implementation Checklist

  • Resolve only operator-defined command ids to absolute executable/fixed args, enter the opened admitted root with an internal fchdir/exec shim, and build a minimal allowlisted environment.
  • Own Unix process groups with one terminal result across exit, timeout, context cancel, explicit cancel, and shared stdout/stderr truncation races.
  • Integrate command/cancel into the workspace runtime and Node handler without touching provider cancellation or permitting shell/PTY/arbitrary argv.
  • Prove success/nonzero/timeout/cancel/group-child/output/env/cross-request behavior plus root rename/replacement resistance, and synchronize command contract/spec limits.
  • Run dependency, focused race, package, vet, cross-build, 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 1 logs.
  • Verify managed .gitignore entries.
  • On PASS write complete.log, preserve/report Milestone metadata, move the directory, and keep the active parent while siblings remain.
  • On WARN/FAIL write only the required next state.

Deviations from Plan

Record deviations and rationale.

Key Design Decisions

Record implemented decisions.

Reviewer Checkpoints

  • Confirm executable and args come only from the approved template; caller supplies no shell/arbitrary argv.
  • Confirm the internal shim validates the opened admitted directory descriptor, calls fchdir, then replaces itself with only the fixed target; path rename/replacement cannot redirect it, malformed control cannot start a target, and no ambient secret is inherited.
  • Confirm one wait/result owner and entire process-group termination for every cancel/timeout race.
  • Confirm stdout/stderr share a cap while overflow drains, and cross-request cancel cannot kill another group.

Verification Results

Paste actual stdout/stderr for each command; record replacements under deviations.

1. Dependency

test -f agent-task/m-iop-owned-single-request-agent-execution/10+09_workspace_files/complete.log || test "$(compgen -G 'agent-task/archive/*/*/m-iop-owned-single-request-agent-execution/10+09_workspace_files/complete.log' | wc -l)" -eq 1

[fill]

2. Process race tests

go test -race ./apps/node/internal/workspace -run 'Test(CommandExecutor|WorkspaceCommandHelperProcess)' -count=1

[fill]

3. Handler race tests

go test -race ./apps/node/internal/node -run 'TestNodeWorkspace(Command|Cancel)' -count=1

[fill]

4. Package regression

go test ./apps/node/internal/workspace ./apps/node/internal/node ./apps/node/internal/transport ./apps/node/cmd/node -count=1

[fill]

5. Vet

go vet ./apps/node/internal/workspace ./apps/node/internal/node ./apps/node/cmd/node

[fill]

6. Darwin compile

GOOS=darwin GOARCH=arm64 go test -c -o /tmp/iop-workspace-command-darwin.test ./apps/node/internal/workspace

[fill]

rg --sort path -n 'command id|fixed args|fchdir|exec|cwd|process group|environment allowlist|stdout|stderr|PTY|shell' 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