From e4f94eaaab3919ff3486de1ad48b8c187a9d94ea Mon Sep 17 00:00:00 2001 From: Snider Date: Sat, 21 Mar 2026 16:36:26 +0000 Subject: [PATCH] fix: address Codex round 4 findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit High: Codex review now sets working directory (was missing) Medium: harvest skip-branch check uses defaultBranch() not just "main" Medium: dry_run reads PROMPT.md from src/ (was reading wrong path) Low: agent prompt says "current directory" not "parent directory" Low: queue prompt matches dispatch prompt Finding 1 (inbox messages vs data) verified as false positive — API returns {messages:[...]}, confirmed against live endpoint. Co-Authored-By: Virgil --- pkg/agentic/dispatch.go | 4 ++-- pkg/agentic/queue.go | 2 +- pkg/agentic/review_queue.go | 4 +++- pkg/monitor/harvest.go | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/agentic/dispatch.go b/pkg/agentic/dispatch.go index 1a0783c..fd96521 100644 --- a/pkg/agentic/dispatch.go +++ b/pkg/agentic/dispatch.go @@ -246,11 +246,11 @@ func (s *PrepSubsystem) dispatch(ctx context.Context, req *mcp.CallToolRequest, srcDir := filepath.Join(wsDir, "src") // The prompt is just: read PROMPT.md and do the work - prompt := "Read PROMPT.md for instructions. All context files (CLAUDE.md, TODO.md, CONTEXT.md, CONSUMERS.md, RECENT.md) are in the parent directory. Work in this directory." + prompt := "Read PROMPT.md for instructions. All context files (CLAUDE.md, TODO.md, CONTEXT.md, CONSUMERS.md, RECENT.md) are in the current directory. Work in this directory." if input.DryRun { // Read PROMPT.md for the dry run output - promptContent, _ := coreio.Local.Read(filepath.Join(wsDir, "PROMPT.md")) + promptContent, _ := coreio.Local.Read(filepath.Join(srcDir, "PROMPT.md")) return nil, DispatchOutput{ Success: true, Agent: input.Agent, diff --git a/pkg/agentic/queue.go b/pkg/agentic/queue.go index b88d88c..c990024 100644 --- a/pkg/agentic/queue.go +++ b/pkg/agentic/queue.go @@ -190,7 +190,7 @@ func (s *PrepSubsystem) drainQueue() { } srcDir := filepath.Join(wsDir, "src") - prompt := "Read PROMPT.md for instructions. All context files (CLAUDE.md, TODO.md, CONTEXT.md, CONSUMERS.md, RECENT.md) are in the parent directory. Work in this directory." + prompt := "Read PROMPT.md for instructions. All context files (CLAUDE.md, TODO.md, CONTEXT.md, CONSUMERS.md, RECENT.md) are in the current directory. Work in this directory." pid, _, err := s.spawnAgent(st.Agent, prompt, wsDir, srcDir) if err != nil { diff --git a/pkg/agentic/review_queue.go b/pkg/agentic/review_queue.go index 576bae9..013abc5 100644 --- a/pkg/agentic/review_queue.go +++ b/pkg/agentic/review_queue.go @@ -312,7 +312,9 @@ func parseRetryAfter(message string) time.Duration { func (s *PrepSubsystem) buildReviewCommand(ctx context.Context, repoDir, reviewer string) *exec.Cmd { switch reviewer { case "codex": - return exec.CommandContext(ctx, "codex", "review", "--base", "github/main") + cmd := exec.CommandContext(ctx, "codex", "review", "--base", "github/main") + cmd.Dir = repoDir + return cmd default: // coderabbit return exec.CommandContext(ctx, "coderabbit", "review", "--plain", "--base", "github/main", "--config", "CLAUDE.md", "--cwd", repoDir) diff --git a/pkg/monitor/harvest.go b/pkg/monitor/harvest.go index 2ab5dd7..df04e8b 100644 --- a/pkg/monitor/harvest.go +++ b/pkg/monitor/harvest.go @@ -110,7 +110,8 @@ func (m *Subsystem) harvestWorkspace(wsDir string) *harvestResult { if branch == "" { branch = detectBranch(srcDir) } - if branch == "" || branch == "main" { + base := defaultBranch(srcDir) + if branch == "" || branch == base { return nil }