d83ad87151
SharedKernel:
- ActionRisk (risk lives on the action) + GatePolicy (the pure autonomy x risk matrix:
Read never holds, Draft/Publish hold unless Autonomous, Destructive ALWAYS holds).
- IActionGate (AgentActionProposal -> execute|hold) and IBoardWriter.AttachArtifactAsync.
Governance:
- ReviewItem (held action: artifact, child titles, trace, decision, edit distance) in a new
review_items table (AddReviewItems migration).
- ActionGate: hold -> ReviewItem + "action.held" audit; autonomous -> execute + audit.
- HeldActionExecutor: writes the artifact onto the task and creates the child tasks via
IBoardWriter (implemented by OrgBoard — no cross-module table access).
- Review inbox API: GET /api/governance/reviews (scope-filtered to where the caller may
approve), POST /reviews/{id}/approve (optional edited content/children -> normalized
edit distance recorded — the north-star metric), POST /reviews/{id}/sendback. Deciding
twice is 409; Members are 403.
Assembler:
- OutputParser (numbered-list child titles, conservative) and the executor now hands every
completed run's proposal to the gate.
OrgBoard: WorkItem.AttachArtifact + BoardWriter.AttachArtifactAsync.
Verified: build green; ArchitectureTests 8/8; IntegrationTests 41/41 incl. the full M5
acceptance — Aria (gated) proposes a spec, it waits in the inbox with its trace, a Member is
403'd, the owner edits-and-approves, the spec + four child stories land on the board, edit
distance > 0 is recorded and audited; Quill (autonomous) executes straight to the board;
destructive holds even for an autonomous seat and can be sent back. Plus the GatePolicy matrix.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using TeamUp.SharedKernel.Board;
|
|
|
|
namespace TeamUp.Modules.Governance.Gate;
|
|
|
|
/// <summary>
|
|
/// Performs the internal action behind an agent proposal: write the artifact onto the task and
|
|
/// create the proposed child tasks. Used by the gate (autonomous path) and the approve endpoint.
|
|
/// </summary>
|
|
internal sealed class HeldActionExecutor(IBoardWriter boardWriter)
|
|
{
|
|
public async Task ExecuteAsync(
|
|
Guid teamId,
|
|
Guid workItemId,
|
|
string content,
|
|
IReadOnlyList<string> childTitles,
|
|
Guid? actedByMemberId,
|
|
CancellationToken cancellationToken = default)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(content))
|
|
{
|
|
await boardWriter.AttachArtifactAsync(workItemId, content, cancellationToken);
|
|
}
|
|
|
|
if (childTitles.Count > 0)
|
|
{
|
|
var children = childTitles.Select(title => new ChildTaskSpec(title, "Story")).ToList();
|
|
await boardWriter.CreateChildTasksAsync(teamId, workItemId, children, actedByMemberId, cancellationToken);
|
|
}
|
|
}
|
|
}
|