Skip to content

Fix engine.version to accept numeric types per schema#8231

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-engine-version-accept-numbers
Dec 31, 2025
Merged

Fix engine.version to accept numeric types per schema#8231
pelikhan merged 2 commits intomainfrom
copilot/fix-engine-version-accept-numbers

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

The schema defines engine.version as "type": ["string", "number"] with examples [20, 3.11], but the code only accepted strings, causing numeric versions to be silently ignored.

Changes

  • pkg/workflow/engine.go: Replace string-only type check with type switch handling string, int/int64/uint64, and float64
  • pkg/workflow/engine_config_test.go: Add test cases for integer (20) and float (3.11) versions

Implementation

Applied the existing max-turns pattern (lines 81-87) to the version field:

switch v := version.(type) {
case string:
    config.Version = v
case int, int64, uint64:
    config.Version = fmt.Sprintf("%d", v)
case float64:
    config.Version = fmt.Sprintf("%g", v)
}

Users can now use numeric versions as documented:

engine:
  id: copilot
  version: 20      # ✓ Now works

engine:
  id: claude
  version: 3.11    # ✓ Now works

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login en.git -trimpath /usr/bin/git -p github.com/githucommit l/linux_amd64/co-m git rev-�� --show-toplevel (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login _.a om/github/gitignore.git /home/REDACTED/go/pkg/mod/golang.ojson -t security ache/node/24.12.--show-toplevel /home/REDACTED/go/pkg/mod/golang.o/run/containerd/io.containerd.runtime.v2.task/moby/56eb414411f4c020612e6a6e402d8b58fa933d073484475aa4650db629696795 -o .git -trimpath /usr/bin/gh -p main -lang=go1.25 gh (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login pload-artifact/git/ref/tags/v5 -trimpath /usr/bin/git -p main -lang=go1.25 git -C 2515-12899/test-purge-campaign-711299749 config (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Fix engine.version to accept numeric types</issue_title>
<issue_description>## Objective

Fix engine.version field to accept numeric types as advertised in schema, preventing silent configuration failures.

Context

The schema defines engine.version as "type": ["string", "number"] with examples [20, 3.11], but the code only accepts strings. Users following schema examples with numeric versions have their configuration silently ignored.

Location: pkg/workflow/engine.go:66-69

Current Implementation

// Only checks string type
if version, hasVersion := engineObj["version"]; hasVersion {
    if versionStr, ok := version.(string); ok {
        config.Version = versionStr
    }
}

Recommended Fix

Apply the pattern already used for max-turns field in the same file (lines 81-87):

if version, hasVersion := engineObj["version"]; hasVersion {
    switch v := version.(type) {
    case string:
        config.Version = v
    case int, int64, uint64:
        config.Version = fmt.Sprintf("%d", v)
    case float64:
        config.Version = fmt.Sprintf("%g", v)
    }
}

Files to Modify

  • Update: pkg/workflow/engine.go (lines 66-69)
  • Update: pkg/workflow/engine_test.go (add test cases)

Acceptance Criteria

  • String versions continue to work: engine.version: "beta"
  • Integer versions work: engine.version: 20
  • Float versions work: engine.version: 3.11
  • Test cases cover all three type scenarios
  • No breaking changes to existing configurations

Estimated Effort

~10 minutes implementation
Related to #8221

AI generated by Plan Command for discussion #8218

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


💡 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.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix engine.version to accept numeric types Fix engine.version to accept numeric types per schema Dec 31, 2025
Copilot AI requested a review from mnkiefer December 31, 2025 01:31
@pelikhan pelikhan marked this pull request as ready for review December 31, 2025 01:33
@pelikhan pelikhan merged commit 3b1f1ed into main Dec 31, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-engine-version-accept-numbers branch December 31, 2025 01:33
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.

[plan] Fix engine.version to accept numeric types

3 participants