fix: require green tests build and typecheck across task scope
This commit is contained in:
@@ -1945,6 +1945,18 @@ describe("buildExecutionPrompt", () => {
|
||||
expect(result).toContain("- **Build:** `pnpm build`");
|
||||
});
|
||||
|
||||
it("tells executors to fix quality-gate failures even outside initial file scope", () => {
|
||||
const task = createMockTaskDetail();
|
||||
const result = buildExecutionPrompt(task, "/home/user/project", {
|
||||
testCommand: "pnpm test",
|
||||
buildCommand: "pnpm build",
|
||||
} as any);
|
||||
|
||||
expect(result).toContain("fix failures even when that requires edits outside the original File Scope");
|
||||
expect(result).toContain("If the repo has a typecheck command, run it before `task_done()`");
|
||||
expect(result).toContain("not for fixes required to get tests, build, or typecheck back to green");
|
||||
});
|
||||
|
||||
it("omits Project Commands section when neither command is set", () => {
|
||||
const task = createMockTaskDetail();
|
||||
const result = buildExecutionPrompt(task, "/home/user/project", {} as any);
|
||||
|
||||
@@ -158,10 +158,11 @@ model, read-only access) to independently assess your work.
|
||||
- Do NOT commit broken or half-implemented code
|
||||
|
||||
## Guardrails
|
||||
- Stay within the file scope defined in PROMPT.md
|
||||
- Treat the File Scope in PROMPT.md as the expected starting scope, not a hard boundary when quality gates fail
|
||||
- Read "Context to Read First" files before starting
|
||||
- Follow the "Do NOT" section strictly
|
||||
- If you find work outside the task's scope, use \`task_create\`
|
||||
- If tests, build, or typecheck fail and the fix requires touching code outside the declared File Scope, fix those failures directly and keep the repo green
|
||||
- Use \`task_create\` for genuinely separate follow-up work, not for mandatory fixes required to make this task land cleanly
|
||||
- Update documentation listed in "Must Update" and check "Check If Affected"
|
||||
- NEVER delete, remove, or gut modules, interfaces, settings, exports, or test files outside your File Scope
|
||||
- NEVER remove features as "cleanup" — if something seems unused, create a task for investigation instead
|
||||
@@ -197,7 +198,7 @@ spawn_agent({
|
||||
- Max 20 total spawned agents system-wide (configurable via settings)
|
||||
|
||||
## Completion
|
||||
After all steps are done, tests pass, and docs are updated:
|
||||
After all steps are done, tests pass, typecheck passes, and docs are updated:
|
||||
\`\`\`bash
|
||||
Call \`task_done()\` to signal completion.
|
||||
\`\`\`
|
||||
@@ -205,7 +206,12 @@ Call \`task_done()\` to signal completion.
|
||||
If a project build command is listed in the prompt, it is a hard completion gate:
|
||||
- Run the exact build command in the current worktree before \`task_done()\`
|
||||
- Do not claim the build passes unless you actually ran it and got exit code 0
|
||||
- If the build fails, do NOT call \`task_done()\`; keep working until it passes`;
|
||||
- If the build fails, do NOT call \`task_done()\`; keep working until it passes
|
||||
|
||||
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`;
|
||||
|
||||
export interface TaskExecutorOptions {
|
||||
semaphore?: AgentSemaphore;
|
||||
@@ -2815,12 +2821,14 @@ ${hasProgress
|
||||
: "Start with Step 0 (Preflight). Work through each step in order."}
|
||||
Use \`task_update\` to report progress on every step transition.
|
||||
Use \`task_log\` for important actions and decisions.
|
||||
Use \`task_create\` if you find out-of-scope work that needs doing.
|
||||
Use \`task_create\` for truly separate follow-up work, not for fixes required to get tests, build, or typecheck back to green.
|
||||
Commit at step boundaries: \`git commit -m "feat(${task.id}): complete Step N — description"\`
|
||||
When all steps are complete: call \`task_done()\`
|
||||
|
||||
If a build command is configured, run that exact command in this worktree before calling \`task_done()\`.
|
||||
Treat a non-zero exit code as a blocking failure. Do not claim success without a real passing run.`;
|
||||
Treat a non-zero exit code as a blocking failure. Do not claim success without a real passing run.
|
||||
Run the configured/full test suite and fix failures even when that requires edits outside the original File Scope.
|
||||
If the repo has a typecheck command, run it before \`task_done()\` and fix any failures it reports.`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,6 +48,7 @@ access to the codebase and can run commands to inspect code.
|
||||
### Do NOT issue REVISE for
|
||||
- STATUS/formatting preferences
|
||||
- Splitting outcome checkboxes into implementation sub-steps
|
||||
- Necessary fixes outside the initial File Scope when they are required to restore green tests, build, or typecheck and do not delete/gut unrelated functionality
|
||||
- Suggestions that improve quality but aren't required for correctness
|
||||
|
||||
## Plan Review Format
|
||||
|
||||
@@ -262,6 +262,16 @@ describe("buildSpecificationPrompt", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("TRIAGE_SYSTEM_PROMPT", () => {
|
||||
it("requires specs to keep tests, build, and typecheck green even outside initial file scope", () => {
|
||||
expect(TRIAGE_SYSTEM_PROMPT).toContain("If keeping tests/build/typecheck green requires edits outside the initial File Scope");
|
||||
expect(TRIAGE_SYSTEM_PROMPT).toContain("Run project typecheck if available");
|
||||
expect(TRIAGE_SYSTEM_PROMPT).toContain("Typecheck passing (if available)");
|
||||
expect(TRIAGE_SYSTEM_PROMPT).toContain("Specs must instruct executors to fix quality-gate failures directly");
|
||||
expect(TRIAGE_SYSTEM_PROMPT).toContain("Refuse necessary fixes just because they touch files outside the initial File Scope");
|
||||
});
|
||||
});
|
||||
|
||||
describe("TRIAGE_SYSTEM_PROMPT", () => {
|
||||
it("includes proactive M/L subtask breakdown guidance", () => {
|
||||
expect(TRIAGE_SYSTEM_PROMPT).toContain(
|
||||
|
||||
@@ -91,8 +91,10 @@ Follow this structure exactly:
|
||||
### Step {N-1}: Testing & Verification
|
||||
|
||||
> ZERO test failures allowed. Full test suite as quality gate.
|
||||
> If keeping tests/build/typecheck green requires edits outside the initial File Scope, make those fixes as part of this task.
|
||||
|
||||
- [ ] Run full test suite
|
||||
- [ ] Run project typecheck if available
|
||||
- [ ] Fix all failures
|
||||
- [ ] Build passes
|
||||
|
||||
@@ -113,6 +115,7 @@ Follow this structure exactly:
|
||||
|
||||
- [ ] All steps complete
|
||||
- [ ] All tests passing
|
||||
- [ ] Typecheck passing (if available)
|
||||
- [ ] Documentation updated
|
||||
|
||||
## Git Commit Convention
|
||||
@@ -127,7 +130,7 @@ Commits at step boundaries. All commits include the task ID:
|
||||
|
||||
- Expand task scope
|
||||
- Skip tests
|
||||
- Modify files outside the File Scope without good reason
|
||||
- Refuse necessary fixes just because they touch files outside the initial File Scope
|
||||
- Commit without the task ID prefix
|
||||
- Remove, delete, or gut modules, settings, interfaces, exports, or test files outside the File Scope
|
||||
- Remove features as "cleanup" — if something seems unused, create a task via \`task_create\`
|
||||
@@ -147,6 +150,8 @@ tests. Manual verification is NOT a test.
|
||||
|
||||
- Each implementation step should include writing tests for the code being changed
|
||||
- The final Testing step runs the FULL test suite
|
||||
- The final Testing step also runs project typecheck when the repo exposes one
|
||||
- Specs must instruct executors to fix quality-gate failures directly, even when the required edits extend beyond the original File Scope
|
||||
- If the project has no test framework, the Testing step must include setting one up
|
||||
as part of this task (not just skipping tests)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user