headless pre-flight false-flags WRONG-REPO by judging against the host cwd #169

Closed
opened 2026-06-18 06:02:43 +00:00 by coilysiren · 1 comment
Owner

Bug: headless pre-flight false-flags WRONG-REPO by judging against the host cwd

ward agent <name> headless runs its pre-flight feasibility read as a host one-shot (goose run -t <prompt> / claude -p <prompt>) via Capture with no Dir set (cmd/ward/agent.go runPreflight, cmd/ward/container_compute.go hostPreflightArgv). So the read inherits the dispatch cwd.

The prompt (preflightPrompt, cmd/ward/agent.go) says "based only on the issue below", but a coding agent ignores that and walks the local working tree. When the issue's repo is not the dispatch cwd, the agent sees the wrong files and concludes WRONG-REPO - even though the real run fresh-clones the issue's repo inside the container.

Observed

ward#131 (a ward-kdl enhancement, correctly filed in the ward repo) was dispatched from a .../agentic-os cwd. The pre-flight goose read the agentic-os tree, saw cmd/ward-kdl/ missing, and returned NO-GO: WRONG-REPO - while its own reason named the ward repo, the repo the issue is already in. The tell: "flagged WRONG-REPO but named this same repo." No container launched; an otherwise-workable issue was stranded behind a false gate.

Fix - two independent levers in cmd/ward/agent.go

  1. Tell the prompt the truth about the clone. preflightPrompt already has ref.Owner/ref.Repo. Add a line stating the real run happens in a fresh clone of owner/repo, the host cwd is unrelated scratch, so judge feasibility from the issue text - not from whatever files are in the current directory. Kills the "ward-kdl is missing -> wrong repo" reasoning at the source.
  2. Belt-and-suspenders: run the pre-flight in a neutral dir. Set Dir on the pre-flight Capture to an empty temp dir so there is no misleading working tree to explore at all.

(1) alone fixes the reported case; (1)+(2) makes it structural.

Acceptance

  • A unit test asserting preflightPrompt names the clone repo (owner/repo) and instructs the agent not to judge from the local working tree.
  • Pre-flight Capture runs in a neutral/empty dir, not the dispatch cwd.
  • pre-commit run --all-files green; docs/agent.md pre-flight section updated to note the read is repo-text-only and runs outside the dispatch tree.

Origin: surfaced on ward#131's pre-flight NO-GO comment.

## Bug: headless pre-flight false-flags WRONG-REPO by judging against the host cwd `ward agent <name> headless` runs its pre-flight feasibility read as a host one-shot (`goose run -t <prompt>` / `claude -p <prompt>`) via `Capture` with **no `Dir` set** (`cmd/ward/agent.go` `runPreflight`, `cmd/ward/container_compute.go` `hostPreflightArgv`). So the read inherits the dispatch cwd. The prompt (`preflightPrompt`, `cmd/ward/agent.go`) says *"based only on the issue below"*, but a coding agent ignores that and walks the local working tree. When the issue's repo is **not** the dispatch cwd, the agent sees the wrong files and concludes WRONG-REPO - even though the real run fresh-clones the issue's repo inside the container. ### Observed ward#131 (a ward-kdl enhancement, correctly filed in the ward repo) was dispatched from a `.../agentic-os` cwd. The pre-flight goose read the agentic-os tree, saw `cmd/ward-kdl/` missing, and returned **NO-GO: WRONG-REPO** - while its own reason named the ward repo, the repo the issue is already in. The tell: "flagged WRONG-REPO but named this same repo." No container launched; an otherwise-workable issue was stranded behind a false gate. ### Fix - two independent levers in `cmd/ward/agent.go` 1. **Tell the prompt the truth about the clone.** `preflightPrompt` already has `ref.Owner/ref.Repo`. Add a line stating the real run happens in a fresh clone of `owner/repo`, the host cwd is unrelated scratch, so judge feasibility from the issue text - not from whatever files are in the current directory. Kills the "ward-kdl is missing -> wrong repo" reasoning at the source. 2. **Belt-and-suspenders: run the pre-flight in a neutral dir.** Set `Dir` on the pre-flight `Capture` to an empty temp dir so there is no misleading working tree to explore at all. (1) alone fixes the reported case; (1)+(2) makes it structural. ### Acceptance - A unit test asserting `preflightPrompt` names the clone repo (`owner/repo`) and instructs the agent not to judge from the local working tree. - Pre-flight `Capture` runs in a neutral/empty dir, not the dispatch cwd. - `pre-commit run --all-files` green; docs/agent.md pre-flight section updated to note the read is repo-text-only and runs outside the dispatch tree. Origin: surfaced on ward#131's pre-flight NO-GO comment.
Author
Owner

🔒 Reserved by ward agent claude — container ward-ward-issue-169-claude-6ea8815f on host kais-macbook-pro.local is carrying this issue (reserved 2026-06-18T06:02:58Z). Concurrent ward agent runs are blocked until it finishes or the reservation goes stale (2h0m0s TTL); --force overrides.

— Claude (she/her), via ward agent

<!-- ward-agent-reservation --> 🔒 Reserved by `ward agent claude` — container `ward-ward-issue-169-claude-6ea8815f` on host `kais-macbook-pro.local` is carrying this issue (reserved 2026-06-18T06:02:58Z). Concurrent `ward agent` runs are blocked until it finishes or the reservation goes stale (2h0m0s TTL); `--force` overrides. <!-- ward-agent-signature --> — Claude (she/her), via `ward agent`
coilysiren 2026-06-18 06:13:01 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/ward#169
No description provided.