## 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 -->
47 lines
1.8 KiB
TypeScript
47 lines
1.8 KiB
TypeScript
/**
|
|
* FNXC:CodeOrganization 2026-08-03-19:10:
|
|
* clearStalePauseAbortBeforeDispatch + clearPauseAbortStateForManualRetry peeled from TaskExecutor (U4).
|
|
*
|
|
* FNXC:WorkflowLifecycle 2026-06-29-10:35:
|
|
* A stale pause-abort marker must not survive into a fresh unpaused dispatch.
|
|
* FN-7225/FN-7226 showed graph-owned execution failures being narrated as
|
|
* pause/resume cleanup even though the task row was not paused. Clear the
|
|
* volatile marker silently at dispatch entry so the task log names the real
|
|
* workflow failure (`step-execute`, parse, review, etc.) instead of implying
|
|
* the engine actually paused.
|
|
*
|
|
* FNXC:ManualRetry 2026-06-29-00:57:
|
|
* User retry is a fresh execution boundary. Clear volatile pause-abort provenance so retries cannot inherit stale engine pause/resume classification from a prior run.
|
|
*/
|
|
import type { Task, TaskStore } from "@fusion/core";
|
|
import { executorLog } from "../logger.js";
|
|
|
|
export type StalePauseAbortDeps = {
|
|
store: TaskStore;
|
|
hasPausedAborted: (taskId: string) => boolean;
|
|
clearPausedAborted: (taskId: string) => void;
|
|
};
|
|
|
|
export async function clearStalePauseAbortBeforeDispatch(
|
|
deps: StalePauseAbortDeps,
|
|
task: Task,
|
|
): Promise<void> {
|
|
if (!deps.hasPausedAborted(task.id)) return;
|
|
let globalPause = false;
|
|
try {
|
|
globalPause = (await deps.store.getSettings()).globalPause === true;
|
|
} catch {
|
|
globalPause = false;
|
|
}
|
|
if (task.paused === true || task.userPaused === true || globalPause) return;
|
|
deps.clearPausedAborted(task.id);
|
|
executorLog.log(`${task.id}: cleared stale pause-abort marker before unpaused execution dispatch`);
|
|
}
|
|
|
|
export function clearPauseAbortStateForManualRetry(
|
|
deps: Pick<StalePauseAbortDeps, "clearPausedAborted">,
|
|
taskId: string,
|
|
): void {
|
|
deps.clearPausedAborted(taskId);
|
|
}
|