Skip to content

fix(cli): SSH key prefix ignores the devcontainer name when devcontainer.json holds a URL #487

Closed

Description

@dan-petty

Problem

_resolve_prefix_from_devcontainer (src/devops_cli/crypto/ssh_keys.py) strips JSONC comments with re.sub(r"//.*$", "", text, flags=re.MULTILINE). That also cuts every string containing //. Since #485, .devcontainer/devcontainer.json holds "credential.https://github.com.helper" values. The stripped text no longer parses, the function returns None, and get_ssh_key_prefix() falls back to the current directory's name.

As a result, devops ssh generate names keys after the checkout directory instead of the devcontainer (devops-cli) in any checkout whose directory has a different name, git worktrees included. tests/test_ssh.py::test_ssh_generate_key_collision fails in those checkouts, and the pre-push hook blocks pushes from them. It passes only where the directory happens to be named devops-cli, as in GitHub CI.

Fix

commands/devcontainer.py already has a string-aware JSONC stripper (_strip_json_comments). Move it to a shared module and use it in both places.

Acceptance criteria

  • The devcontainer name is used as the SSH key prefix when devcontainer.json contains // inside strings.
  • One JSONC comment stripper is shared by the devcontainer command and the SSH key prefix lookup.
  • A test covers a URL-valued string next to real comments.

Activity

  1. added this to the v0.2.23 milestone on Sep 24, 2026
  2. added
    type/bug
    scope/cli
    priority/p1-high
    on Sep 24, 2026
  3. added a commit that references this issue on Sep 24, 2026
    f00b25c
  4. dan-petty commented on Sep 24, 2026

    @dan-petty
    OwnerAuthor

    Closed by #488, merged into release/v0.2.23.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  5. added a commit that references this issue on Sep 28, 2026
    ea49d6e
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

    priority/p1-highscope/clitype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions