BUG-HUNT: [Consistency] Platform detection inconsistency between version and info commands causes user confusion #7152

Open
opened 2026-04-10 08:15:45 +00:00 by HAL9000 · 2 comments
Owner

Background

During Bug Hunt Cycle 2 Batch 3, Worker 22 identified an inconsistency in platform detection logic within the CLI system commands module (src/cleveragents/cli/commands/system.py). The version and info commands — both part of the CLI0.core group per the specification — produce different platform string representations for the same underlying system, causing user confusion and potential breakage for tools that parse this output.

Current Behavior (Bug)

Two distinct format patterns are used in closely related functions within the same file:

Command Function Format Used Example Output
agents version build_version_data() f"{sys.platform}-{platform.machine()}" linux-x86_64
agents info build_info_data() f"{platform.system()} {platform.release()} ({platform.machine()})" Linux 6.12.63 (x86_64)

Affected lines: ~91-93 (version command), ~125-127 (info command) in src/cleveragents/cli/commands/system.py.

The version command uses sys.platform (a Python runtime identifier, e.g. linux, darwin, win32) combined with platform.machine(), while the info command uses platform.system() (human-readable OS name), platform.release() (kernel/OS release), and platform.machine(). These are fundamentally different data sources producing incompatible representations.

Expected Behavior

Both agents version and agents info should report platform information in a single, consistent format. The more detailed format used by info (e.g. Linux 6.12.63 (x86_64)) is preferred as it provides human-readable context. Ideally, a shared helper function (e.g. _platform_string()) should be extracted to guarantee consistency and prevent future drift.

Evidence

On the same system:

  • agents version reports: "linux-x86_64"
  • agents info reports: "Linux 6.12.63 (x86_64)"

Likelihood: High — occurs on every invocation of either command.

Suggested Fix

  1. Extract a private helper function _platform_string() -> str in system.py that returns the canonical platform representation.
  2. Standardise on the more informative format: f"{platform.system()} {platform.release()} ({platform.machine()})".
  3. Update build_version_data() to call _platform_string() instead of the inline f"{sys.platform}-{platform.machine()}" expression.
  4. Update build_info_data() to call _platform_string() as well.
  5. Add/update BDD scenarios in features/ to assert consistent platform output across both commands.

Acceptance Criteria

  • agents version --format json and agents info --format json both return the same platform string format.
  • A single _platform_string() helper is the sole source of truth for platform representation in system.py.
  • No regression in existing BDD scenarios for version or info commands.
  • All nox stages pass and coverage remains ≥ 97%.

Metadata

  • Branch: bugfix/cli/platform-detection-consistency
  • Commit Message: fix(cli): standardise platform string format across version and info commands
  • Milestone: Backlog (no milestone — see backlog note below)
  • Parent Epic: Orphan — no matching Bug Hunt Cycle 2 Epic found; requires manual linking

Subtasks

  • Extract _platform_string() helper in src/cleveragents/cli/commands/system.py
  • Update build_version_data() to use _platform_string()
  • Update build_info_data() to use _platform_string()
  • Add/update BDD feature scenarios asserting consistent platform format for both commands
  • Verify all nox stages pass (lint, typecheck, unit_tests, integration_tests, coverage)

Definition of Done

  • _platform_string() helper exists and is used by both build_version_data() and build_info_data()
  • agents version and agents info return identical platform format in all output modes (rich/plain/json/yaml)
  • BDD scenarios cover the consistency requirement
  • No # type: ignore or bare except: introduced
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone Bug Hunt Cycle 2 Batch 3. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: Acting on behalf of: Bug Hunt Cycle 2 Batch 3 | Agent: new-issue-creator

## Background During Bug Hunt Cycle 2 Batch 3, Worker 22 identified an inconsistency in platform detection logic within the CLI system commands module (`src/cleveragents/cli/commands/system.py`). The `version` and `info` commands — both part of the `CLI0.core` group per the specification — produce different platform string representations for the same underlying system, causing user confusion and potential breakage for tools that parse this output. ## Current Behavior (Bug) Two distinct format patterns are used in closely related functions within the same file: | Command | Function | Format Used | Example Output | |---|---|---|---| | `agents version` | `build_version_data()` | `f"{sys.platform}-{platform.machine()}"` | `linux-x86_64` | | `agents info` | `build_info_data()` | `f"{platform.system()} {platform.release()} ({platform.machine()})"` | `Linux 6.12.63 (x86_64)` | **Affected lines:** `~91-93` (version command), `~125-127` (info command) in `src/cleveragents/cli/commands/system.py`. The `version` command uses `sys.platform` (a Python runtime identifier, e.g. `linux`, `darwin`, `win32`) combined with `platform.machine()`, while the `info` command uses `platform.system()` (human-readable OS name), `platform.release()` (kernel/OS release), and `platform.machine()`. These are fundamentally different data sources producing incompatible representations. ## Expected Behavior Both `agents version` and `agents info` should report platform information in a single, consistent format. The more detailed format used by `info` (e.g. `Linux 6.12.63 (x86_64)`) is preferred as it provides human-readable context. Ideally, a shared helper function (e.g. `_platform_string()`) should be extracted to guarantee consistency and prevent future drift. ## Evidence On the same system: - `agents version` reports: `"linux-x86_64"` - `agents info` reports: `"Linux 6.12.63 (x86_64)"` **Likelihood:** High — occurs on every invocation of either command. ## Suggested Fix 1. Extract a private helper function `_platform_string() -> str` in `system.py` that returns the canonical platform representation. 2. Standardise on the more informative format: `f"{platform.system()} {platform.release()} ({platform.machine()})"`. 3. Update `build_version_data()` to call `_platform_string()` instead of the inline `f"{sys.platform}-{platform.machine()}"` expression. 4. Update `build_info_data()` to call `_platform_string()` as well. 5. Add/update BDD scenarios in `features/` to assert consistent platform output across both commands. ## Acceptance Criteria - `agents version --format json` and `agents info --format json` both return the same `platform` string format. - A single `_platform_string()` helper is the sole source of truth for platform representation in `system.py`. - No regression in existing BDD scenarios for `version` or `info` commands. - All nox stages pass and coverage remains ≥ 97%. --- ## Metadata - **Branch**: `bugfix/cli/platform-detection-consistency` - **Commit Message**: `fix(cli): standardise platform string format across version and info commands` - **Milestone**: Backlog (no milestone — see backlog note below) - **Parent Epic**: _Orphan — no matching Bug Hunt Cycle 2 Epic found; requires manual linking_ ## Subtasks - [ ] Extract `_platform_string()` helper in `src/cleveragents/cli/commands/system.py` - [ ] Update `build_version_data()` to use `_platform_string()` - [ ] Update `build_info_data()` to use `_platform_string()` - [ ] Add/update BDD feature scenarios asserting consistent platform format for both commands - [ ] Verify all nox stages pass (lint, typecheck, unit_tests, integration_tests, coverage) ## Definition of Done - [ ] `_platform_string()` helper exists and is used by both `build_version_data()` and `build_info_data()` - [ ] `agents version` and `agents info` return identical platform format in all output modes (rich/plain/json/yaml) - [ ] BDD scenarios cover the consistency requirement - [ ] No `# type: ignore` or bare `except:` introduced - [ ] All nox stages pass - [ ] Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone Bug Hunt Cycle 2 Batch 3. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: Acting on behalf of: Bug Hunt Cycle 2 Batch 3 | Agent: new-issue-creator
Author
Owner

⚠️ Orphan Issue — Manual Parent Epic Linking Required

This issue was created during automated Bug Hunt Cycle 2 Batch 3 (Worker 22). No matching parent Epic for CLI system command consistency bugs was found in the open issues at time of creation.

Per CONTRIBUTING.md, every issue must be linked to a parent Epic using Forgejo's dependency system (child blocks parent). A human maintainer must:

  1. Identify or create the appropriate parent Epic (e.g. an Epic covering CLI system command quality / CLI0.core group consistency).
  2. Create the dependency link so that this issue (#7152) blocks the parent Epic.

The correct API call direction is:

# This issue (#7152) BLOCKS the parent Epic
curl -X POST ".../issues/7152/blocks" -d '{"index": <PARENT_EPIC_NUMBER>}'

Automated by CleverAgents Bot
Supervisor: Acting on behalf of: Bug Hunt Cycle 2 Batch 3 | Agent: new-issue-creator

⚠️ **Orphan Issue — Manual Parent Epic Linking Required** This issue was created during automated Bug Hunt Cycle 2 Batch 3 (Worker 22). No matching parent Epic for CLI system command consistency bugs was found in the open issues at time of creation. Per CONTRIBUTING.md, every issue **must** be linked to a parent Epic using Forgejo's dependency system (child **blocks** parent). A human maintainer must: 1. Identify or create the appropriate parent Epic (e.g. an Epic covering CLI system command quality / `CLI0.core` group consistency). 2. Create the dependency link so that this issue (#7152) **blocks** the parent Epic. The correct API call direction is: ```bash # This issue (#7152) BLOCKS the parent Epic curl -X POST ".../issues/7152/blocks" -d '{"index": <PARENT_EPIC_NUMBER>}' ``` --- **Automated by CleverAgents Bot** Supervisor: Acting on behalf of: Bug Hunt Cycle 2 Batch 3 | Agent: new-issue-creator
Author
Owner

Verified — Consistency bug: platform detection inconsistency between version and info commands. MoSCoW: Should-have. Priority: Medium.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Verified** — Consistency bug: platform detection inconsistency between version and info commands. MoSCoW: Should-have. Priority: Medium. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#7152
No description provided.