feat(FN-1429): enforce always-green test-suite instructions for executor agents

- Add explicit always-green test suite instructions to executor agent prompts
- Update executor to enforce test-suite validation before task completion
- Add tests for agent prompt generation and executor behavior
- Ensure test failures block merge-ready state rather than allowing broken builds
This commit is contained in:
gsxdsm
2026-04-09 19:33:44 -07:00
parent e1cd7e0876
commit 7bd98d888c
5 changed files with 61 additions and 4 deletions

View File

@@ -123,6 +123,27 @@ describe("resolveAgentPrompt", () => {
const result = resolveAgentPrompt("executor", config);
expect(result).toContain("task execution agent");
});
it("built-in executor prompt requires resolving ALL test failures including unrelated", () => {
const result = resolveAgentPrompt("executor");
// The stricter language must be present to prevent "unrelated failure" deferrals
expect(result).toContain("Resolve ALL test failures");
expect(result).toContain("even if they appear unrelated or pre-existing");
expect(result).toContain("do not defer them to a separate task");
});
it("senior-engineer prompt requires resolving ALL test failures including unrelated", () => {
const config: AgentPromptsConfig = {
roleAssignments: {
executor: "senior-engineer",
},
};
const result = resolveAgentPrompt("executor", config);
expect(result).toContain("Resolve ALL test failures");
expect(result).toContain("even if they appear unrelated or pre-existing");
expect(result).toContain("do not defer them to a separate task");
});
});
// ---------------------------------------------------------------------------

View File

@@ -141,7 +141,8 @@ If a project build command is listed in the prompt, it is a hard completion gate
Tests and typecheck are also hard quality gates:
- Keep fixing failures until the configured/full test suite passes
- If the repository exposes a typecheck command, run it and keep fixing failures until it passes
- Do not stop at "out of scope" if additional fixes are required to restore green tests, build, or typecheck`;
- Do not stop at "out of scope" if additional fixes are required to restore green tests, build, or typecheck
- **CRITICAL: Resolve ALL test failures before completing the task, even if they appear unrelated or pre-existing.** Unrelated failures left unfixed accumulate technical debt and block future integrations. Investigate and fix or suppress them — do not defer them to a separate task.`;
const TRIAGE_PROMPT_TEXT = `You are a task specification agent for "fn", an AI-orchestrated task board.
@@ -494,7 +495,8 @@ Call \`task_done()\` to signal completion.
\`\`\`
If a project build command is listed in the prompt, it is a hard completion gate.
Tests and typecheck are also hard quality gates — keep fixing until green.`;
Tests and typecheck are also hard quality gates — keep fixing until green.
**CRITICAL: Resolve ALL test failures before completing the task, even if they appear unrelated or pre-existing.** Unrelated failures left unfixed accumulate technical debt and block future integrations. Investigate and fix or suppress them — do not defer them to a separate task.`;
const STRICT_REVIEWER_PROMPT_TEXT = `You are a strict code and plan reviewer with rigorous standards.