feat: feasibility workflow — assess, PRD, human go/no-go loop

Routed via the feature label. Stages: assess (read-only agent with a
structured decide tool — verdict as a tool call, not parsed prose;
not-a-fit closes the issue as won't-do with reasons) -> PRD (read-only
agent; problem, solution, surface, acceptance criteria, non-goals) ->
deliver (PRD posted as the watched issue comment, optional [notify]
webhook POST for n8n->email, task -> waiting_human).

The daemon's cycle now watches waiting_human tasks: replies after the
watch comment (excluding the bot) are judged by an LLM (triage role,
APPROVE/REJECT/UNCLEAR + reason — never keyword matching). Approvals
requeue under implement (whose planner now treats an existing PRD as
prior context); rejections close with the reasoning acknowledged;
unclear replies keep waiting.

Supporting changes: forge.Comment returns the comment id;
forge.RepliesAfter; store watch_comment_id (additive migration),
WaitingTasks, Requeue; Route honours a pre-assigned workflow;
AgentStage.Extra for stage-specific tools.

Live: todo#7 assessed fit -> PRD delivered -> waiting_human.
This commit is contained in:
sam committed 2026-07-21 04:27:17 +10:00
1 parent bb9c6f89a2
commit 239b8eda42
10 files changed
+395 -16

No files matched your search

+34 -5
View File
@@ -66,11 +66,40 @@ func (c *Client) AssignedIssues(ctx context.Context, owner, repo, assignee strin
return out, nil
}
// Comment posts an issue (or PR) comment.
func (c *Client) Comment(ctx context.Context, owner, repo string, number int, body string) error {
_, _, err := c.gh.Issues.CreateComment(ctx, owner, repo, number,
// Comment posts an issue (or PR) comment and returns its id, so a
// workflow can watch for replies that come after it.
func (c *Client) Comment(ctx context.Context, owner, repo string, number int, body string) (int64, error) {
cm, _, err := c.gh.Issues.CreateComment(ctx, owner, repo, number,
&github.IssueComment{Body: github.Ptr(body)})
return err
if err != nil {
return 0, err
}
return cm.GetID(), nil
}
// Reply is a human comment on a watched issue.
type Reply struct {
ID int64
User string
Body string
}
// RepliesAfter returns comments on the issue with id > afterID that were
// not written by exclude (the bot) — the human side of waiting_human.
func (c *Client) RepliesAfter(ctx context.Context, owner, repo string, number int, afterID int64, exclude string) ([]Reply, error) {
comments, _, err := c.gh.Issues.ListComments(ctx, owner, repo, number,
&github.IssueListCommentsOptions{ListOptions: github.ListOptions{PerPage: 50}})
if err != nil {
return nil, err
}
var out []Reply
for _, cm := range comments {
if cm.GetID() <= afterID || cm.GetUser().GetLogin() == exclude {
continue
}
out = append(out, Reply{ID: cm.GetID(), User: cm.GetUser().GetLogin(), Body: cm.GetBody()})
}
return out, nil
}
// CreatePR opens a pull request and returns its number.
@@ -102,7 +131,7 @@ func (c *Client) PRState(ctx context.Context, owner, repo string, number int) (s
// CloseIssue closes an issue with a final comment (feasibility "won't do").
func (c *Client) CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error {
if comment != "" {
if err := c.Comment(ctx, owner, repo, number, comment); err != nil {
if _, err := c.Comment(ctx, owner, repo, number, comment); err != nil {
return err
}
}