UAT: agents project context simulate --format json data schema missing spec-required strategy_results and fusion_result keys #6815

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

Background and Context

The agents project context simulate command must return a JSON response with a specific schema. The specification (§ agents project context simulate, JSON tab) defines an exact data structure containing simulation, strategy_results, and fusion_result keys.

Current Behavior

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

{
  "command": "",
  "data": {
    "total_tokens": 0,
    "budget_used": 0.0,
    "strategies_used": ["tier_retrieval"],
    "context_hash": "abc123",
    "preamble": "Simulated context for ...",
    "fragment_count": 0,
    "fragments": [],
    "project": "local/test-proj",
    "view": "default",
    "acms_config": { ... },
    "phase_analysis": { ... }
  }
}

Missing keys: strategy_results, fusion_result. The command field is "" (empty string) because format_output() is called without the command= kwarg (line 1307: format_output(data, output_format)).

Expected Behavior (from spec)

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

{
  "command": "project context simulate",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "simulation": {
      "project": "local/api-service",
      "view": "strategize",
      "budget": 16000,
      "budget_source": "override",
      "focus": ["uko-py:module/src.auth", "uko-py:module/src.db"]
    },
    "strategy_results": [
      {
        "name": "breadth-depth-navigator",
        "confidence": 0.85,
        "budget_tokens": 7200,
        "fragments": 12,
        "top": [
          { "path": "src/auth/__init__.py", "depth": 9, "tokens": 1240, "score": 0.95 }
        ]
      },
      {
        "name": "semantic-embedding",
        "confidence": 0.60,
        "budget_tokens": 5600,
        "fragments": 8,
        "top": [...]
      }
    ],
    "fusion_result": {
      "included_fragments": 18,
      "included_tokens": 14820,
      "budget_utilization": 0.926,
      "excluded_fragments": 7,
      "excluded_tokens": 3200,
      "deduplicated_fragments": 4,
      "skeleton_tokens": 2400,
      "skeleton_ratio": 0.15,
      "preamble_tokens": 180
    }
  },
  "timing": { "duration_ms": 310 },
  "messages": ["Simulation complete (dry run -- no context was assembled)"]
}

Key spec-required data sub-keys: simulation, strategy_results, fusion_result.

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 simulate --format json local/test-proj
  4. Observe: data contains total_tokens, budget_used, strategies_used, etc. — not the spec-required structure
  5. Observe: strategy_results and fusion_result keys are entirely absent
  6. Observe: command field in envelope is "" (empty string)

Code Location

  • src/cleveragents/cli/commands/project_context.py
    • context_simulate() function, lines ~1245–1307
    • format_output(data, output_format) call at line 1307 — missing command="project context simulate" kwarg
    • _assembled_to_dict() helper at lines 260–283 produces the wrong schema
    • The data dict does not decompose results per-strategy as strategy_results entries

Acceptance Criteria

  • --format json output has simulation, strategy_results, and fusion_result sub-keys as per spec
  • strategy_results is an array — one entry per strategy — with name, confidence, budget_tokens, fragments, and top fragment list
  • fusion_result contains included_fragments, included_tokens, budget_utilization, excluded_fragments, excluded_tokens, deduplicated_fragments, skeleton_tokens, skeleton_ratio, preamble_tokens
  • command envelope field is "project context simulate" (not empty string)
  • messages contains "Simulation complete (dry run -- no context was assembled)"

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

## Background and Context The `agents project context simulate` command must return a JSON response with a specific schema. The specification (§ `agents project context simulate`, JSON tab) defines an exact `data` structure containing `simulation`, `strategy_results`, and `fusion_result` keys. ## Current Behavior When running `agents project context simulate --format json <PROJECT>`, the `data` object contains an implementation-internal flat structure (from `project_context.py` lines 1245–1249): ```json { "command": "", "data": { "total_tokens": 0, "budget_used": 0.0, "strategies_used": ["tier_retrieval"], "context_hash": "abc123", "preamble": "Simulated context for ...", "fragment_count": 0, "fragments": [], "project": "local/test-proj", "view": "default", "acms_config": { ... }, "phase_analysis": { ... } } } ``` Missing keys: `strategy_results`, `fusion_result`. The `command` field is `""` (empty string) because `format_output()` is called without the `command=` kwarg (line 1307: `format_output(data, output_format)`). ## Expected Behavior (from spec) The spec (§ `agents project context simulate` JSON tab) requires: ```json { "command": "project context simulate", "status": "ok", "exit_code": 0, "data": { "simulation": { "project": "local/api-service", "view": "strategize", "budget": 16000, "budget_source": "override", "focus": ["uko-py:module/src.auth", "uko-py:module/src.db"] }, "strategy_results": [ { "name": "breadth-depth-navigator", "confidence": 0.85, "budget_tokens": 7200, "fragments": 12, "top": [ { "path": "src/auth/__init__.py", "depth": 9, "tokens": 1240, "score": 0.95 } ] }, { "name": "semantic-embedding", "confidence": 0.60, "budget_tokens": 5600, "fragments": 8, "top": [...] } ], "fusion_result": { "included_fragments": 18, "included_tokens": 14820, "budget_utilization": 0.926, "excluded_fragments": 7, "excluded_tokens": 3200, "deduplicated_fragments": 4, "skeleton_tokens": 2400, "skeleton_ratio": 0.15, "preamble_tokens": 180 } }, "timing": { "duration_ms": 310 }, "messages": ["Simulation complete (dry run -- no context was assembled)"] } ``` Key spec-required `data` sub-keys: `simulation`, `strategy_results`, `fusion_result`. ## 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 simulate --format json local/test-proj` 4. Observe: `data` contains `total_tokens`, `budget_used`, `strategies_used`, etc. — not the spec-required structure 5. Observe: `strategy_results` and `fusion_result` keys are entirely absent 6. Observe: `command` field in envelope is `""` (empty string) ## Code Location - `src/cleveragents/cli/commands/project_context.py` - `context_simulate()` function, lines ~1245–1307 - `format_output(data, output_format)` call at line 1307 — missing `command="project context simulate"` kwarg - `_assembled_to_dict()` helper at lines 260–283 produces the wrong schema - The `data` dict does not decompose results per-strategy as `strategy_results` entries ## Acceptance Criteria - [ ] `--format json` output has `simulation`, `strategy_results`, and `fusion_result` sub-keys as per spec - [ ] `strategy_results` is an array — one entry per strategy — with `name`, `confidence`, `budget_tokens`, `fragments`, and `top` fragment list - [ ] `fusion_result` contains `included_fragments`, `included_tokens`, `budget_utilization`, `excluded_fragments`, `excluded_tokens`, `deduplicated_fragments`, `skeleton_tokens`, `skeleton_ratio`, `preamble_tokens` - [ ] `command` envelope field is `"project context simulate"` (not empty string) - [ ] `messages` contains `"Simulation complete (dry run -- no context was assembled)"` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-10 02:13: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#6815
No description provided.