Keep the launch dump out of the session's git status
The .orchestra directory showed up as untracked work in the very worktree whose own launch context said "uncommitted changes: false". It would have polluted the quality gate, the review diff, and the agent's reading of git status. A .gitignore of "*" inside the directory ignores it including itself. The worker's done marker lives there too and had the same problem. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package herdr
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -98,3 +99,29 @@ func TestTmuxSessionNameKeepsCollisionResistantSuffix(t *testing.T) {
|
||||
t.Fatalf("unsafe tmux session names %q %q", a, b)
|
||||
}
|
||||
}
|
||||
|
||||
// The launch dump is Orchestra's scratch space, not the session's work. A
|
||||
// worktree that starts dirty pollutes the gate, the review diff, and the
|
||||
// agent's own reading of `git status`.
|
||||
func TestWriteLaunchContextLeavesTheWorktreeClean(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
for _, args := range [][]string{{"init"}, {"config", "user.email", "t@t"}, {"config", "user.name", "t"}, {"commit", "--allow-empty", "-m", "init"}} {
|
||||
if out, err := exec.Command("git", append([]string{"-C", dir}, args...)...).CombinedOutput(); err != nil {
|
||||
t.Fatalf("git %v: %v: %s", args, err, out)
|
||||
}
|
||||
}
|
||||
if err := WriteLaunchContext(dir, "the instruction"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, err := os.ReadFile(filepath.Join(dir, LaunchContextFile))
|
||||
if err != nil || string(b) != "the instruction" {
|
||||
t.Fatalf("launch context = %q, err %v", b, err)
|
||||
}
|
||||
out, err := exec.Command("git", "-C", dir, "status", "--short").CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if strings.TrimSpace(string(out)) != "" {
|
||||
t.Fatalf("worktree is dirty after a launch dump:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user