Repository navigation
Description
Problem or Motivation
The implement Job makes its docs commit and its archive commit through _commit_if_changed (src/devops_cli/roadmap/implement/implement_run.py), and no hook runs on them. Its step commits run the commit stage (commit_stage in src/devops_cli/roadmap/implement/implement_hooks.py). A hygiene problem in a generated or archived file thus reaches the pull request with no local check.
Proposed Solution & Architectural Design
In _commit_if_changed, when self._hooks_config() gives a config, call commit_stage(self.path, config) before git commit. When a fixer changes files, stage them and run the stage once more, as the step commit does. The archive commit also runs the openspec gate through its path filter.
wip: commits do not change. The fixers would change files while the agent edits them, and #4713 sends wip commits to a branch with no pull request.
Target Subsystem
Roadmap Automation & Planning (src/devops_cli/roadmap/implement/).
Existing Tool Considered
pre-commit, with the trusted config of main that is already in the runner image. The change reuses commit_stage. Cost (estimate): about 80,000 tokens and 2 hours to build, near 0 to keep.
Acceptance Criteria
Tests:
- A docs commit with trailing whitespace in a generated file is committed with the fix.
- A hook that fails two times stops the item and shows the hook output.
On 2 CPUs, the archive commit takes at most 20 s more (13.2 s measured for the openspec gate).
Dependencies
None. Related: #4713.
Source: #4771
Alternatives check of 2026-11-14: in-use.
The repository already uses this tool.
Tool: pre-commit/pre-commit (https://github.com/pre-commit/pre-commit), MIT, last activity 2026-11-09, maintained.
Proposed design
Problem statement
The implement Job commits the regenerated docs and the archived change through _commit_if_changed, and no commit hook runs on those commits. A hygiene defect in a generated or archived file thus reaches the pull request with no local check. The change runs the trusted commit stage on the commits of _commit_if_changed, commits the files that a fixer rewrites, and stops the item when the stage still fails. The change stays on the commit path and adds no roadmap step.
Acceptance criteria
Requirement: Commit stage before commit
The implement Job SHALL run the trusted commit stage on the staged changes of each commit that _commit_if_changed makes, before git commit.
Scenario: Docs commit runs the stage
- WHEN The docs generator changes a generated file and the job reaches
_commit_if_changed. - THEN The commit stage runs over the staged changes before
git commit.
Requirement: Fixer rewrite is committed
The job SHALL commit the files that a commit-stage fixer rewrites, with the rewritten content.
Scenario: Trailing whitespace is trimmed
- WHEN A generated document holds trailing whitespace and the commit-stage hook rewrites the file.
- THEN The docs commit holds the rewritten file, and that file has no trailing whitespace.
Requirement: Hook failure stops the item
The job SHALL stop the item with the hook output when the commit stage still fails after the fixer rerun.
Scenario: Second stage run fails
- WHEN The commit stage fails, stages the files that the fixer changed, and fails again.
- THEN The item stops with the hook output in the stop comment, and no docs or archive commit is made.
Requirement: No change runs no hook
The job MUST NOT run the commit stage when the commit holds no change.
Scenario: Docs generator writes nothing
- WHEN The docs generator writes no file and the checkout holds no change.
- THEN The job makes no commit and runs the commit stage zero times.
Requirement: WIP commit skips the stage
The job MUST NOT run the commit stage for a wip: commit of a step.
Scenario: Step keeps a ticked task
- WHEN A step makes a
wip:commit for a ticked task. - THEN The commit stage runs zero times for that commit.
Requirement: Archive commit runs a matching hook
The job SHALL run the commit stage over the staged archive commit, so a hook whose file filter matches openspec/changes/archive/ runs.
Scenario: OpenSpec gate matches the archived path
- WHEN The archive commit stages a file under
openspec/changes/archive/and the configured hook filter matches that path. - THEN The hook runs on that file before the archive commit.
Requirement: Archive commit time
The archive commit SHALL add at most 20 s on 2 CPUs when the commit stage runs.
Scenario: Measured archive commit
- WHEN The archive commit runs on 2 CPUs with the configured hooks, and the same commit runs with the stage disabled.
- THEN The run with hooks takes at most 20 s more than the run without them.
Existing Tool Considered
pre-commit (https://github.com/pre-commit/pre-commit), MIT and maintained, is already in use and backs the existing commit_stage. It runs the configured commit hooks on staged files, and it supports fixer hooks that rewrite files, which commit_stage stages and runs again. It lacks the call from _commit_if_changed and the policy on which commits run it; the change supplies that project code.
Key questions
- Which commits run the trusted commit stage?: Every commit that
_commit_if_changedmakes: the docs commit, the archive commit, and the amendment and split commits. The call sits in_commit_if_changed, after the status check and beforegit commit. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:749, src/devops_cli/roadmap/implement/implement_hooks.py]- Chosen: One call in
_commit_if_changed. The commit path is single, so one call covers the docs, archive, amendment and split commits. - Rejected: A call at the docs and archive sites. It repeats the same code and leaves the amendment and split commits without the stage.
- Rejected: A git hook in the checkout. The agent can edit the hook, and the process runner gives a
gitchild the session token.
- Chosen: One call in
- What does the job do when the commit stage still fails after the fixer rerun?: It raises a stop with the hook output, so the item stops and the comment shows the output. No docs or archive commit is made. (best practice) [sources: src/devops_cli/roadmap/implement/implement_hooks.py, src/devops_cli/roadmap/implement/implement_run.py]
- Chosen: Stop the item with the hook output. A local check that fails stops the item, as a failed command of the job does.
- Rejected: Commit anyway and let the pull request checks catch it. The issue asks for the local check, and the pull request checks would cost a repair round.
- Rejected: Run the stage a third time.
commit_stagealready stages the fixer files and runs the stage once more.
- Do
wip:commits run the commit stage?: No. The step makeswip:commits inimplement_step.py, and the job only records and pushes them in_keep._commit_if_changedmakes nowip:commit, so the new call leaves that path unchanged. [sources: src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/roadmap/implement/implement_step.py] - Does the archive commit run a hook whose filter matches the archived path?: Yes.
_commit_if_changedrunsgit add -Abefore the stage, so the archived folderopenspec/changes/archive/<date>-<issue>-<slug>/is in the staged set that pre-commit filters. [sources: src/devops_cli/roadmap/implement/implement_hooks.py] - Does this change need a dependency or a wait on fix(roadmap): the final push of the implement Job can miss the latest main #4957?: No. The issue records no dependency, and the lease push of fix(roadmap): the final push of the implement Job can miss the latest main #4957 is already in
_push, so nothing waits on it. feat(roadmap): the implement Job opens its PR at the end #4713 is related and stays out of this change. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py]- Chosen: No dependency. The commit path does not touch the push, and fix(roadmap): the final push of the implement Job can miss the latest main #4957 is already in the code.
- Rejected: Wait for fix(roadmap): the final push of the implement Job can miss the latest main #4957. The code already holds the lease push that fix(roadmap): the final push of the implement Job can miss the latest main #4957 added, so a wait would block the item for nothing.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.Hygiene gaps reach the pull request but do not block delivery or expose a security risk.Catches whitespace and format issues before the pull request, reducing review noise.The body estimates about 2 hours and 80,000 tokens to build, reusing the existing commit_stage call.Both concern the implement job's commit behaviour, but #2665 delivers the job and #4771 fixes the missing hook call on its docs and archive commits.dan-petty commentedon Nov 12, 2026
Scope update from the Service step jobs plan (#5014).
The owner asked on 2026-11-12 for a separate job for each step that the Service jobs run the same way every time. This issue is the
archive-stepitem of that plan. The plan is extract-first: each repeated step becomes one module and one command (devops roadmap step <name>) that every caller uses, and then the steps that cost most move to their own Jobs.Proposed title:
fix(roadmap): one finish step runs docs, archive and hooksProblem (plan evidence)
implement_run.py:1236 (_finish_change) runs
devops docs generateanddevops openspec archiveonly at the end of the runner Job, and the commit hooks do not run on these commits (#4781). The fix-conflict step needs the same function to make the archive again after a spec conflict. 75 % of the measured conflicts are OpenSpec archive appends (merge-conflict census, 2026-11-11).Added scope
steps/archive.py finish(path, change, issue): docs generate, then openspec archive with strict validation, then one commit with the hooks (the #4781 fix). The archived folder in git is the marker: when _active_change is None, the step skips. Results: archived, already, failed (typed stop plan_defect).
CLI
devops roadmap step archive. The implement Job calls it in place of _finish_change.Timeouts: docs 300 s, archive 300 s, step 600 s, inside the command limit of 1800 s.
Start after push-step, because _finish_change (:1236) lies between _keep (:1187) and _push (:1258), so the two pull requests conflict when they run at the same time.
Cost: about 0.5M tokens and 0.5 agent-day.
Added acceptance
uv run devops ci fail-to-pass --base origin/mainshows that the fix(roadmap): implement runs the commit hooks on docs and archive #4781 test (the hooks run on the archive commit) fails before and passes after.Merge first
Coordination
#4771 stays the parent. This item widens #4781 to the one finish step that fix-conflict also calls.
dan-petty commentedon Nov 12, 2026
Coordination note from #5163 (pull request #5198): that change edits
_generate_docsinsrc/devops_cli/roadmap/implement/implement_run.py. The docs step now runsuv run devops docs generatewith no--sync-readme, because the option is deleted. It does not change_commit_if_changed, so this item can build on either order.devops-cli-service commentedon Nov 14, 2026
Alternatives check: in-use
Reason: The searches found pre-commit, the maintained open-source git hook framework that the project already uses for its commit stage; it runs the configured hooks on staged content and supports fixer hooks that rewrite files and re-run, which is exactly what the issue wants on the docs and archive commits by reusing
commit_stage. The issue itself names pre-commit as the existing tool to reuse, so it is already in use.The repository already uses this tool.
Tool: pre-commit/pre-commit (https://github.com/pre-commit/pre-commit)
Covers:
commit_stagethat the issue reusesLacks:
_commit_if_changed; that integration is project codewip:) run the hooksTools considered:
Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 15, 2026
Refine cannot set this item to Ready at e5dfddb while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
The next refine round also looks at the item again when a commit on the default branch changes one of these files:
src/devops_cli/roadmap/implement/implement_run.py.devops-cli-service commentedon Nov 15, 2026
Status set to Ready at 6786f1a (see proposed design in issue body).
test(roadmap): update hook stage count and scoped check fake after ar…
devops-cli-service commentedon Nov 16, 2026
Released in v0.161.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.161.0
devops-cli-service commentedon Nov 16, 2026
Live since 2026-11-16 06:35 UTC