## Summary
Wave 18 continues the package code-organization program after wave 17
domain folders (U4 Slice A from
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`).
### What changed
Peel **pure, behavior-preserving** helpers out of
`packages/engine/src/executor.ts` into domain modules under
`packages/engine/src/executor/`, with **stable re-exports** from
`executor.ts` so deep imports and `vi.mock("../executor.js")` keep
working.
| New module | Symbols |
|------------|---------|
| `executor/task-done-refusal.ts` | `evaluateTaskDoneRefusal`,
`determineRevisionResetStart`, skip-bypass refusal helper |
| `executor/workflow-feedback-paths.ts` |
`extractReferencedPathsFromWorkflowFeedback`,
`isAlwaysAllowedScopeLeakPath`, `workflowPathMatchesDeclaredScope` |
| `executor/workflow-step-verdict.ts` |
`FUSION_WORKFLOW_STEP_CONVENTIONS_PREAMBLE`, `parseWorkflowStepVerdict`
/ `parseWorkflowStepOutput`, step outcome types |
| `executor/await-input-parse.ts` | `parseAwaitInputSentinel`,
`parseAwaitInputQuestionToolCall` |
| `executor/no-commit-eligibility.ts` | `getNoCommitEligibilityReason`
(+ prompt heuristics) |
`executor.ts` live LOC ~**22817 → ~22427** (first pure-peel batch; more
peels needed to approach the 2k cap).
### Shims
- `old path` `executor.ts` public exports → `new path` `executor/*.ts` →
delete-when consumer deep-imports are re-pointed (not this PR)
### Test plan
- [x] `@fusion/engine` typecheck
- [x] Oracle: task-done refusal, skip-bypass, workflow malformed
verdict, scope-leak allowlist, executor-step-session, executor-prompt
- [x] `vitest --project=engine-core` (merge-gate curated suite)
- [ ] CI merge gate
**Stack:** wave17 (merged) → **this PR**
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Improved recognition of workflow outcomes from structured and
conversational responses.
* Added support for extracting questions from await-input responses and
tool calls.
* Improved workflow feedback handling for referenced files and declared
scope patterns.
* Added clearer guidance for task execution, approvals, verification,
and available tools.
* **Bug Fixes**
* Prevented completion when required review approvals are missing or
revisions remain pending.
* Improved handling of workflows that legitimately require no code
changes.
* Added clearer refusal messages and more reliable revision restarts.
* Sanitized repository paths in Git remediation instructions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
90 lines
3.1 KiB
TypeScript
90 lines
3.1 KiB
TypeScript
/**
|
|
* FNXC:CodeOrganization 2026-08-03-18:40:
|
|
* runExecutorDeterministicVerification peeled from TaskExecutor (U4).
|
|
* Runs configured testCommand + buildCommand in the task worktree.
|
|
*
|
|
* FNXC:EngineDiagnostics 2026-07-26-09:33:
|
|
* Green path verification start/pass is expected work — debug so failures stay prominent.
|
|
*/
|
|
import type { Settings, Task, TaskStore } from "@fusion/core";
|
|
import {
|
|
runVerificationCommand,
|
|
type VerificationResult,
|
|
} from "../execution/verification-utils.js";
|
|
import { executorLog } from "../logger.js";
|
|
import type { EngineRunContext } from "../util/run-audit.js";
|
|
|
|
export type DeterministicVerificationDeps = {
|
|
store: TaskStore;
|
|
getRunContextFor: (taskId: string) => EngineRunContext | undefined;
|
|
};
|
|
|
|
export async function runExecutorDeterministicVerification(
|
|
deps: DeterministicVerificationDeps,
|
|
task: Task,
|
|
worktreePath: string,
|
|
settings: Settings,
|
|
extraEnv?: NodeJS.ProcessEnv,
|
|
): Promise<VerificationResult> {
|
|
const testCommand = settings.testCommand?.trim();
|
|
const buildCommand = settings.buildCommand?.trim();
|
|
|
|
if (!testCommand && !buildCommand) {
|
|
executorLog.debug(`${task.id}: no test/build commands configured — skipping verification`);
|
|
return { allPassed: true };
|
|
}
|
|
|
|
const parts: string[] = [];
|
|
if (testCommand) parts.push(`test: ${testCommand}`);
|
|
if (buildCommand) parts.push(`build: ${buildCommand}`);
|
|
// FNXC:EngineDiagnostics 2026-07-26-09:33: green path verification start/pass is expected work — debug so failures stay prominent.
|
|
executorLog.debug(`${task.id}: [verification] running deterministic verification (${parts.join(", ")})`);
|
|
await deps.store.logEntry(
|
|
task.id,
|
|
`[verification] Running deterministic verification (${parts.join(", ")})`,
|
|
undefined,
|
|
deps.getRunContextFor(task.id),
|
|
);
|
|
|
|
const result: VerificationResult = { allPassed: true };
|
|
|
|
// Run test command first if configured
|
|
if (testCommand) {
|
|
const testResult = await runVerificationCommand(
|
|
deps.store, worktreePath, task.id, testCommand, "test", undefined, executorLog, "executor", extraEnv, settings.verificationCommandTimeoutMs,
|
|
);
|
|
result.testResult = testResult;
|
|
|
|
if (!testResult.success) {
|
|
result.allPassed = false;
|
|
result.failedCommand = "testCommand";
|
|
executorLog.log(`${task.id}: [verification] test failed (exit ${testResult.exitCode})`);
|
|
return result;
|
|
}
|
|
}
|
|
|
|
// Run build command second if configured
|
|
if (buildCommand) {
|
|
const buildResult = await runVerificationCommand(
|
|
deps.store, worktreePath, task.id, buildCommand, "build", undefined, executorLog, "executor", extraEnv, settings.verificationCommandTimeoutMs,
|
|
);
|
|
result.buildResult = buildResult;
|
|
|
|
if (!buildResult.success) {
|
|
result.allPassed = false;
|
|
result.failedCommand = "buildCommand";
|
|
executorLog.log(`${task.id}: [verification] build failed (exit ${buildResult.exitCode})`);
|
|
return result;
|
|
}
|
|
}
|
|
|
|
executorLog.debug(`${task.id}: [verification] passed`);
|
|
await deps.store.logEntry(
|
|
task.id,
|
|
`[verification] Deterministic verification passed`,
|
|
undefined,
|
|
deps.getRunContextFor(task.id),
|
|
);
|
|
return result;
|
|
}
|