From 27157412d8aca09c8f0444613d62fc31d84f12fd Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 23 Jul 2026 13:07:37 +1000 Subject: [PATCH 1/6] fix: set protocol version on baseline-fix agent request --- internal/workflow/implement.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/workflow/implement.go b/internal/workflow/implement.go index 776231be3..d8bf49c01 100644 --- a/internal/workflow/implement.go +++ b/internal/workflow/implement.go @@ -46,6 +46,7 @@ func StageBaselineGate() Stage { modelRef := tc.Cfg.Models["builder"] req := agentexec.Request{ + Version: agentexec.ProtocolVersion, TaskID: tc.Task.ID, Attempt: tc.Task.Attempt, Stage: "baseline-fix", From 7581bcc896f39cc32f4edacd6961c1f73c26e2e1 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 23 Jul 2026 13:55:22 +1000 Subject: [PATCH 2/6] test: update responsive feature test to match fixed CSS --- internal/webui/webui_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/webui/webui_test.go b/internal/webui/webui_test.go index 43130e4c9..8d9f527bc 100644 --- a/internal/webui/webui_test.go +++ b/internal/webui/webui_test.go @@ -155,10 +155,12 @@ func TestIndexHasResponsiveFeatures(t *testing.T) { name string want string }{ - {"mobile-font-padding", "section { min-height: 1.25rem; }"}, - {"table-wrap", "section .table-wrap { position: relative; overflow-x: auto;"}, + {"section-table", ".section-table { overflow-x: auto; }"}, {"feed-wraps", "white-space: normal"}, + {"feed-break-word", "overflow-wrap: break-word"}, {"700px-breakpoint", "@media (max-width: 700px)"}, + {"950px-breakpoint", "@media (max-width: 950px)"}, + {"viewport-meta", ``}, } for _, r := range reqs { if !strings.Contains(body, r.want) { From 3264102ee24987bb1300cb60620068bf72e06592 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 23 Jul 2026 16:10:34 +1000 Subject: [PATCH 3/6] fix: increase plan max_steps to 30 for large repos, bump token budget --- internal/workflow/implement.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/workflow/implement.go b/internal/workflow/implement.go index d8bf49c01..bf9500a0e 100644 --- a/internal/workflow/implement.go +++ b/internal/workflow/implement.go @@ -100,7 +100,7 @@ func Implement() Workflow { Name: "plan", Role: "planner", ReadOnly: true, - MaxSteps: 15, + MaxSteps: 30, Mission: func(tc *TaskContext) string { prd := "" if tc.Task.Plan != "" { From 0d6b26244e495ba1ef6695e3228cdb8543e098db Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 23 Jul 2026 16:15:01 +1000 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20remove=20all=20hardcoded=20MaxSteps?= =?UTF-8?q?=20=E2=80=94=20inherit=20from=20config=20budget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/workflow/feasibility.go | 2 -- internal/workflow/implement.go | 1 - internal/workflow/tdd.go | 1 - 3 files changed, 4 deletions(-) diff --git a/internal/workflow/feasibility.go b/internal/workflow/feasibility.go index f32277494..5271ccd61 100644 --- a/internal/workflow/feasibility.go +++ b/internal/workflow/feasibility.go @@ -29,7 +29,6 @@ func Feasibility() Workflow { Name: "assess", Role: "planner", ReadOnly: true, - MaxSteps: 15, CaptureTools: decideCaptureTools, Mission: func(tc *TaskContext) string { return fmt.Sprintf( @@ -76,7 +75,6 @@ func Feasibility() Workflow { Name: "prd", Role: "planner", ReadOnly: true, - MaxSteps: 20, Mission: func(tc *TaskContext) string { return fmt.Sprintf( "Write a PRD for this accepted feature request on %s.\n\n"+ diff --git a/internal/workflow/implement.go b/internal/workflow/implement.go index bf9500a0e..fda955c11 100644 --- a/internal/workflow/implement.go +++ b/internal/workflow/implement.go @@ -100,7 +100,6 @@ func Implement() Workflow { Name: "plan", Role: "planner", ReadOnly: true, - MaxSteps: 30, Mission: func(tc *TaskContext) string { prd := "" if tc.Task.Plan != "" { diff --git a/internal/workflow/tdd.go b/internal/workflow/tdd.go index 405911c4b..534784cb4 100644 --- a/internal/workflow/tdd.go +++ b/internal/workflow/tdd.go @@ -27,7 +27,6 @@ func TDD() Workflow { Name: "analyse", Role: "planner", ReadOnly: true, - MaxSteps: 15, Mission: func(tc *TaskContext) string { return fmt.Sprintf( "Analyse this bug report for the repository %s and determine the problem surface.\n\n"+ From 212b48a0a00bed18f7c5659acf9f4c8d1fa37401 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 23 Jul 2026 17:25:03 +1000 Subject: [PATCH 5/6] fix: close issue when build passes with 0 changes (no-op detection) --- internal/workflow/implement.go | 3 ++ internal/workflow/implement_test.go | 75 +++++++++++++++++++++++++++++ internal/workflow/steps.go | 13 ++++- internal/workflow/workflow.go | 4 ++ 4 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 internal/workflow/implement_test.go diff --git a/internal/workflow/implement.go b/internal/workflow/implement.go index fda955c11..9d04948f6 100644 --- a/internal/workflow/implement.go +++ b/internal/workflow/implement.go @@ -148,6 +148,9 @@ func Implement() Workflow { }, OnResult: func(tc *TaskContext, res agentexec.Result) error { tc.BuildSummary = res.Summary + if res.Status == agentexec.StatusPassed && len(res.Changes) == 0 { + tc.BuildNoChanges = true + } return nil }, }.Stage(), diff --git a/internal/workflow/implement_test.go b/internal/workflow/implement_test.go new file mode 100644 index 000000000..5b88e4d7f --- /dev/null +++ b/internal/workflow/implement_test.go @@ -0,0 +1,75 @@ +package workflow + +import ( + "context" + "strings" + "testing" + + "github.com/samcharles93/archie-core/internal/forge" + "github.com/samcharles93/archie-core/internal/store" +) + +// fakeForge implements forge.Forge for TestStageCommitPushCloses. +type fakeForge struct { + closed int + commented []string +} + +func (f *fakeForge) CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error { f.closed++; return nil } +func (f *fakeForge) Comment(ctx context.Context, owner, repo string, number int, body string) (int64, error) { + f.commented = append(f.commented, body) + return 0, nil +} +// Remaining forge.Forge stubs — only CloseIssue and Comment are used by StageCommitPush. +func (f *fakeForge) Name() string { return "fake" } +func (f *fakeForge) AcceptInvitations(ctx context.Context) error { return nil } +func (f *fakeForge) AssignedIssues(ctx context.Context, owner, repo, user string) ([]forge.Issue, error) { return nil, nil } +func (f *fakeForge) IssuesWithLabel(ctx context.Context, owner, repo, label string) ([]forge.Issue, error) { return nil, nil } +func (f *fakeForge) CreatePR(ctx context.Context, owner, repo, title, head, base, body string) (int, error) { return 0, nil } +func (f *fakeForge) PRState(ctx context.Context, owner, repo string, number int) (string, error) { return "", nil } +func (f *fakeForge) React(ctx context.Context, owner, repo string, number int, reaction string) error { return nil } +func (f *fakeForge) RepliesAfter(ctx context.Context, owner, repo string, number int, afterID int64, exclude string) ([]forge.Reply, error) { return nil, nil } +func (f *fakeForge) SetStateLabel(ctx context.Context, owner, repo string, number int, label string, known []string) {} +func (f *fakeForge) VerifyPush(ctx context.Context, owner, repo string) error { return nil } + +// TestStageCommitPushClosesIssueWhenBuildNoChanges verifies that +// StageCommitPush closes the issue with a comment when BuildNoChanges +// is true, instead of trying to commit and failing. +func TestStageCommitPushClosesIssueWhenBuildNoChanges(t *testing.T) { + f := &fakeForge{} + + stage := StageCommitPush(func(tc *TaskContext) string { + return "commit msg" + }) + + tc := &TaskContext{ + Forge: f, + BuildSummary: "already fixed", + BuildNoChanges: true, + Dir: "/tmp/test", + Branch: "archie/issue-1", + Task: &store.Task{ID: 1, Owner: "o", Repo: "r", IssueNumber: 1}, + } + + err := stage.Run(context.Background(), tc) + if err != nil { + t.Errorf("unexpected error: %v", err) + } + + if f.closed != 1 { + t.Errorf("expected CloseIssue to be called once, got %d", f.closed) + } else { + t.Log("CloseIssue called (no changes needed)") + } + + found := false + for _, c := range f.commented { + if strings.Contains(c, "no changes required") { + found = true + break + } + } + if !found { + t.Error("expected a comment about no changes required") + } +} diff --git a/internal/workflow/steps.go b/internal/workflow/steps.go index 9a9740a1b..bae3168ce 100644 --- a/internal/workflow/steps.go +++ b/internal/workflow/steps.go @@ -48,10 +48,19 @@ func StageCommit(name string, message func(*TaskContext) string) Stage { } // StageCommitPush commits everything in the worktree and pushes the -// branch; an empty tree parks (the workflow produced nothing). +// branch. When the builder completed with no changes (BuildNoChanges is +// set), the issue is already resolved — close it with a comment instead +// of erroring on an empty tree. func StageCommitPush(message func(*TaskContext) string) Stage { - commit := StageCommit("commit-push", message) return Stage{Name: "commit-push", Run: func(ctx context.Context, tc *TaskContext) error { + if tc.BuildNoChanges { + body := fmt.Sprintf("**archie closed this issue — no changes required.**\n\n%s", tc.BuildSummary) + if _, err := tc.Forge.Comment(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, body); err != nil { + tc.Log.Warn("no-op close comment failed", "err", err) + } + return tc.Forge.CloseIssue(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, "") + } + commit := StageCommit("commit-push", message) if err := commit.Run(ctx, tc); err != nil { return err } diff --git a/internal/workflow/workflow.go b/internal/workflow/workflow.go index 8484b46d3..3181e6bca 100644 --- a/internal/workflow/workflow.go +++ b/internal/workflow/workflow.go @@ -56,6 +56,10 @@ type TaskContext struct { Branch string // BuildSummary is the builder agent's finish summary — the PR body. BuildSummary string + // BuildNoChanges is set when the builder returned StatusPassed but + // made no file changes — the fix already exists or the issue is a + // no-op. StageCommitPush closes the issue instead of erroring. + BuildNoChanges bool // ReproProof is the captured failing-test output from a TDD repro // stage, posted on the PR as evidence the bug was reproduced. ReproProof string From 7ef92200327e27713ec007d7d200bd75a3c4081b Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 23 Jul 2026 17:43:15 +1000 Subject: [PATCH 6/6] fix: set Outcome on BuildNoChanges to stop workflow before open-pr --- internal/workflow/implement_test.go | 5 +++++ internal/workflow/steps.go | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/workflow/implement_test.go b/internal/workflow/implement_test.go index 5b88e4d7f..c5e6296f8 100644 --- a/internal/workflow/implement_test.go +++ b/internal/workflow/implement_test.go @@ -61,6 +61,11 @@ func TestStageCommitPushClosesIssueWhenBuildNoChanges(t *testing.T) { } else { t.Log("CloseIssue called (no changes needed)") } + if tc.Outcome.Status != store.StatusMerged { + t.Errorf("expected Outcome=Merged, got %s", tc.Outcome.Status) + } else { + t.Log("Outcome set to Merged (workflow stops)") + } found := false for _, c := range f.commented { diff --git a/internal/workflow/steps.go b/internal/workflow/steps.go index bae3168ce..c6cfd669a 100644 --- a/internal/workflow/steps.go +++ b/internal/workflow/steps.go @@ -58,7 +58,11 @@ func StageCommitPush(message func(*TaskContext) string) Stage { if _, err := tc.Forge.Comment(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, body); err != nil { tc.Log.Warn("no-op close comment failed", "err", err) } - return tc.Forge.CloseIssue(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, "") + if err := tc.Forge.CloseIssue(ctx, tc.Task.Owner, tc.Task.Repo, tc.Task.IssueNumber, ""); err != nil { + return err + } + tc.Outcome = Outcome{Status: store.StatusMerged, Detail: "closed — no changes required"} + return nil } commit := StageCommit("commit-push", message) if err := commit.Run(ctx, tc); err != nil {