UAT: agents project context set --format json data schema incorrect — missing context_policy, limits, summarization, other_views keys #6818

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

Background and Context

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

Current Behavior

When running agents project context set --format json ... <PROJECT>, the data object contains an internal flat structure (from project_context.py lines 745–758):

{
  "command": "",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "default_view": { "include_resources": [], "exclude_resources": [], ... },
    "strategize_view": null,
    "execute_view": null,
    "apply_view": null,
    "acms_config": {
      "hot_max_tokens": 8000,
      "warm_max_decisions": 500,
      ...
    }
  },
  "timing": { ... },
  "messages": [...]
}

Additionally:

  • In rich mode (default), the command outputs only a success Panel ("Context Policy Updated") with no structured data at all — no context_policy, limits, or summarization panels as shown in the spec's Rich example
  • The command field in the envelope is always "" (empty) because format_output() is called without the command= kwarg (line 758: format_output(data, output_format))

Expected Behavior (from spec)

The spec (§ agents project context set JSON tab) requires:

{
  "command": "project context set",
  "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
    },
    "other_views": {
      "execute": "(default)",
      "apply": "(default)",
      "default": "(unset)"
    }
  },
  "timing": { "duration_ms": 42 },
  "messages": ["Context policy updated"]
}

Additionally, the spec's Rich output example (§ agents project context set, Rich tab) shows four distinct panels: Context Policy, Limits, Summarization, and Other Views — not a single "Context Policy Updated" success panel.

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 set --hot-max-tokens 12000 --warm-max-decisions 50 --format json local/test-proj
  4. Observe: data has default_view, strategize_view, execute_view, apply_view, acms_config — not the spec-required structure
  5. Observe: command field in envelope is "" (empty string)
  6. Run the same command without --format json (rich mode)
  7. Observe: only a single "Context Policy Updated" success panel — not the spec-required multi-panel output showing policy details, limits, and summarization

Code Location

  • src/cleveragents/cli/commands/project_context.py
    • context_set() function, lines ~745–758
    • format_output(data, output_format) call at line 758 — missing command="project context set" kwarg
    • data = _policy_to_dict(policy) + data["acms_config"] = acms at lines 745–746 — wrong schema
    • Rich output at lines 747–756 shows only a success Panel instead of the spec-required 4-panel layout

Acceptance Criteria

  • --format json output has context_policy, limits, summarization, other_views sub-keys as per spec
  • limits reflects the effective ACMS tier limits (hot_max_tokens, warm/cold decisions, query_limit, max_file_size, max_total_size)
  • other_views shows the state of non-target views (e.g., "(default)" or "(unset)")
  • command envelope field is "project context set" (not empty string)
  • Rich output shows 4 panels: Context Policy, Limits, Summarization, Other Views matching the spec's Rich example

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

## Background and Context The `agents project context set` command must return a structured JSON response on success. The specification (§ `agents project context set`, JSON tab) defines an exact schema for the `data` object. ## Current Behavior When running `agents project context set --format json ... <PROJECT>`, the `data` object contains an internal flat structure (from `project_context.py` lines 745–758): ```json { "command": "", "status": "ok", "exit_code": 0, "data": { "default_view": { "include_resources": [], "exclude_resources": [], ... }, "strategize_view": null, "execute_view": null, "apply_view": null, "acms_config": { "hot_max_tokens": 8000, "warm_max_decisions": 500, ... } }, "timing": { ... }, "messages": [...] } ``` Additionally: - In `rich` mode (default), the command outputs only a success `Panel` ("Context Policy Updated") with no structured data at all — no context_policy, limits, or summarization panels as shown in the spec's Rich example - The `command` field in the envelope is always `""` (empty) because `format_output()` is called without the `command=` kwarg (line 758: `format_output(data, output_format)`) ## Expected Behavior (from spec) The spec (§ `agents project context set` JSON tab) requires: ```json { "command": "project context set", "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 }, "other_views": { "execute": "(default)", "apply": "(default)", "default": "(unset)" } }, "timing": { "duration_ms": 42 }, "messages": ["Context policy updated"] } ``` Additionally, the spec's Rich output example (§ `agents project context set`, Rich tab) shows four distinct panels: `Context Policy`, `Limits`, `Summarization`, and `Other Views` — not a single "Context Policy Updated" success panel. ## 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 set --hot-max-tokens 12000 --warm-max-decisions 50 --format json local/test-proj` 4. Observe: `data` has `default_view`, `strategize_view`, `execute_view`, `apply_view`, `acms_config` — not the spec-required structure 5. Observe: `command` field in envelope is `""` (empty string) 6. Run the same command without `--format json` (rich mode) 7. Observe: only a single "Context Policy Updated" success panel — not the spec-required multi-panel output showing policy details, limits, and summarization ## Code Location - `src/cleveragents/cli/commands/project_context.py` - `context_set()` function, lines ~745–758 - `format_output(data, output_format)` call at line 758 — missing `command="project context set"` kwarg - `data = _policy_to_dict(policy)` + `data["acms_config"] = acms` at lines 745–746 — wrong schema - Rich output at lines 747–756 shows only a success Panel instead of the spec-required 4-panel layout ## Acceptance Criteria - [ ] `--format json` output has `context_policy`, `limits`, `summarization`, `other_views` sub-keys as per spec - [ ] `limits` reflects the effective ACMS tier limits (hot_max_tokens, warm/cold decisions, query_limit, max_file_size, max_total_size) - [ ] `other_views` shows the state of non-target views (e.g., `"(default)"` or `"(unset)"`) - [ ] `command` envelope field is `"project context set"` (not empty string) - [ ] Rich output shows 4 panels: `Context Policy`, `Limits`, `Summarization`, `Other Views` matching the spec's Rich example --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-10 02:15: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#6818
No description provided.