A Complete LoopForge Guide: Six Roles, Parent/Child Workflows and Three-Repository Delivery

A full Web/API/E2E reservation-cancellation tutorial covering Docker, all role briefs, eight parent and six child nodes, complete scripts, human review and PR delivery. Source spacing is repaired with syntax-only checks, without executing the workflow.
This complete multi-repository tutorial comes from Zhi Xingxing AI and uses Tencent’s open-source LoopForge. It retains project setup, all six role briefs, an eight-node parent and six-node child workflow, the complete scripts, reviews and human acceptance. The source interface calls workflows SOPs; current official documentation may call them LOOPs.
The code is material for review, not an installation performed by AINRK. No image was built, service started, model called or PR created. The source has collapsed spaces and paragraph breaks. This edition repairs unambiguous spacing around test, echo, kill, printf, case, nohup and Nginx directives and performs shell syntax parsing only, not dependency, image or end-to-end validation. Pinned example versions are retained and must be checked against the project lockfiles.
A project often spans independently maintained frontend, API and test repositories. The difficulty is keeping requirements, contracts, implementations and evidence aligned, rather than merely having several agents write code. LoopForge organizes roles, scripts and human decisions around that shared delivery goal. The report places it alongside research on more autonomous multi-agent systems, not as proof of equivalent architecture or benchmark performance.

1. The demo and the cancellation requirement
The example is a meeting-room reservation system with three repositories: meeting-room-web for the interface, meeting-room-api for the service, and meeting-room-e2e for Playwright tests. It already lists available rooms and creates reservations. The change adds cancellation: the record disappears and its room/time slot becomes available again. This requires all three repositories, making it a bounded delivery example rather than a complete production booking system.


The original screenshot shows the page before cancellation. Readers following along should fork the three demo repositories into their own GitHub account and connect those forks, so later pushes and PRs affect repositories they control.
2. Create a project and bind the repositories
A LoopForge project is a collaboration space for repositories, roles, workflows and requirements; it does not merge repositories. In Settings → Project configuration → New project, name it “Meeting-room multi-repository delivery demo”, use a generated key and describe coordinated Web/API/E2E work. The default SOP is required; choose an existing workflow temporarily, then explicitly select the new workflow when creating the requirement. Switch to the new project with the top selector.


Under the project’s Code repositories, add each fork URL and save. The example uses main, leaves subpaths empty and makes meeting-room-web the default. Binding repositories determines what the project can use; selecting repositories on a requirement determines what this particular run uses. A default Web repository does not implicitly include API and E2E. Select all three later.


3. Prepare one Docker environment
Web and API need Node.js; E2E needs Playwright and browsers. One shared image avoids separate tool setup. A Dockerfile defines installed tools and versions; a sandbox selects it and supplies runtime variables and root-filesystem settings. In Settings → Environment assets → Dockerfiles, create the example meeting-room-node / meeting-room development environment.

The source pins mcr.microsoft.com/playwright:v1.65.1-noble and CodeBuddy CLI 2.167.0. Match the image to the E2E project’s @playwright/test version rather than copying a tag into an unrelated project. The official image provides browsers and system dependencies, not the project’s Playwright npm package. The Dockerfile adds Git, Git LFS, Nginx and other tools, checks executables, requires Node 22 or newer and locates Chromium, Headless Shell and FFmpeg. It has no COPY instruction, so the example needs no local build-context files.
# 基础镜像版本须与 E2E 项目的 @playwright/test 版本一致。
FROM mcr.microsoft.com/playwright:v1.65.1-noble
ARG CODEBUDDY_VERSION=2.167.0
ENV DEBIAN_FRONTEND=noninteractive \
CI=true \
PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 \
NPM_CONFIG_AUDIT=false \
NPM_CONFIG_FUND=false \
NPM_CONFIG_UPDATE_NOTIFIER=false
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bash \
ca-certificates \
curl \
git \
git-lfs \
jq \
nginx \
openssh-client \
ripgrep \
unzip \
&& rm -rf /var/lib/apt/lists/*
RUN git lfs install --system \
&& git lfs version
RUN npm install --global --no-audit --no-fund \
"@tencent-ai/codebuddy-code@${CODEBUDDY_VERSION}" \
&& command -v codebuddy \
&& test "$(codebuddy --version)" = "${CODEBUDDY_VERSION}"
# 验证运行工具及版本。
RUN set -eu; \
command -v node; \
command -v npm; \
command -v git; \
command -v nginx; \
command -v curl; \
command -v jq; \
command -v rg; \
command -v codebuddy; \
node --version; \
npm --version; \
git --version; \
git lfs version; \
nginx -v; \
curl --version; \
jq --version; \
rg --version; \
codebuddy --version
RUN node -e 'const major = Number(process.versions.node.split(".")[0]); if (!Number.isInteger(major) || major < 22) { console.error("Node.js >= 22 required, current: " + process.version); process.exit(1); } console.log("Node.js version check passed: " + process.version);'
RUN set -eu; \
test "${PLAYWRIGHT_BROWSERS_PATH}" = "/ms-playwright"; \
test -d "${PLAYWRIGHT_BROWSERS_PATH}"; \
echo "PLAYWRIGHT_BROWSERS_PATH=${PLAYWRIGHT_BROWSERS_PATH}"; \
echo "Installed Playwright components:"; \
find "${PLAYWRIGHT_BROWSERS_PATH}" \
-mindepth 1 \
-maxdepth 1 \
-type d \
-print \
| sort
# 验证预装的浏览器组件。
RUN set -eu; \
chromium_bin="$(find "${PLAYWRIGHT_BROWSERS_PATH}" \
-maxdepth 5 \
-type f \
-path "*/chromium-*/*" \
-name "chrome" \
-perm /111 \
-print \
-quit)"; \
headless_shell_bin="$(find "${PLAYWRIGHT_BROWSERS_PATH}" \
-maxdepth 5 \
-type f \
-path "*/chromium_headless_shell-*/*" \
\( -name "chrome-headless-shell" -o -name "headless_shell" \) \
-perm /111 \
-print \
-quit)"; \
ffmpeg_bin="$(find "${PLAYWRIGHT_BROWSERS_PATH}" \
-maxdepth 5 \
-type f \
-path "*/ffmpeg-*/*" \
\( -name "ffmpeg" -o -name "ffmpeg-*" \) \
-perm /111 \
-print \
-quit)"; \
if [ -z "${chromium_bin}" ]; then \
echo "ERROR: executable Chromium binary was not found" >&2; \
find "${PLAYWRIGHT_BROWSERS_PATH}" -maxdepth 5 -type f -print >&2; \
exit 1; \
fi; \
if [ -z "${headless_shell_bin}" ]; then \
echo "ERROR: executable Chromium Headless Shell was not found" >&2; \
find "${PLAYWRIGHT_BROWSERS_PATH}" -maxdepth 5 -type f -print >&2; \
exit 1; \
fi; \
if [ -z "${ffmpeg_bin}" ]; then \
echo "ERROR: executable FFmpeg binary was not found" >&2; \
find "${PLAYWRIGHT_BROWSERS_PATH}" -maxdepth 5 -type f -print >&2; \
exit 1; \
fi; \
echo "Chromium: ${chromium_bin}"; \
echo "Headless Shell: ${headless_shell_bin}"; \
echo "FFmpeg: ${ffmpeg_bin}"; \
"${chromium_bin}" --version; \
"${headless_shell_bin}" --version; \
"${ffmpeg_bin}" -version
RUN nginx -t
WORKDIR /workspace
CMD ["bash"]
Save it, then create a Docker sandbox under Environment assets → Sandboxes. Use the name “Meeting-room three-repository Docker sandbox”, key meeting-room-docker, isolation docker and the saved development Dockerfile. Supply these environment variables:

{
"CI":"true",
"PLAYWRIGHT_BROWSERS_PATH":"/ms-playwright"
}PLAYWRIGHT_BROWSERS_PATH points to preinstalled browsers. The example leaves the container root filesystem writable. Making it read-only changes /usr and /etc and may use a bounded temporary memory filesystem for /tmp. That is a deliberate example setting, not a general security guarantee or a recommendation for every workload.

Before building workflows, open a project conversation, enable Advanced settings → Show runtime selection and select the new sandbox. Ask for a new workspace checking out all three project repositories, and specify inspection only: no file edits, commits or PRs. The inspection prompt requests the following evidence:
- Print $PATH; locate and report node and npm versions.
- Locate CodeBuddy, Nginx, Git and ripgrep and report each version.
- Check PLAYWRIGHT_BROWSERS_PATH=/ms-playwright and that Chromium and Chromium Headless Shell execute.
- List top-level workspace directories.
- For each repository, run git status --short and git branch --show-current.

Expected results are Node at least 22, CodeBuddy 2.167.0, usable npm/Nginx/Git/rg, the browser path and executables, and all three directories. A successful git status with no output means no tracked modifications or unignored untracked files, rather than proof that every generated file is absent. Once environment and workspace checks match the intended baseline, configure roles.

4. Common constraints and six role briefs
Separate shared rules from role-specific work. Shared constraints prevent duplicated instructions and make boundaries explicit. Create “Meeting-room three-repository delivery constraints”, key meeting-room-delivery-constraints, and bind it to each role.

- Read the requirement, relevant README files and upstream artifacts first.
- Do not run git checkout or git switch or change the work branch without authorization.
- Edit only repositories assigned to the role; other repositories may be inspected read-only.
- For API path, request, response or error changes, check the Web and E2E implications too.
- Never fabricate tests, builds, reviews, PRs or CI results. Report actual commands, exit codes, failures and unverified scope.
- Do not write or print tokens, private keys, cookies or model credentials.
- Do not merge PRs, push directly to main or deploy to production without authorization.
- Limit changes to this requirement; no unrelated refactoring or dependency upgrades.
- Before completion, implementation roles, the independent reviewer and delivery coordinator each inspect git diff and git status in all three repositories.

Create six roles with CodeBuddy as CLI, an available model and the shared rule. They are requirement/design, Web, API, E2E, independent review and delivery coordination. Their scopes and artifacts are listed below; the same roles are bound to Agent nodes later.

Requirement analyst and cross-repository designer
The sole deliverables are requirement.md and design.md at the workspace root. Do not change business code, install dependencies, run tests, start services or a browser, commit or create PRs. If already at the Run workspace root, write the files there, not inside one of the three repositories.
- Inspect only the relevant baseline: Web README, package.json, index.html and src/app.js; API README, package.json, src/app.js and test/api.test.js; E2E README, package.json, playwright.config.js and tests/booking.spec.js. Use bounded rg searches only when necessary.
- Do not scan node_modules, dist, .git, .agentflow, playwright-report or test-results; do not dump a recursive workspace tree or entire large files.
- Read the requirement, inspect within scope, create both documents early, complete requirements, design, risks and acceptance criteria, then check both files exist and are nonempty. Finish after those checks without extra exploration.
- requirement.md includes background, objectives, current baseline, scope, non-goals, normal flow, failures, three-repository impact, verifiable acceptance criteria and assumptions requiring confirmation.
- Define DELETE /api/reservations/{reservationId}: success 204 with an empty body, missing/already-cancelled reservation 404, malformed ID 400; confirmation before deletion, removal from the list, released availability, isolation from other reservations and unchanged create/conflict behavior.
- design.md identifies current files, changes in each repository, request/response/error contract, lookup and removal from the API’s in-memory array, confirmation/loading/success/failure states, refresh logic, API/E2E coverage, implementation order, rollback and a deterministic verification plan.
- Use ./assets/... frontend resource paths so CSS and JavaScript load below /devpreview/<Run ID>/8080/. The only completion commands are test -s requirement.md and test -s design.md.
Frontend engineer: meeting-room-web
Read the two design documents and existing page; inspect API/E2E read-only if needed, but edit only Web business code. Add a cancel control on each reservation and a confirmation showing subject, room and slot. Closing it must not call DELETE. Disable the control while pending. Refresh reservations and availability on success; retain the reservation and show the actual error on failure. Preserve visual design, responsiveness, accessibility and HTML escaping. Run npm ci, npm run check and npm run build. Record changed files, implementation, actual commands, outcomes and uncovered scope in frontend-implementation.md.
API engineer: meeting-room-api
Read the requirement, design, routes, in-memory structure and tests. Other repositories are read-only. Implement DELETE /api/reservations/{reservationId}: delete an existing item and return 204, return 404 for absent or repeated deletion and 400 for malformed IDs. The source brief also mentions missing IDs; define how the router handles that case rather than confusing an unmatched route with a malformed path parameter. Free the original room/slot immediately and leave all other reservations unchanged. Do not introduce authentication, a database or auditing. Run npm ci, npm run check and npm test, and record contract changes, files, commands, results and unverified scope in api-implementation.md.
End-to-end engineer: meeting-room-e2e
Read the requirement, design and implementation reports and inspect actual Web/API changes, normally modifying only E2E. Real Playwright scenarios must create a reservation, see it in the day’s list, open cancellation, inspect subject/room/time, confirm, see removal and restored availability, rebook the same slot, verify repeated deletion returns 404, preserve another reservation, and rerun existing creation/conflict cases. Record commands, exit codes, pass/fail counts and Trace or screenshot paths in e2e-report.md. Do not mutate API memory directly to fake success.
Independent reviewer
This role is not an implementer and must not edit implementation. Read requirement.md, design.md, both implementation reports, e2e-report.md and validation-report.md, and examine all three Git diffs. Check Web/API contract alignment, accidental deletion of another reservation, repeat clicks/requests, actual slot release, incorrect removal after failure, conflict-check regressions, genuine test evidence, out-of-scope changes and credential leaks. Write a standalone REJECT for a blocker or APPROVE when no blockers remain in review.md.
Delivery coordinator
Check all requirements, designs, implementation/test/validation/review reports and human acceptance, then inspect each branch, status and diff. Create PRs only for repositories with real code changes, never empty PRs. Check usable GitHub credentials, push/PR permissions and tools before acting. Use LoopForge-created work branches targeting main; include the same requirement title or ID, cross-repository dependencies, evidence and related PR links. Never auto-merge or deploy. Record PR URLs and current CI status in delivery.md; if push, creation or CI inspection is unavailable, report exactly where it stopped.

Role verification commands check minimum artifacts, not business correctness. Require nonempty requirement.md and design.md for the designer; each implementation/test report for its role plus that repository’s git diff --check; nonempty review.md for the reviewer and delivery.md for the coordinator. The source screenshot lists these basic checks. Passing them does not replace later deterministic tests or human review.

5. Build a reusable child workflow and the parent delivery workflow
Avoid copying the same implementation and test stages into every feature or bug-fix process. Put those stages in a child SOP, then place it between parent-level design approval and acceptance. Publish the child before selecting it in the parent. Both use meeting-room-docker and a shared workspace, so requirements, modifications and reports are available without manually moving files.
The child SOP: six nodes
Create “Meeting-room three-repository development and testing” from a blank workflow, select the Docker sandbox and configure project-use permissions. Its six nodes are: three-repository preflight; Web implementation and API implementation in parallel; E2E after both join; deterministic validation; and a human code-approval gate. The two implementation branches join before E2E so it sees both results.


The preflight script checks repository directories, source baseline, requirement/design artifacts and required tools. Existing uncommitted edits are printed and retained so rework continues from them; this script neither discards changes nor rejects a workspace merely for being dirty. The .git-directory check assumes this demo’s checkout form; a Git worktree may instead use a .git file and need an adjusted Git validity check.
#!/bin/sh
set -eu
for repo in meeting-room-web meeting-room-api meeting-room-e2e; do
if [ ! -d "$repo/.git" ]; then
echo "缺少仓库或不是 Git 仓库:$repo"
exit 1
fi
echo "===== $repo ====="
git -C "$repo" branch --show-current
status="$(git -C "$repo" status --short)"
if [ -n "$status" ]; then
echo "$status"
echo "检测到工作区已有改动,将在现有改动基础上继续执行。"
else
echo "工作区干净"
fi
done
test -f meeting-room-web/package.json
test -f meeting-room-web/index.html
test -f meeting-room-api/package.json
test -f meeting-room-api/src/app.js
test -f meeting-room-e2e/package.json
test -f meeting-room-e2e/playwright.config.js
test -s requirement.md
test -s design.md
command -v node
command -v npm
command -v codebuddy
command -v nginx
command -v git
command -v rg
node --version
npm --version
codebuddy --version
nginx -v
echo "三仓预检通过"Bind the Web, API and E2E Agent nodes to their corresponding roles. Both implementers read the same contract; E2E follows their join.

The deterministic script installs locked dependencies with npm ci, runs Web check/build and API check/tests, checks E2E scripts, starts temporary API and Nginx processes on ports 13000 and 18080, waits for health endpoints, runs real Playwright with the preinstalled browsers, and checks all diffs. It writes commands and PASS/FAIL evidence to validation-report.md. The exit trap stops the two processes. These are script intentions, not a report that AINRK ran them.
exec bash <<'BASH'
set -Eeuo pipefail
ROOT="$PWD"
REPORT="$ROOT/validation-report.md"
RUNTIME="/tmp/meeting-room-validation-${AGENTFLOW_RUN_ID:-local}"
API_PORT=13000
WEB_PORT=18080
mkdir -p \
"$RUNTIME" \
"$RUNTIME/client_temp" \
"$RUNTIME/proxy_temp"
: > "$REPORT"
API_PID=""
NGINX_PID=""
cleanup() {
if [[ -n "$NGINX_PID" ]] && kill -0 "$NGINX_PID" 2>/dev/null; then
kill "$NGINX_PID" 2>/dev/null || true
fi
if [[ -n "$API_PID" ]] && kill -0 "$API_PID" 2>/dev/null; then
kill "$API_PID" 2>/dev/null || true
fi
}
trap cleanup EXIT
run_check() {
local title="$1"
shift
{
echo
echo "## $title"
echo
echo '```text'
printf '$'
printf ' %q' "$@"
echo
} >> "$REPORT"
if "$@" >> "$REPORT" 2>&1; then
{
echo '```'
echo
echo "- 结果:PASS"
} >> "$REPORT"
else
local code=$?
{
echo '```'
echo
echo "- 结果:FAIL"
echo "- 退出码:$code"
} >> "$REPORT"
exit "$code"
fi
}
wait_for_url() {
local url="$1"
for _ in $(seq 130); do
if curl --fail --silent --show-error "$url" >/dev/null 2>&1; then
return 0
fi
sleep 1
done
return 1
}
run_check "前端安装依赖" \
npm --prefix "$ROOT/meeting-room-web" ci --no-audit --no-fund
run_check "前端语法检查" \
npm --prefix "$ROOT/meeting-room-web" run check
run_check "前端构建" \
npm --prefix "$ROOT/meeting-room-web" run build
run_check "API 安装依赖" \
npm --prefix "$ROOT/meeting-room-api" ci --no-audit --no-fund
run_check "API 语法检查" \
npm --prefix "$ROOT/meeting-room-api" run check
run_check "API 单元测试" \
npm --prefix "$ROOT/meeting-room-api" test
run_check "E2E 安装依赖" \
npm --prefix "$ROOT/meeting-room-e2e" ci --no-audit --no-fund
run_check "E2E 脚本检查" \
npm --prefix "$ROOT/meeting-room-e2e" run check
cat > "$RUNTIME/nginx.conf" <<EOF
pid $RUNTIME/nginx.pid;
error_log $RUNTIME/nginx-error.log info;
events {
worker_connections 128;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log $RUNTIME/nginx-access.log;
client_body_temp_path $RUNTIME/client_temp;
proxy_temp_path $RUNTIME/proxy_temp;
server {
listen 0.0.0.0:$WEB_PORT;
server_name _;
root $ROOT/meeting-room-web/dist;
index index.html;
location /api/ {
proxy_pass http://127.0.0.1:$API_PORT;
proxy_http_version 1.1;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
}
location / {
try_files \$uri \$uri/ /index.html;
}
}
}
EOF
nginx -t -c "$RUNTIME/nginx.conf" >> "$REPORT" 2>&1
PORT="$API_PORT" \
node "$ROOT/meeting-room-api/src/server.js" \
> "$RUNTIME/api.log" \
2>&1 &
API_PID="$!"
nginx \
-c "$RUNTIME/nginx.conf" \
-g "daemon off;" \
> "$RUNTIME/nginx.log" \
2>&1 &
NGINX_PID="$!"
if ! wait_for_url "http://127.0.0.1:$API_PORT/api/health"; then
echo "API 启动失败" >> "$REPORT"
sed -n '1,200p' "$RUNTIME/api.log" >> "$REPORT"
exit 1
fi
if ! wait_for_url "http://127.0.0.1:$WEB_PORT/api/health"; then
echo "Web 或反向代理启动失败" >> "$REPORT"
sed -n '1,200p' "$RUNTIME/nginx.log" >> "$REPORT"
sed -n '1,200p' "$RUNTIME/nginx-error.log" >> "$REPORT"
exit 1
fi
run_check "Playwright 端到端测试" \
env \
BASE_URL="http://127.0.0.1:$WEB_PORT" \
PLAYWRIGHT_BROWSERS_PATH="/ms-playwright" \
npm --prefix "$ROOT/meeting-room-e2e" run test:e2e
for repo in meeting-room-web meeting-room-api meeting-room-e2e; do
run_check "$repo diff 检查" \
git -C "$ROOT/$repo" diff --check
done
{
echo
echo "## 最终结论"
echo
echo "会议室三仓确定性验证全部通过。"
} >> "$REPORT"
cat "$REPORT"
BASHAfter successful validation, add “Three-repository human code confirmation”. Set failure to send work back to preflight. The reviewer must inspect full diffs in the child workspace, not merely read an agent’s summary. Rework keeps existing code, repeats development/E2E/validation and returns for approval without repeating already-approved parent design.
- Web: only cancellation changes; a clear cancel action; correct subject/room/time confirmation; dismiss without DELETE; disabled/loading controls; list and availability refresh; retained records and readable errors on failure; HTML escaping, responsive design and prior style; no debug code, hardcoded test URLs or unrelated files.
- API: DELETE /api/reservations/:reservationId; 204 with no body; 404 for missing/repeated reservations; 400 for malformed IDs; no stack/path/internal-structure leakage; deleted item absent from listings; slot released; other items unchanged; existing creation/conflict checks preserved; no database/login/permission expansion.
- E2E: create, confirm details, cancel, disappear, release, rebook, missing/repeated cancellation and unaffected other reservation; no test.only, test.skip or debug shortcuts; preserve Trace/screenshots on failure.
- Shared: all validation checks PASS and all three diff checks pass; no credentials, node_modules, reports or runtime logs committed; remotes unchanged; no auto-merge or production deployment; one shared DELETE contract.
- Approve only after checking. On rejection identify repository, file/module, actual problem, expected result and missing tests, then return to preflight.

Publish this child SOP. Its six nodes and rework route can then be reused by other parent workflows.
The parent SOP: eight nodes
Create “Meeting-room three-repository end-to-end delivery” using the same sandbox. Its eight nodes are requirement/design, human design approval, the child development/test SOP, independent cross-repository review, review-result gate, temporary full-stack preview startup, human page acceptance and PR/delivery summary.

The design gate checks scope, DELETE path/status/errors, all three impacts, absent/repeated cancellation, slot reopening and avoidance of unnecessary database, login, permissions or auditing. Return unclear work to requirement/design with specific reasons; approve before implementation. Select the published child for the next node. Parent and child have separate runs but share the workspace. Independent review then compares all changes with the design. Completing a review is not the same as approval; the following script requires APPROVE and rejects REJECT:
#!/bin/sh
set -eu
test -s review.md
if rg -n '^[[:space:]]*REJECT[[:space:]]*$' review.md; then
echo "独立评审存在阻断项,需要退回开发与测试子流程。"
exit 1
fi
if ! rg -n '^[[:space:]]*APPROVE[[:space:]]*$' review.md; then
echo "review.md 中缺少明确的 APPROVE 结论。"
exit 1
fi
echo "独立评审通过"Next start a temporary full-stack acceptance environment inside this Run’s sandbox, not production. The script stops previous Run-specific PIDs on retry, installs/builds the projects, configures Nginx on 8080 proxying API requests to 3000, starts both with logs and PID files, verifies frontend/API/proxy health and prints the /devpreview/<Run ID>/8080/ path. Because PID files and kill are involved, use it only in the intended disposable Run environment, not as a general production-service manager.
set -eu
ROOT="$(pwd)"
WEB_DIR="$ROOT/meeting-room-web"
API_DIR="$ROOT/meeting-room-api"
RUNTIME_DIR="/tmp/meeting-room-preview-${AGENTFLOW_RUN_ID:-local}"
test -d "$WEB_DIR"
test -d "$API_DIR"
test -f "$WEB_DIR/package.json"
test -f "$API_DIR/package.json"
mkdir -p \
"$RUNTIME_DIR" \
"$RUNTIME_DIR/client_temp" \
"$RUNTIME_DIR/proxy_temp"
stop_service() {
pid_file="$1"
if [ ! -s "$pid_file" ]; then
return
fi
service_pid="$(sed -n '1p' "$pid_file" 2>/dev/null || true)"
case "$service_pid" in
""|*[!0-9]*)
return
;;
esac
if kill -0 "$service_pid" 2>/dev/null; then
kill "$service_pid" 2>/dev/null || true
wait_count=0
while kill -0 "$service_pid" 2>/dev/null; do
wait_count=$((wait_count + 1))
if [ "$wait_count" -ge 10 ]; then
kill -9 "$service_pid" 2>/dev/null || true
break
fi
sleep 1
done
fi
}
wait_for_url() {
target_url="$1"
attempt=0
while ! curl --fail --silent --show-error "$target_url" >/dev/null 2>&1; do
attempt=$((attempt + 1))
if [ "$attempt" -ge 30 ]; then
return 1
fi
sleep 1
done
}
# 节点重试时,停止本次 Run 之前启动的旧进程。
stop_service "$RUNTIME_DIR/nginx.process.pid"
stop_service "$RUNTIME_DIR/api.pid"
# 安装依赖并构建前端。
npm --prefix "$API_DIR" ci --no-audit --no-fund
npm --prefix "$WEB_DIR" ci --no-audit --no-fund
npm --prefix "$API_DIR" run check
npm --prefix "$WEB_DIR" run check
npm --prefix "$WEB_DIR" run build
# 为 Run 内的动态验收环境生成 Nginx 配置。
cat > "$RUNTIME_DIR/nginx.conf" <<EOF
pid $RUNTIME_DIR/nginx.pid;
error_log $RUNTIME_DIR/nginx-error.log info;
events {
worker_connections 128;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log $RUNTIME_DIR/nginx-access.log;
client_body_temp_path $RUNTIME_DIR/client_temp;
proxy_temp_path $RUNTIME_DIR/proxy_temp;
server {
listen 0.0.0.0:8080;
server_name _;
root $WEB_DIR/dist;
index index.html;
location /api/ {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
}
location / {
try_files \$uri \$uri/ /index.html;
}
}
}
EOF
# 启动 API。
: > "$RUNTIME_DIR/api.log"
nohup env PORT=3000 \
node "$API_DIR/src/server.js" \
> "$RUNTIME_DIR/api.log" \
2>&1 \
< /dev/null &
printf '%s\n' "$!" > "$RUNTIME_DIR/api.pid"
# 启动前先检查 Nginx 配置。
nginx -t -c "$RUNTIME_DIR/nginx.conf"
: > "$RUNTIME_DIR/nginx.log"
nohup nginx \
-c "$RUNTIME_DIR/nginx.conf" \
-g "daemon off;" \
> "$RUNTIME_DIR/nginx.log" \
2>&1 \
< /dev/null &
printf '%s\n' "$!" > "$RUNTIME_DIR/nginx.process.pid"
# 同时验证 API、前端和 Nginx 反向代理。
if ! wait_for_url "http://127.0.0.1:3000/api/health"; then
echo "API 启动失败:"
sed -n '1,160p' "$RUNTIME_DIR/api.log"
exit 1
fi
if ! wait_for_url "http://127.0.0.1:8080/"; then
echo "前端启动失败:"
sed -n '1,160p' "$RUNTIME_DIR/nginx.log"
sed -n '1,160p' "$RUNTIME_DIR/nginx-error.log"
exit 1
fi
if ! wait_for_url "http://127.0.0.1:8080/api/health"; then
echo "前端到 API 的代理验证失败:"
sed -n '1,160p' "$RUNTIME_DIR/nginx-error.log"
exit 1
fi
RUN_ID="${AGENTFLOW_RUN_ID:-请从运行详情复制完整 Run ID}"
echo
echo "全栈验收环境已启动。"
echo "容器内地址:http://127.0.0.1:8080/"
echo "LoopForge 站内验收地址:/devpreview/${RUN_ID}/8080/"
echo "API 日志:$RUNTIME_DIR/api.log"
echo "Nginx 日志:$RUNTIME_DIR/nginx.log"The page gate requires a real browser interaction, with these complete acceptance steps:
- Copy the complete Run ID and open /devpreview/<Run ID>/8080/ under the current LoopForge domain.
- Check layout, styling, CSS and JavaScript; the page must show a healthy service connection rather than remain connecting or offline.
- Choose a future date, create a uniquely named reservation and see it in the day’s list.
- Click cancel; verify subject, room and time. Dismiss once and confirm the reservation remains.
- Open cancellation again and confirm. Check the old record disappears and its exact room/time becomes available.
- Rebook the same room and slot. Refresh and ensure the cancelled old reservation does not return.
- Open /devpreview/<Run ID>/8080/api/health and check status=ok. Ensure no obvious broken layout or unusable controls.
- Approve only if all pass. Otherwise record Run ID, date/room, steps, page messages, actual results and console/network errors, then send back to the child development/test SOP.

Publish the parent after connecting these nodes. Human page acceptance is followed by the delivery coordinator only when approved.
6. Run the three-repository cancellation requirement
Create a requirement in the meeting-room demo project with “Add meeting-room reservation cancellation” as its first line. Explicitly select Web, API and E2E, delivery by SOP, and the parent end-to-end workflow. Its complete requirement should contain the following contract and scope:
- Background and objective: users can query rooms and create bookings but cannot cancel. Cancellation must remove a record, immediately release its room/time and permit rebooking.
- Baseline: Web contains source, styles, JavaScript and build scripts; API contains Express and Node unit tests; E2E contains Playwright configuration, Docker Compose and existing booking cases. These are existing repositories, not empty projects. If only a README appears, stop and report repository URL, HEAD and origin/main; do not initialize a replacement on the wrong baseline.
- API: DELETE /api/reservations/{reservationId}; 204, empty body on success; 404 with an error such as “Reservation does not exist or was already cancelled” for absent/repeated cancellation; 400 with a readable non-leaking error for malformed ID. Delete from the in-memory list; GET /api/reservations no longer returns it, GET /api/rooms reflects availability, other items remain unchanged and POST/conflict behavior stays intact.
- Web: accessible cancel action for every record; confirmation with subject/room/time; dismiss without deleting; invoke DELETE only after confirmation; prevent double submission; show success and refresh both views; retain the record and actual API error on failure; preserve style, responsiveness and HTML escaping; use ./assets/... to support the dynamic preview prefix.
- API tests: successful, nonexistent and repeated deletion, released availability and isolation from other reservations, with health, query, creation and conflict tests still passing. No authentication, database or auditing is added.
- E2E: future date and unique subject; create and see a record, inspect and confirm cancellation, see removal and availability, rebook, check repeated DELETE 404 and another reservation unaffected, and rerun conflict cases. Preserve Trace/screenshots on failure and stop test subprocesses. Run npm ci first, use local @playwright/test@1.65.1, skip playwright install and set PLAYWRIGHT_BROWSERS_PATH=/ms-playwright.
- Non-goals: login/authentication, ownership permissions or admins, a database, editing reservations, bulk cancellation, audit history, auto-merging PRs and production deployment.
- Acceptance: all related Web/API/E2E checks pass; create/cancel/rebook works in the dynamic preview; confirmation is correct; cancelled records vanish without harming others; repeated cancellation is 404; conflicts still block; changed repositories have separate linked PRs for one requirement, with neither merge nor deployment automated.
Without a separately selected assignee, the example uses the project Owner as the responsible person. Runs use that person’s credentials, so confirm GitHub and model credentials are configured before starting, without pasting secrets into prompts.
The parent first creates requirement.md and design.md, then pauses for human approval. In particular, verify repeated cancellation behavior and whether the slot reopens. A plan that mentions only hiding the list row is incomplete and should be returned with that omission. After approval, open the child run from its node to follow parallel development.

At the child’s code gate, inspect Web interaction/API calls, API contract/business logic and E2E acceptance coverage, together with validation-report.md. Give repository-specific feedback, review revised diffs and evidence, then approve. The parent resumes independent review and its explicit gate before starting the preview and waiting for human page acceptance.

Use the full preview path from the startup node. Create a reservation, note the room and time, cancel it, then reserve that exact slot again. Disappearing from the list alone does not prove availability was released. Record concrete failures and send back to development, then repeat the same checks. Only a successful create/cancel/rebook chain supports accepting this example change.

After page approval, PR/delivery coordination completes the eighth parent node; the six child nodes have already completed. Inspect the final run state, open PRs from delivery.md or each GitHub Pull requests page and confirm every actually changed repository has a PR linked to the same requirement. PR creation is the delivery outcome here; it is not an automatic merge or deployment.


7. What can be reused, and what still needs checking
The reusable part is the connection between configuration, role boundaries, scripts and human decisions. A child workflow avoids repeated construction of common implementation/test stages. Real command results provide evidence, while humans retain design, code and page gates and a clear route for rework. Start with a frequent, bounded change and expand only after the workflow is reliable.
The original screenshots document the author’s run, not an independent reproduction by AINRK. We read all 29 body images and retained them in order, preserving the original cover rather than inventing one. Code/log strings shared above retain their source Chinese. The Playwright project package still needs npm ci even though the image contains browsers. Match versions, define missing-route behavior separately from malformed IDs, accommodate .git files for worktrees where relevant, and stop temporary preview processes or remove the Run sandbox after acceptance.
Edited by AINRK. Reporting lead: A Tencent Super-Agent Tutorial: Six Agents across Three Repositories (opens in a new tab); original reporting: Zhi Xingxing AI; original author: Zhi Xingxing AI; source date: 2026-12-04 09:33 (Beijing time, UTC+8).
Reference: Source at github.com (opens in a new tab)
Reference: Source at playwright.dev (opens in a new tab)
Reference: Source at github.com (opens in a new tab)
After reading
Join the AINRK community
Read how to join the community and connect with people working in AI.




