agentic-orchestrator 0.1.4 → 0.1.6
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/.claude/settings.local.json +6 -1
- package/README.md +81 -54
- package/agentic/orchestrator/defaults/policy.defaults.yaml +212 -0
- package/agentic/orchestrator/schemas/adapters.schema.json +17 -4
- package/agentic/orchestrator/schemas/agents.schema.json +58 -13
- package/agentic/orchestrator/schemas/gates.schema.json +88 -17
- package/agentic/orchestrator/schemas/index.schema.json +172 -37
- package/agentic/orchestrator/schemas/multi-project.schema.json +85 -17
- package/agentic/orchestrator/schemas/plan.schema.json +135 -30
- package/agentic/orchestrator/schemas/policy.schema.json +198 -69
- package/agentic/orchestrator/schemas/policy.user.schema.json +165 -0
- package/agentic/orchestrator/schemas/qa_test_index.schema.json +71 -14
- package/agentic/orchestrator/schemas/state.schema.json +196 -39
- package/apps/control-plane/scripts/validate-architecture-rules.mjs +5 -3
- package/apps/control-plane/scripts/validate-docker-mcp-contract.mjs +0 -3
- package/apps/control-plane/scripts/validate-mcp-contracts.ts +2 -6
- package/apps/control-plane/src/application/services/policy-loader-service.ts +115 -0
- package/apps/control-plane/src/cli/aop.ts +35 -1
- package/apps/control-plane/src/cli/cli-argument-parser.ts +4 -0
- package/apps/control-plane/src/cli/help-command-handler.ts +2 -1
- package/apps/control-plane/src/cli/init-command-handler.ts +136 -27
- package/apps/control-plane/src/cli/retry-command-handler.ts +3 -6
- package/apps/control-plane/src/cli/types.ts +1 -0
- package/apps/control-plane/src/core/git.ts +1 -3
- package/apps/control-plane/src/core/kernel.ts +3 -6
- package/apps/control-plane/src/core/schemas.ts +36 -1
- package/apps/control-plane/src/interfaces/cli/bootstrap.ts +1 -1
- package/apps/control-plane/src/mcp/tool-registry-loader.ts +37 -1
- package/apps/control-plane/src/supervisor/qa-wave-executor.ts +1 -1
- package/apps/control-plane/test/aop.spec.ts +37 -0
- package/apps/control-plane/test/batch-operations.spec.ts +5 -3
- package/apps/control-plane/test/bootstrap-attach.spec.ts +28 -18
- package/apps/control-plane/test/bootstrap-edge-cases.spec.ts +25 -15
- package/apps/control-plane/test/bootstrap.spec.ts +30 -22
- package/apps/control-plane/test/cli.unit.spec.ts +55 -10
- package/apps/control-plane/test/core-utils.spec.ts +12 -3
- package/apps/control-plane/test/feature-deletion-service.spec.ts +2 -1
- package/apps/control-plane/test/feature-lifecycle.spec.ts +1 -1
- package/apps/control-plane/test/helpers.ts +22 -2
- package/apps/control-plane/test/init-wizard.spec.ts +160 -7
- package/apps/control-plane/test/issue-tracker.spec.ts +3 -3
- package/apps/control-plane/test/kernel.spec.ts +62 -0
- package/apps/control-plane/test/lock-service.spec.ts +4 -4
- package/apps/control-plane/test/policy-loader-service.spec.ts +346 -0
- package/apps/control-plane/test/reactions.spec.ts +8 -6
- package/apps/control-plane/test/resume-command.spec.ts +31 -15
- package/apps/control-plane/test/supervisor.unit.spec.ts +2 -2
- package/apps/control-plane/test/tool-registry-loader.spec.ts +12 -0
- package/apps/control-plane/vitest.config.ts +1 -1
- package/dist/apps/control-plane/application/services/policy-loader-service.d.ts +24 -0
- package/dist/apps/control-plane/application/services/policy-loader-service.js +90 -0
- package/dist/apps/control-plane/application/services/policy-loader-service.js.map +1 -0
- package/dist/apps/control-plane/application/tools/tool-metadata.js +1 -0
- package/dist/apps/control-plane/application/tools/tool-metadata.js.map +1 -1
- package/dist/apps/control-plane/cli/aop.js +33 -1
- package/dist/apps/control-plane/cli/aop.js.map +1 -1
- package/dist/apps/control-plane/cli/cli-argument-parser.js +4 -0
- package/dist/apps/control-plane/cli/cli-argument-parser.js.map +1 -1
- package/dist/apps/control-plane/cli/dashboard-command-handler.js +11 -5
- package/dist/apps/control-plane/cli/dashboard-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/help-command-handler.js +5 -4
- package/dist/apps/control-plane/cli/help-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/init-command-handler.d.ts +1 -0
- package/dist/apps/control-plane/cli/init-command-handler.js +110 -26
- package/dist/apps/control-plane/cli/init-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/retry-command-handler.js +3 -6
- package/dist/apps/control-plane/cli/retry-command-handler.js.map +1 -1
- package/dist/apps/control-plane/cli/types.d.ts +1 -0
- package/dist/apps/control-plane/core/git.js +1 -3
- package/dist/apps/control-plane/core/git.js.map +1 -1
- package/dist/apps/control-plane/core/kernel.js +3 -5
- package/dist/apps/control-plane/core/kernel.js.map +1 -1
- package/dist/apps/control-plane/core/schemas.d.ts +2 -0
- package/dist/apps/control-plane/core/schemas.js +31 -1
- package/dist/apps/control-plane/core/schemas.js.map +1 -1
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js +1 -1
- package/dist/apps/control-plane/interfaces/cli/bootstrap.js.map +1 -1
- package/dist/apps/control-plane/mcp/tool-registry-loader.d.ts +2 -0
- package/dist/apps/control-plane/mcp/tool-registry-loader.js +31 -1
- package/dist/apps/control-plane/mcp/tool-registry-loader.js.map +1 -1
- package/dist/apps/control-plane/supervisor/build-wave-executor.js +1 -1
- package/dist/apps/control-plane/supervisor/build-wave-executor.js.map +1 -1
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js +1 -1
- package/dist/apps/control-plane/supervisor/qa-wave-executor.js.map +1 -1
- package/package.json +18 -17
- package/packages/web-dashboard/package.json +1 -1
- package/packages/web-dashboard/src/app/api/actions/route.ts +2 -2
- package/packages/web-dashboard/src/app/api/events/route.ts +1 -1
- package/packages/web-dashboard/src/app/api/features/[id]/checkout/route.ts +1 -1
- package/packages/web-dashboard/src/app/api/features/[id]/diff/route.ts +1 -1
- package/packages/web-dashboard/src/app/api/features/[id]/evidence/[artifact]/route.ts +1 -1
- package/packages/web-dashboard/src/app/api/features/[id]/review/route.ts +2 -2
- package/packages/web-dashboard/src/app/api/features/[id]/route.ts +1 -1
- package/packages/web-dashboard/src/app/api/projects/route.ts +2 -2
- package/packages/web-dashboard/src/app/api/status/route.ts +1 -1
- package/packages/web-dashboard/src/app/page.tsx +1 -1
- package/packages/web-dashboard/src/lib/aop-client.ts +1 -1
- package/packages/web-dashboard/src/lib/orchestrator-tools.ts +1 -1
- package/packages/web-dashboard/tsconfig.json +1 -0
- package/spec-files/completed/agentic_orchestrator_init_policy_ux_simplification_spec.md +481 -0
- package/spec-files/outstanding/agentic_orchestrator_artifact_database_publishing_spec.md +500 -0
- package/spec-files/outstanding/agentic_orchestrator_observability_integrity_diagnostics_spec.md +500 -195
- package/spec-files/outstanding/agentic_orchestrator_performance_improvements_spec.md +471 -162
- package/spec-files/outstanding/agentic_orchestrator_planning_review_quality_spec.md +532 -268
- package/spec-files/outstanding/agentic_orchestrator_productization_commercial_spec.md +645 -0
- package/spec-files/progress.md +99 -2
- package/tsconfig.base.json +4 -0
- /package/spec-files/{outstanding → completed}/agentic_orchestrator_validator_hardening_spec.md +0 -0
|
@@ -1,25 +1,50 @@
|
|
|
1
1
|
# Feature Spec: Planning and Review Quality Hardening (AOP)
|
|
2
2
|
|
|
3
|
-
> **Purpose of this document**:
|
|
3
|
+
> **Purpose of this document**: Provide implementation-ready delivery for Q1, Q2, Q7, Q8, and Q9 with an explicit architectural critique of the prior draft and a corrected execution plan aligned to the current control-plane architecture.
|
|
4
4
|
|
|
5
|
-
**Version:**
|
|
6
|
-
**Date:** 2026-03-
|
|
7
|
-
**Status:** Draft
|
|
5
|
+
**Version:** 2.0
|
|
6
|
+
**Date:** 2026-03-04
|
|
7
|
+
**Status:** Draft (Architecture-Corrected)
|
|
8
8
|
**Roadmap Mapping:** M34-M36
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
## 0. Standards and
|
|
12
|
+
## 0. Standards and Dependencies
|
|
13
13
|
|
|
14
|
-
### 0.1 Standards
|
|
14
|
+
### 0.1 Required Standards
|
|
15
15
|
|
|
16
16
|
All implementation MUST preserve:
|
|
17
|
-
- deterministic
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- existing collision
|
|
17
|
+
- deterministic tool behavior and normalized error envelopes
|
|
18
|
+
- MCP/in-process transport parity for all new tools
|
|
19
|
+
- policy/schema-governed behavior changes (no hidden defaults)
|
|
20
|
+
- existing lock/collision safety guarantees
|
|
21
|
+
- architecture boundary validation (`validate:architecture`)
|
|
21
22
|
|
|
22
|
-
### 0.2
|
|
23
|
+
### 0.2 Required Upstream Inputs
|
|
24
|
+
|
|
25
|
+
Implementing agents MUST read:
|
|
26
|
+
- `spec-files/outstanding/agentic_orchestrator_quality_adoption_execution_spec.md`
|
|
27
|
+
- `apps/control-plane/src/application/services/plan-service.ts`
|
|
28
|
+
- `apps/control-plane/src/core/collisions.ts`
|
|
29
|
+
- `apps/control-plane/src/application/services/gate-service.ts`
|
|
30
|
+
- `apps/control-plane/src/core/gates.ts`
|
|
31
|
+
- `apps/control-plane/src/application/services/reporting-service.ts`
|
|
32
|
+
- `apps/control-plane/src/supervisor/planning-wave-executor.ts`
|
|
33
|
+
- `apps/control-plane/src/supervisor/build-wave-executor.ts`
|
|
34
|
+
- `apps/control-plane/src/supervisor/qa-wave-executor.ts`
|
|
35
|
+
- `apps/control-plane/src/core/constants.ts`
|
|
36
|
+
- `apps/control-plane/src/core/error-codes.ts`
|
|
37
|
+
- `agentic/orchestrator/defaults/policy.defaults.yaml`
|
|
38
|
+
- `agentic/orchestrator/schemas/policy.schema.json`
|
|
39
|
+
- `agentic/orchestrator/schemas/plan.schema.json`
|
|
40
|
+
- `agentic/orchestrator/schemas/state.schema.json`
|
|
41
|
+
- `agentic/orchestrator/schemas/gates.schema.json`
|
|
42
|
+
- `agentic/orchestrator/tools/catalog.json`
|
|
43
|
+
- `packages/web-dashboard/src/lib/aop-client.ts`
|
|
44
|
+
- `packages/web-dashboard/src/lib/types.ts`
|
|
45
|
+
- `packages/web-dashboard/src/app/page.tsx`
|
|
46
|
+
|
|
47
|
+
### 0.3 Feature Scope
|
|
23
48
|
|
|
24
49
|
This spec implements:
|
|
25
50
|
- **Q1** Semantic Collision Engine
|
|
@@ -28,60 +53,84 @@ This spec implements:
|
|
|
28
53
|
- **Q8** Flaky Gate Intelligence + Quarantine Workflow
|
|
29
54
|
- **Q9** Auto-Generated Review Briefs
|
|
30
55
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- ML-based probabilistic planning heuristics
|
|
56
|
+
Out of scope:
|
|
57
|
+
- ML-based probabilistic heuristics
|
|
34
58
|
- autonomous prompt rewriting
|
|
35
|
-
-
|
|
59
|
+
- silent gate bypasses without policy and audit metadata
|
|
36
60
|
|
|
37
61
|
---
|
|
38
62
|
|
|
39
|
-
## 1.
|
|
63
|
+
## 1. Architectural Critique of Prior Draft (v1.0)
|
|
40
64
|
|
|
41
|
-
|
|
65
|
+
The prior draft was directionally useful, but not implementation-safe against the current architecture. Key issues:
|
|
42
66
|
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
- provide deterministic, high-signal review briefs for human approval
|
|
67
|
+
1. **Semantic collision data model was underspecified**
|
|
68
|
+
- Problem: Q1 demanded semantic conflicts (OpenAPI/event/db intent) but provided no canonical plan-level fields to compare deterministically.
|
|
69
|
+
- Impact: impossible to implement reliably in `plan.submit` without brittle repo parsing or heuristic guessing.
|
|
70
|
+
- Correction: add explicit `plan.semantic_intent` contract to `plan.schema.json`.
|
|
48
71
|
|
|
49
|
-
|
|
72
|
+
2. **Policy changes were not wired to current schema constraints**
|
|
73
|
+
- Problem: root `policy.schema.json` is strict (`additionalProperties: false`). New sections cannot be added by policy text alone.
|
|
74
|
+
- Impact: runtime load fails if sections are added without schema/default updates.
|
|
75
|
+
- Correction: update defaults + full policy schema + init-policy generation paths.
|
|
50
76
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
77
|
+
3. **Tool-surface proposal was incomplete**
|
|
78
|
+
- Problem: adding tools without corresponding updates to constants, kernel handler registration, catalog, RBAC, and behavior metadata causes contract/runtime drift.
|
|
79
|
+
- Impact: `validate:mcp-contracts` and runtime authorization failures.
|
|
80
|
+
- Correction: include full tool lifecycle wiring as normative work.
|
|
54
81
|
|
|
55
|
-
|
|
82
|
+
4. **Flaky workflow lacked a mutating governance path**
|
|
83
|
+
- Problem: draft provided read-only flake report but no deterministic mutation interface for quarantine owner/reason/expiry.
|
|
84
|
+
- Impact: “workflow” cannot be executed via orchestrator contracts.
|
|
85
|
+
- Correction: add explicit quarantine upsert/clear contracts and audit metadata.
|
|
56
86
|
|
|
57
|
-
|
|
87
|
+
5. **Flaky model lacked deterministic test-level input source**
|
|
88
|
+
- Problem: current gate evidence includes step-level execution, not standardized per-test outcomes.
|
|
89
|
+
- Impact: per-test flaky scoring cannot be computed reliably.
|
|
90
|
+
- Correction: extend gate parser model to optionally ingest structured test results (e.g., junit_xml / vitest_json).
|
|
58
91
|
|
|
59
|
-
|
|
92
|
+
6. **Review brief integration path mismatched actual dashboard architecture**
|
|
93
|
+
- Problem: draft targeted non-existent `packages/web-dashboard/src/components/ReviewPanel.tsx`.
|
|
94
|
+
- Impact: implementation ambiguity and likely dead-end edits.
|
|
95
|
+
- Correction: wire through existing `aop-client.ts`, `types.ts`, and `app/page.tsx`.
|
|
60
96
|
|
|
61
|
-
Plan
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
4. **semantic collision checks (new)**
|
|
66
|
-
5. feasibility scoring threshold check (optional)
|
|
97
|
+
7. **Plan feasibility scoring lacked deterministic formula contract**
|
|
98
|
+
- Problem: scoring factors were named but not formally defined.
|
|
99
|
+
- Impact: non-repeatable behavior and test fragility.
|
|
100
|
+
- Correction: define exact component formulas and rounding rules.
|
|
67
101
|
|
|
68
|
-
|
|
102
|
+
8. **No rollout/failure-mode safety for quality gates**
|
|
103
|
+
- Problem: missing `report_only` vs `enforce` semantics for early rollout.
|
|
104
|
+
- Impact: high risk of accidental throughput regression.
|
|
105
|
+
- Correction: add explicit enforcement modes with default `report_only`.
|
|
69
106
|
|
|
70
|
-
|
|
107
|
+
---
|
|
71
108
|
|
|
72
|
-
|
|
109
|
+
## 2. Revised Architecture Fit
|
|
73
110
|
|
|
74
|
-
|
|
111
|
+
### 2.1 Existing Runtime Touchpoints
|
|
75
112
|
|
|
76
|
-
|
|
113
|
+
- **Plan admission path**: `PlanService.planSubmit()` is the authoritative hook for Q1/Q2 enforcement.
|
|
114
|
+
- **Collision reporting path**: `ReportingService.collisionsScan()` is the authoritative hook for scan output parity.
|
|
115
|
+
- **Gate execution path**: `GateService.gatesRun()` + `core/gates.ts` is the authoritative hook for flaky intelligence ingestion.
|
|
116
|
+
- **Supervisor quality loop**: planning/build/qa executors remain orchestrators, not policy evaluators.
|
|
117
|
+
- **Review/report path**: `ReportingService` is the authoritative place for review brief APIs.
|
|
118
|
+
- **Dashboard rendering path**: `aop-client.ts` + `page.tsx` is the current UI integration seam.
|
|
77
119
|
|
|
78
|
-
|
|
120
|
+
### 2.2 Boundary Rules (Normative)
|
|
121
|
+
|
|
122
|
+
- `core/*` MUST remain framework-agnostic pure logic where practical (no service imports).
|
|
123
|
+
- orchestration/policy decisions belong in `application/services/*`.
|
|
124
|
+
- new MCP tools MUST be implemented via kernel handler registration and catalog/schema integration.
|
|
125
|
+
- no feature may bypass policy schema validation.
|
|
79
126
|
|
|
80
127
|
---
|
|
81
128
|
|
|
82
129
|
## 3. Contracts and Schema Deltas
|
|
83
130
|
|
|
84
|
-
|
|
131
|
+
## 3.1 Policy Extensions
|
|
132
|
+
|
|
133
|
+
Add to defaults + schema:
|
|
85
134
|
|
|
86
135
|
```yaml
|
|
87
136
|
innovation:
|
|
@@ -94,373 +143,588 @@ innovation:
|
|
|
94
143
|
planning:
|
|
95
144
|
feasibility:
|
|
96
145
|
enabled: false
|
|
146
|
+
enforcement_mode: report_only # report_only | enforce
|
|
97
147
|
minimum_score: 70
|
|
148
|
+
minimum_component_score: 0.45
|
|
98
149
|
weights:
|
|
99
150
|
scope_realism: 0.25
|
|
100
151
|
test_sufficiency: 0.25
|
|
101
|
-
dependency_completeness: 0.
|
|
152
|
+
dependency_completeness: 0.20
|
|
102
153
|
contract_risk: 0.15
|
|
103
154
|
lock_contention_risk: 0.15
|
|
104
155
|
|
|
105
156
|
testing:
|
|
106
157
|
flaky:
|
|
107
158
|
enabled: false
|
|
159
|
+
window_size: 20
|
|
160
|
+
min_observations: 6
|
|
161
|
+
suspect_threshold: 0.45
|
|
162
|
+
alternation_weight: 0.40
|
|
163
|
+
failure_rate_weight: 0.60
|
|
164
|
+
allow_quarantine_for_required_modes: false
|
|
108
165
|
quarantine:
|
|
109
166
|
max_days: 14
|
|
110
167
|
require_owner: true
|
|
111
168
|
require_reason: true
|
|
169
|
+
|
|
170
|
+
reporting:
|
|
171
|
+
review_brief:
|
|
172
|
+
enabled: false
|
|
173
|
+
generate_on_ready_to_merge: true
|
|
174
|
+
include_diff_stat: true
|
|
175
|
+
include_flaky_summary: true
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Normative behavior:
|
|
179
|
+
- all flags default `false` (opt-in rollout)
|
|
180
|
+
- `weights` MUST sum to 1.0 exactly after normalization (schema + runtime validation)
|
|
181
|
+
- `enforcement_mode=report_only` logs score metadata but never blocks plan acceptance
|
|
182
|
+
|
|
183
|
+
## 3.2 Plan Schema Extension (`plan.schema.json`)
|
|
184
|
+
|
|
185
|
+
Add optional deterministic semantic declarations:
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"semantic_intent": {
|
|
190
|
+
"openapi_operations": [
|
|
191
|
+
{
|
|
192
|
+
"operation_id": "users_update",
|
|
193
|
+
"path": "/users/{id}",
|
|
194
|
+
"method": "PATCH",
|
|
195
|
+
"change": "modify_response"
|
|
196
|
+
}
|
|
197
|
+
],
|
|
198
|
+
"event_changes": [
|
|
199
|
+
{
|
|
200
|
+
"event_name": "user.updated",
|
|
201
|
+
"version": "v2",
|
|
202
|
+
"change": "schema_breaking"
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"db_intents": [
|
|
206
|
+
{
|
|
207
|
+
"entity": "users",
|
|
208
|
+
"change": "drop_column",
|
|
209
|
+
"field": "legacy_status"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
112
214
|
```
|
|
113
215
|
|
|
114
|
-
|
|
216
|
+
Rules:
|
|
217
|
+
- absence of `semantic_intent` is valid; engine treats as empty intent set
|
|
218
|
+
- deterministic compare uses normalized lowercase for `method` and stable key ordering
|
|
219
|
+
|
|
220
|
+
## 3.3 State and Artifact Deltas
|
|
221
|
+
|
|
222
|
+
Add/extend runtime artifacts:
|
|
115
223
|
|
|
116
224
|
```text
|
|
117
225
|
.aop/
|
|
118
226
|
analytics/flaky-tests.json
|
|
227
|
+
runtime/prompt-contract/latest.json
|
|
119
228
|
features/<feature_id>/review_brief.json
|
|
120
|
-
|
|
121
|
-
agentic/orchestrator/
|
|
122
|
-
prompt-contract/
|
|
123
|
-
fixtures/
|
|
124
|
-
invariants/
|
|
125
|
-
schemas/review_brief.schema.json
|
|
126
229
|
```
|
|
127
230
|
|
|
128
|
-
|
|
231
|
+
State frontmatter extension (`state.schema.json`):
|
|
232
|
+
- `collisions.semantic` array
|
|
233
|
+
- `planning_quality.feasibility_score` number (0-100)
|
|
234
|
+
- `planning_quality.feasibility_breakdown` object
|
|
235
|
+
- `reporting.review_brief_path` string
|
|
129
236
|
|
|
130
|
-
|
|
131
|
-
- `gate.flaky_report_get` (read-only)
|
|
132
|
-
- `report.feature_review_brief` (read-only)
|
|
237
|
+
## 3.4 Tool Surface Changes
|
|
133
238
|
|
|
134
|
-
|
|
239
|
+
### New Tools
|
|
240
|
+
|
|
241
|
+
1. `plan.score` (read-only)
|
|
242
|
+
- returns feasibility score + deterministic breakdown + reasons
|
|
243
|
+
|
|
244
|
+
2. `gate.flaky_report_get` (read-only)
|
|
245
|
+
- returns flaky suspects, quarantine entries, expiry warnings
|
|
246
|
+
|
|
247
|
+
3. `gate.flaky_quarantine_upsert` (mutating)
|
|
248
|
+
- upsert quarantine entry (`test_key`, `owner`, `reason`, `expires_at`)
|
|
249
|
+
|
|
250
|
+
4. `gate.flaky_quarantine_clear` (mutating)
|
|
251
|
+
- clear quarantine entry by `test_key`
|
|
252
|
+
|
|
253
|
+
5. `report.feature_review_brief` (read-only)
|
|
254
|
+
- returns parsed review brief for feature
|
|
255
|
+
|
|
256
|
+
### Extended Existing Tool Contracts
|
|
257
|
+
|
|
258
|
+
- `collisions.scan` output adds `semantic_conflicts[]`
|
|
259
|
+
- `report.feature_summary` adds optional `review_brief` and `feasibility`
|
|
260
|
+
|
|
261
|
+
### Required Wiring for Every New Tool
|
|
262
|
+
|
|
263
|
+
- `apps/control-plane/src/core/constants.ts` (`TOOLS` constants)
|
|
264
|
+
- `apps/control-plane/src/core/kernel.ts` (handler registration + method wrappers)
|
|
265
|
+
- `apps/control-plane/src/application/tools/tool-metadata.ts` (mutating metadata)
|
|
266
|
+
- `agentic/orchestrator/tools/catalog.json`
|
|
267
|
+
- `agentic/orchestrator/tools/schemas/input/*.json`
|
|
268
|
+
- `agentic/orchestrator/tools/schemas/output/*.json`
|
|
269
|
+
- `agentic/orchestrator/defaults/policy.defaults.yaml` RBAC lists
|
|
270
|
+
- generated `agentic/orchestrator/tools.md`
|
|
271
|
+
|
|
272
|
+
## 3.5 Error Code Additions
|
|
273
|
+
|
|
274
|
+
Add to `apps/control-plane/src/core/error-codes.ts`:
|
|
275
|
+
- `semantic_collision_detected`
|
|
276
|
+
- `plan_feasibility_below_threshold`
|
|
277
|
+
- `plan_feasibility_config_invalid`
|
|
278
|
+
- `prompt_contract_invariant_failed`
|
|
279
|
+
- `flaky_quarantine_policy_violation`
|
|
280
|
+
- `flaky_test_result_parse_failed`
|
|
281
|
+
- `review_brief_not_found`
|
|
135
282
|
|
|
136
283
|
---
|
|
137
284
|
|
|
138
|
-
## 4. Detailed
|
|
285
|
+
## 4. Detailed Implementation Plan (Normative)
|
|
139
286
|
|
|
140
|
-
##
|
|
287
|
+
## PRQ0: Contract Scaffolding and Policy Wiring
|
|
141
288
|
|
|
142
|
-
###
|
|
143
|
-
|
|
289
|
+
### Goals
|
|
290
|
+
- land all schema/default/tool scaffolding first to avoid mid-phase drift
|
|
144
291
|
|
|
145
|
-
###
|
|
146
|
-
|
|
292
|
+
### File Targets
|
|
293
|
+
- `agentic/orchestrator/defaults/policy.defaults.yaml`
|
|
294
|
+
- `agentic/orchestrator/schemas/policy.schema.json`
|
|
295
|
+
- `agentic/orchestrator/schemas/plan.schema.json`
|
|
296
|
+
- `agentic/orchestrator/schemas/state.schema.json`
|
|
297
|
+
- `agentic/orchestrator/schemas/gates.schema.json`
|
|
298
|
+
- `apps/control-plane/src/core/constants.ts`
|
|
299
|
+
- `apps/control-plane/src/core/error-codes.ts`
|
|
300
|
+
- `agentic/orchestrator/tools/catalog.json`
|
|
301
|
+
- `agentic/orchestrator/tools/schemas/input/*` (new tool schemas)
|
|
302
|
+
- `agentic/orchestrator/tools/schemas/output/*` (new tool schemas)
|
|
303
|
+
- `agentic/orchestrator/tools.md`
|
|
304
|
+
- `apps/control-plane/src/cli/init-command-handler.ts` (full policy template alignment)
|
|
147
305
|
|
|
148
|
-
###
|
|
306
|
+
### Mandatory Checks
|
|
307
|
+
- `npm run validate:mcp-contracts`
|
|
308
|
+
- `npm run validate:architecture`
|
|
149
309
|
|
|
150
|
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
310
|
+
Exit criteria:
|
|
311
|
+
- kernel loads composed policy with new fields
|
|
312
|
+
- no contract-validator drift
|
|
153
313
|
|
|
154
|
-
|
|
314
|
+
---
|
|
155
315
|
|
|
156
|
-
|
|
157
|
-
{
|
|
158
|
-
"semantic_conflicts": [
|
|
159
|
-
{
|
|
160
|
-
"type": "openapi_operation_conflict",
|
|
161
|
-
"feature_a": "feature_1",
|
|
162
|
-
"feature_b": "feature_2",
|
|
163
|
-
"fingerprint": "sha256:...",
|
|
164
|
-
"severity": "high",
|
|
165
|
-
"details": {
|
|
166
|
-
"path": "/users/{id}",
|
|
167
|
-
"method": "PATCH"
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
```
|
|
316
|
+
## PRQ1: Q1 Semantic Collision Engine
|
|
173
317
|
|
|
174
|
-
###
|
|
318
|
+
### Design
|
|
175
319
|
|
|
176
|
-
|
|
320
|
+
Implement semantic comparisons as an additive layer over existing syntactic collisions.
|
|
321
|
+
|
|
322
|
+
### Core algorithm
|
|
323
|
+
|
|
324
|
+
1. Normalize candidate + accepted plan semantic intents.
|
|
325
|
+
2. Compare candidate against each accepted plan:
|
|
326
|
+
- OpenAPI conflict if same `operation_id` OR same `path+method` and incompatible `change` class.
|
|
327
|
+
- Event conflict if same `event_name` and incompatible `version/change` pair.
|
|
328
|
+
- DB intent conflict if same `entity` and conflicting operations (`drop_column` vs `rename_column`, etc.).
|
|
329
|
+
3. Emit stable sorted conflicts and deterministic fingerprint.
|
|
330
|
+
4. Merge with existing `files/areas/contracts` collision result.
|
|
331
|
+
|
|
332
|
+
### Implementation Targets
|
|
333
|
+
|
|
334
|
+
- `apps/control-plane/src/core/semantic-collisions.ts` (new, pure)
|
|
177
335
|
- `apps/control-plane/src/application/services/plan-service.ts`
|
|
178
336
|
- `apps/control-plane/src/application/services/reporting-service.ts`
|
|
179
337
|
- `agentic/orchestrator/tools/schemas/output/collisions.scan.output.schema.json`
|
|
338
|
+
- `apps/control-plane/src/core/kernel.ts` (if helper wrapper needed)
|
|
339
|
+
|
|
340
|
+
### Behavioral Rules
|
|
341
|
+
|
|
342
|
+
- semantic collision enforcement follows existing `collision_policy` (`reject`/`block`)
|
|
343
|
+
- blocked queue entry MUST store both syntactic + semantic fingerprints
|
|
344
|
+
- `state.collisions.semantic` MUST be populated on block/reject responses
|
|
180
345
|
|
|
181
|
-
###
|
|
346
|
+
### Test Plan
|
|
182
347
|
|
|
183
|
-
- semantic
|
|
184
|
-
-
|
|
348
|
+
- `apps/control-plane/test/semantic-collisions.spec.ts` (new)
|
|
349
|
+
- extend `apps/control-plane/test/plan-service.spec.ts`
|
|
350
|
+
- extend `apps/control-plane/test/collisions.spec.ts`
|
|
351
|
+
- extend transport parity assertions in `apps/control-plane/test/mcp.spec.ts`
|
|
352
|
+
|
|
353
|
+
Exit criteria:
|
|
354
|
+
- same inputs produce byte-identical `semantic_conflicts` ordering
|
|
355
|
+
- plan blocking/rejection behavior unchanged except added semantic details
|
|
185
356
|
|
|
186
357
|
---
|
|
187
358
|
|
|
188
|
-
##
|
|
359
|
+
## PRQ2: Q2 Plan Feasibility Scoring
|
|
189
360
|
|
|
190
|
-
###
|
|
191
|
-
Schema-valid plans can still be operationally poor and drive retries.
|
|
361
|
+
### Design
|
|
192
362
|
|
|
193
|
-
|
|
194
|
-
Add deterministic scoring service and optional threshold gate in plan admission.
|
|
363
|
+
Add deterministic score computation service and optional admission enforcement.
|
|
195
364
|
|
|
196
|
-
###
|
|
365
|
+
### Deterministic formula contract
|
|
197
366
|
|
|
198
|
-
|
|
199
|
-
- test sufficiency: acceptance criteria mapped to gate/test obligations
|
|
200
|
-
- dependency completeness: missing/unsatisfied dependencies
|
|
201
|
-
- contract risk: openapi/events/db impact complexity
|
|
202
|
-
- lock contention risk: likelihood of blocking based on held/pending locks
|
|
367
|
+
`score = round(100 * sum(weight_i * component_i))`
|
|
203
368
|
|
|
204
|
-
|
|
369
|
+
Components (0.0-1.0):
|
|
370
|
+
- `scope_realism`: bounded function of planned file count, allowed-area breadth, and summary specificity.
|
|
371
|
+
- `test_sufficiency`: acceptance criteria count and presence of verification mapping (`gate_profile`, `gate_targets`, `verification_overrides`).
|
|
372
|
+
- `dependency_completeness`: dependency declarations resolvable from index state.
|
|
373
|
+
- `contract_risk`: penalty for high-risk contract surface changes with no matching acceptance criteria/risk notes.
|
|
374
|
+
- `lock_contention_risk`: penalty when required lock resources are currently held and blocked queue depth is high.
|
|
205
375
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
},
|
|
217
|
-
"reasons": [
|
|
218
|
-
"Acceptance criteria #3 has no mapped verification target"
|
|
219
|
-
]
|
|
220
|
-
}
|
|
221
|
-
```
|
|
376
|
+
Normalization rules:
|
|
377
|
+
- all component values clamp to `[0,1]`
|
|
378
|
+
- weights normalize to sum 1.0 at runtime
|
|
379
|
+
- reasons array order is lexical and deterministic
|
|
380
|
+
|
|
381
|
+
### Enforcement behavior
|
|
382
|
+
|
|
383
|
+
- if `enabled=false`: no score evaluation in plan admission path
|
|
384
|
+
- if `enabled=true && enforcement_mode=report_only`: score computed and stored, never blocks
|
|
385
|
+
- if `enabled=true && enforcement_mode=enforce`: block when `score < minimum_score` OR any component `< minimum_component_score`
|
|
222
386
|
|
|
223
|
-
###
|
|
387
|
+
### Implementation Targets
|
|
224
388
|
|
|
225
389
|
- `apps/control-plane/src/application/services/plan-feasibility-service.ts` (new)
|
|
226
390
|
- `apps/control-plane/src/application/services/plan-service.ts`
|
|
391
|
+
- `apps/control-plane/src/application/services/reporting-service.ts`
|
|
392
|
+
- `apps/control-plane/src/core/kernel.ts`
|
|
393
|
+
- `agentic/orchestrator/tools/schemas/input/plan.score.input.schema.json` (new)
|
|
227
394
|
- `agentic/orchestrator/tools/schemas/output/plan.score.output.schema.json` (new)
|
|
395
|
+
- `agentic/orchestrator/tools/schemas/output/plan.submit.output.schema.json` (optional metadata extension)
|
|
396
|
+
|
|
397
|
+
### Test Plan
|
|
228
398
|
|
|
229
|
-
|
|
399
|
+
- `apps/control-plane/test/plan-feasibility-service.spec.ts` (new)
|
|
400
|
+
- extend `apps/control-plane/test/plan-service.spec.ts`
|
|
401
|
+
- extend `apps/control-plane/test/mcp.spec.ts` for `plan.score`
|
|
230
402
|
|
|
231
|
-
|
|
232
|
-
-
|
|
403
|
+
Exit criteria:
|
|
404
|
+
- repeated scoring over identical inputs yields identical score and reasons
|
|
405
|
+
- enforcement only active when explicitly configured
|
|
233
406
|
|
|
234
407
|
---
|
|
235
408
|
|
|
236
|
-
##
|
|
409
|
+
## PRQ3: Q7 Prompt Contract Test Harness
|
|
410
|
+
|
|
411
|
+
### Design
|
|
412
|
+
|
|
413
|
+
Treat prompt behavior as deterministic source contract tests in CI.
|
|
414
|
+
|
|
415
|
+
### Contract model
|
|
416
|
+
|
|
417
|
+
Fixture set:
|
|
418
|
+
- `agentic/orchestrator/prompt-contract/fixtures/*.json`
|
|
237
419
|
|
|
238
|
-
|
|
239
|
-
|
|
420
|
+
Invariant set:
|
|
421
|
+
- `agentic/orchestrator/prompt-contract/invariants/*.json`
|
|
240
422
|
|
|
241
|
-
|
|
242
|
-
|
|
423
|
+
Harness:
|
|
424
|
+
- `apps/control-plane/scripts/test-prompt-contracts.mjs`
|
|
243
425
|
|
|
244
|
-
|
|
426
|
+
Output artifact:
|
|
427
|
+
- `.aop/runtime/prompt-contract/latest.json`
|
|
245
428
|
|
|
246
|
-
|
|
247
|
-
- builder output must not propose forbidden tool usage
|
|
248
|
-
- QA output must contain explicit evidence/test update intent
|
|
429
|
+
### Invariants (minimum)
|
|
249
430
|
|
|
250
|
-
|
|
431
|
+
- Planner fixture outputs include either `PLAN_SUBMISSION` or deterministic `REQUEST` rationale.
|
|
432
|
+
- Builder fixture outputs never request forbidden tools.
|
|
433
|
+
- QA fixture outputs include explicit verification/remediation intent.
|
|
434
|
+
- Output objects must satisfy role-specific schema fragments.
|
|
251
435
|
|
|
252
|
-
|
|
253
|
-
- repo assets:
|
|
254
|
-
- `agentic/orchestrator/prompt-contract/fixtures/*`
|
|
255
|
-
- `agentic/orchestrator/prompt-contract/invariants/*`
|
|
256
|
-
- package script:
|
|
257
|
-
- `npm run test:prompt-contracts`
|
|
436
|
+
### CI integration
|
|
258
437
|
|
|
259
|
-
|
|
438
|
+
- add script: `test:prompt-contracts`
|
|
439
|
+
- add optional validator wrapper: `validate:prompt-contracts`
|
|
440
|
+
- enforce execution whenever files under:
|
|
441
|
+
- `agentic/orchestrator/prompts/`
|
|
442
|
+
- `agentic/orchestrator/prompt-contract/`
|
|
443
|
+
- `apps/control-plane/src/supervisor/worker-decision-loop.ts`
|
|
444
|
+
change.
|
|
260
445
|
|
|
261
|
-
|
|
446
|
+
### Implementation Targets
|
|
262
447
|
|
|
263
|
-
|
|
448
|
+
- `apps/control-plane/scripts/test-prompt-contracts.mjs` (new)
|
|
449
|
+
- `agentic/orchestrator/prompt-contract/fixtures/*` (new)
|
|
450
|
+
- `agentic/orchestrator/prompt-contract/invariants/*` (new)
|
|
451
|
+
- `package.json` scripts
|
|
452
|
+
- CI workflow file(s) to wire execution
|
|
264
453
|
|
|
265
|
-
|
|
266
|
-
|
|
454
|
+
### Test Plan
|
|
455
|
+
|
|
456
|
+
- `apps/control-plane/test/prompt-contract-harness.spec.ts` (new)
|
|
457
|
+
- failure snapshot tests for invariant diagnostics
|
|
458
|
+
|
|
459
|
+
Exit criteria:
|
|
460
|
+
- invariant failures provide actionable role + fixture + invariant id diagnostics
|
|
461
|
+
- harness runtime is deterministic and independent of live provider calls
|
|
267
462
|
|
|
268
463
|
---
|
|
269
464
|
|
|
270
|
-
##
|
|
465
|
+
## PRQ4: Q8 Flaky Gate Intelligence + Quarantine Workflow
|
|
466
|
+
|
|
467
|
+
### Design
|
|
271
468
|
|
|
272
|
-
|
|
273
|
-
Flaky failures create noisy retries and reduce confidence in gate results.
|
|
469
|
+
Introduce deterministic flaky scoring over historical test outcomes and governed quarantine controls.
|
|
274
470
|
|
|
275
|
-
###
|
|
276
|
-
Track per-test stability history and expose deterministic suspect scoring and quarantine governance.
|
|
471
|
+
### Data pipeline
|
|
277
472
|
|
|
278
|
-
|
|
473
|
+
1. Gate execution emits structured test results (optional parser path):
|
|
474
|
+
- extend `gates.yaml` parser config with `parsers.tests`
|
|
475
|
+
- supported initial parsers: `none`, `junit_xml`, `vitest_json`
|
|
476
|
+
2. `GateService` ingests latest run outcomes after each gate run.
|
|
477
|
+
3. `FlakyGateService` updates `.aop/analytics/flaky-tests.json` with rolling window stats.
|
|
478
|
+
4. Suspect score computed deterministically:
|
|
479
|
+
- `suspect_score = failure_rate_weight * failure_rate + alternation_weight * alternation_rate`
|
|
480
|
+
5. Quarantine controls applied only with explicit metadata and expiry.
|
|
279
481
|
|
|
280
|
-
|
|
281
|
-
- rolling window results
|
|
282
|
-
- failure-rate and alternation index
|
|
283
|
-
- quarantine metadata (`owner`, `reason`, `expires_at`)
|
|
482
|
+
### Quarantine rules
|
|
284
483
|
|
|
285
|
-
|
|
484
|
+
- upsert requires owner/reason/expiry when required by policy
|
|
485
|
+
- expiry > now and <= `max_days`
|
|
486
|
+
- expired entries move to `expired_quarantines[]` and are treated as non-quarantined
|
|
487
|
+
- required gate modes remain blocking unless `allow_quarantine_for_required_modes=true`
|
|
286
488
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
-
|
|
290
|
-
|
|
489
|
+
### Runtime artifact contract
|
|
490
|
+
|
|
491
|
+
`.aop/analytics/flaky-tests.json`:
|
|
492
|
+
|
|
493
|
+
```json
|
|
494
|
+
{
|
|
495
|
+
"version": 1,
|
|
496
|
+
"updated_at": "2026-03-04T00:00:00Z",
|
|
497
|
+
"tests": {
|
|
498
|
+
"vitest:auth.spec.ts:refresh token retries": {
|
|
499
|
+
"history": ["pass", "fail", "pass", "fail"],
|
|
500
|
+
"failure_rate": 0.5,
|
|
501
|
+
"alternation_rate": 1.0,
|
|
502
|
+
"suspect_score": 0.7,
|
|
503
|
+
"status": "suspect",
|
|
504
|
+
"quarantine": {
|
|
505
|
+
"owner": "alice",
|
|
506
|
+
"reason": "upstream nondeterministic timeout",
|
|
507
|
+
"expires_at": "2026-03-10T00:00:00Z"
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
```
|
|
291
513
|
|
|
292
|
-
###
|
|
514
|
+
### Implementation Targets
|
|
293
515
|
|
|
294
516
|
- `apps/control-plane/src/application/services/flaky-gate-service.ts` (new)
|
|
295
517
|
- `apps/control-plane/src/application/services/gate-service.ts`
|
|
518
|
+
- `apps/control-plane/src/core/gates.ts` (test parser extraction)
|
|
519
|
+
- `agentic/orchestrator/schemas/gates.schema.json`
|
|
520
|
+
- `agentic/orchestrator/tools/schemas/input/gate.flaky_report_get.input.schema.json` (new)
|
|
296
521
|
- `agentic/orchestrator/tools/schemas/output/gate.flaky_report_get.output.schema.json` (new)
|
|
522
|
+
- `agentic/orchestrator/tools/schemas/input/gate.flaky_quarantine_upsert.input.schema.json` (new)
|
|
523
|
+
- `agentic/orchestrator/tools/schemas/output/gate.flaky_quarantine_upsert.output.schema.json` (new)
|
|
524
|
+
- `agentic/orchestrator/tools/schemas/input/gate.flaky_quarantine_clear.input.schema.json` (new)
|
|
525
|
+
- `agentic/orchestrator/tools/schemas/output/gate.flaky_quarantine_clear.output.schema.json` (new)
|
|
526
|
+
|
|
527
|
+
### Test Plan
|
|
297
528
|
|
|
298
|
-
|
|
529
|
+
- `apps/control-plane/test/flaky-gate-service.spec.ts` (new)
|
|
530
|
+
- extend `apps/control-plane/test/gates.spec.ts` for test parser extraction
|
|
531
|
+
- extend `apps/control-plane/test/supervisor.spec.ts` for retry/quarantine interactions
|
|
532
|
+
- extend `apps/control-plane/test/mcp.spec.ts` for new tools and parity
|
|
299
533
|
|
|
300
|
-
|
|
301
|
-
-
|
|
534
|
+
Exit criteria:
|
|
535
|
+
- suspect list deterministic for identical history
|
|
536
|
+
- quarantine lifecycle enforced with owner/reason/expiry constraints
|
|
537
|
+
- required-gate integrity preserved by default
|
|
302
538
|
|
|
303
539
|
---
|
|
304
540
|
|
|
305
|
-
##
|
|
541
|
+
## PRQ5: Q9 Auto-Generated Review Briefs
|
|
306
542
|
|
|
307
|
-
###
|
|
308
|
-
Human reviewers must manually synthesize plan/diff/evidence context.
|
|
543
|
+
### Design
|
|
309
544
|
|
|
310
|
-
|
|
311
|
-
Generate concise structured review brief artifacts for each reviewable feature.
|
|
545
|
+
Generate deterministic review briefs from canonical runtime artifacts; no free-form model synthesis.
|
|
312
546
|
|
|
313
|
-
###
|
|
547
|
+
### Trigger points
|
|
314
548
|
|
|
315
|
-
-
|
|
316
|
-
-
|
|
317
|
-
- gate outcome matrix
|
|
318
|
-
- unresolved risks/questions
|
|
319
|
-
- evidence references
|
|
549
|
+
- automatic generation when feature transitions to `ready_to_merge` after successful `full` gate
|
|
550
|
+
- on-demand regeneration via `report.feature_review_brief` if file missing/stale
|
|
320
551
|
|
|
321
|
-
###
|
|
552
|
+
### Brief sections (fixed order)
|
|
322
553
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
"events": true,
|
|
331
|
-
"db": false
|
|
332
|
-
},
|
|
333
|
-
"gate_summary": {
|
|
334
|
-
"fast": "pass",
|
|
335
|
-
"full": "pass",
|
|
336
|
-
"merge": "na"
|
|
337
|
-
},
|
|
338
|
-
"open_questions": [
|
|
339
|
-
"Should retry cap be environment-specific?"
|
|
340
|
-
],
|
|
341
|
-
"evidence_refs": [
|
|
342
|
-
".aop/features/my_feature/evidence/gates/full-2026-03-03.json"
|
|
343
|
-
]
|
|
344
|
-
}
|
|
345
|
-
```
|
|
554
|
+
1. intent summary
|
|
555
|
+
2. scope and touched files
|
|
556
|
+
3. contract and semantic risk summary
|
|
557
|
+
4. feasibility score and rationale
|
|
558
|
+
5. gate matrix + flaky summary
|
|
559
|
+
6. unresolved questions / review prompts
|
|
560
|
+
7. evidence references
|
|
346
561
|
|
|
347
|
-
###
|
|
562
|
+
### Artifact path
|
|
563
|
+
|
|
564
|
+
- `.aop/features/<feature_id>/review_brief.json`
|
|
565
|
+
|
|
566
|
+
### Implementation Targets
|
|
348
567
|
|
|
349
568
|
- `apps/control-plane/src/application/services/review-brief-service.ts` (new)
|
|
350
569
|
- `apps/control-plane/src/application/services/reporting-service.ts`
|
|
351
|
-
- `
|
|
570
|
+
- `apps/control-plane/src/application/services/gate-service.ts` (trigger hook)
|
|
571
|
+
- `apps/control-plane/src/core/path-layout.ts` (optional helper: `reviewBriefPath(featureId)`)
|
|
352
572
|
- `agentic/orchestrator/schemas/review_brief.schema.json` (new)
|
|
573
|
+
- `agentic/orchestrator/tools/schemas/input/report.feature_review_brief.input.schema.json` (new)
|
|
574
|
+
- `agentic/orchestrator/tools/schemas/output/report.feature_review_brief.output.schema.json` (new)
|
|
575
|
+
- `packages/web-dashboard/src/lib/types.ts`
|
|
576
|
+
- `packages/web-dashboard/src/lib/aop-client.ts`
|
|
577
|
+
- `packages/web-dashboard/src/app/page.tsx`
|
|
578
|
+
|
|
579
|
+
### Dashboard integration contract
|
|
353
580
|
|
|
354
|
-
|
|
581
|
+
- `FeatureDetail` adds optional `review_brief`
|
|
582
|
+
- details pane renders structured brief sections when present
|
|
583
|
+
- fallback message when brief unavailable
|
|
355
584
|
|
|
356
|
-
|
|
357
|
-
|
|
585
|
+
### Test Plan
|
|
586
|
+
|
|
587
|
+
- `apps/control-plane/test/review-brief-service.spec.ts` (new)
|
|
588
|
+
- extend `apps/control-plane/test/services.spec.ts` / `kernel.spec.ts` for trigger behavior
|
|
589
|
+
- extend `apps/control-plane/test/dashboard-api.integration.spec.ts`
|
|
590
|
+
- add UI rendering test under web-dashboard workspace for brief display
|
|
591
|
+
|
|
592
|
+
Exit criteria:
|
|
593
|
+
- brief generation is deterministic and schema-valid
|
|
594
|
+
- dashboard shows brief without regressions to existing detail panel behavior
|
|
358
595
|
|
|
359
596
|
---
|
|
360
597
|
|
|
361
|
-
##
|
|
598
|
+
## PRQ6: Hardening, Rollout, and Migration
|
|
599
|
+
|
|
600
|
+
### Rollout order
|
|
362
601
|
|
|
363
|
-
|
|
602
|
+
1. Ship PRQ0 contracts and flags off by default.
|
|
603
|
+
2. Enable Q1+Q2 in `report_only` mode in internal environments.
|
|
604
|
+
3. Enable Q7 CI harness as warning for one sprint, then enforce.
|
|
605
|
+
4. Enable Q8 flaky intelligence with quarantine enforcement still strict.
|
|
606
|
+
5. Enable Q9 brief generation and dashboard rendering.
|
|
607
|
+
6. Flip enforcement toggles selectively per repo.
|
|
364
608
|
|
|
365
|
-
|
|
366
|
-
1. Implement semantic analyzers + schema updates.
|
|
367
|
-
2. Implement feasibility scoring + threshold enforcement.
|
|
609
|
+
### Backfill guidance
|
|
368
610
|
|
|
369
|
-
|
|
370
|
-
-
|
|
611
|
+
- optional one-time job can ingest recent gate evidence files into `flaky-tests.json` history.
|
|
612
|
+
- missing historical test-level data is acceptable; model starts with forward-only data.
|
|
371
613
|
|
|
372
|
-
###
|
|
614
|
+
### Observability requirements
|
|
373
615
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
616
|
+
- emit structured log events for:
|
|
617
|
+
- feasibility score evaluation
|
|
618
|
+
- semantic collision detection
|
|
619
|
+
- flaky suspect/quarantine transitions
|
|
620
|
+
- review brief generation success/failure
|
|
377
621
|
|
|
378
|
-
|
|
379
|
-
|
|
622
|
+
---
|
|
623
|
+
|
|
624
|
+
## 5. Core Tradeoffs
|
|
380
625
|
|
|
381
|
-
|
|
626
|
+
1. **Semantic precision vs planner burden**
|
|
627
|
+
- richer `semantic_intent` improves detection but increases plan authoring complexity.
|
|
382
628
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
2. Add quarantine governance and expiry checks.
|
|
629
|
+
2. **Early plan quality gates vs throughput**
|
|
630
|
+
- enforcing feasibility reduces churn but can block progress if thresholds are too strict.
|
|
386
631
|
|
|
387
|
-
|
|
388
|
-
-
|
|
632
|
+
3. **Flaky noise reduction vs masking regressions**
|
|
633
|
+
- quarantine reduces false alarms but can hide real defects if governance is weak.
|
|
389
634
|
|
|
390
|
-
|
|
635
|
+
4. **Strict prompt contracts vs iteration speed**
|
|
636
|
+
- strong invariants prevent regressions but add maintenance overhead when role behavior evolves.
|
|
391
637
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
2. Add MCP report tool and dashboard integration.
|
|
638
|
+
5. **Comprehensive review briefs vs generation cost**
|
|
639
|
+
- richer summaries help reviewers but add I/O/compute per `ready_to_merge` transition.
|
|
395
640
|
|
|
396
|
-
|
|
397
|
-
-
|
|
641
|
+
6. **New tool count vs API surface simplicity**
|
|
642
|
+
- dedicated tools improve explicitness and RBAC isolation but increase contract maintenance load.
|
|
398
643
|
|
|
399
644
|
---
|
|
400
645
|
|
|
401
|
-
## 6.
|
|
646
|
+
## 6. Milestones and Implementation Sequence
|
|
402
647
|
|
|
403
|
-
###
|
|
648
|
+
### Milestone A (Week 1)
|
|
649
|
+
- PRQ0 scaffolding complete
|
|
650
|
+
- contract validators green
|
|
404
651
|
|
|
405
|
-
|
|
406
|
-
-
|
|
407
|
-
-
|
|
408
|
-
- flaky score and quarantine expiry logic
|
|
409
|
-
- brief assembly ordering and content extraction
|
|
652
|
+
### Milestone B (Week 2)
|
|
653
|
+
- Q1 semantic collisions + tests complete
|
|
654
|
+
- Q2 feasibility scoring in `report_only`
|
|
410
655
|
|
|
411
|
-
###
|
|
656
|
+
### Milestone C (Week 3)
|
|
657
|
+
- Q7 prompt contract harness enforced in CI
|
|
658
|
+
- Q8 flaky ingestion and reporting complete
|
|
412
659
|
|
|
413
|
-
|
|
414
|
-
-
|
|
415
|
-
-
|
|
416
|
-
- flaky report generation from realistic gate histories
|
|
417
|
-
- review brief generation from live feature artifacts
|
|
660
|
+
### Milestone D (Week 4)
|
|
661
|
+
- Q8 quarantine workflow complete
|
|
662
|
+
- Q9 review brief generation + dashboard integration complete
|
|
418
663
|
|
|
419
|
-
###
|
|
664
|
+
### Milestone E (Week 5)
|
|
665
|
+
- full stabilization, parity tests, docs, and rollout playbook
|
|
420
666
|
|
|
421
|
-
|
|
422
|
-
- `gate.flaky_report_get`
|
|
423
|
-
- `report.feature_review_brief`
|
|
667
|
+
---
|
|
424
668
|
|
|
425
|
-
|
|
669
|
+
## 7. Test Strategy (Normative)
|
|
426
670
|
|
|
427
|
-
|
|
428
|
-
- no brief available state handled clearly
|
|
671
|
+
### 7.1 Unit
|
|
429
672
|
|
|
430
|
-
|
|
673
|
+
- semantic comparator edge cases and fingerprint determinism
|
|
674
|
+
- feasibility component formulas and normalization
|
|
675
|
+
- prompt invariant evaluator diagnostics
|
|
676
|
+
- flaky suspect score and quarantine expiry behavior
|
|
677
|
+
- review brief assembly sorting and field completeness
|
|
431
678
|
|
|
432
|
-
|
|
679
|
+
### 7.2 Integration
|
|
433
680
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
681
|
+
- `plan.submit` rejection/block behavior for semantic collisions
|
|
682
|
+
- feasibility enforcement/report-only mode behavior
|
|
683
|
+
- gate-run ingestion of parsed test outcomes
|
|
684
|
+
- quarantine update/clear flow through MCP tools
|
|
685
|
+
- ready-to-merge trigger writes `review_brief.json`
|
|
439
686
|
|
|
440
|
-
|
|
687
|
+
### 7.3 Transport Parity
|
|
688
|
+
|
|
689
|
+
- `plan.score`
|
|
690
|
+
- `gate.flaky_report_get`
|
|
691
|
+
- `gate.flaky_quarantine_upsert`
|
|
692
|
+
- `gate.flaky_quarantine_clear`
|
|
693
|
+
- `report.feature_review_brief`
|
|
441
694
|
|
|
442
|
-
|
|
695
|
+
### 7.4 UI and API
|
|
443
696
|
|
|
444
|
-
-
|
|
445
|
-
|
|
697
|
+
- dashboard detail endpoint includes review brief when present
|
|
698
|
+
- dashboard page renders review brief sections deterministically
|
|
699
|
+
- missing brief state handled gracefully
|
|
446
700
|
|
|
447
|
-
|
|
448
|
-
|
|
701
|
+
### 7.5 Validation Gates
|
|
702
|
+
|
|
703
|
+
- `npm run lint`
|
|
704
|
+
- `npm run typecheck`
|
|
705
|
+
- `npm test`
|
|
706
|
+
- `npm run validate:mcp-contracts`
|
|
707
|
+
- `npm run validate:architecture`
|
|
708
|
+
|
|
709
|
+
---
|
|
449
710
|
|
|
450
|
-
|
|
451
|
-
- Mitigation: fixture versioning and required update notes on role contract changes.
|
|
711
|
+
## 8. Acceptance Criteria
|
|
452
712
|
|
|
453
|
-
|
|
454
|
-
|
|
713
|
+
1. Q1/Q2 admission controls are deterministic, policy-controlled, and rollout-safe (`report_only` supported).
|
|
714
|
+
2. Q7 prompt contract harness blocks prompt regressions with actionable diagnostics.
|
|
715
|
+
3. Q8 flaky intelligence produces deterministic suspect scoring and governed quarantine workflows.
|
|
716
|
+
4. Q9 review briefs are generated from canonical artifacts and consumable via MCP + dashboard.
|
|
717
|
+
5. New tool contracts pass schema validation, RBAC checks, and MCP/in-process parity tests.
|
|
718
|
+
6. No regressions in existing lock, collision, and merge safety behavior.
|
|
455
719
|
|
|
456
720
|
---
|
|
457
721
|
|
|
458
722
|
## 9. Definition of Done
|
|
459
723
|
|
|
460
|
-
A completed
|
|
461
|
-
-
|
|
462
|
-
- schema/catalog updates
|
|
463
|
-
-
|
|
464
|
-
-
|
|
465
|
-
- `spec-files/progress.md`
|
|
724
|
+
A completed milestone MUST include:
|
|
725
|
+
- implemented file inventory mapped to the phase above
|
|
726
|
+
- schema/catalog/RBAC/tool-doc updates
|
|
727
|
+
- unit + integration + parity tests
|
|
728
|
+
- validator and test command summaries
|
|
729
|
+
- `spec-files/progress.md` update with completed tasks, residual tasks, and risks
|
|
466
730
|
|