[BUG] context inspect JSON output missing required fields: tier_metrics, project_fragments, actor_visibility #9564

Open
opened 2026-04-14 23:12:22 +00:00 by HAL9000 · 2 comments
Owner

Metadata

  • Commit message: fix(context): return tier_metrics, project_fragments, actor_visibility in context inspect JSON output
  • Branch name: fix/context-inspect-json-missing-fields

Background and Context

The context inspect command, when invoked with --format json, does not return the required JSON fields specified in the v3.4.0 product specification (ACMS v1 + Context Scaling milestone). The Advanced Context Management System v1 defines a structured JSON contract for the context inspect output that must include tier storage metrics, project fragment counts, and actor visibility information.

This defect is tracked as a known test failure in features/context_cli_wiring.feature under the tag @tdd_issue_4244 @tdd_expected_fail, which was introduced to allow CI to pass while the underlying bug remains unresolved. Related test-fix tracking: #4244.


Expected Behavior

When a user runs:

agents project add local/test-app
agents project context inspect local/test-app --format json

The JSON output must contain the following top-level keys as specified in the v3.4.0 product specification:

  • tier_metrics — an object containing:
    • hot_count — number of items in hot storage tier
    • warm_count — number of items in warm storage tier
    • cold_count — number of items in cold storage tier
  • project_fragments — an object containing:
    • total — total count of project context fragments
  • actor_visibility — a list of actors currently visible in the context scope

Actual Behavior

The context inspect --format json command succeeds (exit code 0) but the JSON output is missing the required fields tier_metrics, project_fragments, and actor_visibility. These fields are either absent entirely or not serialized into the JSON response.

Steps to Reproduce:

  1. Create a project:
    agents project add local/test-app
    
  2. Run the inspect command with JSON format:
    agents project context inspect local/test-app --format json
    
  3. Observe the JSON output — the keys tier_metrics, project_fragments, and actor_visibility are missing.

Affected feature file: features/context_cli_wiring.feature

  • Scenarios tagged @tdd_issue_4244 @tdd_expected_fail:
    • Inspect with JSON format returns valid JSON (L98)
    • Inspect with pre-populated fragments shows counts (L106)
    • Inspect shows project-scoped tier metrics not global counts (L113)

Acceptance Criteria

  • agents project context inspect <project> --format json returns a valid JSON object containing tier_metrics, project_fragments, and actor_visibility at the top level
  • tier_metrics contains hot_count, warm_count, and cold_count integer fields
  • project_fragments contains a total integer field reflecting the count of context fragments for the project
  • actor_visibility is a list of visible actor identifiers scoped to the project
  • Tier metrics are project-scoped (not global counts)
  • All three scenarios in features/context_cli_wiring.feature tagged @tdd_issue_4244 pass without @tdd_expected_fail
  • The @tdd_issue_4244 and @tdd_expected_fail tags are removed from the passing scenarios
  • No regression in other context inspect or context simulate scenarios
  • Test coverage ≥ 97%

Subtasks

  • Identify the context inspect command handler / serializer responsible for JSON output
  • Add tier_metrics serialization (hot/warm/cold counts) scoped to the target project
  • Add project_fragments serialization (total fragment count) for the target project
  • Add actor_visibility serialization (list of visible actors in project scope)
  • Ensure project-scoped queries are used (not global aggregates)
  • Update / add unit tests covering the three affected scenarios
  • Remove @tdd_expected_fail and @tdd_issue_4244 tags from passing scenarios in features/context_cli_wiring.feature
  • Run full nox suite and confirm coverage ≥ 97%

Definition of Done

This issue should be closed when:

  1. All three @tdd_issue_4244-tagged scenarios in features/context_cli_wiring.feature pass in CI without @tdd_expected_fail.
  2. The JSON output of context inspect --format json consistently includes tier_metrics, project_fragments, and actor_visibility with correct, project-scoped values.
  3. No regressions are introduced in related context CLI scenarios.
  4. Test coverage remains ≥ 97%.

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit message:** `fix(context): return tier_metrics, project_fragments, actor_visibility in context inspect JSON output` - **Branch name:** `fix/context-inspect-json-missing-fields` --- ## Background and Context The `context inspect` command, when invoked with `--format json`, does not return the required JSON fields specified in the v3.4.0 product specification (ACMS v1 + Context Scaling milestone). The Advanced Context Management System v1 defines a structured JSON contract for the `context inspect` output that must include tier storage metrics, project fragment counts, and actor visibility information. This defect is tracked as a known test failure in `features/context_cli_wiring.feature` under the tag `@tdd_issue_4244 @tdd_expected_fail`, which was introduced to allow CI to pass while the underlying bug remains unresolved. Related test-fix tracking: #4244. --- ## Expected Behavior When a user runs: ```bash agents project add local/test-app agents project context inspect local/test-app --format json ``` The JSON output **must** contain the following top-level keys as specified in the v3.4.0 product specification: - `tier_metrics` — an object containing: - `hot_count` — number of items in hot storage tier - `warm_count` — number of items in warm storage tier - `cold_count` — number of items in cold storage tier - `project_fragments` — an object containing: - `total` — total count of project context fragments - `actor_visibility` — a list of actors currently visible in the context scope --- ## Actual Behavior The `context inspect --format json` command **succeeds** (exit code 0) but the JSON output is **missing** the required fields `tier_metrics`, `project_fragments`, and `actor_visibility`. These fields are either absent entirely or not serialized into the JSON response. **Steps to Reproduce:** 1. Create a project: ```bash agents project add local/test-app ``` 2. Run the inspect command with JSON format: ```bash agents project context inspect local/test-app --format json ``` 3. Observe the JSON output — the keys `tier_metrics`, `project_fragments`, and `actor_visibility` are missing. **Affected feature file:** `features/context_cli_wiring.feature` - Scenarios tagged `@tdd_issue_4244 @tdd_expected_fail`: - `Inspect with JSON format returns valid JSON` (L98) - `Inspect with pre-populated fragments shows counts` (L106) - `Inspect shows project-scoped tier metrics not global counts` (L113) --- ## Acceptance Criteria - [ ] `agents project context inspect <project> --format json` returns a valid JSON object containing `tier_metrics`, `project_fragments`, and `actor_visibility` at the top level - [ ] `tier_metrics` contains `hot_count`, `warm_count`, and `cold_count` integer fields - [ ] `project_fragments` contains a `total` integer field reflecting the count of context fragments for the project - [ ] `actor_visibility` is a list of visible actor identifiers scoped to the project - [ ] Tier metrics are **project-scoped** (not global counts) - [ ] All three scenarios in `features/context_cli_wiring.feature` tagged `@tdd_issue_4244` pass without `@tdd_expected_fail` - [ ] The `@tdd_issue_4244` and `@tdd_expected_fail` tags are removed from the passing scenarios - [ ] No regression in other `context inspect` or `context simulate` scenarios - [ ] Test coverage ≥ 97% --- ## Subtasks - [ ] Identify the `context inspect` command handler / serializer responsible for JSON output - [ ] Add `tier_metrics` serialization (hot/warm/cold counts) scoped to the target project - [ ] Add `project_fragments` serialization (total fragment count) for the target project - [ ] Add `actor_visibility` serialization (list of visible actors in project scope) - [ ] Ensure project-scoped queries are used (not global aggregates) - [ ] Update / add unit tests covering the three affected scenarios - [ ] Remove `@tdd_expected_fail` and `@tdd_issue_4244` tags from passing scenarios in `features/context_cli_wiring.feature` - [ ] Run full `nox` suite and confirm coverage ≥ 97% --- ## Definition of Done This issue should be closed when: 1. All three `@tdd_issue_4244`-tagged scenarios in `features/context_cli_wiring.feature` pass in CI without `@tdd_expected_fail`. 2. The JSON output of `context inspect --format json` consistently includes `tier_metrics`, `project_fragments`, and `actor_visibility` with correct, project-scoped values. 3. No regressions are introduced in related context CLI scenarios. 4. Test coverage remains ≥ 97%. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
Author
Owner

[AUTO-OWNR-1] Triage Decision: Verified — MoSCoW/Must Have

Valid bug: context inspect JSON output missing required fields (tier_metrics, project_fragments, actor_visibility). This is a spec compliance issue for ACMS v1 (v3.4.0).

Milestone: v3.4.0
Priority: High


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

[AUTO-OWNR-1] **Triage Decision: Verified — MoSCoW/Must Have** Valid bug: context inspect JSON output missing required fields (tier_metrics, project_fragments, actor_visibility). This is a spec compliance issue for ACMS v1 (v3.4.0). **Milestone:** v3.4.0 **Priority:** High --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Author
Owner

Triage Decision [AUTO-OWNR]

Status: Verified

Type: Bug
Priority: High
MoSCoW: Must Have
Milestone: v3.4.0

Rationale: The context inspect JSON output missing required fields (tier_metrics, project_fragments, actor_visibility) is a spec compliance bug for v3.4.0. The ACMS context inspect command must return all required fields per the specification. Must Have for v3.4.0 milestone completion.


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

## Triage Decision [AUTO-OWNR] **Status**: ✅ Verified **Type**: Bug **Priority**: High **MoSCoW**: Must Have **Milestone**: v3.4.0 **Rationale**: The context inspect JSON output missing required fields (tier_metrics, project_fragments, actor_visibility) is a spec compliance bug for v3.4.0. The ACMS context inspect command must return all required fields per the specification. Must Have for v3.4.0 milestone completion. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
HAL9000 added this to the v3.4.0 milestone 2026-04-16 10:35:22 +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#9564
No description provided.