UAT: agents project context show --format json data schema incorrect — missing context_policy, limits, summarization, current_usage keys #6808

Open
opened 2026-04-10 02:11:50 +00:00 by HAL9000 · 0 comments
Owner

Background and Context

The agents project context show command must return a structured JSON response. The specification (§ agents project context show, JSON tab) defines an exact schema for the data object.

Current Behavior

When running agents project context show --format json <PROJECT>, the data object contains the following flat structure (from project_context.py lines 804–820):

{
  "command": "",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "default_view": { ... },
    "strategize_view": null,
    "execute_view": null,
    "apply_view": null,
    "acms_config": {
      "hot_max_tokens": 8000,
      "warm_max_decisions": 500,
      ...
    }
  },
  ...
}

The command field in the envelope is also always "" (empty) because format_output() is called without the command= kwarg (line 915: format_output(data, output_format)).

Expected Behavior (from spec)

The spec (§ agents project context show JSON tab) requires the data object to contain:

{
  "command": "project context show",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "context_policy": {
      "project": "local/api-service",
      "view": "strategize",
      "include_resources": ["repo"],
      "exclude_paths": ["**/node_modules/**"]
    },
    "limits": {
      "hot_max_tokens": 12000,
      "warm_max_decisions": 50,
      "cold_max_decisions": 200,
      "query_limit": 20,
      "max_file_size": "1 MB",
      "max_total_size": "50 MB"
    },
    "summarization": {
      "enabled": true,
      "max_tokens": 800
    },
    "current_usage": {
      "hot_context_tokens": 8420,
      "hot_context_limit": 12000,
      "warm_entries": 12,
      "warm_limit": 50,
      "cold_entries": 47,
      "cold_limit": 200,
      "indexed_resources": 1
    }
  },
  "timing": { "duration_ms": 38 },
  "messages": ["Context policy loaded"]
}

Required top-level data sub-keys: context_policy, limits, summarization, current_usage.

Steps to Reproduce

  1. Clone the repo and install the package
  2. Create a project: agents project create local/test-proj
  3. Run: agents project context show --format json local/test-proj
  4. Observe: data has default_view, strategize_view, execute_view, apply_view, acms_config instead of the spec-required structure
  5. Observe: command field is always "" (empty string)

Code Location

  • src/cleveragents/cli/commands/project_context.py
    • context_show() function, lines ~804–915
    • format_output(data, output_format) call at line 915 — missing command="project context show" kwarg
    • The data dict built at lines 804–820 does not follow the spec schema

Acceptance Criteria

  • --format json output wraps data in context_policy, limits, summarization, current_usage sub-keys as per spec
  • current_usage reflects live tier usage (hot token count vs limit, warm/cold entry counts vs limits, indexed resource count)
  • command envelope field is "project context show" (not empty string)
  • All other envelope fields (status, exit_code, timing, messages) remain correct

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

## Background and Context The `agents project context show` command must return a structured JSON response. The specification (§ `agents project context show`, JSON tab) defines an exact schema for the `data` object. ## Current Behavior When running `agents project context show --format json <PROJECT>`, the `data` object contains the following flat structure (from `project_context.py` lines 804–820): ```json { "command": "", "status": "ok", "exit_code": 0, "data": { "default_view": { ... }, "strategize_view": null, "execute_view": null, "apply_view": null, "acms_config": { "hot_max_tokens": 8000, "warm_max_decisions": 500, ... } }, ... } ``` The `command` field in the envelope is also always `""` (empty) because `format_output()` is called without the `command=` kwarg (line 915: `format_output(data, output_format)`). ## Expected Behavior (from spec) The spec (§ `agents project context show` JSON tab) requires the `data` object to contain: ```json { "command": "project context show", "status": "ok", "exit_code": 0, "data": { "context_policy": { "project": "local/api-service", "view": "strategize", "include_resources": ["repo"], "exclude_paths": ["**/node_modules/**"] }, "limits": { "hot_max_tokens": 12000, "warm_max_decisions": 50, "cold_max_decisions": 200, "query_limit": 20, "max_file_size": "1 MB", "max_total_size": "50 MB" }, "summarization": { "enabled": true, "max_tokens": 800 }, "current_usage": { "hot_context_tokens": 8420, "hot_context_limit": 12000, "warm_entries": 12, "warm_limit": 50, "cold_entries": 47, "cold_limit": 200, "indexed_resources": 1 } }, "timing": { "duration_ms": 38 }, "messages": ["Context policy loaded"] } ``` Required top-level `data` sub-keys: `context_policy`, `limits`, `summarization`, `current_usage`. ## Steps to Reproduce 1. Clone the repo and install the package 2. Create a project: `agents project create local/test-proj` 3. Run: `agents project context show --format json local/test-proj` 4. Observe: `data` has `default_view`, `strategize_view`, `execute_view`, `apply_view`, `acms_config` instead of the spec-required structure 5. Observe: `command` field is always `""` (empty string) ## Code Location - `src/cleveragents/cli/commands/project_context.py` - `context_show()` function, lines ~804–915 - `format_output(data, output_format)` call at line 915 — missing `command="project context show"` kwarg - The `data` dict built at lines 804–820 does not follow the spec schema ## Acceptance Criteria - [ ] `--format json` output wraps data in `context_policy`, `limits`, `summarization`, `current_usage` sub-keys as per spec - [ ] `current_usage` reflects live tier usage (hot token count vs limit, warm/cold entry counts vs limits, indexed resource count) - [ ] `command` envelope field is `"project context show"` (not empty string) - [ ] All other envelope fields (`status`, `exit_code`, `timing`, `messages`) remain correct --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-10 02:12:05 +00:00
HAL9000 self-assigned this 2026-04-10 06:07:49 +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#6808
No description provided.