Skip to content

docs(agents): the full gate runs once per push, after the last rebase or amend, so the pre-push hook reuses its verdict #1663

Closed

Description

@dan-petty

Friction

  • Agents run uv run devops ci by hand, then rebase, amend or edit, then push. The pre-push hook then finds no saved verdict for the new content and runs the whole gate again.
  • Each repeat costs a full gate: about 200 s alone on the release tip at load 14-23, and 370-930 s in agents' hook runs under shared load.
  • A content-keyed verdict that matches costs the push about 9-14 s instead.

Evidence

Checked at release/v0.2.37 30b8fdd.

  • The verdict is keyed on content, not commits: the blob hash of every tracked and non-ignored untracked file, the hashes of pyproject.toml, uv.lock and .pre-commit-config.yaml, and the options {fix, check} (src/devops_cli/ci/cache.py:34-38, :140-146, :164-185, :246-279, :282-309). There is one verdict file per worktree root (:86-88).
  • So it survives git add, git commit and pre-commit's stash of unstaged changes, and the hook reuses it: earlier logs show hook cache hits of 4.9 s inside the CLI and 8.7-13.8 s through pre-commit.
  • It is lost by a rebase, amend or edit after the manual run, by --check or --no-fix (different options), by a run in another worktree, and by any failure: a failed run clears it (src/devops_cli/commands/ci.py:1090-1092), including a failed --only or --skip run.
  • A run whose docs pre-fix rewrites files saves no verdict (src/devops_cli/commands/ci.py:998-1004), and pre-commit fails a hook that modifies files.
  • That happens to every push from a release tip whose generated docs went stale when two pull requests, each green on its own base, merged together. The tip at 25e2cda carried a stale docs/MCP_TOOLS.md until bfb312a, and the same skew can come back.
  • One workflow's reflog shows a manual gate, then an amend and a rebase onto the release tip, then a push that ran the gate again.
  • AGENTS.md:57-58 says a push needs a passing uv run devops ci in the session and that the pre-push hook enforces it. It does not say that the hook's run counts, so agents run the gate by hand first.

Remedy

  • AGENTS.md and docs/SDLC.md say: the pre-push hook's uv run devops ci is the gate run. A manual run counts only when nothing changes before the push. Run it, if at all, after the last rebase, amend or edit, in the worktree you push from, with no --check, --no-fix, --only or --skip.
  • They also say: when the hook's docs pre-fix rewrites files, regenerate and commit the docs, then push again. Do not repeat the push unchanged.
  • Workflow prompts that order a manual gate before a rebase or amend are changed the same way (outside this repository).
  • No check, threshold or hook changes.

Acceptance criteria

  • Tests first, offline: a test over src/devops_cli/ci/cache.py shows that a verdict saved for a tree is found again after git add and git commit of that tree in a tmp_path repository, and is not found after an amend that changes a file.
  • AGENTS.md and docs/SDLC.md carry the wording above; devops docs check passes.
  • No change to .pre-commit-config.yaml or to any check.

Proposed design

Problem statement

Agents run the full CI gate manually, then rebase or amend changes, and push. The pre-push hook runs the full gate again because it doesn't reuse the previous verdict, causing unnecessary delays of 200-930 seconds per push.

Acceptance criteria

  • Criterion 1: A test verifies that a verdict saved for a tree is found again after git add and git commit of that tree in a tmp_path repository.
    Verification: Run tests over src/devops_cli/ci/cache.py that simulate a git add and git commit on a tree, ensuring the verdict is reused.
  • Criterion 2: A test verifies that a verdict is not found after an amend that changes a file.
    Verification: Run tests over src/devops_cli/ci/cache.py that simulate an amend changing a file, ensuring the old verdict is cleared and a new one is generated.
  • Criterion 3: AGENTS.md and docs/SDLC.md are updated with new wording about when to run the gate manually.
    Verification: Check that AGENTS.md and docs/SDLC.md contain the specified wording: 'the pre-push hook's uv run devops ci is the gate run' and 'Run it, if at all, after the last rebase, amend or edit'.
  • Criterion 4: The devops docs check passes after the changes.
    Verification: Run devops docs check command to ensure documentation is valid.

Key questions

  • Does the verdict reuse logic depend on content keys or commit hashes?: The verdict is keyed on content, not commits: the blob hash of every tracked and non-ignored untracked file, the hashes of pyproject.toml, uv.lock and .pre-commit-config.yaml, and the options {fix, check} (src/devops_cli/ci/cache.py:34-38, :140-146, :164-185, :246-279, :282-309). [sources: src/devops_cli/ci/cache.py:34-38, src/devops_cli/ci/cache.py:140-146, src/devops_cli/ci/cache.py:164-185, src/devops_cli/ci/cache.py:246-279, src/devops_cli/ci/cache.py:282-309]
  • What conditions cause a verdict to be cleared?: A verdict is lost by a rebase, amend or edit after the manual run, by --check or --no-fix (different options), by a run in another worktree, and by any failure: a failed run clears it (src/devops_cli/commands/ci.py:1090-1092), including a failed --only or --skip run. A run whose docs pre-fix rewrites files saves no verdict (src/devops_cli/commands/ci.py:998-1004), and pre-commit fails a hook that modifies files. [sources: src/devops_cli/commands/ci.py:1090-1092, src/devops_cli/commands/ci.py:998-1004]
  • What is the expected behavior for the pre-push hook after manual runs?: The pre-push hook should reuse the verdict from a manual run if nothing changes before the push, and only re-run the full gate if there are changes. (proposed) [sources: src/devops_cli/ci/cache.py:86-88]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/docs
    on Oct 18, 2026
  2. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Type: type/docs. The candidate focuses on documentation updates and clarifications for agents and the SDLC.
    • Priority: P2-Medium. This improves workflow efficiency but is not critical or urgent.
    • Value: Medium. Improves agent workflow, reducing friction and time spent during pushes.
    • Effort: Low. Involves updating documentation and tests without changing core logic or adding new features.
  3. added this to the v0.2.38 milestone on Oct 20, 2026
  4. dan-petty commented on Oct 20, 2026

    @dan-petty
    OwnerAuthor

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

  5. dan-petty commented on Oct 20, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1761, merged into release/v0.2.38 as 3f9a2f3.

    Resolves #1663

    5 file(s) changed.

    How it was verified

    Check runs at fee61c9:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • devops-cli: pass
    • zizmor: pass
    • bandit: pass
    • CodeQL: pass
    • Analyze (actions): pass
    • Fail-to-Pass Check: pass
    • Rule Pack Tests: pass
    • Changed-Test Independence: pass
    • Fail-to-Pass Self-Check: pass
    • Tests & Coverage: pass
    • Analyze (python): pass
    • Static Analysis: pass
    • Service Image: skipping
    • Dependency Freshness: skipping
    • DevContainer Image: skipping

    Acceptance Criteria of docs/agent/tasks/task-1663-ci-verdict-reuse-pre-push.md:

    No Acceptance Criteria section.

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

    source/agenttype/docs

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions