Skip to content

feat(agents): remote agent sessions install the git hooks #4773

Closed

Description

@dan-petty

Problem or Motivation

Claude Code cloud sessions (claude.ai/code) and the Copilot coding agent install no git hooks. Their commits and pushes thus skip every hook, and they will also skip the push gate of #4670.

  • The end-of-file defect on main (openspec/changes/archive/2026-11-02-3249-title-limit-round3/specs/roadmap-stage/spec.md, from 707775f in fix(roadmap): count the title summary like the CI check #3286) came from plan commit 54ccd34 of a claude.ai/code session. The file ends with two newlines today.
  • 16 commits since 2026-10-28 have a Claude-Session trailer.
  • .github/workflows/copilot-setup-steps.yml has no pre-commit install step.
  • Only the devcontainer installs the hooks, at each start (src/devops_cli/commands/devcontainer.py).

Proposed Solution & Architectural Design

Claude Code. Add a SessionStart hook (matcher startup|resume) to .claude/settings.json and to src/devops_cli/templates/claude_settings.json.j2.

  • The hook exits 0 when CLAUDE_CODE_REMOTE is not true. This is the documented variable of a cloud session. The devcontainer already installs the hooks.
  • The hook exits 0 when uv or .pre-commit-config.yaml is missing.
  • Else it runs cd "$CLAUDE_PROJECT_DIR" && uv run pre-commit install.

Copilot. Add one step uv run pre-commit install after the tool install in copilot-setup-steps.yml. #4681 also changes this file.

Both are standard interfaces, and they block nothing.

Target Subsystem

AI agent harness settings (.claude/settings.json, src/devops_cli/templates/claude_settings.json.j2) and .github/workflows/copilot-setup-steps.yml.

Existing Tool Considered

Claude Code SessionStart hooks and pre-commit install. The Claude Code docs (code.claude.com/docs/en/cloud-environments) say that the SessionStart hooks of the repository run in local and cloud sessions, that pypi.org is in the Limited allow list, and that uv is installed. The change is configuration only. Cost (estimate): about 50,000 tokens and 1 hour to build, near 0 to keep.

Acceptance Criteria

  • A test renders the template and finds the hook.
  • In a temporary clone, the hook command with CLAUDE_CODE_REMOTE=true writes .git/hooks/pre-commit and .git/hooks/pre-push. When the variable is not set, it writes nothing and exits 0.
  • actionlint and zizmor pass on copilot-setup-steps.yml.
  • In the 14 days after the merge, 0 commits on main with a Claude-Session trailer fail pre-commit run --files on their changed files.

Dependencies

None. Related: #4670 (the push hook that these sessions then run), #4681.

Source: #4771

Activity

  1. added
    source/agent
    on Nov 11, 2026
  2. added
    type/feature
    scope/agents
    status/new
    value/medium
    effort/low
    on Nov 11, 2026
  3. dan-petty commented on Nov 11, 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/feature. The feat prefix of the title gives the type.
    • Scope: scope/agents. The (agents) scope of the title gives the scope.
    • Priority: P2-Medium. It closes a quality gap on remote sessions but does not block a release or fix a live defect.
    • Value: Medium. It prevents unvalidated commits from remote agents reaching main, as shown by the cited end-of-file defect.
    • Effort: Low. The change is two configuration edits and one workflow step, estimated at one hour.
    • Related: feat(devcontainer): isolate project ssh signing keys and install pre-commit globally #66, which asks for a different change. Both ensure pre-commit is available, but #66 targets the devcontainer while the candidate targets remote cloud agent sessions.
  4. added
    priority/p2-medium
    owner/agent
    on Nov 11, 2026
  5. removed
    status/new
    owner/agent
    on Nov 12, 2026
  6. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 16:17 UTC

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/agentssource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions