UAT: agents resource type show/add --format json wrong schema — uses resource_kind/cli_args/flat sandbox_strategy instead of spec-required physical_virtual/cli_arguments/nested sandbox object; missing source and registered fields #6868

Open
opened 2026-04-10 03:49:03 +00:00 by HAL9000 · 0 comments
Owner

Background and Context

agents resource type show <NAME> --format json and agents resource type add --config <FILE> --format json both route through the _resource_type_dict() helper in src/cleveragents/cli/commands/resource.py. This helper produces a dict that does not conform to the JSON schema specified in the documentation for either command.

Current Behavior

_resource_type_dict() (line 121–148 of resource.py) produces:

{
  "name": "git-checkout",
  "description": "...",
  "resource_kind": "physical",
  "sandbox_strategy": "git_worktree",
  "user_addable": true,
  "built_in": true,
  "inherits": null,
  "cli_args": [
    { "name": "--path", "type": "path", "required": true, "description": "...", "default": null }
  ],
  "parent_types": [],
  "child_types": ["git", "fs-directory"],
  "handler": "GitCheckoutHandler",
  "capabilities": { "read": true, "write": true, "sandbox": true, "checkpoint": false },
  "equivalence": null
}

Additionally, neither command wraps output in the standard command/status/exit_code/data/timing/messages JSON envelope.

Expected Behavior (from spec)

Per docs/specification.md §agents resource type show (JSON tab):

{
  "command": "resource type show",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "name": "git-checkout",
    "source": "built-in",
    "description": "A locally checked-out git repository with worktree",
    "physical_virtual": "physical",
    "user_addable": true,
    "cli_arguments": [
      { "argument": "--path", "required": true, "type": "path", "description": "Local checkout directory" },
      { "argument": "--branch", "required": false, "type": "string", "description": "Default branch (default: main)" }
    ],
    "parent_types": { "allowed": "any", "top_level": true },
    "child_types": [
      { "type": "git", "auto": true, "manual_link": false, "description": "..." },
      { "type": "fs-directory", "auto": true, "manual_link": false, "description": "..." }
    ],
    "sandbox": {
      "strategy": "git_worktree",
      "checkpointable": true,
      "handler": "GitCheckoutHandler"
    }
  },
  "timing": { "started": "...", "duration_ms": 42 },
  "messages": ["Resource type details loaded"]
}

Per docs/specification.md §agents resource type add (JSON tab) the data object also requires registered (ISO timestamp).

Acceptance Criteria

  • --format json output uses physical_virtual not resource_kind
  • --format json output uses cli_arguments array with argument key (not cli_args/name)
  • --format json output nests strategy, checkpointable, handler under sandbox object
  • --format json output includes source field ("built-in" or "custom")
  • resource type add --format json includes registered ISO timestamp
  • Output is wrapped in spec-required command/status/exit_code/data/timing/messages envelope
  • parent_types rendered as structured object not flat list

Supporting Information

  • File: src/cleveragents/cli/commands/resource.py, function _resource_type_dict() (lines 121–148)
  • Spec reference: docs/specification.md §agents resource type show and §agents resource type add
  • Previously filed cycle-4 issue #6831 covers resource type list JSON — this issue is distinct and covers show and add

Subtasks

  • Rewrite _resource_type_dict() to produce spec-compliant schema
  • Add source computation (built-in vs custom via spec.built_in)
  • Emit registered field for type add output
  • Nest sandbox_strategy/handler/checkpointable under sandbox object
  • Restructure cli_argscli_arguments with argument key
  • Restructure parent_types as {allowed, top_level} object
  • Restructure child_types as list of {type, auto, manual_link, description} objects
  • Wrap output in standard JSON envelope
  • Tests (Behave): add scenarios for JSON output schema compliance
  • Tests (Robot): add integration test for JSON output
  • Run nox -s coverage_report, verify ≥97%
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Metadata

  • Commit Message: fix(cli): align resource type show/add json output with spec schema
  • Branch: fix/resource-type-show-add-json-schema

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Background and Context `agents resource type show <NAME> --format json` and `agents resource type add --config <FILE> --format json` both route through the `_resource_type_dict()` helper in `src/cleveragents/cli/commands/resource.py`. This helper produces a dict that does not conform to the JSON schema specified in the documentation for either command. ## Current Behavior `_resource_type_dict()` (line 121–148 of `resource.py`) produces: ```json { "name": "git-checkout", "description": "...", "resource_kind": "physical", "sandbox_strategy": "git_worktree", "user_addable": true, "built_in": true, "inherits": null, "cli_args": [ { "name": "--path", "type": "path", "required": true, "description": "...", "default": null } ], "parent_types": [], "child_types": ["git", "fs-directory"], "handler": "GitCheckoutHandler", "capabilities": { "read": true, "write": true, "sandbox": true, "checkpoint": false }, "equivalence": null } ``` Additionally, neither command wraps output in the standard `command/status/exit_code/data/timing/messages` JSON envelope. ## Expected Behavior (from spec) Per `docs/specification.md` §`agents resource type show` (JSON tab): ```json { "command": "resource type show", "status": "ok", "exit_code": 0, "data": { "name": "git-checkout", "source": "built-in", "description": "A locally checked-out git repository with worktree", "physical_virtual": "physical", "user_addable": true, "cli_arguments": [ { "argument": "--path", "required": true, "type": "path", "description": "Local checkout directory" }, { "argument": "--branch", "required": false, "type": "string", "description": "Default branch (default: main)" } ], "parent_types": { "allowed": "any", "top_level": true }, "child_types": [ { "type": "git", "auto": true, "manual_link": false, "description": "..." }, { "type": "fs-directory", "auto": true, "manual_link": false, "description": "..." } ], "sandbox": { "strategy": "git_worktree", "checkpointable": true, "handler": "GitCheckoutHandler" } }, "timing": { "started": "...", "duration_ms": 42 }, "messages": ["Resource type details loaded"] } ``` Per `docs/specification.md` §`agents resource type add` (JSON tab) the `data` object also requires `registered` (ISO timestamp). ## Acceptance Criteria - [ ] `--format json` output uses `physical_virtual` not `resource_kind` - [ ] `--format json` output uses `cli_arguments` array with `argument` key (not `cli_args`/`name`) - [ ] `--format json` output nests `strategy`, `checkpointable`, `handler` under `sandbox` object - [ ] `--format json` output includes `source` field (`"built-in"` or `"custom"`) - [ ] `resource type add --format json` includes `registered` ISO timestamp - [ ] Output is wrapped in spec-required `command/status/exit_code/data/timing/messages` envelope - [ ] `parent_types` rendered as structured object not flat list ## Supporting Information - File: `src/cleveragents/cli/commands/resource.py`, function `_resource_type_dict()` (lines 121–148) - Spec reference: `docs/specification.md` §`agents resource type show` and §`agents resource type add` - Previously filed cycle-4 issue #6831 covers `resource type list` JSON — this issue is distinct and covers `show` and `add` ## Subtasks - [ ] Rewrite `_resource_type_dict()` to produce spec-compliant schema - [ ] Add `source` computation (built-in vs custom via `spec.built_in`) - [ ] Emit `registered` field for `type add` output - [ ] Nest `sandbox_strategy`/`handler`/`checkpointable` under `sandbox` object - [ ] Restructure `cli_args` → `cli_arguments` with `argument` key - [ ] Restructure `parent_types` as `{allowed, top_level}` object - [ ] Restructure `child_types` as list of `{type, auto, manual_link, description}` objects - [ ] Wrap output in standard JSON envelope - [ ] Tests (Behave): add scenarios for JSON output schema compliance - [ ] Tests (Robot): add integration test for JSON output - [ ] Run `nox -s coverage_report`, verify ≥97% - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. ## Metadata - **Commit Message**: `fix(cli): align resource type show/add json output with spec schema` - **Branch**: `fix/resource-type-show-add-json-schema` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-10 04:40:36 +00:00
HAL9000 self-assigned this 2026-04-10 06:07:47 +00:00
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#6868
No description provided.