Skip to content

test(ci): prove the Copilot setup hooks in a live Copilot run #5147

Open

Description

@devops-cli-service

Split from #5136.

Problem The Copilot setup steps install the pre-commit and pre-push hooks. The branch-name hook refused each commit on a copilot/ branch. #5136 scopes the pattern of that hook so a copilot/ name passes. The branch-current hook can refuse a push when origin/main moves after the agent starts its branch, and the agent cannot rebase. No offline test shows what a live Copilot cloud agent does with the installed hooks. ## Why this part is deferred The proof needs a live Copilot cloud agent run on a test issue. Only GitHub starts that run. The roadmap cannot start it or observe it. The fix of #5136 is testable offline, so this proof waits on an outside event. ## Acceptance criteria - A person assigns the Copilot cloud agent to a test issue on a repository that runs the setup steps. - The agent makes at least one commit on its copilot/ branch with no hook refusal. - The agent pushes its branch with no hook refusal. - When the branch-current hook refuses the push, the run records the failure and a new item scopes that hook for copilot/ branches. ## References - https://docs.github.com/en/copilot/concepts/agents/coding-agent/risks-and-mitigations - https://github.com/orgs/community/discussions/167906

Proposed design

Problem statement

The Copilot setup steps install the pre-commit and the pre-push hooks in the environment of the Copilot cloud agent. No offline test shows what a live Copilot cloud agent does with these hooks. The branch-current hook can refuse a push when origin/main moves after the agent starts its branch, and the agent cannot rebase. This item records one live run in an evidence comment on this item, and it files a new item when a hook refuses.

Acceptance criteria

Requirement: Setup steps install both hook types

The copilot-setup-steps job of a live Copilot run MUST install the pre-commit and the pre-push hook types in the environment of the agent.

Scenario: The setup job installs both hook types

  • WHEN A person reads the log of the copilot-setup-steps job of the live run with uv run devops gh run view <run-id> --log.
  • THEN The log shows the hook install step with a success result, so both hook types of default_install_hook_types are installed.

Requirement: Commit on the copilot branch

A live Copilot cloud agent run MUST make at least one commit on its copilot/ branch with no branch-name refusal.

Scenario: The agent commits on its copilot branch

  • WHEN A person with write access assigns the Copilot cloud agent to a test issue, and the agent commits its change.
  • THEN The log of the run shows the commit on the copilot/ branch with no branch-name refusal, and the evidence comment records the commit SHA and the run URL.

Requirement: Push of the copilot branch

A live Copilot cloud agent run MUST push its copilot/ branch with no pre-push hook refusal.

Scenario: The agent pushes its copilot branch

  • WHEN The live run pushes the copilot/ branch of the agent to the repository.
  • THEN The log of the run shows the push with no pre-push refusal, and the evidence comment records the pushed branch, the run URL and whether the pre-push hook ran.

Requirement: Branch-current refusal is recorded

When the branch-current hook refuses the push, the item MUST record the refusal text and the run URL in the evidence comment, and it MUST file a new roadmap item that scopes branch-current for copilot/ branches.

Scenario: The branch-current hook refuses the push

  • WHEN The log of the live run shows that the branch-current hook refused the push of the copilot/ branch.
  • THEN The evidence comment records the refusal text and the run URL, and a new roadmap item names the change that scopes branch-current for copilot/ branches.

Existing Tool Considered

No alternatives check has run on this item. pre-commit 4.7.0 (pyproject.toml, dev group) is the open, maintained tool that installs and runs the hooks of .pre-commit-config.yaml. It covers the install and the run of these hooks on a clone, and it needs no code from this repository. It lacks a way to run them in the hosted environment of the Copilot cloud agent, which only a live Copilot run exercises. The item writes no code of its own, so it has no build cost: its cost is one live run that a person starts and reads, and one evidence comment.

Key questions

  • Which hook types does pre-commit install install in the environment of the agent?: It installs the pre-commit and the pre-push hook types, because .pre-commit-config.yaml sets default_install_hook_types: [pre-commit, pre-push]. The branch-name hook runs at the commit stage. The branch-current hook runs at the push stage. [sources: .pre-commit-config.yaml:1, .pre-commit-config.yaml]
  • Does the branch-name pattern accept a copilot/ branch at this commit?: Yes. The lookahead of the pattern accepts copilot/<slug>, and its comment cites fix(ci): Copilot setup hooks refuse commits on copilot/ branches #5136. A copilot/ name passes the commit hook, so this item needs no further change from fix(ci): Copilot setup hooks refuse commits on copilot/ branches #5136. [sources: .pre-commit-config.yaml]
  • Which check is the gate for a push of a copilot/ branch?: The required checks of the ruleset are the gate. ADR 0004, as amended by ADR 0014, gives the gate to the required checks and says the pre-push hook runs only the fast static checks. A branch-current refusal stops the push before those checks run, so the evidence comment records it. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md, .pre-commit-config.yaml]
    • Chosen: The required checks of the ruleset. ADR 0004 gives the gate to the required checks.
    • Rejected: The pre-push hook. ADR 0004 says the hook runs only the fast static checks, and a hook on one clone cannot bind the merge.
  • Where does the item record the result of the live run?: In one evidence comment on this item, with the date, the run URL and each hook result. The item stays open until the run ends, and it closes after the comment. (best practice) [sources: CONTEXT.md]
    • Chosen: Evidence comment on this item. This item stays open until the run ends, so a reader finds the record at the item that it closes.
    • Rejected: Evidence comment on the test issue. A person closes the test issue after the run, so the record goes with it.
    • Rejected: A guideline under docs/guidelines/. CONTEXT.md forbids an issue number and a date in a guideline, and this result holds both.
    • Rejected: A mocked test of the hooks. A mocked test runs the hooks on a local clone, so it shows nothing of the cloud agent.
  • Which issue serves as the test issue of the live run?: A throwaway issue with no priority/* label. CONTEXT.md keeps an issue with no priority/* label a candidate, so no roadmap job takes it. A person closes it after the run. (best practice) [sources: CONTEXT.md]
    • Chosen: A throwaway issue with no priority/* label. CONTEXT.md keeps an issue with no priority/* label a candidate, so no roadmap job takes it.
    • Rejected: An existing roadmap item. A run on a real item pushes a copilot/ branch that no plan covers.
  • What does the item do when the branch-current hook refuses the push?: The item records the refusal text and the run URL in the evidence comment, and it files a new item that scopes branch-current for copilot/ branches. The item relaxes no hook before evidence shows that the hook fires. (best practice) [sources: .pre-commit-config.yaml, docs/adr/0004-ci-is-the-authoritative-gate.md]
    • Chosen: Record the refusal and file a new item. The live run gives the evidence, and the new item holds the change of the hook.
    • Rejected: Relax branch-current in this item. No evidence shows that the hook refuses a push on a copilot/ branch, and the required checks still gate the merge.
    • Rejected: Stop the item on the refusal. The run still proves the setup steps and the commit.
  • Does the item need code?: No. The item writes no code. It records one live run in an evidence comment, and it files a new item when a hook refuses. The proof needs the hosted environment of the Copilot agent, and no repository code can start or observe that run. (best practice) [sources: AGENTS.md, CONTEXT.md]
    • Chosen: No code. The proof needs the hosted Copilot environment, and no repository code can start or observe that run.
    • Rejected: A mocked test of the hooks. A mocked test runs on a local clone and shows nothing of the cloud agent.
  • What do the installed hooks check, and where do they run?: They run as local git hooks in the clone of the agent. pre-commit runs them on the machine that holds the clone. A test on a local clone shows the hook behavior, but it does not show the hosted environment of the agent. [sources: .pre-commit-config.yaml, pyproject.toml]

Fit

Fits in one pull request.

Suspected block

A live Copilot cloud agent run on a test issue, which only GitHub starts and a person with write access triggers.

Dependencies

None.

Activity

  1. added
    source/agent
    type/test
    scope/ci
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  2. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    ContributorAuthor
  3. added
    priority/p3-low
    on Nov 12, 2026
  4. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  5. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See the first point of Open questions and Watched files in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  6. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block and Watched files in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

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

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block and Watched files in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  8. devops-cli-service commented on Nov 24, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

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/p3-lowscope/cisource/agentstatus/newtype/testvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions