Skip to content

fix(roadmap): WIP keeper must test packages before pushing WIP commits #4068

Not planned

Description

@dan-petty

Problem

In src/devops_cli/roadmap/implement/implement_wip.py, WipKeeper commits the working tree as a wip: commit when the agent ticks a task and the verification commands of that specific task pass. The implement job then pushes this commit to the remote tracking branch on GitHub.

In issue #3251 / PR #3981, Task 1.2 added tests in tests/roadmap/stage/test_roadmap_stage_manifest.py. When test_roadmap_stage_manifest.py passed, WipKeeper made a WIP commit and pushed it to origin/feat/3251-add-a-test-first-manifest-kind.

However:

  1. Other tests in the same package (tests/roadmap/stage/) were failing because the prompt file was not updated yet.
  2. Fast pre-push static checks (devops ci) were not executed before the push.
  3. Pushing this commit to GitHub triggered the full GitHub Actions CI matrix on a broken commit, marking the pull request checks red and wasting CI runner time.

AGENTS.md rule 5 states that pre-push checks run fast static checks and the required checks of CI gate the merge. Pushing intermediate WIP commits that fail package tests breaks CI on the pull request.

Expected

Before pushing a wip: commit to the remote tracking branch, WipKeeper or the implement job must verify that the commit passes fast static checks and scoped package tests (using plan_tests or pre-push gates). If scoped package tests or static checks fail, WipKeeper should record the commit locally in the workspace to save work, but must not push the failing commit to the remote repository.

Acceptance criteria

  • WipKeeper or implement_step runs scoped package checks or fast pre-push checks before pushing a wip: commit to origin.
  • If scoped checks fail, the commit stays local and is not pushed to the remote branch.
  • A test verifies that WipKeeper does not push commits that fail scoped package checks.

Feasibility

src/devops_cli/roadmap/implement/implement_wip.py and implement_step.py manage WIP commit creation and push.
plan_tests in devops_cli.roadmap.stage.stage_tests finds package tests for changed paths.
Running fast checks before remote push prevents failed CI runs on draft pull requests.

Existing tool considered

The existing devops ci fast check runner and plan_tests function. No new dependency is needed.

Cost

Build: about 20k tokens and 1 hour. Keep: about 1k tokens per quarter. Fix: about 4k tokens and 0.2 hours.

Related

Found during evaluation of #3251 / PR #3981. Related to #3054 and #3993.

Dependencies

Alternatives check of 2026-11-25: 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.
Reason: The searches found pre-commit, already used by the repository: it can run and block hooks at the pre-push stage, but it selects by file patterns, not plan_tests scoped tests, and ADR 0014 keeps the pre-push hook to fast static checks.

Covers:

  • Runs configured hook commands at the pre-push stage
  • Aborts the push when a hook exits nonzero
  • Selects hook commands by changed-file patterns

Lacks:

  • No import-graph selection of scoped package tests
  • ADR 0014 limits the pre-push hook to fast static checks
  • No record of a refused WIP commit in the implement job
  • Hooks can be skipped with --no-verify

Proposed design

Problem statement

The implement job pushes each wip: commit to the remote tracking branch. That path runs no scoped package test and no fast static check. A broken commit then starts the full CI matrix on GitHub and marks the pull request checks red. The change gates the WIP push on the scoped package tests and the fast static checks. A refused commit stays on the local branch, and the record names the failing check. The work waits on #6521, the re-architecture of the stage, implement and fix-checks jobs.

Acceptance criteria

Requirement: Scoped test gate

The implement job SHALL run the scoped package tests that plan_tests selects for the changed paths before it pushes a wip: commit.

Scenario: A failing scoped test keeps the WIP commit off the remote

  • WHEN the scoped package tests of a wip: commit fail
  • THEN the test sees no push of that commit and a refusal that names the failing test module

Requirement: Fast static check gate

The implement job SHALL run the fast static checks of the pre-push stage before it pushes a wip: commit.

Scenario: A failing fast static check keeps the WIP commit off the remote

  • WHEN a fast static check of the pre-push stage fails on a wip: commit
  • THEN the test sees no push of that commit and a refusal that names the failing check

Requirement: Green WIP push

The implement job SHALL push a wip: commit when its scoped package tests and its fast static checks pass.

Scenario: A WIP commit with passing checks reaches the remote

  • WHEN the scoped package tests and the fast static checks of a wip: commit pass
  • THEN the test sees exactly one push of that commit to the remote tracking branch

Requirement: Kept WIP commit

The implement job MUST keep a refused wip: commit on the local branch and MUST NOT push it.

Scenario: A refused WIP commit stays on the local branch

  • WHEN the gate refuses a wip: commit
  • THEN the test sees that commit as the tip of the local branch and no push of it

Existing Tool Considered

pre-commit (https://github.com/pre-commit/pre-commit), MIT, verdict in-use: the repository already uses this tool. The alternatives check in the issue body gives what pre-commit covers and lacks. The proposal adds what pre-commit lacks. plan_tests selects the scoped package tests for the changed paths. The implement job records the refused wip: commit and the failing module. The gate runs in the job, so no hook skip bypasses it. The cost of this glue code is about 20k tokens and 1 hour to build. It is about 1k tokens per quarter to keep, and about 4k tokens and 0.2 hours to fix.

Key questions

  • Does the implement job already run the scoped checks before its final push?: Yes. The agent phase runs the scoped checks after the steps, the documents and the archive. publish then pushes the commits that passed. The wip: push path runs neither the scoped checks nor the fast static checks. [sources: src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/roadmap/implement/implement_scoped_ci.py:105]
  • Which checks run before the WIP push?: The scoped package tests that plan_tests selects for the changed paths, and the fast static checks of the pre-push stage. ADR 0014 keeps the pre-push hook to the fast static checks, so the job adds the scoped package tests and runs both sets before the push. (best practice) [sources: AGENTS.md, src/devops_cli/roadmap/implement/implement_scoped_ci.py:105]
    • Chosen: The scoped package tests and the fast static checks. They cover the two failures that reached origin and stay inside the 5-minute limit.
    • Rejected: The full devops ci check. AGENTS.md rule 5 makes a check that averages over 5 min + 1 min tolerance a P0 bug, and the gate runs on each wip: commit.
    • Rejected: The scoped package tests only. A failing fast static check would still reach the remote branch.
    • Rejected: The fast static checks only. The issue reports that failing package tests also reached the remote branch.
  • Where does the WIP push gate run?: In the implement job, in the code path that pushes a wip: commit. WipKeeper makes the commit and the job owns the remote push, so the gate sits at that push. (best practice) [sources: src/devops_cli/roadmap/implement/implement_step.py]
    • Chosen: In the implement job, at the WIP push. The job owns the remote push and already holds the scoped checks.
    • Rejected: Inside WipKeeper, where the commit is made. WipKeeper writes no remote and runs no scoped test.
    • Rejected: In the pre-push hook only. ADR 0014 keeps the pre-push hook to the fast static checks, and the hook is no place for the scoped package tests.
  • What does the job do with a refused WIP commit?: It keeps the commit on the local branch and pushes nothing. The tip of the step stays at that commit, so a later stop keeps the work of the group. (best practice) [sources: CONTEXT.md, src/devops_cli/roadmap/implement/implement_run.py]
    • Chosen: Keep the commit on the local branch. It keeps the work of the group and meets the issue.
    • Rejected: Discard the commit. It loses the work of the group.
    • Rejected: Amend until the gate passes. An amend hides the refused commit and its reason from the record.
    • Rejected: Stop the item at once. A later task can make the scoped tests pass, and the group can continue.
  • Can one pull request deliver the gate and its test?: Yes. The gate is one change in the WIP push path of the implement job, and one test covers its record. (best practice) [sources: src/devops_cli/roadmap/implement/implement_step.py, tests/roadmap/implement/test_roadmap_implement_step_commit.py]
    • Chosen: One pull request. The change is one gate and the test of its record.
    • Rejected: Split the gate and the test. The test proves the gate in the same change, and a second pull request adds review load.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521

Watched files

A commit on the default branch that changes one of these files starts the next refine round.

  • src/devops_cli/roadmap/implement/implement_run.py
  • src/devops_cli/roadmap/implement/implement_step.py

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. Wastes CI runner time and marks PR checks red, but does not block functionality or lose work.
    • Value: Medium. Prevents wasted CI runs and broken PR check status on every WIP push that fails package tests.
    • Effort: Low. The candidate states about 1 hour build; devops ci and plan_tests already exist and need only a call before the push.
    • Related: feat(roadmap): the implement job runs the scoped CI before it pushes and repairs failures #3043, which asks for a different change. Both run scoped checks before a push, but #3043 covers the implement job's group push with repair rounds while the candidate covers WipKeeper's intermediate WIP push with a hard block.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Corroborating evidence from PR #4035 (issue #3253):

    WipKeeper committed 03b5eeb6 without formatting src/devops_cli/roadmap/stage/stage_criteria.py because roadmap_implement_step.md instructs the model not to run ruff format.

    Pushing this WIP commit to origin/feat/3253-map-all-issue-requirements-to-a triggered CI run 42404156774, which failed Static Analysis on ruff format --check.

    WipKeeper._commit must format changed Python files or verify fast static checks before it pushes WIP commits to GitHub.

  5. added
    status/ready
    and removed
    status/new
    on Nov 8, 2026
  6. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at ba4679c (see proposed design in issue body).

  7. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: Two searches found no external tool that gates an implement job's push on scoped package tests and fast static checks. The closest is pre-commit's pre-push stage, which is maintained and MIT-licensed. It would only run static hooks on a git push. It does not select tests for the changed paths, report the failing module, or keep a failing wip: commit local. The repository already has a pre-push hook for fast checks (ADR 0014). The gate is glue code inside the job around the repository's own plan_tests and fast checks.

    Tool: none found

    Covers:

    • pre-commit can run static hooks at the pre-push stage

    Lacks:

    • Scoped test selection for the changed paths
    • A gate inside the implement job that keeps a failing wip: commit local
    • A report that names the failing check or test module
    • A test that records pushes

    Tools considered:

    Searches run:

    • run scoped tests and static checks before git push wip commit pre-push gate tool, results: 5
    • pre-commit framework pre-push stage hooks run checks before git push, results: 5

    Sources:

    Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.

  8. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Evidence from the defect inventory of 2026-11-11. It reads 14 days of check runs, from 2026-10-27 to 2026-11-10.

    The step runs ruff format (_format_failure in src/devops_cli/roadmap/implement/implement_step.py) only at the end of the step. WipKeeper makes its commit before that. So the deterministic fixer exists, but it does not run on a wip: commit. A possible acceptance criterion: run _format_failure on the paths of a wip: commit before the commit, or keep the commit local as this issue proposes.

  9. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Scope from the iteration lane plan (2026-11-11)

    #4713 makes this issue obsolete (child 14 of #4667). After #4713, a wip push of the implement Job goes to a branch with no pull request and starts no CI run. The full gate runs in the Job pod before the one push that opens the pull request.

    This issue closes as not planned, with a link to #4713, when #4713 merges. Do not start work on this issue.

  10. dan-petty commented on Nov 14, 2026

    @dan-petty
    OwnerAuthor

    Cannot complete safely in one low-effort pull request: the gate must run inside WipKeeper.on_commit before _push_passed, format the changed Python files, and keep the WIP commit local on failure. Formatting after the commit needs an amend of the WIP tip, which changes the keeper's tip used by fold/unfold/reset, the implement.wip record, and the stop reset. The design does not say how the tip and the record follow that amend. Split it: (1) gate the WIP push on _scoped_run and keep the commit local on failure, (2) format-before-gate with the WIP tip and record updated, (3) the regression test. Raise the effort if it stays one item.

  11. added
    status/new
    and removed
    status/ready
    on Nov 14, 2026
  12. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    The proposal at c212f77 needs splitting into 3 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.

    1. Gate the WIP push on the scoped checks and keep the commit local on failure.
    2. Format the changed Python files before the WIP commit, so the WIP tip and the implement.wip record need no update.
    3. Add the regression test that no push is recorded when the scoped checks fail.
  13. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: none, no tool. A person decides what the new result means for the item.

    Searches (9)

    Tools considered:

    Searches run:

    • git pre-push hook run only tests for changed packages, results: 5
    • pre-commit framework pre-push stage run tests before push, results: 5
    • pre-commit.com pre-push hook configuration, results: 5
    • lefthook git hooks run tests pre-push, results: 5
    • pytest-testmon pytest plugin affected tests only, results: 5
    • git hook prevent push failing tests tool, results: 5
    • pre-commit, results: 5
    • husky lint-staged git hooks, results: 5
    • pre-commit.com pre-push stage hooks documentation, results: 5

    Sources:

  14. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  15. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.

  16. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  17. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    Closed: the WIP keeper no longer exists.

    #6562 deleted implement_wip.py. The implement Job ends at its draft, and a step makes no wip: commit.

  18. removed
    status/new
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions