Skip to content

script_runner: _detect_runtime and is_runtime_cmd use bare substring matching #454

@danielmeppiel

Description

@danielmeppiel

Description

Follow-up from #396 and PR #397. The regex-based runtime detection has a false-positive when model names contain runtime keywords (e.g., copilot --model gpt-5.3-codex). PR #397 fixes the codex regex, but the same bug class exists in:

  1. is_runtime_cmd() (~line 263): uses runtime_name in cmd bare substring match
  2. _detect_runtime() (~line 412-421): uses runtime in script_content bare substring match
  3. Copilot regex (~line 362): same (^|\s) pattern that matches mid-command
  4. LLM regex (~line 381): same pattern

Expected behavior

All runtime detection should use start-of-string anchored patterns (^runtime\s+) for command matching. The env-var detection path (lines 296-341) already handles prefix cases separately.

Location

src/apm_cli/core/script_runner.py

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDeprecated: use type/bug. Kept for issue history; will be removed in milestone 0.10.0.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions