@tea-agent/loop-agent 0.11.0 → 0.13.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -1
- package/README.md +33 -4
- package/dist/application/dag/generate-task-dag.js +45 -0
- package/dist/application/dag/run-dag.js +10 -0
- package/dist/application/dag/validate-dag.js +11 -0
- package/dist/cli/command-definitions.js +10 -3
- package/dist/commands/init.js +74 -7
- package/dist/commands/knowledge.js +129 -31
- package/dist/governance/manifest-types.js +3 -0
- package/dist/shared/package-metadata.js +135 -0
- package/dist/task/config-types.js +6 -1
- package/dist/worker/cli.js +99 -2
- package/dist/worker/delivery/package.js +3 -3
- package/dist/worker/feature/decision-loader.js +37 -6
- package/dist/worker/feature/next-action.js +10 -2
- package/dist/worker/feature/ready-plan-projection.js +81 -0
- package/dist/worker/feature/reducer.js +2 -1
- package/dist/worker/feature/review.js +19 -2
- package/dist/worker/feature/run.js +27 -2
- package/dist/worker/follow-up/approve.js +5 -2
- package/dist/worker/follow-up/factory.js +1 -1
- package/dist/worker/observability/event-history.js +216 -0
- package/dist/worker/observability/read-model.js +552 -118
- package/dist/worker/observe/paths.js +17 -0
- package/dist/worker/observe/routes.js +310 -23
- package/dist/worker/observe/server.js +59 -1
- package/dist/worker/observe/spec-evidence.js +281 -0
- package/dist/worker/observe/static/api.js +46 -0
- package/dist/worker/observe/static/app.js +120 -2598
- package/dist/worker/observe/static/constants.js +148 -0
- package/dist/worker/observe/static/copy.js +67 -0
- package/dist/worker/observe/static/dag-helpers.js +172 -0
- package/dist/worker/observe/static/dag-model.js +72 -0
- package/dist/worker/observe/static/dom.js +61 -0
- package/dist/worker/observe/static/format-pool.js +67 -0
- package/dist/worker/observe/static/format.js +292 -0
- package/dist/worker/observe/static/index.html +300 -82
- package/dist/worker/observe/static/kpi.js +94 -0
- package/dist/worker/observe/static/relations.js +133 -0
- package/dist/worker/observe/static/router.js +93 -0
- package/dist/worker/observe/static/run-processing.js +148 -0
- package/dist/worker/observe/static/shell-chrome.js +68 -0
- package/dist/worker/observe/static/state.js +253 -0
- package/dist/worker/observe/static/styles.css +1731 -495
- package/dist/worker/observe/static/views/batch.js +227 -0
- package/dist/worker/observe/static/views/dag-graph.js +172 -0
- package/dist/worker/observe/static/views/dag-inspector.js +596 -0
- package/dist/worker/observe/static/views/dag.js +362 -0
- package/dist/worker/observe/static/views/dashboard.js +445 -0
- package/dist/worker/observe/static/views/failures.js +143 -0
- package/dist/worker/observe/static/views/feature.js +492 -0
- package/dist/worker/observe/static/views/pool.js +350 -0
- package/dist/worker/observe/static/views/run.js +453 -0
- package/dist/worker/observe/static/views/session-timeline.js +205 -0
- package/dist/worker/observe/static/views/shell.js +7 -0
- package/dist/worker/observe/static/views/task.js +314 -0
- package/dist/worker/observe/static/views/timeline.js +163 -0
- package/dist/worker/pool/doctor.js +165 -0
- package/dist/worker/pool/migrate-state.js +303 -0
- package/dist/worker/pool/run-store.js +205 -17
- package/dist/worker/pool/types.js +17 -1
- package/dist/worker/pool/validation.js +100 -15
- package/dist/worker/report/morning-report.js +12 -2
- package/dist/worker/runner/run-ready.js +41 -26
- package/dist/worker/task-graph/ready-planner.js +136 -0
- package/dist/workflows/dag/controller-identity.js +104 -0
- package/dist/workflows/dag/convergence/controller.js +16 -8
- package/dist/workflows/dag/failure-routing.js +12 -1
- package/dist/workflows/dag/init-hybrid.js +1233 -11
- package/dist/workflows/dag/node-execution.js +123 -29
- package/dist/workflows/dag/repair-artifact.js +91 -0
- package/dist/workflows/dag/report.js +50 -0
- package/dist/workflows/dag/retry-policy.js +138 -0
- package/dist/workflows/dag/runner.js +32 -0
- package/dist/workflows/dag/runtime-contract.js +87 -0
- package/dist/workflows/dag/skill-snapshot.js +2 -0
- package/dist/workflows/dag/types.js +45 -1
- package/dist/workflows/dag/validate.js +68 -4
- package/docs/README.md +1 -1
- package/docs/agent-dag-recovery-playbook.md +9 -0
- package/docs/agent-dag-runner.md +26 -1
- package/docs/architecture/dag-execution.md +6 -0
- package/docs/architecture/evolution.md +7 -5
- package/docs/architecture/facts-and-state.md +15 -2
- package/docs/architecture/worker-and-feature.md +6 -2
- package/docs/decisions/README.md +3 -0
- package/docs/design/README.md +12 -3
- package/docs/exec-plans/active/README.md +2 -2
- package/docs/exec-plans/completed/README.md +12 -0
- package/docs/feature-workflow.md +108 -2
- package/docs/loop-agent-harness.md +15 -4
- package/docs/progress/README.md +22 -0
- package/docs/reports/README.md +14 -2
- package/docs/templates/agent-dag-report.schema.json +17 -0
- package/docs/templates/agent-dag.schema.json +69 -1
- package/docs/templates/agent-dag.supervised-implementation.json +8 -2
- package/docs/templates/backend-test-dag.generate-pytest.prompt.md +139 -0
- package/docs/templates/backend-test-dag.json +288 -0
- package/docs/templates/backend-test-dag.retrospect.prompt.md +125 -0
- package/docs/templates/backend-test-dag.review-cases.prompt.md +81 -0
- package/docs/templates/knowledge-graph-bootstrap-dag.json +118 -0
- package/docs/templates/knowledge-sync-dag.json +177 -0
- package/docs/templates/knowledge-sync-draft.schema.json +71 -0
- package/docs/verification-matrix.md +2 -1
- package/package.json +8 -2
- package/scripts/kb-bootstrap-init-skeleton.sh +239 -0
- package/scripts/kb-graph-incremental-prepare.mjs +372 -0
- package/scripts/kb-graph-incremental-prepare.sh +5 -0
- package/scripts/kb-graph-materialize.mjs +105 -0
- package/scripts/kb-graph-materialize.sh +4 -0
- package/scripts/kb-graph-promote.mjs +153 -0
- package/scripts/kb-graph-promote.sh +4 -0
- package/scripts/kb-query.mjs +554 -0
- package/scripts/kb-query.sh +5 -0
- package/skills/agent-worker/SKILL.md +3 -1
- package/skills/agent-worker/references/agent-worker-operator.md +18 -1
- package/skills/frontend-design-review/SKILL.md +26 -24
- package/skills/frontend-implementation/SKILL.md +29 -26
- package/skills/frontend-implementation/references/node-contracts.md +50 -19
- package/skills/frontend-review/SKILL.md +1 -1
- package/skills/loop-agent/references/command-reference.md +2 -0
- package/skills/loop-agent/references/hybrid-dag.md +22 -3
- package/skills/loop-agent/references/verification-and-failure-handling.md +6 -0
package/docs/progress/README.md
CHANGED
|
@@ -6,6 +6,17 @@
|
|
|
6
6
|
|
|
7
7
|
## 近期要点(导读)
|
|
8
8
|
|
|
9
|
+
- [`2026-07-16-ready-planner.md`](2026-07-16-ready-planner.md) — Priority-aware Ready Planner:M1 core + RP-02 Feature/report/Observe 同源投影(已验证)
|
|
10
|
+
- [`2026-07-15-task-pool-v2-feature-scoped-task-identity.md`](2026-07-15-task-pool-v2-feature-scoped-task-identity.md) — Task Pool v2 复合身份:M1 store + M2 consumers + M3 Observe + M4 文档收口(已归档 completed)
|
|
11
|
+
- [`2026-07-15-init-update-surface-coverage.md`](2026-07-15-init-update-surface-coverage.md) — 修复初始化 surface 升级漏检(自动发现 copied 文件、blockedTargetPaths fail-safe、drift gate)实施交接(已验证)
|
|
12
|
+
- [`2026-07-15-readonly-node-retry.md`](2026-07-15-readonly-node-retry.md) — 只读 Pi DAG 节点安全重试(默认策略、attempt 证据、validation 门禁)实施交接(已验证)
|
|
13
|
+
- [`2026-07-15-repair-artifact-gate-runtime-contract-implementation.md`](2026-07-15-repair-artifact-gate-runtime-contract-implementation.md) — 显式 repairNodeId、runtime contract preflight 与 run-owned controller identity 实施交接(已验证)
|
|
14
|
+
- [`2026-07-14-observe-ui-r5-boundary-final.md`](2026-07-14-observe-ui-r5-boundary-final.md) — R5 轻量入口与显式模块边界 DAG closeout
|
|
15
|
+
- [`2026-07-14-observe-ui-r5-remediation.md`](2026-07-14-observe-ui-r5-remediation.md) — R5 浏览器状态所有权修复 DAG closeout
|
|
16
|
+
- [`2026-07-14-observe-ui-r5.md`](2026-07-14-observe-ui-r5.md) — Observe 前端模块化与体验收敛(已验证)
|
|
17
|
+
- [`2026-07-14-observe-ui-r4.md`](2026-07-14-observe-ui-r4.md) — Observe 事件时间线、有界 JSONL 与投影健康(已验证)
|
|
18
|
+
- [`2026-07-14-observe-ui-r3.md`](2026-07-14-observe-ui-r3.md) — Observe Feature 决策详情与对象关联导航(已验证)
|
|
19
|
+
- [`2026-07-14-observe-ui-r2.md`](2026-07-14-observe-ui-r2.md) — Observe Batch / Worker Run 证据化详情收口
|
|
9
20
|
- [`2026-07-14-init-canonical-layout-handoff.md`](2026-07-14-init-canonical-layout-handoff.md) — 目标项目初始化布局迁移到 `ai_workspace/loop-agent/` 与 `.agents/skills/` 的跨会话交接
|
|
10
21
|
- [`2026-07-14-self-update-notifier-implementation.md`](2026-07-14-self-update-notifier-implementation.md) — loop-agent CLI 自更新提醒实现、TDD 验证和 bounded DAG fallback 交接
|
|
11
22
|
- [`2026-07-14-docs-living-docs-calibration.md`](2026-07-14-docs-living-docs-calibration.md) — 活文档校准(Dynamic Workflow / 六个月 / ADR)
|
|
@@ -18,6 +29,17 @@
|
|
|
18
29
|
|
|
19
30
|
## 全量列表(新→旧)
|
|
20
31
|
|
|
32
|
+
- [`2026-07-16-ready-planner.md`](2026-07-16-ready-planner.md)
|
|
33
|
+
- [`2026-07-15-task-pool-v2-feature-scoped-task-identity.md`](2026-07-15-task-pool-v2-feature-scoped-task-identity.md)
|
|
34
|
+
- [`2026-07-15-init-update-surface-coverage.md`](2026-07-15-init-update-surface-coverage.md)
|
|
35
|
+
- [`2026-07-15-readonly-node-retry.md`](2026-07-15-readonly-node-retry.md)
|
|
36
|
+
- [`2026-07-15-repair-artifact-gate-runtime-contract-implementation.md`](2026-07-15-repair-artifact-gate-runtime-contract-implementation.md)
|
|
37
|
+
- [`2026-07-14-observe-ui-r5-boundary-final.md`](2026-07-14-observe-ui-r5-boundary-final.md)
|
|
38
|
+
- [`2026-07-14-observe-ui-r5-remediation.md`](2026-07-14-observe-ui-r5-remediation.md)
|
|
39
|
+
- [`2026-07-14-observe-ui-r5.md`](2026-07-14-observe-ui-r5.md)
|
|
40
|
+
- [`2026-07-14-observe-ui-r4.md`](2026-07-14-observe-ui-r4.md)
|
|
41
|
+
- [`2026-07-14-observe-ui-r3.md`](2026-07-14-observe-ui-r3.md)
|
|
42
|
+
- [`2026-07-14-observe-ui-r2.md`](2026-07-14-observe-ui-r2.md)
|
|
21
43
|
- [`2026-07-14-init-canonical-layout-handoff.md`](2026-07-14-init-canonical-layout-handoff.md)
|
|
22
44
|
- [`2026-07-14-self-update-notifier-implementation.md`](2026-07-14-self-update-notifier-implementation.md)
|
|
23
45
|
- [`2026-07-14-website-docs-ia-and-converge.md`](2026-07-14-website-docs-ia-and-converge.md)
|
package/docs/reports/README.md
CHANGED
|
@@ -8,11 +8,17 @@
|
|
|
8
8
|
|
|
9
9
|
- 按日期前缀浏览下方列表(新→旧)
|
|
10
10
|
- init surface 审查:文件名含 `init-evolution-review`
|
|
11
|
-
- 能力基线滚动分析:[`2026-07-02-repository-analysis.md`](2026-07-02-repository-analysis.md)
|
|
11
|
+
- 能力基线滚动分析:[`2026-07-02-repository-analysis.md`](2026-07-02-repository-analysis.md)(**已冻结**;2026-07-15 最终再采样关闭 0.11.0;非第二 CHANGELOG)
|
|
12
12
|
|
|
13
13
|
## 近期要点(导读,非权威全集)
|
|
14
14
|
|
|
15
15
|
- [`current-capability-summary.md`](current-capability-summary.md) — **活**能力摘要(新进展写这里 / CHANGELOG / 新 report)
|
|
16
|
+
- [`2026-07-16-task-pool-priority-aware-ready-planner.md`](2026-07-16-task-pool-priority-aware-ready-planner.md) — Priority-aware Ready Planner 关闭报告
|
|
17
|
+
- [`2026-07-15-task-pool-v2-feature-scoped-task-identity.md`](2026-07-15-task-pool-v2-feature-scoped-task-identity.md) — Task Pool v2 复合身份 M0–M4 最终报告
|
|
18
|
+
- [`2026-07-15-task-pool-v2-init-evolution-review.md`](2026-07-15-task-pool-v2-init-evolution-review.md) — Task Pool v2 文档变更的 init surface 非影响审查
|
|
19
|
+
- [`2026-07-15-init-update-surface-coverage-init-evolution-review.md`](2026-07-15-init-update-surface-coverage-init-evolution-review.md) — 初始化 surface 升级漏检修复的 init surface 审查(init update required)
|
|
20
|
+
- [`2026-07-15-readonly-node-retry-init-evolution-review.md`](2026-07-15-readonly-node-retry-init-evolution-review.md) — 只读 Pi DAG 节点安全重试的 init surface 审查(surface check only,无需 init evolution)
|
|
21
|
+
- [`2026-07-15-backend-test-dag-init-evolution-review.md`](2026-07-15-backend-test-dag-init-evolution-review.md) — 后端测试专用 DAG 的 package/init surface 审查
|
|
16
22
|
- [`2026-07-15-init-canonical-layout-init-evolution-review.md`](2026-07-15-init-canonical-layout-init-evolution-review.md) — init canonical layout、旧布局安全迁移和废弃 harness 字段清理审查
|
|
17
23
|
- [`2026-07-14-self-update-notifier-implementation.md`](2026-07-14-self-update-notifier-implementation.md) — loop-agent CLI 自更新提醒实现、DAG 边界、TDD 与 init surface 非影响证据
|
|
18
24
|
- [`2026-07-14-docs-living-docs-calibration.md`](2026-07-14-docs-living-docs-calibration.md) — 活文档校准(Dynamic Workflow / 六个月 / analysis 冻结 / ADR)
|
|
@@ -21,10 +27,16 @@
|
|
|
21
27
|
- [`2026-07-13-sdd-embedded-skills.md`](2026-07-13-sdd-embedded-skills.md) — repo-local SDD skill 嵌入增强的 DAG、TDD、独立审查、验证和基线风险证据
|
|
22
28
|
- [`2026-07-13-versioned-self-hosting-bootstrap.md`](2026-07-13-versioned-self-hosting-bootstrap.md) — 版本化自举证据
|
|
23
29
|
- [`2026-07-12-m2-completion-audit.md`](2026-07-12-m2-completion-audit.md) — 第二月完成审计
|
|
24
|
-
- [`2026-07-02-repository-analysis.md`](2026-07-02-repository-analysis.md) —
|
|
30
|
+
- [`2026-07-02-repository-analysis.md`](2026-07-02-repository-analysis.md) — **已冻结**仓库能力基线快照(2026-07-15 最终再采样至 0.11.0;勿再当 CHANGELOG)
|
|
25
31
|
|
|
26
32
|
## 全量列表(新→旧)
|
|
27
33
|
|
|
34
|
+
- [`2026-07-16-task-pool-priority-aware-ready-planner.md`](2026-07-16-task-pool-priority-aware-ready-planner.md)
|
|
35
|
+
- [`2026-07-15-task-pool-v2-feature-scoped-task-identity.md`](2026-07-15-task-pool-v2-feature-scoped-task-identity.md)
|
|
36
|
+
- [`2026-07-15-task-pool-v2-init-evolution-review.md`](2026-07-15-task-pool-v2-init-evolution-review.md)
|
|
37
|
+
- [`2026-07-15-init-update-surface-coverage-init-evolution-review.md`](2026-07-15-init-update-surface-coverage-init-evolution-review.md)
|
|
38
|
+
- [`2026-07-15-readonly-node-retry-init-evolution-review.md`](2026-07-15-readonly-node-retry-init-evolution-review.md)
|
|
39
|
+
- [`2026-07-15-backend-test-dag-init-evolution-review.md`](2026-07-15-backend-test-dag-init-evolution-review.md)
|
|
28
40
|
- [`2026-07-15-init-canonical-layout-init-evolution-review.md`](2026-07-15-init-canonical-layout-init-evolution-review.md)
|
|
29
41
|
- [`dogfood-preflight-static-20260709090443.md`](dogfood-preflight-static-20260709090443.md)
|
|
30
42
|
- [`current-capability-summary.md`](current-capability-summary.md)
|
|
@@ -444,6 +444,23 @@
|
|
|
444
444
|
},
|
|
445
445
|
"pausedByNodeId": { "type": "string" },
|
|
446
446
|
"pauseReason": { "type": "string" },
|
|
447
|
+
"controllerIdentity": {
|
|
448
|
+
"type": "object",
|
|
449
|
+
"additionalProperties": false,
|
|
450
|
+
"required": ["status", "capturedAt", "runtimeContractCompatibility"],
|
|
451
|
+
"properties": {
|
|
452
|
+
"status": { "enum": ["pinned", "legacy-unpinned"] },
|
|
453
|
+
"capturedAt": { "type": "string" },
|
|
454
|
+
"packageName": { "type": "string" },
|
|
455
|
+
"packageVersion": { "type": "string" },
|
|
456
|
+
"packageFingerprint": { "type": "string" },
|
|
457
|
+
"binarySha256": { "type": "string" },
|
|
458
|
+
"runtimeContractCompatibility": {
|
|
459
|
+
"enum": ["compatible", "incompatible", "legacy-unspecified"]
|
|
460
|
+
},
|
|
461
|
+
"runtimeContractReason": { "type": "string" }
|
|
462
|
+
}
|
|
463
|
+
},
|
|
447
464
|
"executorJsonl": { "$ref": "#/$defs/dagArtifactRef" },
|
|
448
465
|
"convergence": { "$ref": "#/$defs/dagConvergence" },
|
|
449
466
|
"nodes": {
|
|
@@ -5,18 +5,29 @@
|
|
|
5
5
|
"type": "object",
|
|
6
6
|
"additionalProperties": false,
|
|
7
7
|
"required": ["version", "title", "tasks"],
|
|
8
|
+
"allOf": [
|
|
9
|
+
{
|
|
10
|
+
"if": { "properties": { "version": { "const": 3 } }, "required": ["version"] },
|
|
11
|
+
"then": { "required": ["runtimeContract"] }
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"if": { "required": ["runtimeContract"] },
|
|
15
|
+
"then": { "properties": { "version": { "const": 3 } } }
|
|
16
|
+
}
|
|
17
|
+
],
|
|
8
18
|
"properties": {
|
|
9
19
|
"$schema": {
|
|
10
20
|
"type": "string"
|
|
11
21
|
},
|
|
12
22
|
"version": {
|
|
13
|
-
"enum": [1, 2],
|
|
23
|
+
"enum": [1, 2, 3],
|
|
14
24
|
"default": 1
|
|
15
25
|
},
|
|
16
26
|
"title": {
|
|
17
27
|
"type": "string",
|
|
18
28
|
"minLength": 1
|
|
19
29
|
},
|
|
30
|
+
"runtimeContract": { "$ref": "#/$defs/runtimeContract" },
|
|
20
31
|
"objective": {
|
|
21
32
|
"type": "string"
|
|
22
33
|
},
|
|
@@ -72,6 +83,21 @@
|
|
|
72
83
|
"required": ["models"]
|
|
73
84
|
},
|
|
74
85
|
"$defs": {
|
|
86
|
+
"runtimeContract": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"required": ["schemaVersion", "agentRuntime", "repairWriterProtocol"],
|
|
90
|
+
"description": "DagSpec v3 controller capability handshake. Compatibility is decided by capability fields first; minimumControllerVersion is enforced when present. Legacy v1/v2 DAGs may omit this block.",
|
|
91
|
+
"properties": {
|
|
92
|
+
"schemaVersion": { "const": 1 },
|
|
93
|
+
"agentRuntime": { "const": "pi-only" },
|
|
94
|
+
"repairWriterProtocol": { "const": "explicit-node-v1" },
|
|
95
|
+
"minimumControllerVersion": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+([-+].+)?$"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
75
101
|
"complexity": {
|
|
76
102
|
"enum": ["LOW", "MED", "HIGH"]
|
|
77
103
|
},
|
|
@@ -140,6 +166,11 @@
|
|
|
140
166
|
"fromNodeId": {
|
|
141
167
|
"type": "string",
|
|
142
168
|
"pattern": "^[a-z][a-z0-9-]*$"
|
|
169
|
+
},
|
|
170
|
+
"repairNodeId": {
|
|
171
|
+
"type": "string",
|
|
172
|
+
"pattern": "^[a-z][a-z0-9-]*$",
|
|
173
|
+
"description": "Explicit governed Pi repair writer this gate feeds (executor=pi, toolProfile=write, writePolicy=exclusive, non-empty allowedPaths+writeSet, depends_on the gate). New DAGs must set this; legacy DAGs are only accepted when a unique safe downstream Pi writer can be derived."
|
|
143
174
|
}
|
|
144
175
|
}
|
|
145
176
|
},
|
|
@@ -211,6 +242,39 @@
|
|
|
211
242
|
"status": { "enum": ["success", "error"] }
|
|
212
243
|
}
|
|
213
244
|
},
|
|
245
|
+
"retryPolicy": {
|
|
246
|
+
"type": "object",
|
|
247
|
+
"additionalProperties": false,
|
|
248
|
+
"required": ["maxAttempts"],
|
|
249
|
+
"description": "Retry policy for safe read-only planner/scout/reviewer/verifier/closeout Pi nodes. Total attempts include the first try and are capped at five. Supervisors, implementers, and side-effecting nodes are ineligible. Only the categories listed in retryCategories are retried; quota/auth/invalid-output/write-guard are never retried.",
|
|
250
|
+
"properties": {
|
|
251
|
+
"maxAttempts": {
|
|
252
|
+
"type": "integer",
|
|
253
|
+
"minimum": 1,
|
|
254
|
+
"maximum": 5,
|
|
255
|
+
"description": "Total attempts including the first try. 1 disables retry."
|
|
256
|
+
},
|
|
257
|
+
"backoff": { "const": "exponential", "default": "exponential" },
|
|
258
|
+
"initialDelayMs": {
|
|
259
|
+
"type": "integer",
|
|
260
|
+
"minimum": 0,
|
|
261
|
+
"default": 2000
|
|
262
|
+
},
|
|
263
|
+
"maxDelayMs": {
|
|
264
|
+
"type": "integer",
|
|
265
|
+
"minimum": 0,
|
|
266
|
+
"default": 30000
|
|
267
|
+
},
|
|
268
|
+
"retryCategories": {
|
|
269
|
+
"type": "array",
|
|
270
|
+
"items": {
|
|
271
|
+
"enum": ["timeout", "network", "rate-limit", "unavailable"]
|
|
272
|
+
},
|
|
273
|
+
"default": ["timeout", "network", "rate-limit", "unavailable"],
|
|
274
|
+
"description": "Failure categories eligible for retry. quota is never eligible."
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
},
|
|
214
278
|
"promptSource": {
|
|
215
279
|
"type": "object",
|
|
216
280
|
"additionalProperties": false,
|
|
@@ -296,6 +360,10 @@
|
|
|
296
360
|
"default": "record-only"
|
|
297
361
|
}
|
|
298
362
|
}
|
|
363
|
+
},
|
|
364
|
+
"retryPolicy": {
|
|
365
|
+
"$ref": "#/$defs/retryPolicy",
|
|
366
|
+
"description": "Opt-in retry policy. Allowed only on safe read-only planner/scout/reviewer/verifier/closeout non-dynamic Pi nodes; validation rejects it on supervisors, implementers, writers, dynamic, shell, static, docs-only, and decision-gate nodes. Generated DAGs declare the default policy on eligible nodes automatically."
|
|
299
367
|
}
|
|
300
368
|
},
|
|
301
369
|
"oneOf": [
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./agent-dag.schema.json",
|
|
3
|
-
"version":
|
|
3
|
+
"version": 3,
|
|
4
4
|
"title": "Agent DAG supervised implementation template",
|
|
5
|
+
"runtimeContract": {
|
|
6
|
+
"schemaVersion": 1,
|
|
7
|
+
"agentRuntime": "pi-only",
|
|
8
|
+
"repairWriterProtocol": "explicit-node-v1"
|
|
9
|
+
},
|
|
5
10
|
"objective": "Demonstrate a reusable supervised implementation DAG: contract → parallel scouts → plan → write-set audit → write-set gate → implement → soft verify → process supervisor → repair → hard verify → review verdict → review gate → decision gate → closeout. Write-set, process, and review verdict nodes emit first-line VERDICT for deterministic gates, reducing main-session intervention.",
|
|
6
11
|
"successCriteria": [
|
|
7
12
|
"contract-pi returns a read-only implementation contract with narrow write boundaries",
|
|
@@ -318,7 +323,8 @@
|
|
|
318
323
|
"lineMode": "first-verdict-line"
|
|
319
324
|
},
|
|
320
325
|
"repairArtifactGate": {
|
|
321
|
-
"fromNodeId": "process-supervisor-pi"
|
|
326
|
+
"fromNodeId": "process-supervisor-pi",
|
|
327
|
+
"repairNodeId": "repair-pi"
|
|
322
328
|
},
|
|
323
329
|
"cwd": ".",
|
|
324
330
|
"timeoutMs": 60000
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Backend Test DAG Generate Pytest Prompt Template
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Use this prompt for a **pytest code generation** node: `executor: "pi"`, `role: "implementer"`, `toolProfile: "write"`, `writePolicy: "exclusive"`. The implementer converts reviewed backend functional test cases into pytest automation code with 1:1 traceability.
|
|
6
|
+
|
|
7
|
+
Do **not** create a new executor type. This is a standard `executor: pi` writer node.
|
|
8
|
+
|
|
9
|
+
## Recommended DAG Node Shape
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"id": "generate-backend-pytest-pi",
|
|
14
|
+
"depends_on": ["review-backend-cases-gate-shell"],
|
|
15
|
+
"complexity": "HIGH",
|
|
16
|
+
"executor": "pi",
|
|
17
|
+
"role": "implementer",
|
|
18
|
+
"toolProfile": "write",
|
|
19
|
+
"writePolicy": "exclusive",
|
|
20
|
+
"writeSet": ["testcase/**/test_*.py"],
|
|
21
|
+
"allowedPaths": ["testcase/**/test_*.py"],
|
|
22
|
+
"forbiddenPaths": [".harness/**", "artifacts/**"],
|
|
23
|
+
"outputContract": "Pytest test files under tests/backend/ with 1:1 mapping to functional test case IDs. Summary lists generated files, test function count, and any skipped cases with reasons.",
|
|
24
|
+
"subtask_prompt_markdown": "./backend-test-dag.generate-pytest.prompt.md"
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Prompt Body
|
|
29
|
+
|
|
30
|
+
You are the Backend Test DAG **pytest code generator**.
|
|
31
|
+
|
|
32
|
+
Your job is to convert reviewed test cases under `testcase/md/` into pytest automation code. Write test files under `testcase/` only. Stay within `writeSet`. Do not write root `artifacts/**`.
|
|
33
|
+
|
|
34
|
+
### Output Steps (do in order)
|
|
35
|
+
|
|
36
|
+
1. First, output a brief summary: how many files, how many test functions planned
|
|
37
|
+
2. Then write each test file under `testcase/`
|
|
38
|
+
|
|
39
|
+
### Inputs
|
|
40
|
+
|
|
41
|
+
1. **Reviewed test cases** — files under `testcase/md/` (approved by `review-backend-cases-pi`).
|
|
42
|
+
2. **Target project conventions** — read `conftest.py`, `pytest.ini` / `pyproject.toml` to understand conventions, but do NOT modify them.
|
|
43
|
+
|
|
44
|
+
Do NOT re-read source documents. Use the reviewed cases only.
|
|
45
|
+
|
|
46
|
+
### Conversion Rules
|
|
47
|
+
|
|
48
|
+
#### File Naming
|
|
49
|
+
|
|
50
|
+
- Every test file must start with `test_` prefix (e.g. `test_order.py`, `test_user_api.py`)
|
|
51
|
+
- pytest collects tests from files matching `test_*.py` or `*_test.py` — use `test_` prefix exclusively
|
|
52
|
+
- Never create test files without the `test_` prefix
|
|
53
|
+
|
|
54
|
+
#### Write Boundary
|
|
55
|
+
|
|
56
|
+
- Only **create new** test script files under `testcase/`
|
|
57
|
+
- Do NOT modify existing files: `conftest.py`, `pytest.ini`, `pyproject.toml`, `setup.cfg`, `__init__.py`, or any other framework/config file
|
|
58
|
+
- Reuse existing fixtures; if required fixtures do not exist, report the gap instead of creating or modifying framework files
|
|
59
|
+
- Read existing framework files to understand conventions, but treat them as immutable
|
|
60
|
+
|
|
61
|
+
#### Naming Conflict Resolution
|
|
62
|
+
|
|
63
|
+
- If a file with the target name already exists under `testcase/`, add a numeric suffix: `test_order.py` → `test_order_01.py` → `test_order_02.py`
|
|
64
|
+
- Never overwrite or append to existing files — each test script must be a standalone file
|
|
65
|
+
- Check for existing files before writing; if `test_<module>.py` exists, use `test_<module>_01.py`
|
|
66
|
+
|
|
67
|
+
#### 1:1 Traceability
|
|
68
|
+
|
|
69
|
+
Every functional test case ID (`BE-<MODULE>-<NNN>`) must map to exactly one pytest function:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
# testcase/md/BE-ORDER-001 → testcase/test_order.py
|
|
73
|
+
def test_BE_ORDER_001_create_order_with_valid_data():
|
|
74
|
+
"""BE-ORDER-001: Create order with valid request body."""
|
|
75
|
+
...
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- Function name: `test_<CASE_ID_with_underscores>` (e.g. `test_BE_ORDER_001_...`)
|
|
79
|
+
- Docstring first line: `<CASE_ID>: <Case Title>`
|
|
80
|
+
|
|
81
|
+
#### File Organization
|
|
82
|
+
|
|
83
|
+
- All test files go under `testcase/` directory in the host project root
|
|
84
|
+
- Group test files by MODULE segment: `BE-ORDER-*` → `testcase/test_order.py`, `BE-USER-*` → `testcase/test_user.py`
|
|
85
|
+
- Follow existing project conventions for import style, fixture scope
|
|
86
|
+
|
|
87
|
+
#### Fixture Strategy
|
|
88
|
+
|
|
89
|
+
- Reuse existing project fixtures from `conftest.py` when available
|
|
90
|
+
- Do not create or modify fixture/configuration files in this node
|
|
91
|
+
- Prefer `@pytest.fixture(scope="function")` for test isolation
|
|
92
|
+
- Use `@pytest.mark.parametrize` for boundary condition cases with multiple inputs
|
|
93
|
+
|
|
94
|
+
#### Test Integrity
|
|
95
|
+
|
|
96
|
+
- Tests verify implementation correctness — if a test fails, the implementation likely has a bug, not the test
|
|
97
|
+
- Do NOT weaken assertions, remove test cases, or modify test logic to make tests pass
|
|
98
|
+
- Do NOT add workarounds, skips, or try/except blocks to hide failures without explicit justification
|
|
99
|
+
- Report all failures honestly in the output; the downstream `execute-backend-pytest-shell` node captures exit codes and stdout/stderr as-is
|
|
100
|
+
|
|
101
|
+
#### Assertions
|
|
102
|
+
|
|
103
|
+
- Use `assert` statements, not `unittest` assertions
|
|
104
|
+
- Assert specific values, not just "no exception"
|
|
105
|
+
- For API tests: assert status code, response body keys, and specific field values
|
|
106
|
+
- For database tests: assert record state after operation
|
|
107
|
+
|
|
108
|
+
#### Conditional Test Implementation (include ONLY if test cases exist)
|
|
109
|
+
|
|
110
|
+
- **Authentication tests**: implement ONLY if `testcase/md/` contains auth-related cases
|
|
111
|
+
- Use `@pytest.mark.auth` marker
|
|
112
|
+
- Test no token, expired token, invalid token, insufficient permissions, cross-user access
|
|
113
|
+
- **Timeout tests**: implement ONLY if `testcase/md/` contains timeout-related cases
|
|
114
|
+
- Use `@pytest.mark.timeout` marker
|
|
115
|
+
- Use `unittest.mock.patch` or `pytest-mock` to simulate slow responses
|
|
116
|
+
- If no such cases exist in the reviewed test cases, do NOT add these tests
|
|
117
|
+
|
|
118
|
+
#### Markers
|
|
119
|
+
|
|
120
|
+
- `@pytest.mark.positive` — happy path cases
|
|
121
|
+
- `@pytest.mark.negative` — error/exception cases
|
|
122
|
+
- `@pytest.mark.boundary` — edge cases
|
|
123
|
+
- `@pytest.mark.<MODULE>` — module-specific marker (e.g. `@pytest.mark.order`)
|
|
124
|
+
|
|
125
|
+
#### Skip Policy
|
|
126
|
+
|
|
127
|
+
If a test case cannot be automated (requires external service not mockable, requires manual verification), add it with `@pytest.mark.skip(reason="...")` and document the reason. Do not omit the function — traceability requires it exists.
|
|
128
|
+
|
|
129
|
+
### Output Shape (after summary line)
|
|
130
|
+
|
|
131
|
+
After the mandatory summary line, provide:
|
|
132
|
+
|
|
133
|
+
1. **Generated Files** — list of files written under `tests/backend/`.
|
|
134
|
+
2. **Function Mapping Table** — `| Test Case ID | Pytest Function | File | Marker |`.
|
|
135
|
+
3. **Skipped Cases** — if any, list with reason.
|
|
136
|
+
4. **Conventions Observed** — note project fixtures/config discovered and followed.
|
|
137
|
+
5. **Residual Risks** — cases that may need manual verification or environment setup.
|
|
138
|
+
|
|
139
|
+
Do not include chain-of-thought. Do not write root `artifacts/**`.
|