feat(pr-review): operator/chat trigger queues a pr-review task

review_pr self-omitted since 7299b923 deleted the synchronous reviewer it
called. It is rebuilt on the task enqueue path everything else uses: the
tool resolves the identity's configured repo, then queues a pr-review task
naming the pull request through the workflow's declared pr_number input,
which is the same generic input mechanism a watched-repos binding uses.

That input has to reach the store with the task, so
EnqueueChatTaskRequest gains inputs_json and the tasks insert writes the
inputs column directly. StampTaskBinding no longer writes it: the insert is
now the column's only writer, and a chat task must not acquire binding
provenance just to carry an input.

ChatPRReviewer, its result shape and the reviewer wiring are deleted with
the path they served.
This commit is contained in:
sam committed 2026-09-28 18:24:36 +10:00
1 parent a6627954bd
commit 5c91575166
39 files changed
+227 -192

No files matched your search

@@ -60,7 +60,7 @@ func TestExecuteTaskRequestStartsWorkflowCallCallee(t *testing.T) {
const callerYAML = "id: caller\nrepository: none\ninputs:\n src_ip: {type: string}\nsteps:\n - type: workflow.call\n settings:\n workflow: callee\n inputs: {src_ip: \"inputs.src_ip\"}\n wait: false\n - type: agent.run\n settings:\n mission: report\n"
// A real caller row, claimed and running, so the store's enqueue reads
// the same row shape production does.
task, err := st.EnqueueChatTask(ctx, "", "", "workflow.call integration", "", "caller", "")
task, err := st.EnqueueChatTask(ctx, "", "", "workflow.call integration", "", "caller", "", nil)
if err != nil {
t.Fatalf("seed caller task: %v", err)
}
-2
View File
@@ -41,7 +41,6 @@ type chatSetup struct {
ChatTaskLister gateway.ChatTaskLister
ChatTaskLogs gateway.ChatTaskLogReader
ChatTaskActor gateway.ChatTaskActor
ChatPRReviewer gateway.ChatPRReviewer
DefaultChatIdentity string
// Bus carries primary-input events (archie-core-035): a completed
// chat turn is published here so input-driven curators can wake. Nil
@@ -182,7 +181,6 @@ func newChatTurnRunner(
TaskLogs: s.ChatTaskLogs,
TaskActor: s.ChatTaskActor,
TaskIdentity: s.DefaultChatIdentity,
PRReviewer: s.ChatPRReviewer,
Bus: s.Bus,
BotUser: cfg.BotUser,
Channel: channel,
+3 -10
View File
@@ -126,16 +126,9 @@ func (b *boot) setupGatewayChat(ctx context.Context, actor gateway.ChatTaskActor
setup := chatSetup{
Cfg: config.NewHolder(cfg), LLM: b.chatLLM, ChatModels: b.chatModels, ToolReg: b.toolReg,
Personas: b.personas, ChatTasks: b.chatTasks,
ChatTaskLister: chatTaskListerAdapter{tasks: b.stateStore.Tasks},
ChatTaskLogs: chatTaskLogReaderAdapter{tasks: b.stateStore.TaskByID, taskLogs: b.taskLogs},
// ChatPRReviewer is nil for now: the synchronous operator-review
// implementation (prReviewer) was removed with the adversarial
// self-review system it depended on (archie-core-afbk.7). The
// review_pr chat tool self-omits when its reviewer is nil, so the
// dashboard/chat simply stops advertising the capability until the
// operator trigger is rebuilt to enqueue an async pr-review task
// instead (tracked in that bead's continuation).
ChatTaskActor: actor, ChatPRReviewer: nil,
ChatTaskLister: chatTaskListerAdapter{tasks: b.stateStore.Tasks},
ChatTaskLogs: chatTaskLogReaderAdapter{tasks: b.stateStore.TaskByID, taskLogs: b.taskLogs},
ChatTaskActor: actor,
DefaultChatIdentity: b.defaultChatIdentity,
Bus: b.bus, Log: b.log,
MemoryEngine: b.memoryStore(),
+3 -1
View File
@@ -539,14 +539,16 @@ type chatTaskWriterAdapter struct {
enqueue func(
ctx context.Context,
owner, repo, title, body, workflow, identity string,
inputs map[string]any,
) (*workflow.Task, error)
}
func (a chatTaskWriterAdapter) EnqueueChatTask(
ctx context.Context,
owner, repo, title, body, workflow, identity string,
inputs map[string]any,
) (int64, error) {
task, err := a.enqueue(ctx, owner, repo, title, body, workflow, identity)
task, err := a.enqueue(ctx, owner, repo, title, body, workflow, identity, inputs)
if err != nil {
return 0, err
}
+3 -2
View File
@@ -567,7 +567,7 @@ func TestManualRequeueTaskRejectsOtherStatuses(t *testing.T) {
func TestChatTaskListerAdapterReadsSQLiteIdentity(t *testing.T) {
st := pgstore.Open(t)
t.Cleanup(func() { _ = st.Close() })
want, err := st.EnqueueChatTask(t.Context(), "acme", "widget", "identity task", "", "tdd", "reviewer")
want, err := st.EnqueueChatTask(t.Context(), "acme", "widget", "identity task", "", "tdd", "reviewer", nil)
if err != nil {
t.Fatal(err)
}
@@ -610,13 +610,14 @@ func TestChatTaskWriterAdapter(t *testing.T) {
enqueue: func(
context.Context,
string, string, string, string, string, string,
map[string]any,
) (*workflow.Task, error) {
return tt.result, tt.err
},
}
id, err := adapter.EnqueueChatTask(
context.Background(),
"owner", "repo", "title", "body", "workflow", "identity",
"owner", "repo", "title", "body", "workflow", "identity", nil,
)
if (err != nil) != tt.wantErr {
t.Fatalf("EnqueueChatTask() error = %v, wantErr %t", err, tt.wantErr)
+1 -1
View File
@@ -175,7 +175,7 @@ func TestStateStoreDataSurvivesRestart(t *testing.T) {
if err := first.openStateStore(t.Context()); err != nil {
t.Fatalf("first openStateStore: %v", err)
}
task, err := first.st.EnqueueChatTask(t.Context(), "acme", "widget", "restart check", "body", "implement", "")
task, err := first.st.EnqueueChatTask(t.Context(), "acme", "widget", "restart check", "body", "implement", "", nil)
if err != nil {
t.Fatalf("EnqueueChatTask: %v", err)
}
@@ -52,7 +52,7 @@ func TestChatTaskActorAdapterCrossIdentityRefused(t *testing.T) {
st := pgstore.Open(t)
t.Cleanup(func() { _ = st.Close() })
task, err := st.EnqueueChatTask(ctx, "acme", "widget", "parked job", "", "", "identity-owner")
task, err := st.EnqueueChatTask(ctx, "acme", "widget", "parked job", "", "", "identity-owner", nil)
if err != nil {
t.Fatal(err)
}
@@ -146,7 +146,7 @@ func TestChatTaskActorAdapterRefusesDisallowedStateAction(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
task, err := st.EnqueueChatTask(ctx, "acme", "widget", "test task", "", "", "archie")
task, err := st.EnqueueChatTask(ctx, "acme", "widget", "test task", "", "", "archie", nil)
if err != nil {
t.Fatal(err)
}
@@ -251,7 +251,7 @@ func TestChatTaskActorAdapterAppliesActionsToStore(t *testing.T) {
adapter := newChatTaskActorForTest(t, st, config.Config{MaxRetries: 3})
task, err := st.EnqueueChatTask(ctx, "acme", "widget", "actionable task", "", "", "archie")
task, err := st.EnqueueChatTask(ctx, "acme", "widget", "actionable task", "", "", "archie", nil)
if err != nil {
t.Fatal(err)
}
+1 -1
View File
@@ -48,7 +48,7 @@ func TestDashboardAndChatAgreeOnTerminalStates(t *testing.T) {
st := pgstore.Open(t)
t.Cleanup(func() { _ = st.Close() })
task, err := st.EnqueueChatTask(ctx, "acme", "widget", "decide on me", "", "", "reviewer")
task, err := st.EnqueueChatTask(ctx, "acme", "widget", "decide on me", "", "", "reviewer", nil)
if err != nil {
t.Fatal(err)
}
@@ -171,7 +171,7 @@ func composeUIProcess(t *testing.T) (*webui.Server, int64) {
}
t.Cleanup(closeClient)
task, err := st.EnqueueChatTask(t.Context(), "acme", "widget", "a task", "body", "implement", "")
task, err := st.EnqueueChatTask(t.Context(), "acme", "widget", "a task", "body", "implement", "", nil)
if err != nil {
t.Fatalf("seed task: %v", err)
}
+1 -1
View File
@@ -103,7 +103,7 @@ func serveGRPC(t *testing.T, register func(grpc.ServiceRegistrar)) (target strin
func TestUIServesDashboardAgainstRemoteContracts(t *testing.T) {
st := pgstore.Open(t)
defer st.Close()
if _, err := st.EnqueueChatTask(t.Context(), "acme", "widget", "remote summary", "body", "implement", ""); err != nil {
if _, err := st.EnqueueChatTask(t.Context(), "acme", "widget", "remote summary", "body", "implement", "", nil); err != nil {
t.Fatalf("seed task: %v", err)
}
// Claimed (not just enqueued): StartStep guards on the execution's own
+1 -1
View File
@@ -156,7 +156,7 @@ func composeUIProcessWithLog(t *testing.T) (*webui.Server, int64, int) {
st := pgstore.Open(t)
t.Cleanup(func() { _ = st.Close() })
task, err := st.EnqueueChatTask(t.Context(), "acme", "widget", "a task", "body", "implement", "")
task, err := st.EnqueueChatTask(t.Context(), "acme", "widget", "a task", "body", "implement", "", nil)
if err != nil {
t.Fatalf("seed task: %v", err)
}