@exaudeus/workrail 3.9.2 → 3.11.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/dist/application/services/validation-engine.js +134 -0
- package/dist/application/services/workflow-compiler.js +54 -0
- package/dist/manifest.json +150 -78
- package/dist/mcp/handlers/v2-advance-core/assessment-consequences.d.ts +14 -0
- package/dist/mcp/handlers/v2-advance-core/assessment-consequences.js +27 -0
- package/dist/mcp/handlers/v2-advance-core/assessment-validation.d.ts +16 -0
- package/dist/mcp/handlers/v2-advance-core/assessment-validation.js +213 -0
- package/dist/mcp/handlers/v2-advance-core/event-builders.d.ts +1 -0
- package/dist/mcp/handlers/v2-advance-core/event-builders.js +3 -2
- package/dist/mcp/handlers/v2-advance-core/index.js +23 -8
- package/dist/mcp/handlers/v2-advance-core/input-validation.d.ts +9 -1
- package/dist/mcp/handlers/v2-advance-core/input-validation.js +22 -2
- package/dist/mcp/handlers/v2-advance-core/outcome-blocked.d.ts +2 -0
- package/dist/mcp/handlers/v2-advance-core/outcome-blocked.js +69 -19
- package/dist/mcp/handlers/v2-advance-core/outcome-success.js +22 -0
- package/dist/mcp/handlers/v2-execution/replay.js +7 -0
- package/dist/mcp/output-schemas.d.ts +156 -42
- package/dist/mcp/output-schemas.js +17 -1
- package/dist/mcp/v2-response-formatter.js +7 -1
- package/dist/types/workflow-definition.d.ts +26 -0
- package/dist/types/workflow-definition.js +16 -1
- package/dist/v2/durable-core/constants.d.ts +4 -1
- package/dist/v2/durable-core/constants.js +5 -2
- package/dist/v2/durable-core/domain/assessment-consequence-event-builder.d.ts +23 -0
- package/dist/v2/durable-core/domain/assessment-consequence-event-builder.js +36 -0
- package/dist/v2/durable-core/domain/assessment-record.d.ts +12 -0
- package/dist/v2/durable-core/domain/assessment-record.js +2 -0
- package/dist/v2/durable-core/domain/assessment-recorded-event-builder.d.ts +22 -0
- package/dist/v2/durable-core/domain/assessment-recorded-event-builder.js +38 -0
- package/dist/v2/durable-core/domain/blocked-node-builder.d.ts +1 -1
- package/dist/v2/durable-core/domain/blocked-node-builder.js +8 -0
- package/dist/v2/durable-core/domain/blocking-decision.d.ts +6 -0
- package/dist/v2/durable-core/domain/blocking-decision.js +15 -0
- package/dist/v2/durable-core/domain/prompt-renderer.js +53 -67
- package/dist/v2/durable-core/domain/reason-model.d.ts +12 -2
- package/dist/v2/durable-core/domain/reason-model.js +27 -2
- package/dist/v2/durable-core/domain/retrieval-contract.d.ts +105 -0
- package/dist/v2/durable-core/domain/retrieval-contract.js +310 -0
- package/dist/v2/durable-core/domain/risk-policy-guardrails.js +1 -0
- package/dist/v2/durable-core/domain/validation-criteria-validator.d.ts +1 -0
- package/dist/v2/durable-core/domain/validation-criteria-validator.js +11 -0
- package/dist/v2/durable-core/schemas/artifacts/assessment.d.ts +55 -0
- package/dist/v2/durable-core/schemas/artifacts/assessment.js +29 -0
- package/dist/v2/durable-core/schemas/artifacts/index.d.ts +2 -1
- package/dist/v2/durable-core/schemas/artifacts/index.js +8 -1
- package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +24 -24
- package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +141 -21
- package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.js +10 -1
- package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +729 -171
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +1442 -202
- package/dist/v2/durable-core/schemas/session/events.d.ts +231 -8
- package/dist/v2/durable-core/schemas/session/events.js +36 -0
- package/dist/v2/durable-core/schemas/session/gaps.d.ts +2 -2
- package/dist/v2/projections/assessment-consequences.d.ts +19 -0
- package/dist/v2/projections/assessment-consequences.js +33 -0
- package/dist/v2/projections/assessments.d.ts +21 -0
- package/dist/v2/projections/assessments.js +35 -0
- package/dist/v2/projections/resume-ranking.d.ts +1 -0
- package/dist/v2/projections/resume-ranking.js +12 -24
- package/package.json +1 -1
- package/spec/workflow.schema.json +110 -0
- package/workflows/bug-investigation.agentic.v2.json +28 -2
- package/workflows/mr-review-workflow.agentic.v2.json +10 -5
- package/workflows/test-artifact-loop-control.json +28 -2
|
@@ -135,6 +135,14 @@
|
|
|
135
135
|
},
|
|
136
136
|
"uniqueItems": true
|
|
137
137
|
},
|
|
138
|
+
"assessments": {
|
|
139
|
+
"type": "array",
|
|
140
|
+
"description": "Workflow-declared assessment definitions. Steps reference these by ID via assessmentRefs instead of embedding assessment structure inline repeatedly.",
|
|
141
|
+
"items": {
|
|
142
|
+
"$ref": "#/$defs/assessmentDefinition"
|
|
143
|
+
},
|
|
144
|
+
"uniqueItems": true
|
|
145
|
+
},
|
|
138
146
|
"extensionPoints": {
|
|
139
147
|
"type": "array",
|
|
140
148
|
"description": "Bounded cognitive slots that users can customize via .workrail/bindings.json. Each slot is referenced in step prompts via {{wr.bindings.slotId}} and resolved at compile time. Use extension points for bounded cognitive units, not for core orchestration or final synthesis ownership.",
|
|
@@ -293,6 +301,21 @@
|
|
|
293
301
|
"runCondition": { "$ref": "#/$defs/condition" },
|
|
294
302
|
"validationCriteria": { "oneOf": [ { "type": "array", "items": { "$ref": "#/$defs/validationRule" } }, { "$ref": "#/$defs/validationComposition" } ] },
|
|
295
303
|
"outputContract": { "$ref": "#/$defs/outputContract" },
|
|
304
|
+
"assessmentRefs": {
|
|
305
|
+
"type": "array",
|
|
306
|
+
"description": "References to workflow-level assessment definitions expected for this step. V1 supports exactly one assessmentRef per step.",
|
|
307
|
+
"items": { "type": "string", "minLength": 1, "maxLength": 64 },
|
|
308
|
+
"minItems": 1,
|
|
309
|
+
"maxItems": 1,
|
|
310
|
+
"uniqueItems": true
|
|
311
|
+
},
|
|
312
|
+
"assessmentConsequences": {
|
|
313
|
+
"type": "array",
|
|
314
|
+
"description": "Step-local assessment consequence declarations. V1 supports at most one exact-match follow-up consequence.",
|
|
315
|
+
"items": { "$ref": "#/$defs/assessmentConsequence" },
|
|
316
|
+
"minItems": 1,
|
|
317
|
+
"maxItems": 1
|
|
318
|
+
},
|
|
296
319
|
"notesOptional": { "type": "boolean", "description": "When true, output.notesMarkdown is not required for this step. Steps with outputContract are automatically exempt. Use sparingly for mechanical steps with no substantive work to document." },
|
|
297
320
|
"functionDefinitions": { "type": "array", "items": { "$ref": "#/$defs/functionDefinition" } },
|
|
298
321
|
"functionCalls": { "type": "array", "items": { "$ref": "#/$defs/functionCall" } },
|
|
@@ -727,6 +750,93 @@
|
|
|
727
750
|
"required": ["contractRef"],
|
|
728
751
|
"additionalProperties": false
|
|
729
752
|
},
|
|
753
|
+
"assessmentDimension": {
|
|
754
|
+
"type": "object",
|
|
755
|
+
"description": "A bounded dimension within a workflow-declared assessment definition.",
|
|
756
|
+
"properties": {
|
|
757
|
+
"id": {
|
|
758
|
+
"type": "string",
|
|
759
|
+
"minLength": 1,
|
|
760
|
+
"maxLength": 64
|
|
761
|
+
},
|
|
762
|
+
"purpose": {
|
|
763
|
+
"type": "string",
|
|
764
|
+
"minLength": 1,
|
|
765
|
+
"maxLength": 256
|
|
766
|
+
},
|
|
767
|
+
"levels": {
|
|
768
|
+
"type": "array",
|
|
769
|
+
"items": {
|
|
770
|
+
"type": "string",
|
|
771
|
+
"minLength": 1,
|
|
772
|
+
"maxLength": 64
|
|
773
|
+
},
|
|
774
|
+
"minItems": 2,
|
|
775
|
+
"uniqueItems": true
|
|
776
|
+
},
|
|
777
|
+
"required": {
|
|
778
|
+
"type": "boolean",
|
|
779
|
+
"default": true
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
"required": ["id", "purpose", "levels"],
|
|
783
|
+
"additionalProperties": false
|
|
784
|
+
},
|
|
785
|
+
"assessmentDefinition": {
|
|
786
|
+
"type": "object",
|
|
787
|
+
"description": "Workflow-declared assessment definition referenced by steps.",
|
|
788
|
+
"properties": {
|
|
789
|
+
"id": {
|
|
790
|
+
"type": "string",
|
|
791
|
+
"minLength": 1,
|
|
792
|
+
"maxLength": 64
|
|
793
|
+
},
|
|
794
|
+
"purpose": {
|
|
795
|
+
"type": "string",
|
|
796
|
+
"minLength": 1,
|
|
797
|
+
"maxLength": 256
|
|
798
|
+
},
|
|
799
|
+
"dimensions": {
|
|
800
|
+
"type": "array",
|
|
801
|
+
"items": {
|
|
802
|
+
"$ref": "#/$defs/assessmentDimension"
|
|
803
|
+
},
|
|
804
|
+
"minItems": 1
|
|
805
|
+
}
|
|
806
|
+
},
|
|
807
|
+
"required": ["id", "purpose", "dimensions"],
|
|
808
|
+
"additionalProperties": false
|
|
809
|
+
},
|
|
810
|
+
"assessmentConsequenceTrigger": {
|
|
811
|
+
"type": "object",
|
|
812
|
+
"description": "Exact-match trigger on one declared assessment dimension and one declared canonical level.",
|
|
813
|
+
"properties": {
|
|
814
|
+
"dimensionId": { "type": "string", "minLength": 1, "maxLength": 64 },
|
|
815
|
+
"equalsLevel": { "type": "string", "minLength": 1, "maxLength": 64 }
|
|
816
|
+
},
|
|
817
|
+
"required": ["dimensionId", "equalsLevel"],
|
|
818
|
+
"additionalProperties": false
|
|
819
|
+
},
|
|
820
|
+
"assessmentConsequenceEffect": {
|
|
821
|
+
"type": "object",
|
|
822
|
+
"description": "V1 assessment consequence effect. Keeps the same step pending and requires follow-up before retry.",
|
|
823
|
+
"properties": {
|
|
824
|
+
"kind": { "const": "require_followup" },
|
|
825
|
+
"guidance": { "type": "string", "minLength": 1, "maxLength": 512 }
|
|
826
|
+
},
|
|
827
|
+
"required": ["kind", "guidance"],
|
|
828
|
+
"additionalProperties": false
|
|
829
|
+
},
|
|
830
|
+
"assessmentConsequence": {
|
|
831
|
+
"type": "object",
|
|
832
|
+
"description": "Step-local assessment consequence declaration. V1 supports one exact-match follow-up consequence only.",
|
|
833
|
+
"properties": {
|
|
834
|
+
"when": { "$ref": "#/$defs/assessmentConsequenceTrigger" },
|
|
835
|
+
"effect": { "$ref": "#/$defs/assessmentConsequenceEffect" }
|
|
836
|
+
},
|
|
837
|
+
"required": ["when", "effect"],
|
|
838
|
+
"additionalProperties": false
|
|
839
|
+
},
|
|
730
840
|
"functionCall": {
|
|
731
841
|
"type": "object",
|
|
732
842
|
"properties": {
|
|
@@ -31,6 +31,19 @@
|
|
|
31
31
|
"TRIGGERS: WorkRail can only react to explicit outputs. Use structural fields like `contextUnknownCount`, `hypothesesConsideredCount`, `hasStrongAlternative`, `contradictionCount`, `unresolvedEvidenceGapCount`, and `diagnosisConfidenceBand`.",
|
|
32
32
|
"BOUNDARY: this workflow investigates and proves root cause. It may describe high-level fix direction and likely files, but must not create implementation plans, patch sequencing, PR plans, or code-writing momentum."
|
|
33
33
|
],
|
|
34
|
+
"assessments": [
|
|
35
|
+
{
|
|
36
|
+
"id": "diagnosis_readiness_gate",
|
|
37
|
+
"purpose": "Assess whether the diagnosis is ready to hand off after validation.",
|
|
38
|
+
"dimensions": [
|
|
39
|
+
{
|
|
40
|
+
"id": "confidence",
|
|
41
|
+
"purpose": "How confident the agent is that the diagnosis is ready for final handoff.",
|
|
42
|
+
"levels": ["low", "high"]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
34
47
|
"steps": [
|
|
35
48
|
{
|
|
36
49
|
"id": "phase-0-triage-and-intake",
|
|
@@ -116,7 +129,20 @@
|
|
|
116
129
|
{
|
|
117
130
|
"id": "phase-5-diagnosis-validation",
|
|
118
131
|
"title": "Phase 5: Diagnosis Validation Bundle",
|
|
119
|
-
"prompt": "Stress-test the current diagnosis before handoff.\n\nSet `diagnosisConfidenceBand` using these rules:\n- High = all symptoms explained, no material contradictions, no unresolved evidence gaps\n- Medium = likely diagnosis, but one bounded uncertainty remains\n- Low = multiple viable explanations remain or contradictions are unresolved\n\nMode-adaptive validation:\n- QUICK: self-challenge; if `diagnosisConfidenceBand != High` or contradictions remain, optionally spawn ONE WorkRail Executor running `routine-hypothesis-challenge`\n- STANDARD: if delegation is available, spawn TWO WorkRail Executors SIMULTANEOUSLY running `routine-hypothesis-challenge` and `routine-execution-simulation`\n- THOROUGH: if delegation is available, spawn THREE WorkRail Executors SIMULTANEOUSLY running `routine-hypothesis-challenge`, `routine-execution-simulation`, and an additional `routine-hypothesis-challenge` pass focused on breaking the current diagnosis from a different angle\n\nParallel-output synthesis rules:\n- if 2+ validators raise serious concerns, reopen evidence or shortlist work\n- if exactly one validator raises a concern, investigate it before escalating\n- if no validator can materially break the diagnosis and `contradictionCount = 0`, proceed to handoff\n\nSet context variables:\n- `diagnosisConfidenceBand`\n- `validationFindingsCountBySeverity`\n- `validationSummary`\n\nBoundary rule:\n- allowed: high-level fix direction, likely files involved, verification recommendations\n- not allowed: implementation plan, patch sequencing, PR plan, or code-writing momentum",
|
|
132
|
+
"prompt": "Stress-test the current diagnosis before handoff.\n\nSet `diagnosisConfidenceBand` using these rules:\n- High = all symptoms explained, no material contradictions, no unresolved evidence gaps\n- Medium = likely diagnosis, but one bounded uncertainty remains\n- Low = multiple viable explanations remain or contradictions are unresolved\n\nMode-adaptive validation:\n- QUICK: self-challenge; if `diagnosisConfidenceBand != High` or contradictions remain, optionally spawn ONE WorkRail Executor running `routine-hypothesis-challenge`\n- STANDARD: if delegation is available, spawn TWO WorkRail Executors SIMULTANEOUSLY running `routine-hypothesis-challenge` and `routine-execution-simulation`\n- THOROUGH: if delegation is available, spawn THREE WorkRail Executors SIMULTANEOUSLY running `routine-hypothesis-challenge`, `routine-execution-simulation`, and an additional `routine-hypothesis-challenge` pass focused on breaking the current diagnosis from a different angle\n\nParallel-output synthesis rules:\n- if 2+ validators raise serious concerns, reopen evidence or shortlist work\n- if exactly one validator raises a concern, investigate it before escalating\n- if no validator can materially break the diagnosis and `contradictionCount = 0`, proceed to handoff\n\nAfter synthesizing the validation result, assess whether the diagnosis is ready for final handoff.\n\nSet context variables:\n- `diagnosisConfidenceBand`\n- `validationFindingsCountBySeverity`\n- `validationSummary`\n\nBoundary rule:\n- allowed: high-level fix direction, likely files involved, verification recommendations\n- not allowed: implementation plan, patch sequencing, PR plan, or code-writing momentum",
|
|
133
|
+
"assessmentRefs": ["diagnosis_readiness_gate"],
|
|
134
|
+
"assessmentConsequences": [
|
|
135
|
+
{
|
|
136
|
+
"when": {
|
|
137
|
+
"dimensionId": "confidence",
|
|
138
|
+
"equalsLevel": "low"
|
|
139
|
+
},
|
|
140
|
+
"effect": {
|
|
141
|
+
"kind": "require_followup",
|
|
142
|
+
"guidance": "Resolve the remaining diagnosis uncertainty, tighten the evidence summary, and retry this validation step before handing off."
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
],
|
|
120
146
|
"requireConfirmation": {
|
|
121
147
|
"or": [
|
|
122
148
|
{ "var": "diagnosisConfidenceBand", "equals": "Low" },
|
|
@@ -131,4 +157,4 @@
|
|
|
131
157
|
"requireConfirmation": true
|
|
132
158
|
}
|
|
133
159
|
]
|
|
134
|
-
}
|
|
160
|
+
}
|
|
@@ -19,19 +19,22 @@
|
|
|
19
19
|
"DEFAULT BEHAVIOR: self-execute with tools. Only ask for missing external artifacts, permissions, or business context you cannot resolve yourself.",
|
|
20
20
|
"V2 DURABILITY: use output.notesMarkdown and explicit `continue_workflow` context keys as durable workflow state. Do NOT rely on the review document as required workflow memory.",
|
|
21
21
|
"ARTIFACT STRATEGY: `reviewDocPath` is an optional human-facing artifact only. Create or update it only when it materially improves handoff or readability. Workflow truth lives in notes and explicit context fields.",
|
|
22
|
+
"NOTES QUALITY: notes should work for both a human reader and a future agent resuming later. For important phases, make clear what was learned, what was decided, what remains uncertain, and what should happen next.",
|
|
22
23
|
"OWNERSHIP & DELEGATION: the main agent owns truth, synthesis, severity calibration, recommendation, and final handoff. Delegate only bounded reviewer or validation work through the WorkRail Executor.",
|
|
23
24
|
"SUBAGENT SYNTHESIS: treat reviewer-family and validator output as evidence, not conclusions. State your current hypothesis before delegation, then say what was confirmed, what was new, what you reject, and what changed your mind.",
|
|
24
25
|
"PARALLELISM: parallelize independent cognition; serialize canonical synthesis, coverage-ledger updates, recommendation decisions, and document writes.",
|
|
25
26
|
"REVIEW MODEL: first build shared understanding, then freeze a neutral fact packet, then let reviewer families challenge it in parallel, then reconcile contradictions explicitly.",
|
|
26
27
|
"COVERAGE LEDGER: explicitly track review domains as `checked`, `uncertain`, `not_applicable`, `contradicted`, or `needs_followup`. Do not finalize with unresolved material gaps unless you name them clearly.",
|
|
27
28
|
"TRIGGERS: WorkRail can only react to explicit fields. Use structural fields such as `contextUnknownCount`, `criticalSurfaceTouched`, `coverageUncertainCount`, `contradictionCount`, `falsePositiveRiskCount`, `blindSpotCount`, and `needsSimulation`.",
|
|
29
|
+
"BOUNDARY DISCIPLINE: attempt to determine the real review target and the likely ancestor-relative review surface. If that confidence remains weak, continue with downgraded confidence and disclose the limitation clearly instead of pretending certainty.",
|
|
30
|
+
"SOURCE DISCOVERY: opportunistically recover PR context, ticket/docs context, and repo/user policy context from the strongest available sources. Missing sources should usually lower confidence and be disclosed, not block the workflow.",
|
|
28
31
|
"BOUNDARY: do not post comments, approve, reject, or merge unless the user explicitly asks. Produce findings, recommendation, and handoff material only."
|
|
29
32
|
],
|
|
30
33
|
"steps": [
|
|
31
34
|
{
|
|
32
35
|
"id": "phase-0-understand-and-classify",
|
|
33
|
-
"title": "Phase 0:
|
|
34
|
-
"prompt": "Build
|
|
36
|
+
"title": "Phase 0: Locate, Bound, Enrich & Classify",
|
|
37
|
+
"prompt": "Build the review foundation in one pass.\n\nStep 1 — Early exit / minimum inputs:\nBefore exploring, verify that the review target is real and inspectable. If the diff, changed files, or equivalent review material are completely absent and cannot be inferred with tools, ask for the minimum missing artifact and stop. Do NOT ask questions you can resolve with tools.\n\nStep 2 — Locate and bound the review target:\nAttempt to determine the strongest available review target and boundary.\n\nAttempt to establish:\n- `reviewTargetKind` from the strongest available source such as PR/MR, branch, patch, diff, or local working tree changes\n- `reviewTargetSource` describing where the target came from\n- likely PR/MR identity when available (`prUrl`, `prNumber`)\n- likely base / ancestor reference (`baseCandidate`, `mergeBaseRef`) when available\n- whether the branch may include inherited or out-of-scope changes\n- `boundaryConfidence`: High / Medium / Low\n\nDo not over-prescribe your own investigation path. Use the strongest available evidence and record uncertainty honestly.\n\nStep 3 — Enrich with context:\nRecover the strongest available intent and policy context from whatever sources are actually available.\n\nAttempt to recover:\n- MR title and purpose\n- ticket / issue / acceptance context (`ticketRefs`, `ticketContext`)\n- supporting docs / specs / rollout context (`supportingDocsFound`)\n- repo or user policy/convention context when it is likely to affect review judgment (`policySourcesFound`)\n- `contextConfidence`: High / Medium / Low\n\nStep 4 — Review-surface hygiene:\nClassify the visible change into a minimal review surface.\n\nSet:\n- `coreReviewSurface`\n- `likelyNoiseOrMechanicalChurn`\n- `likelyInheritedOrOutOfScopeChanges`\n- `reviewSurfaceSummary`\n- `reviewScopeWarnings`\n\nThe goal is not a giant ledger. The goal is to avoid treating every visible changed file as equally worthy of deep review by default.\n\nStep 5 — Classify the review:\nAfter exploration, classify the work.\n\nSet:\n- `reviewMode`: QUICK / STANDARD / THOROUGH\n- `riskLevel`: Low / Medium / High\n- `shapeProfile`: choose the best primary label from `isolated_change`, `crosscutting_change`, `mechanically_noisy_change`, or `ambiguous_boundary`\n- `changeTypeProfile`: choose the best primary label from `general_code_change`, `api_contract_change`, `data_model_or_migration`, `security_sensitive`, or `test_only`\n- `maxParallelism`: 0 / 3 / 5\n- `criticalSurfaceTouched`: true / false\n- `needsSimulation`: true / false\n- `needsBoundaryFollowup`: true / false\n- `needsContextFollowup`: true / false\n- `needsReviewerBundle`: true / false\n\nDecision guidance:\n- QUICK: very small, isolated, low-risk changes with little ambiguity\n- STANDARD: typical feature or bug-fix reviews with moderate ambiguity or moderate risk\n- THOROUGH: critical surfaces, architectural novelty, high risk, broad change sets, or strong need for independent reviewer perspectives\n\nMinimal routing guidance:\n- if `boundaryConfidence = Low`, bias toward boundary/context follow-up before strong recommendation confidence\n- if `changeTypeProfile = api_contract_change`, bias toward contract/consumer/backward-compatibility scrutiny\n- if `changeTypeProfile = data_model_or_migration`, bias toward rollout / compatibility / simulation scrutiny\n- if `changeTypeProfile = security_sensitive`, bias toward adversarial/runtime-risk scrutiny and lower tolerance for weak evidence\n- if `changeTypeProfile = test_only`, bias toward stronger false-positive suppression\n- if `shapeProfile = mechanically_noisy_change`, bias toward stronger noise filtering and lower appetite for style-only findings\n\nStep 6 — Optional deeper context:\nIf `reviewMode` is STANDARD or THOROUGH and context remains incomplete, and delegation is available, spawn TWO WorkRail Executors SIMULTANEOUSLY running `routine-context-gathering` with focus=COMPLETENESS and focus=DEPTH. Synthesize both outputs before finishing this step.\n\nStep 7 — Human-facing artifact:\nChoose `reviewDocPath` only if a live artifact will materially improve human readability. Default suggestion: `mr-review.md` at the project root. This artifact is optional and never canonical workflow state.\n\nFallback behavior:\n- if PR/MR is not found but a branch/diff is inspectable, continue with downgraded context confidence and disclose missing PR context later\n- if the branch is inspectable but merge-base / ancestor remains ambiguous, continue with downgraded boundary confidence, set `needsBoundaryFollowup = true`, and disclose the uncertainty later\n- if ticket or supporting docs are missing, continue with downgraded context confidence and avoid overclaiming intent-sensitive findings\n- if only a patch/diff is available, continue if it is inspectable, but keep lower confidence on intent/boundary-dependent conclusions\n- if the review target itself is missing, ask only for that missing artifact and stop\n\nSet these keys in the next `continue_workflow` call's `context` object:\n- `reviewTargetKind`\n- `reviewTargetSource`\n- `prUrl`\n- `prNumber`\n- `baseCandidate`\n- `mergeBaseRef`\n- `boundaryConfidence`\n- `contextConfidence`\n- `mrTitle`\n- `mrPurpose`\n- `ticketRefs`\n- `ticketContext`\n- `supportingDocsFound`\n- `policySourcesFound`\n- `accessibleContextSources`\n- `missingContextSources`\n- `focusAreas`\n- `changedFileCount`\n- `criticalSurfaceTouched`\n- `reviewMode`\n- `riskLevel`\n- `shapeProfile`\n- `changeTypeProfile`\n- `maxParallelism`\n- `reviewDocPath`\n- `contextSummary`\n- `candidateFiles`\n- `moduleRoots`\n- `contextUnknownCount`\n- `coverageGapCount`\n- `authorIntentUnclear`\n- `needsSimulation`\n- `needsBoundaryFollowup`\n- `needsContextFollowup`\n- `needsReviewerBundle`\n- `coreReviewSurface`\n- `likelyNoiseOrMechanicalChurn`\n- `likelyInheritedOrOutOfScopeChanges`\n- `reviewSurfaceSummary`\n- `reviewScopeWarnings`\n- `openQuestions`\n\nRules:\n- answer your own questions with tools whenever possible\n- only keep true human-decision questions in `openQuestions`\n- keep `openQuestions` bounded to the minimum necessary\n- classify AFTER exploring, not before\n- before leaving this phase, either establish the likely review boundary or explicitly record why you could not",
|
|
35
38
|
"requireConfirmation": {
|
|
36
39
|
"or": [
|
|
37
40
|
{ "var": "reviewMode", "equals": "THOROUGH" },
|
|
@@ -58,12 +61,13 @@
|
|
|
58
61
|
"Keep `recommendationHypothesis` as a secondary hypothesis to challenge, not a frame to defend."
|
|
59
62
|
],
|
|
60
63
|
"procedure": [
|
|
61
|
-
"Create a neutral `reviewFactPacket` containing: MR purpose and expected behavior change, changed files and module roots, key contracts / invariants / affected consumers, call-chain highlights, relevant repo patterns and exemplars, tests/docs expectations, and explicit open unknowns.",
|
|
64
|
+
"Create a neutral `reviewFactPacket` containing: MR purpose and expected behavior change, review target and review-surface summary, changed files and module roots, key contracts / invariants / affected consumers, call-chain highlights, relevant repo patterns and exemplars, tests/docs expectations, discovered ticket/doc/policy context, accessible and missing context sources, and explicit open unknowns.",
|
|
62
65
|
"Initialize `coverageLedger` for these domains: `correctness_logic`, `contracts_invariants`, `patterns_architecture`, `runtime_production_risk`, `tests_docs_rollout`, `security_performance`.",
|
|
63
66
|
"Perform a preliminary self-review from the fact packet before choosing reviewer families.",
|
|
64
67
|
"Reviewer family options: `correctness_invariants`, `patterns_architecture`, `runtime_production_risk`, `test_docs_rollout`, `false_positive_skeptic`, `missed_issue_hunter`.",
|
|
65
68
|
"Selection guidance: QUICK = no bundle by default unless ambiguity still feels material; STANDARD = 3 families by default; THOROUGH = 5 families by default.",
|
|
66
69
|
"Always include `correctness_invariants` unless clearly not applicable. Include `test_docs_rollout` in STANDARD and THOROUGH unless clearly not applicable. Include `runtime_production_risk` when `criticalSurfaceTouched = true` or `needsSimulation = true`. Include `missed_issue_hunter` in THOROUGH. Include `false_positive_skeptic` when Major/Critical findings seem plausible or severity inflation risk is non-trivial.",
|
|
70
|
+
"Routing guidance: for `api_contract_change`, bias toward contract / consumer / backward-compatibility scrutiny; for `data_model_or_migration`, bias toward rollout / compatibility / simulation scrutiny; for `security_sensitive`, bias toward runtime-risk scrutiny and lower tolerance for weak evidence; for `test_only`, bias toward stronger false-positive suppression; for `mechanically_noisy_change`, bias toward stronger noise filtering and lower appetite for style-only findings.",
|
|
67
71
|
"Set `coverageUncertainCount` as the number of coverage domains not yet safely closed: `uncertain` + `contradicted` + `needs_followup`.",
|
|
68
72
|
"Initialize `contradictionCount`, `blindSpotCount`, and `falsePositiveRiskCount` to `0` if no reviewer-family bundle will run."
|
|
69
73
|
],
|
|
@@ -191,8 +195,9 @@
|
|
|
191
195
|
"Before delegating, state: what is your current recommendation, where are you least confident, and what finding would most likely change your mind now?",
|
|
192
196
|
"Mode-adaptive validation: QUICK = self-validate and optionally spawn ONE WorkRail Executor running `routine-hypothesis-challenge` if a serious uncertainty remains; STANDARD = if validation is required and delegation is available, spawn TWO WorkRail Executors SIMULTANEOUSLY running `routine-hypothesis-challenge` and either `routine-execution-simulation` or `routine-plan-analysis`; THOROUGH = if validation is required and delegation is available, spawn THREE WorkRail Executors SIMULTANEOUSLY running `routine-hypothesis-challenge`, `routine-execution-simulation` when needed, and `routine-plan-analysis`.",
|
|
193
197
|
"After receiving validator output, explicitly synthesize what was confirmed, what was new, what appears weak, and whether your recommendation changed.",
|
|
198
|
+
"Perform a compact confidence assessment using these dimensions: `boundaryConfidence`, `intentConfidence`, `evidenceConfidence`, `coverageConfidence`, and `consensusConfidence`. Rate each as High / Medium / Low, explain each in one sentence, and then derive final recommendation confidence with these rules: if boundary is Low, final confidence is Low; else if evidence is Low, final confidence is Low; else if 2 or more dimensions are Medium, final confidence is Medium; else if all key dimensions are High, final confidence is High. Unresolved disagreement can only lower confidence, never raise it.",
|
|
194
199
|
"Compute `docCompletenessConcernCount` by counting one concern for each material packaging gap: missing rationale for any Critical or Major finding, missing ready-to-post MR comment for any Critical or Major finding, recommendation mismatch with canonical findings, still-uncertain / contradicted / needs-followup coverage domains not summarized clearly, or any missing required final section needed for actionability.",
|
|
195
|
-
"Set these keys in the next `continue_workflow` call's `context` object: `validatorConsensusLevel`, `validationSummary`, `recommendationConfidenceBand`, `docCompletenessConcernCount`."
|
|
200
|
+
"Set these keys in the next `continue_workflow` call's `context` object: `intentConfidence`, `evidenceConfidence`, `coverageConfidence`, `consensusConfidence`, `confidenceAssessmentSummary`, `validatorConsensusLevel`, `validationSummary`, `recommendationConfidenceBand`, `docCompletenessConcernCount`."
|
|
196
201
|
],
|
|
197
202
|
"verify": [
|
|
198
203
|
"If 2+ validators still raise serious concerns, confidence is downgraded and synthesis is reopened.",
|
|
@@ -210,7 +215,7 @@
|
|
|
210
215
|
{
|
|
211
216
|
"id": "phase-6-final-handoff",
|
|
212
217
|
"title": "Phase 6: Final Handoff",
|
|
213
|
-
"prompt": "Provide the final MR review handoff.\n\nInclude:\n- MR title and purpose\n- review mode used\n- final recommendation and confidence band\n- counts of Critical / Major / Minor / Nit findings\n- top findings with rationale\n- strongest remaining areas of uncertainty, if any\n- summary of the coverage ledger, especially any still-uncertain domains\n- ready-to-post MR comments summary\n- any validation outcomes a human reviewer should see\n- path to the full human-facing review artifact (`reviewDocPath`) only if one was created\n\nRules:\n- the final recommendation assists a human reviewer; it does not replace them\n- if `reviewDocPath` exists, treat it as a human-facing companion artifact only\n- do not post comments, approve, reject, or merge unless the user explicitly asks",
|
|
218
|
+
"prompt": "Provide the final MR review handoff.\n\nInclude:\n- MR title and purpose\n- review mode used\n- final recommendation and confidence band\n- confidence assessment summary, including the most important reason confidence was capped if it was not High\n- counts of Critical / Major / Minor / Nit findings\n- top findings with rationale\n- strongest remaining areas of uncertainty, if any\n- summary of the coverage ledger, especially any still-uncertain domains\n- ready-to-post MR comments summary\n- any validation outcomes a human reviewer should see\n- review environment status:\n - what review target/context sources were successfully used\n - what important sources were missing or ambiguous\n - boundary confidence and context confidence\n - how those limits affected the review\n- path to the full human-facing review artifact (`reviewDocPath`) only if one was created\n\nRules:\n- the final recommendation assists a human reviewer; it does not replace them\n- if `reviewDocPath` exists, treat it as a human-facing companion artifact only\n- be explicit when missing PR/ticket/doc/boundary context limited confidence\n- do not post comments, approve, reject, or merge unless the user explicitly asks",
|
|
214
219
|
"requireConfirmation": true
|
|
215
220
|
}
|
|
216
221
|
]
|
|
@@ -53,8 +53,34 @@
|
|
|
53
53
|
{
|
|
54
54
|
"id": "complete",
|
|
55
55
|
"title": "Complete",
|
|
56
|
-
"prompt": "The iteration loop has completed.
|
|
57
|
-
"requireConfirmation": false
|
|
56
|
+
"prompt": "The iteration loop has completed. Assess whether the loop result is ready to publish.\n\nProvide an assessment artifact for readiness.",
|
|
57
|
+
"requireConfirmation": false,
|
|
58
|
+
"assessmentRefs": ["readiness_gate"],
|
|
59
|
+
"assessmentConsequences": [
|
|
60
|
+
{
|
|
61
|
+
"when": {
|
|
62
|
+
"dimensionId": "confidence",
|
|
63
|
+
"equalsLevel": "low"
|
|
64
|
+
},
|
|
65
|
+
"effect": {
|
|
66
|
+
"kind": "require_followup",
|
|
67
|
+
"guidance": "Review the loop result one more time and confirm the outcome before completing this step."
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"assessments": [
|
|
74
|
+
{
|
|
75
|
+
"id": "readiness_gate",
|
|
76
|
+
"purpose": "Assess whether the loop result is ready to publish.",
|
|
77
|
+
"dimensions": [
|
|
78
|
+
{
|
|
79
|
+
"id": "confidence",
|
|
80
|
+
"purpose": "How confident the agent is that the loop result is complete and correct.",
|
|
81
|
+
"levels": ["low", "high"]
|
|
82
|
+
}
|
|
83
|
+
]
|
|
58
84
|
}
|
|
59
85
|
]
|
|
60
86
|
}
|