Skip to content

Pin Claude Code CLI version to 2.0.1 instead of @latest#1127

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-5467be02-5904-4e8f-8060-ce45999943f3
Oct 1, 2025
Merged

Pin Claude Code CLI version to 2.0.1 instead of @latest#1127
pelikhan merged 3 commits intomainfrom
copilot/fix-5467be02-5904-4e8f-8060-ce45999943f3

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 1, 2025

Problem

The Claude Code CLI was being installed using @latest version specifier in the generated GitHub Actions workflows. This caused two issues:

  1. Lack of reproducibility: Workflows could produce different results across runs as new versions were automatically picked up
  2. Potential breaking changes: Updates to Claude Code CLI could introduce breaking changes without warning

Solution

This PR pins the Claude Code CLI version to 2.0.1 (the current latest stable release) by default, while still allowing users to override this via the engine.version field in their workflow frontmatter.

Implementation

Added a DefaultClaudeCodeVersion constant in pkg/constants/constants.go and updated the Claude engine to use this pinned version instead of hardcoded "latest":

// Before
version := "latest"
if workflowData.EngineConfig != nil && workflowData.EngineConfig.Version != "" {
    version = workflowData.EngineConfig.Version
}

// After
version := constants.DefaultClaudeCodeVersion  // "2.0.1"
if workflowData.EngineConfig != nil && workflowData.EngineConfig.Version != "" {
    version = workflowData.EngineConfig.Version
}

This generates workflow steps like:

- name: Execute Claude Code CLI
  run: |
    npx @anthropic-ai/claude-code@2.0.1 --print ...

Pattern Consistency

This follows the established pattern in the codebase for other tools:

  • GitHub MCP server: pinned to sha-09deac4
  • Playwright: uses latest by default but supports version override

User Control

Users can still specify a custom version in their workflow frontmatter:

---
engine:
  id: claude
  version: v1.2.3  # Override the default
---

Testing

  • All unit tests updated and passing
  • All workflow files recompiled with the new pinned version
  • Manual verification of generated workflows
  • Custom version override tested and confirmed working
Original prompt

This section details on the original issue you should resolve

<issue_title>claude code version should be pinned instead of "@latest"</issue_title>
<issue_description>In the "Execute Claude Code CLI" step, the claude code CLI version should be pinned</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1126

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits October 1, 2025 08:30
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copilot AI changed the title [WIP] claude code version should be pinned instead of "@latest" Pin Claude Code CLI version to 2.0.1 instead of @latest Oct 1, 2025
Copilot AI requested a review from Mossaka October 1, 2025 08:35
found = false
for _, line := range stepLines {
if strings.Contains(line, "npx @anthropic-ai/claude-code@latest") {
if strings.Contains(line, "npx @anthropic-ai/claude-code@2.0.1") {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use default version strong

@pelikhan pelikhan marked this pull request as ready for review October 1, 2025 14:44
@pelikhan pelikhan merged commit 65fff8f into main Oct 1, 2025
11 of 12 checks passed
@pelikhan pelikhan deleted the copilot/fix-5467be02-5904-4e8f-8060-ce45999943f3 branch October 1, 2025 14:51
Copilot AI requested a review from pelikhan October 1, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude code version should be pinned instead of "@latest"

3 participants