Context
A commit/PR lane on 2026-07-01 hit a concrete preflight-contract surprise: plain npm run agent-preflight mutated touched files by running check-block-alignment --fix, even though the operator mental model and the command name read like a preflight check. That mutation was not unsafe, but it created extra diff-review and staging cost while trying to prove that a PR was already ready.
Verify-before-assert evidence:
package.json defines agent-preflight as node ./buildScripts/util/agent-preflight.mjs.
buildScripts/util/agent-preflight.mjs exposes .option('--no-fix', 'Skip the check-block-alignment --fix pass.').
- The default path calls
check-block-alignment.mjs --fix when options.fix is true, then calls check-block-alignment.mjs --staged.
.agents/skills/pull-request/references/pull-request-workflow.md tells authors to run npm run agent-preflight -- [files...], but does not mention the mutating default or the --no-fix check-only mode.
- Live latest-open sweep: checked latest 20 open issues at 2026-07-01T17:42:49Z; no equivalent open ticket found.
- Duplicate sweep: checked GitHub searches for
agent-preflight check-block-alignment no-fix mutates files, repo resources/content / resources/content/issues / resources/content/discussions, and Neo Knowledge Base ticket search. Closest prior is closed #13813, which created the standalone preflight bundle; no open duplicate covers surfacing --no-fix or separating check-only semantics.
- A2A in-flight sweep: checked latest 30 messages; no overlapping
[lane-claim] or [lane-intent] for this scope.
The Problem
agent-preflight currently mixes two distinct operator intents behind one default command:
- Repair mode: normalize block alignment before commit, accepting mechanical edits.
- Check-only mode: prove that the staged/worktree state is ready without modifying it.
Both modes are useful. The problem is discoverability and contract clarity. A command named "preflight" and documented in the PR workflow as a gate reads like a validation step. When it silently performs a formatting write first, an author can misclassify the resulting diff as new logical drift, restage more files than expected, or spend time manually undoing/reapplying formatting that the hook would have required anyway.
This also obscures which command should be used in different moments:
- Before polishing a branch: mutating repair is fine.
- Before validating a PR body or post-rebase state: check-only is often the safer mental model.
- In docs/skills: agents need the mode split explicitly, because they execute commands literally and report evidence from command names.
The Architectural Reality
The substrate already has most of the machinery:
buildScripts/util/agent-preflight.mjs owns the bundled author preflight surface.
check-block-alignment.mjs already has explicit check and --fix modes.
agent-preflight already exposes --no-fix; the missing piece is command-contract surfacing and tests/docs that keep the mode split intentional.
pull-request-workflow.md is the main consumer-facing authority that tells agents when to run the command.
This is not a request to remove auto-fix. The existing repair default may remain correct, but the workflow must make it explicit and provide a check-only recipe at validation boundaries.
The Fix
Make the agent-preflight repair-vs-check contract explicit and mechanically covered.
Possible implementation shape:
- Update
agent-preflight CLI help/output so mutating mode is obvious, e.g. command description or startup line names check-block-alignment --fix when active and names --no-fix as check-only.
- Update the PR workflow to distinguish repair preflight from final validation preflight, with examples for:
npm run agent-preflight -- <files> when the author wants auto-fix repair.
npm run agent-preflight -- --no-fix <files> when the author wants a non-mutating validation pass.
npm run agent-preflight -- --pr-body <draft.md> for PR-body-only lint where no source gates are in scope.
- Add or adjust unit coverage for
agent-preflight argument parsing / run orchestration so --no-fix skips the check-block-alignment --fix gate while still running the staged/check gate.
Contract Ledger Matrix
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
npm run agent-preflight -- <files> |
package.json, buildScripts/util/agent-preflight.mjs |
Clearly advertised as repair-capable; may run check-block-alignment --fix |
If repair fails, report the failing gate and leave normal command failure |
pull-request-workflow.md |
Unit/orchestration test plus command output/help assertion |
npm run agent-preflight -- --no-fix <files> |
agent-preflight Commander option |
Check-only mode skips check-block-alignment --fix and still runs non-mutating gates |
If drift exists, fail with the check gate and a repair hint |
pull-request-workflow.md |
Unit/orchestration test proving --fix is not invoked |
| PR workflow preflight guidance |
.agents/skills/pull-request/references/pull-request-workflow.md |
Authors can choose repair vs validation mode intentionally |
Existing default command remains available |
same file |
Skill/workflow text update plus local agent-preflight evidence |
Decision Record impact
none. This is developer/agent workflow clarity around an existing build-script surface.
Acceptance Criteria
Out of Scope
- Replacing
check-block-alignment with another formatter.
- Removing the default repair behavior without a separate architecture decision.
- Changing husky/lint-staged pre-commit behavior.
- Broad PR-review or lifecycle workflow rewrites.
Related
- #13813 — closed predecessor that created the standalone preflight bundle.
- #13720 — closed staged-scope block-alignment hook work.
- #14212 — closed block-alignment overreach/regression work.
buildScripts/util/agent-preflight.mjs
buildScripts/util/check-block-alignment.mjs
.agents/skills/pull-request/references/pull-request-workflow.md
Origin Session ID: c0dfa949-22de-4daf-bbd2-1e093383fefc
Handoff Retrieval Hint: "agent-preflight no-fix check-only default mutates check-block-alignment --fix PR workflow"
Context
A commit/PR lane on 2026-07-01 hit a concrete preflight-contract surprise: plain
npm run agent-preflightmutated touched files by runningcheck-block-alignment --fix, even though the operator mental model and the command name read like a preflight check. That mutation was not unsafe, but it created extra diff-review and staging cost while trying to prove that a PR was already ready.Verify-before-assert evidence:
package.jsondefinesagent-preflightasnode ./buildScripts/util/agent-preflight.mjs.buildScripts/util/agent-preflight.mjsexposes.option('--no-fix', 'Skip the check-block-alignment --fix pass.').check-block-alignment.mjs --fixwhenoptions.fixis true, then callscheck-block-alignment.mjs --staged..agents/skills/pull-request/references/pull-request-workflow.mdtells authors to runnpm run agent-preflight -- [files...], but does not mention the mutating default or the--no-fixcheck-only mode.agent-preflight check-block-alignment no-fix mutates files, reporesources/content/resources/content/issues/resources/content/discussions, and Neo Knowledge Base ticket search. Closest prior is closed #13813, which created the standalone preflight bundle; no open duplicate covers surfacing--no-fixor separating check-only semantics.[lane-claim]or[lane-intent]for this scope.The Problem
agent-preflightcurrently mixes two distinct operator intents behind one default command:Both modes are useful. The problem is discoverability and contract clarity. A command named "preflight" and documented in the PR workflow as a gate reads like a validation step. When it silently performs a formatting write first, an author can misclassify the resulting diff as new logical drift, restage more files than expected, or spend time manually undoing/reapplying formatting that the hook would have required anyway.
This also obscures which command should be used in different moments:
The Architectural Reality
The substrate already has most of the machinery:
buildScripts/util/agent-preflight.mjsowns the bundled author preflight surface.check-block-alignment.mjsalready has explicit check and--fixmodes.agent-preflightalready exposes--no-fix; the missing piece is command-contract surfacing and tests/docs that keep the mode split intentional.pull-request-workflow.mdis the main consumer-facing authority that tells agents when to run the command.This is not a request to remove auto-fix. The existing repair default may remain correct, but the workflow must make it explicit and provide a check-only recipe at validation boundaries.
The Fix
Make the
agent-preflightrepair-vs-check contract explicit and mechanically covered.Possible implementation shape:
agent-preflightCLI help/output so mutating mode is obvious, e.g. command description or startup line namescheck-block-alignment --fixwhen active and names--no-fixas check-only.npm run agent-preflight -- <files>when the author wants auto-fix repair.npm run agent-preflight -- --no-fix <files>when the author wants a non-mutating validation pass.npm run agent-preflight -- --pr-body <draft.md>for PR-body-only lint where no source gates are in scope.agent-preflightargument parsing / run orchestration so--no-fixskips thecheck-block-alignment --fixgate while still running the staged/check gate.Contract Ledger Matrix
npm run agent-preflight -- <files>package.json,buildScripts/util/agent-preflight.mjscheck-block-alignment --fixpull-request-workflow.mdnpm run agent-preflight -- --no-fix <files>agent-preflightCommander optioncheck-block-alignment --fixand still runs non-mutating gatespull-request-workflow.md--fixis not invoked.agents/skills/pull-request/references/pull-request-workflow.mdagent-preflightevidenceDecision Record impact
none. This is developer/agent workflow clarity around an existing build-script surface.
Acceptance Criteria
agent-preflight --helpor command output makes the default mutating alignment-repair behavior discoverable.--no-fixcheck-only mode.--no-fixdoes not invokecheck-block-alignment --fix.Out of Scope
check-block-alignmentwith another formatter.Related
buildScripts/util/agent-preflight.mjsbuildScripts/util/check-block-alignment.mjs.agents/skills/pull-request/references/pull-request-workflow.mdOrigin Session ID: c0dfa949-22de-4daf-bbd2-1e093383fefc
Handoff Retrieval Hint: "agent-preflight no-fix check-only default mutates check-block-alignment --fix PR workflow"