feat(workflow): configure review precision and approval on the review.pr step

This commit is contained in:
sam committed 2026-10-17 17:00:55 +11:00
1 parent a973bd6567
commit 7e940acad4
19 files changed
+107 -267

No files matched your search

-1
View File
@@ -273,7 +273,6 @@ var runtimeResourceKinds = []string{
controlplane.SchedulingPolicyKind,
controlplane.ToolSettingsKind,
controlplane.PluginSettingsKind,
controlplane.ReviewSettingsKind,
controlplane.ChannelSettingsKind,
controlplane.ContainerRuntimePoliciesKind,
controlplane.CredentialBindingsKind,
+1 -1
View File
@@ -8,7 +8,7 @@ import (
// Schemas are not declared here: each Definition names its document type, and
// Definition.Descriptor derives the JSON Schema from it (internal/app/controlplane/schema.go).
func builtinDefinitions(steps workflow.StepRegistry, settings map[string]any) []Definition {
definitions := []Definition{taskPolicyDefinition(), workflowDefinition(), workflowDefinitionsDefinition(steps, settings), workflowEnablementDefinition(), curatorDefinition(), soulDefinition(), scheduleDefinition(), agentProfileDefinition(), playbooksDefinition(), skillsDefinition(), credentialBindingsDefinition(), identityGrantsDefinition(), reviewSettingsDefinition(), orgModelPolicyDefinition(), forgeConnectionsDefinition()}
definitions := []Definition{taskPolicyDefinition(), workflowDefinition(), workflowDefinitionsDefinition(steps, settings), workflowEnablementDefinition(), curatorDefinition(), soulDefinition(), scheduleDefinition(), agentProfileDefinition(), playbooksDefinition(), skillsDefinition(), credentialBindingsDefinition(), identityGrantsDefinition(), orgModelPolicyDefinition(), forgeConnectionsDefinition()}
definitions = append(definitions, modelDefinitions()...)
definitions = append(definitions, operationalDefinitions()...)
return definitions
+1 -1
View File
@@ -156,7 +156,7 @@ func (s *Server) readResource(ctx context.Context, orgID, kind string, into any)
// copy alone. Another org's write would be stored and never applied.
var instanceOnlyKinds = map[string]bool{
ChannelSettingsKind: true, SchedulingPolicyKind: true,
ReviewSettingsKind: true, TaskPolicyKind: true, ToolSettingsKind: true,
TaskPolicyKind: true, ToolSettingsKind: true,
PluginSettingsKind: true, ContainerRuntimePoliciesKind: true, AgentProfileKind: true,
ExtensionSettingsKind: true, UpdateSettingsKind: true, WorkflowExecutionSettingsKind: true,
}
@@ -1,34 +0,0 @@
package controlplane
import (
"github.com/samcharles93/archie-core/internal/config"
)
// ReviewSettingsKind is the control-plane resource holding the pr-review
// workflow's two dials: whether a post-worthiness pass runs before findings are
// posted, and whether a human approves the draft before it posts. The file's
// [review] section seeds it; the stored document outranks the file from then on
const ReviewSettingsKind = "review-settings"
type reviewSettings struct {
PrecisionGate bool `json:"precision_gate" title:"Precision gate" doc:"Run a post-worthiness pass before findings are posted."`
ApproveBeforePost bool `json:"approve_before_post" title:"Approve before posting" doc:"Park a finished review for operator approval before it posts."`
}
func reviewSettingsDefinition() Definition {
return Definition{
Kind: ReviewSettingsKind,
Title: "Review settings",
ApplyMode: "live",
Document: reviewSettings{},
Seed: func(cfg config.Config) any {
return reviewSettings{PrecisionGate: cfg.Review.PrecisionGate, ApproveBeforePost: cfg.Review.ApproveBeforePost}
},
Validate: validateReviewSettings,
}
}
// validateReviewSettings accepts every value.
func validateReviewSettings(input []byte) error {
return validateAs(input, func(reviewSettings) error { return nil })
}
@@ -124,17 +124,6 @@ func runtimeConfigFrom(ctx context.Context, reader controlplanerpc.ResourceReade
}); err != nil {
return config.Config{}, nil, err
}
// review-settings owns the pr-review dials once the store carries a value.
// The two fields are assigned individually, not `out.Review = ...`: a field
// added to config.Review later keeps the file's value until the stored
// document carries it.
if err := layerResource(ctx, reader, versions, ReviewSettingsKind, func(settings reviewSettings) error {
out.Review.PrecisionGate = settings.PrecisionGate
out.Review.ApproveBeforePost = settings.ApproveBeforePost
return nil
}); err != nil {
return config.Config{}, nil, err
}
return runtimeToolConfigFrom(ctx, reader, versions, out)
}
-2
View File
@@ -99,8 +99,6 @@ func Run(ctx context.Context, opts Options, w io.Writer) (bench.Summary, error)
}
// The pipeline resolves its model through the default alias.
cfg.Models = map[string]string{config.DefaultModelAlias: reviewRef}
cfg.Review.ApproveBeforePost = false
cfg.Review.PrecisionGate = false
reviewer := &liveReviewer{cfg: cfg, agent: modelloop.NewLoopRunner(rt, slog.Default()), source: prsource.New(newPublicGitHub())}
judge := &modelJudge{runtime: rt, modelRef: judgeRef}