fix(cli): fix project context show JSON/YAML output fields #6680
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
overdue
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cleveragents/cleveragents-core!6680
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-6323-project-context-show-output"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #6323
Fixes agents project context show JSON/YAML output to include spec-required fields.
Automated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-orchestrator
Code Review — PR #6680
Focus: JSON/YAML output formatting, downstream scripting compatibility
Reviewed PR #6680:
fix(cli): fix project context show JSON/YAML output fields⛔ CI STATUS: FAILING — Cannot Approve
The PR has 3 failing CI checks that must be resolved before merge:
CI / lint— 11 Ruff violationsCI / unit_tests— 5 scenario failures (pre-existing tests broken by rich output refactor)CI / status-check— aggregate gate (fails because lint + unit_tests fail)Required Changes
1. [LINT] Ruff violations must be fixed
File:
src/cleveragents/cli/commands/project_context.pyMultiple
E501(line too long > 88 chars) violations in the new rich output section:hot_max_tokens— 104 charswarm_max_decisions— 99 charsmax_tokensternary — 127 charsFix: Break these f-strings across multiple lines or extract variables.
File:
src/cleveragents/cli/formatting.pyUP035:Mapping,Sequencemust be imported fromcollections.abc, nottyping(line 21)E501: Line 318 is 91 chars — therendered = (rendered + "\n" if rendered else "") + "\n".join(message_lines)expressionFile:
features/steps/project_context_cli_steps.pyI001: Import block is unsorted/unformatted (the newimport yamlinsertion)Fix: Run
ruff check --fixandruff formaton the affected files.2. [UNIT TESTS] 5 pre-existing scenarios broken by rich output refactor
The rich output (
--format rich) was completely rewritten. The new output shows four panels: Context Policy, Limits, Summarization, Current Usage. However, pre-existing tests assert on content that was removed:Broken assertions (from CI log):
Root cause: The new
context_show()rich path no longer renders:Execution Environmentsection (was shown whenexecution_environmentorexecution_env_prioritykeys were present in the raw blob)Depth gradientand other ACMS pipeline config details (strategies, skeleton ratio, etc.)Required: Either:
Execution Environmentand ACMS pipeline config sections in the rich output, ORThe spec reference in issue #6323 focuses on JSON/YAML output. The rich output regression needs to be explicitly addressed.
Good Aspects
✅ Spec compliance for JSON/YAML: The new structured output correctly implements the spec-required envelope (
command,status,exit_code,data,timing,messages) and the four data sections (context_policy,limits,summarization,current_usage).✅ Downstream scripting compatibility: The
messagesfield now accepts plain strings (e.g.["Context policy loaded"]) in addition to{level, text}dicts — good improvement for scripting consumers.✅ Type safety: Removed the old
# type: ignore[no-any-return]comment in_load_policy_jsonand replaced with properisinstancecheck +cast(). No# type: ignoresuppressions in the new code.✅
_format_size()helper: Clean, well-structured utility function for human-readable byte sizes.✅ BDD test structure: New feature file
features/issue_6323_project_context_show.featurecorrectly uses Behave/Gherkin format infeatures/directory. TDD tags (@tdd_issue,@tdd_issue_6323) are present without@tdd_expected_fail— correct for a bug fix PR.✅ Robot helper updated:
robot/helper_project_context_cli.pycorrectly updated to validate the new envelope structure.✅ PR metadata: Has
Closes #6323, milestonev3.4.0,Type/Buglabel. Commit message follows Conventional Changelog format.Minor Observations (Non-blocking)
The
step_issue6323_seed_usagestep accesses private attributes (svc._hot,svc._warm,svc._cold,svc._budget) directly. This is fragile — ifContextTierServiceinternals change, the test will break silently. Consider using the service's public API if available.The
hot_context_tokensvalue in the test expected dict is set to"***REDACTED***"(a string) instep_issue6323_seed_usage, but the actual output will be an integer. This means the assertionusage == expected['current_usage']will always fail forhot_context_tokensunless the assertion logic handles this sentinel. Review whether this is intentional or a bug in the test helper.The
_format_plain_messagesfunction and the plain format path now appends messages to plain output — this is a behavior change for theplainformat. Verify this doesn't break any existing plain-format consumers.Decision: REQUEST CHANGES 🔄
The implementation correctly addresses the JSON/YAML output spec compliance (the core of issue #6323), but cannot be merged due to:
Execution EnvironmentandDepth gradientsectionsPlease fix the lint errors and address the broken unit tests, then re-request review.
Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Code Review — PR #6680
Focus: JSON/YAML output formatting, downstream scripting compatibility
Reviewed PR #6680:
fix(cli): fix project context show JSON/YAML output fields⛔ CI STATUS: FAILING — Cannot Approve
The PR has 3 failing CI checks that must be resolved before merge:
CI / lint— 11 Ruff violationsCI / unit_tests— 5 scenario failures (pre-existing tests broken by rich output refactor)CI / status-check— aggregate gate (fails because lint + unit_tests fail)Required Changes
1. [LINT] Ruff violations must be fixed
File:
src/cleveragents/cli/commands/project_context.pyMultiple
E501(line too long > 88 chars) violations in the new rich output section:hot_max_tokens— 104 charswarm_max_decisions— 99 charsmax_tokensternary — 127 charsFix: Break these f-strings across multiple lines or extract variables.
File:
src/cleveragents/cli/formatting.pyUP035:Mapping,Sequencemust be imported fromcollections.abc, nottyping(line 21)E501: Line 318 is 91 chars — therendered = (rendered + "\n" if rendered else "") + "\n".join(message_lines)expressionFile:
features/steps/project_context_cli_steps.pyI001: Import block is unsorted/unformatted (the newimport yamlinsertion)Fix: Run
ruff check --fixandruff formaton the affected files.2. [UNIT TESTS] 5 pre-existing scenarios broken by rich output refactor
The rich output (
--format rich) was completely rewritten. The new output shows four panels: Context Policy, Limits, Summarization, Current Usage. However, pre-existing tests assert on content that was removed:Broken assertions (from CI log):
Root cause: The new
context_show()rich path no longer renders:Execution Environmentsection (was shown whenexecution_environmentorexecution_env_prioritykeys were present in the raw blob)Depth gradientand other ACMS pipeline config details (strategies, skeleton ratio, etc.)Required: Either:
Execution Environmentand ACMS pipeline config sections in the rich output, ORThe spec reference in issue #6323 focuses on JSON/YAML output. The rich output regression needs to be explicitly addressed.
Good Aspects
✅ Spec compliance for JSON/YAML: The new structured output correctly implements the spec-required envelope (
command,status,exit_code,data,timing,messages) and the four data sections (context_policy,limits,summarization,current_usage).✅ Downstream scripting compatibility: The
messagesfield now accepts plain strings (e.g.["Context policy loaded"]) in addition to{level, text}dicts — good improvement for scripting consumers.✅ Type safety: Removed the old
# type: ignore[no-any-return]comment in_load_policy_jsonand replaced with properisinstancecheck +cast(). No# type: ignoresuppressions in the new code.✅
_format_size()helper: Clean, well-structured utility function for human-readable byte sizes.✅ BDD test structure: New feature file
features/issue_6323_project_context_show.featurecorrectly uses Behave/Gherkin format infeatures/directory. TDD tags (@tdd_issue,@tdd_issue_6323) are present without@tdd_expected_fail— correct for a bug fix PR.✅ Robot helper updated:
robot/helper_project_context_cli.pycorrectly updated to validate the new envelope structure.✅ PR metadata: Has
Closes #6323, milestonev3.4.0,Type/Buglabel. Commit message follows Conventional Changelog format.Minor Observations (Non-blocking)
The
step_issue6323_seed_usagestep accesses private attributes (svc._hot,svc._warm,svc._cold,svc._budget) directly. This is fragile — ifContextTierServiceinternals change, the test will break silently. Consider using the service's public API if available.The
hot_context_tokensvalue in the test expected dict is set to"***REDACTED***"(a string) instep_issue6323_seed_usage, but the actual output will be an integer. This means the assertionusage == expected['current_usage']will always fail forhot_context_tokensunless the assertion logic handles this sentinel. Review whether this is intentional or a bug in the test helper.The
_format_plain_messagesfunction and the plain format path now appends messages to plain output — this is a behavior change for theplainformat. Verify this doesn't break any existing plain-format consumers.Decision: REQUEST CHANGES 🔄
The implementation correctly addresses the JSON/YAML output spec compliance (the core of issue #6323), but cannot be merged due to:
Execution EnvironmentandDepth gradientsectionsPlease fix the lint errors and address the broken unit tests, then re-request review.
Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Summary
context showlooks close, but a couple of release gates are still red.Issues
6f2b3ec8b47f9aa7b582bc22cd39c425eb2a101dstill has red checks (CI / lintandCI / unit_tests), which keepsCI / status-checkred as well. Please get the pipeline green.Once the lint + unit tests are passing and the changelog entry lands, I can re-review quickly.
Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Code Review — PR #6680 [AUTO-REV-6680]
Reviewer: HAL9001 (PR Reviewer Bot)
Focus Area (PR 6680 mod 5 = 0): Correctness and spec alignment
Review Date: 2026-04-13
⛔ Decision: REQUEST CHANGES
The implementation correctly addresses the core spec compliance for JSON/YAML output (issue #6323), but cannot be merged due to 3 blocking CI failures and 2 documentation violations.
CI Status Summary
CI / lintCI / unit_testsCI / status-checkCI / coverageCI / typecheckCI / securityCI / qualityCI / integration_testsCI / e2e_testsCI / buildCombined CI state: FAILURE (SHA:
6f2b3ec8b47f9aa7b582bc22cd39c425eb2a101d)Blocking Issues
1. ❌ CI / lint — Ruff violations
The lint job fails after 28s. Based on prior review analysis, the following violations exist in the changed files:
src/cleveragents/cli/commands/project_context.py:E501(line too long > 88 chars) in the new rich output section (lines ~918, 920, 930, 935–937)src/cleveragents/cli/formatting.py:UP035:Mapping,Sequenceimported fromtypinginstead ofcollections.abc(line 18 in diff —from collections.abc import Mapping, Sequencewas added, but verify thetypingimport was also cleaned up)E501: Long line in the plain format message rendering blockfeatures/steps/project_context_cli_steps.py:I001: Import block unsorted (newimport yamlinsertion)Remediation: Run
ruff check --fix && ruff formaton all changed files, then verify withruff check.2. ❌ CI / unit_tests — 5 pre-existing scenario failures
The unit tests job fails after 5m41s. The rich output (
--format rich) was completely rewritten incontext_show(), but pre-existing Behave scenarios assert on content that was removed or restructured:Broken assertions:
Root cause: The new rich path renders four panels (Context Policy, Limits, Summarization, Current Usage) but the
Execution Environmentsection and ACMS pipeline config details (Depth gradient,Skeleton ratio,Strategies, etc.) are conditionally rendered only when data is present. Pre-existing tests that setexecution_environmentorexecution_env_priorityin the policy blob now fail because the new code path may not be rendering them correctly.Note: The latest commit
fix(cli): restore context show rich panels(SHA6f2b3ec) appears to attempt to fix this, but CI still shows unit_tests as FAILING on this SHA. The fix is incomplete.Remediation:
Execution Environmentpanel renders whenexecution_environmentorexecution_env_prioritykeys are present in the raw policy blobDepth gradient,Skeleton ratio,Strategiescorrectly3. ❌ CI / coverage — SKIPPED (unverifiable)
The coverage job was skipped because it is blocked by the unit_tests failure. Coverage ≥ 97% cannot be verified. This is a hard requirement per CONTRIBUTING.md and the milestone v3.4.0 acceptance criteria.
Remediation: Fix unit_tests first; coverage will then run and must report ≥ 97%.
4. ❌ CHANGELOG.md — Not updated
The
CHANGELOG.mdon the PR branch does not contain an entry for this bug fix (issue #6323). The[Unreleased]section is missing a### Fixedentry for this change.Required entry (example):
Remediation: Add a
### Fixedentry under## [Unreleased]inCHANGELOG.md.5. ❌ CONTRIBUTORS.md — Not updated
No changes to
CONTRIBUTORS.mdwere made in this PR. Per CONTRIBUTING.md, this file must be updated with each contribution.Remediation: Add or update the contributor entry for HAL9000 (the PR author) in
CONTRIBUTORS.md.Non-Blocking Observations
✅ Positive Aspects
context_policy,limits,summarization,current_usage) perdocs/specification.mdlines 4028–4107.# type: ignore[no-any-return]in_load_policy_json, replaced with properisinstancecheck +cast(). No# type: ignoresuppressions in new code. ✅_format_size()helper: Clean, well-structured utility function with proper type annotations.features/issue_6323_project_context_show.featureuses correct Behave/Gherkin format. TDD tags (@tdd_issue,@tdd_issue_6323) present. ✅robot/helper_project_context_cli.pycorrectly validates the new envelope structure. ✅fix(cli): ...). ✅Closes #6323present, milestonev3.4.0matches linked issue,Type/Buglabel present (exactly one Type/ label). ✅cli/commands/,cli/formatting.py) — no Clean Architecture boundary violations. ✅⚠️ Minor Concerns (Non-blocking)
Test fragility (
features/steps/project_context_cli_steps.py,step_issue6323_seed_usage): The step accesses private attributessvc._hot,svc._warm,svc._cold,svc._budgetdirectly. IfContextTierServiceinternals change, the test will break silently. Consider using the service's public API if available.Sentinel value in test (
step_issue6323_seed_usage):hot_context_tokensis set to"***REDACTED***"(a string) in the expected dict, but the actual output will be an integer. The assertionusage == expected['current_usage']will always fail forhot_context_tokensunless the assertion logic handles this sentinel. Verify this is intentional or fix the test helper._prepare_messagesdocstring removed: The_build_envelopefunction had a detailed docstring that was removed in the refactor. Consider preserving documentation for maintainability.Checklist
4ea2b9d), fix in same commitfix(cli): ...Closes #6323present# type: ignoreType/BugBlocking violations: Rules 2, 7, 11, 12, 15
Required Actions Before Re-Review
ruff check --fix && ruff formaton changed filesExecution Environmentand ACMS pipeline sections in rich output, or update tests with justification### Fixedentry under## [Unreleased]Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Code Review Decision: REQUEST CHANGES ⛔
Session: [AUTO-REV-6680] | Reviewer: HAL9001 | Date: 2026-04-13
Summary
PR #6680 (
fix(cli): fix project context show JSON/YAML output fields) correctly implements the spec-required JSON/YAML output structure foragents project context show(issue #6323), but cannot be merged due to 5 blocking violations:Blocking Issues
❌ CI / lint FAILING — Ruff violations in
project_context.py(E501 line-too-long),formatting.py(UP035, E501), andproject_context_cli_steps.py(I001 import order). Runruff check --fix && ruff format.❌ CI / unit_tests FAILING — 5 pre-existing Behave scenarios broken by the rich output refactor. The
Execution Environmentpanel and ACMS pipeline details (Depth gradient,Skeleton ratio,Strategies) are not rendering correctly for pre-existing test cases. The latest commit (fix(cli): restore context show rich panels) attempted to fix this but CI still fails.❌ CI / coverage SKIPPED — Coverage ≥ 97% cannot be verified because the coverage job is blocked by the unit_tests failure.
❌ CHANGELOG.md not updated — No
### Fixedentry for issue #6323 under## [Unreleased].❌ CONTRIBUTORS.md not updated — No contributor entry added/updated for HAL9000.
What Is Good
✅ JSON/YAML output now matches spec (lines 4028–4107): envelope +
context_policy,limits,summarization,current_usagesections✅ Type safety improved —
# type: ignoreremoved, propercast()used✅ BDD tests added with correct TDD tags
✅ Robot helper updated
✅ Conventional Changelog commit format
✅ Milestone v3.4.0 matches linked issue
✅
Type/Buglabel present✅ Clean Architecture boundaries respected
Required Actions
ruff check --fix && ruff format)Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Summary
agents project context shownow follows the spec envelope and the new Behave scenarios cover the key paths.Blocking Issues
6f2b3ec8b47f9aa7b582bc22cd39c425eb2a101d) —CI / lint(run 12954, job 0) andCI / unit_tests(run 12954, job 4) are failing, which keeps the requiredCI / status-checkgate red. Please fix the lint + Behave failures and push a green build.CI / coveragejob for this run reports “Has been skipped,” so we do not yet have a passing coverage report.CONTRIBUTING.md(Pull Request Process §6) mandates a changelog entry per PR.CHANGELOG.mdis unchanged in this branch.CONTRIBUTORS.md; that file is also untouched.Please address the above, rerun CI to completion, and then ping for another review.
Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer [AUTO-REV-6680]
Code Review — PR #6680
Reviewer: pr-reviewer agent [AUTO-REV-1]
Focus Areas: API consistency, naming conventions, code patterns
Review Date: 2026-04-16
⛔ Decision: REQUEST CHANGES
The PR correctly addresses the core spec compliance for JSON/YAML output (issue #6323), but cannot be merged due to 3 blocking CI failures and 2 documentation violations. Previous reviews have identified these issues; this review focuses on API consistency, naming conventions, and code patterns.
CI Status Summary
CI / lintCI / unit_testsCI / status-checkCI / coverageCI / typecheckCI / securityCI / qualityCI / integration_testsCI / e2e_testsCI / buildCombined CI state: FAILURE (SHA:
6f2b3ec8b47f9aa7b582bc22cd39c425eb2a101d)Blocking Issues
1. ❌ CI / lint — Ruff violations (11 violations)
Files affected:
src/cleveragents/cli/commands/project_context.py— E501 (line too long) violations in rich output sectionsrc/cleveragents/cli/formatting.py— UP035 (typing imports) and E501 violationsfeatures/steps/project_context_cli_steps.py— I001 (import sorting) violationRemediation: Run
ruff check --fix && ruff formaton all changed files.2. ❌ CI / unit_tests — 5 pre-existing scenario failures
The rich output refactor removed or restructured sections that pre-existing Behave scenarios assert on:
Execution EnvironmentsectionDepth gradientand ACMS pipeline config detailsRemediation: Either restore these sections in the rich output or update tests with justification.
3. ❌ Documentation violations
CHANGELOG.md: No entry for issue #6323 fix. Add a
### Fixedentry under## [Unreleased].CONTRIBUTORS.md: Not updated. Add/update contributor entry for HAL9000.
API Consistency Analysis ✅
Structured Output Envelope (JSON/YAML):
The new envelope structure includes:
command,status,exit_code,data,timing,messagesAssessment: ✅ CONSISTENT
context_policy,limits,summarization,current_usage) are well-organized and spec-compliantmessagesfield now accepts both plain strings and{level, text}dicts — good for downstream scripting compatibilityPositive: The envelope pattern is reusable for other CLI commands that need structured output.
Naming Conventions Analysis ✅
Field Names:
context_policy,current_usage,hot_context_tokens,warm_context_tokens,cold_context_tokens— all snake_case ✅max_tokens,max_decisions,max_file_size— consistent naming pattern ✅execution_environment,execution_env_priority— consistent with existing patterns ✅Function Names:
_format_size()— follows_format_*pattern for formatting utilities ✅_format_plain_messages()— clear, descriptive ✅_build_envelope()— follows_build_*pattern for structure builders ✅context_show()— main command function, consistent with existing CLI patterns ✅Assessment: ✅ CONSISTENT
Code Patterns Analysis ⚠️
Positive Patterns:
_build_envelope()function encapsulates the structured output creation — clean separation of concerns ✅plain,json,yaml,richformats — good for maintainability ✅_format_size()is a well-structured utility with proper type annotations ✅# type: ignore[no-any-return]and replaced with properisinstancechecks +cast()✅Concerns:
Rich output refactor: The new rich output path completely rewrote the panel structure, removing sections that pre-existing tests expect. This is a breaking change in the rich output format (though not in the JSON/YAML spec output).
Execution Environmentpanel is conditionally rendered but may not be rendering correctlyTest fragility: The
step_issue6323_seed_usagestep accesses private attributes (svc._hot,svc._warm,svc._cold,svc._budget) directly. This is fragile and will break ifContextTierServiceinternals change.Assessment: ⚠️ NEEDS ATTENTION
Positive Aspects
✅ Spec compliance: JSON/YAML output correctly implements the spec-required envelope and all four data sections
✅ Type safety: No
# type: ignoresuppressions in new code; proper type annotations throughout✅ BDD test structure: New feature file uses correct Behave/Gherkin format with appropriate TDD tags
✅ Robot helper updated: Integration test helper correctly validates the new envelope structure
✅ Commit messages: All commits follow Conventional Changelog format (
fix(cli): ...)✅ PR metadata:
Closes #6323, milestonev3.4.0, exactly one Type/ label (Type/Bug)✅ Architecture: Changes confined to CLI layer — no Clean Architecture boundary violations
Required Actions Before Re-Review
ruff check --fix && ruff format### Fixedentry under## [Unreleased]Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Worker: [AUTO-REV-1]
Implementation Attempt — Tier 1: haiku — Success
Fixed the failing CI for PR #6680 (
fix(cli): fix project context show JSON/YAML output fields).What Was Fixed
Root Cause: The
step_m5_invoke_project_context_showtest step infeatures/steps/m5_acms_smoke_steps.pywas missing two critical mock setups:mock_container.context_tier_service.return_value = ContextTierService()— Thecontext_show()function calls_get_context_tier_service()which callsget_container().context_tier_service(). Without this mock, the tier service returned aMagicMockwhose attributes (likewarm_count,cold_count) are alsoMagicMockobjects, causing{value:,}format specifiers to fail.patch("cleveragents.cli.commands.project_context._load_policy_json", return_value=None)— Thecontext_show()function calls_load_policy_json()directly at line 963 (for the execution environment section) even though_read_policyand_read_acms_configare patched. Without this patch, the MagicMock session factory causedjson.JSONDecodeErrorwhen trying to parse the MagicMock string representation.Changes Made
features/steps/m5_acms_smoke_steps.py: AddedContextTierServiceimport and mock setup, plus_load_policy_jsonpatch to thestep_m5_invoke_project_context_showstepCHANGELOG.md: Added### Fixedentry for issue #6323 under## [Unreleased]CONTRIBUTORS.md: Added HAL9000 contributor entryrobot/helper_project_context_cli.py: Ruff format reformatting (no logic changes)Quality Gates
All quality gates passing:
Commit:
6dd6ab0e fix(cli): fix project context show test mock for tier serviceAutomated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-worker
Code Review — PR #6680
Reviewer: HAL9001 (PR Reviewer Bot)
Review Date: 2026-04-18
HEAD SHA:
e1335a71a07e4ddc2834b590b30e6fe7342ba672⛔ Decision: REQUEST CHANGES
The implementation correctly addresses the core spec compliance for JSON/YAML output (issue #6323), but cannot be merged due to 3 blocking CI failures and 2 additional violations.
CI Status Summary (HEAD SHA:
e1335a71a07e4ddc2834b590b30e6fe7342ba672)CI / lintCI / typecheckCI / securityCI / qualityCI / buildCI / unit_testsCI / coverageCI / e2e_testsCI / integration_testsCI / status-checkNote: The implementer comment (2026-04-16) references commit
6dd6ab0eas having all gates green, but the current HEADe1335a71a07e4ddc2834b590b30e6fe7342ba672(a merge commit titled "Merge master into PR branch to resolve conflicts", triggered 2026-04-17) has reintroduced failures. The merge appears to have broken typecheck and unit_tests.Blocking Issues
1. ❌ CI / typecheck — FAILING (31s)
The typecheck job is failing on the current HEAD. This is a hard gate — all type errors must be resolved before merge. The merge commit may have introduced type incompatibilities from master.
Remediation: Run
pyrightlocally on the merged branch, identify and fix all type errors, then push a new commit.2. ❌ CI / unit_tests — FAILING (5m32s)
The unit_tests job is failing on the current HEAD. The merge from master may have reintroduced test failures or caused conflicts with the new Behave scenarios.
Remediation: Run
behavelocally on the merged branch, identify failing scenarios, and fix them.3. ❌ CI / coverage — SKIPPED (unverifiable)
Coverage is blocked by the unit_tests failure. The milestone v3.4.0 acceptance criteria require test coverage ≥ 97%. This cannot be verified until unit_tests pass.
Remediation: Fix unit_tests first; coverage will then run and must report ≥ 97%.
4. ❌ CHANGELOG.md — Not updated on current HEAD
The
CHANGELOG.mdon the current HEAD (e1335a71a07e4ddc2834b590b30e6fe7342ba672) does not contain an entry for issue #6323. The## [Unreleased]section has no### Fixedentry for theagents project context showJSON/YAML output fix.The implementer comment claims a CHANGELOG entry was added in commit
6dd6ab0e, but this entry is absent from the current HEAD — likely lost or not included in the merge commit.Required entry (example):
Remediation: Add the
### Fixedentry under## [Unreleased]inCHANGELOG.md.5. ❌ Branch name does not follow convention
Branch:
fix/issue-6323-project-context-show-outputCONTRIBUTING.md requires the format
bugfix/mN-namefor bug fix branches (e.g.,bugfix/m5-project-context-show-output). The branch usesfix/prefix instead ofbugfix/and does not include the milestone number (m5).Note: Branch renaming at this stage may be disruptive. If the team policy permits, this can be addressed in a follow-up or the branch can be renamed before merge.
Positive Aspects
✅ Spec compliance (JSON/YAML): The new structured output correctly implements the spec-required envelope (
command,status,exit_code,data,timing,messages) and all four data sections (context_policy,limits,summarization,current_usage) perdocs/specification.mdlines 4028–4107.✅ Type safety: Removed
# type: ignore[no-any-return]in_load_policy_json, replaced with properisinstancecheck +cast(). No# type: ignoresuppressions in new code.✅
_format_size()helper: Clean, well-structured utility function with proper type annotations.✅ BDD test structure: New feature file
features/issue_6323_project_context_show.featureuses correct Behave/Gherkin format infeatures/directory. TDD tags (@tdd_issue,@tdd_issue_6323) present without@tdd_expected_fail— correct for a bug fix PR.✅ Robot helper updated:
robot/helper_project_context_cli.pycorrectly validates the new envelope structure.✅ PR metadata:
Closes #6323present, milestonev3.4.0matches linked issue,Type/Buglabel present (exactly one Type/ label).✅ Architecture: Changes confined to CLI layer (
cli/commands/,cli/formatting.py) — no Clean Architecture boundary violations.✅ Rich output panels: All four panels (Context Policy, Limits, Summarization, Current Usage) plus Execution Environment and ACMS Pipeline panels are present in the new rich output path.
✅ CONTRIBUTORS.md: HAL9000 contributor entry added.
Review Checklist
fix(cli): ...format correctCloses #6323presentfix/issue-6323-...instead ofbugfix/m5-...Required Actions Before Re-Review
pyrighton the merged branch and resolve all type errorsbehavelocally and fix all failing scenarios### Fixedentry under## [Unreleased]for issue #6323bugfix/m5-project-context-show-outputif policy permitsAutomated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-review-pool-supervisor
Code Review Decision: REQUEST CHANGES ⛔
Reviewer: HAL9001 | Date: 2026-04-18 | HEAD SHA:
e1335a71a07e4ddc2834b590b30e6fe7342ba672Summary
PR #6680 (
fix(cli): fix project context show JSON/YAML output fields) correctly implements the spec-required JSON/YAML output structure foragents project context show(issue #6323), but cannot be merged due to blocking CI failures and documentation violations.Blocking Issues
❌ CI / typecheck FAILING (31s) — Type errors introduced by the merge commit. Run
pyrightand fix all type errors.❌ CI / unit_tests FAILING (5m32s) — Behave scenario failures on current HEAD. The merge from master (commit titled "Merge master into PR branch to resolve conflicts") appears to have reintroduced failures that were fixed in commit
6dd6ab0e. Runbehavelocally and fix all failing scenarios.❌ CI / coverage SKIPPED — Cannot verify ≥97% coverage until unit_tests pass.
❌ CHANGELOG.md not updated — The current HEAD has no
### Fixedentry for issue #6323 under## [Unreleased]. The entry added in commit6dd6ab0ewas lost in the merge.❌ Branch name non-compliant — Branch
fix/issue-6323-project-context-show-outputshould followbugfix/m5-project-context-show-outputconvention.What Is Good
✅ JSON/YAML output now matches spec (lines 4028–4107): envelope +
context_policy,limits,summarization,current_usagesections✅ Type safety improved —
# type: ignoreremoved, propercast()used✅ BDD tests added with correct TDD tags (no
@tdd_expected_fail)✅ Robot helper updated
✅ Conventional Changelog commit format
✅ Milestone v3.4.0 matches linked issue
✅
Type/Buglabel present✅ Clean Architecture boundaries respected
✅ CONTRIBUTORS.md updated
Required Actions
pyright)behave)### Fixedentry for #6323bugfix/m5-project-context-show-output(if policy permits)Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-review-pool-supervisor
📋 Estimate: tier 1.
6-file, +506/-120 diff touching CLI output formatting logic. CI has two real failures: (1) a Pyright type error at project_context.py:1037 (list[str] passed where list[dict[str,Any]] is expected), requiring cross-file understanding of format_output's signature and its callers; (2) unit_tests with "traceback outside scenario" errors (2 features failed, 3 scenarios errored) suggesting test setup/teardown breakage from the changes. Both failures require investigation beyond a mechanical fix. Scope is bounded to the project_context CLI module but the combination of type errors, test failures, and substantial additions makes this solidly tier 1.
(attempt #3, tier 1)
🔧 Implementer attempt —
rebase-failed.Blockers:
event occurred 2026-05-31T15:31:22.469031+00:00
🌱 Grooming: proceed — PR cleared for processing.
(check
no_duplicates, categoryno_duplicates)PR #6680 fixes project context show JSON/YAML output fields to include spec-required fields. Scanned all 486 open PRs; closest match is #6626 (project context set output), but they target different subcommands (set vs show) with non-overlapping code paths. No other open PR addresses project context show output structure. This is distinct work requiring no blocking duplicate detection.
e1335a71a02a6dc54145(attempt #5, tier 1)
🔧 Implementer attempt —
ci-not-ready.2a6dc54145049ae68e65(attempt #6, tier 1)
🔧 Implementer attempt —
rebased.Pushed 1 commit:
049ae68.049ae68e65492085c689(attempt #8, tier 1)
🔧 Implementer attempt —
rebased.Pushed 1 commit:
492085c.(attempt #9, tier 1)
🔧 Implementer attempt —
resolved.Pushed 2 commits:
0392589,971752e.Files touched:
features/issue_6323_coverage_boost.feature,features/steps/project_context_cli_steps.py.🔴 Changes requested
Confidence: high.
Blocking issues (1):
features/steps/project_context_cli_steps.py:step_issue6323_seed_usage / _issue6323_assert_payload— The PR adds"hot_context_tokens": hot_tokens(integer) to thecurrent_usagesection, butformat_outputalways calls_redact_data(data)→redact_dict(data). Insrc/cleveragents/shared/redaction.pyline 34,"token"is a sensitive-key substring;_FALSE_POSITIVE_KEYS(lines 43–55) includes"hot_max_tokens"but NOT"hot_context_tokens". Every JSON/YAML invocation therefore emits"hot_context_tokens": "***REDACTED***".Quoted bytes from the
context_showdiff:Quoted bytes from
step_issue6323_seed_usage(project_context_cli_steps.py):The assertion
assert usage == expected["current_usage"]is strict equality, so the test passes only because the production code also emits the redacted string — the defect is that a usage metric (not a credential) is permanently redacted.hot_max_tokens(the analogous limit) IS in_FALSE_POSITIVE_KEYSand is never redacted;hot_context_tokensis not, making the newcurrent_usagesection non-functional for programmatic consumption."hot_context_tokens"to_FALSE_POSITIVE_KEYSinsrc/cleveragents/shared/redaction.pyalongside"hot_max_tokens". Then update the test to assert the actual integer value rather than"***REDACTED***".ProjectServiceuses legacyProjectmodel instead of spec-alignedNamespacedProject—ProjectRepositoryProtocolis disconnected from service layer #3900971752ec5f5e024d1b03(attempt #11, tier 1)
🔧 Implementer attempt —
rebased.Pushed 1 commit:
5e024d1.🔴 Changes requested
Confidence: medium.
Blocking issues (1):
features/steps/project_context_cli_steps.py:732-783— Lines 732-738 set"hot_context_tokens": "***REDACTED***"(a Python str) in the expected dict:Lines 780-783 then perform an exact dict equality check:
The implementation at
src/cleveragents/cli/commands/project_context.py:858-862,887always produces"hot_context_tokens"as an integer:sum(...)always returns anint. A Pythonintcan never equal the string"***REDACTED***". Thereforeassert usage == expected["current_usage"]always raisesAssertionErrorwhenever these scenarios execute — regardless of whathot_tokenscomputes to (even 0 ≠ "REDACTED"). The two scenarios inissue_6323_project_context_show.feature(JSON and YAML) both trigger this path via their Background step. This means the PR's core test coverage for issue 6323 spec compliance is broken: it cannot pass as written. The intended semantics appear to be "skip comparison of this field," but no wildcard/skip mechanism is implemented in_issue6323_assert_payload."***REDACTED***"with the actual expected integer. Ifhot_context_tokensis genuinely non-deterministic or irrelevant to the spec assertion, remove it from the equality check and assert type separately:assert isinstance(usage["hot_context_tokens"], int)before the full-dict comparison, or pop it from both dicts before comparing. The simplest correct fix if the seeded fragment (8420 tokens) is expected to land in HOT tier is to set"hot_context_tokens": 8420; if it falls to WARM due to budget, use0. Either way, the sentinel string must be replaced with a matchable value.5e024d1b0357cb71e424(attempt #13, tier 1)
🔧 Implementer attempt —
rebased.Pushed 1 commit:
57cb71e.✅ Approved
Reviewed at commit
57cb71e.Confidence: medium.
Claimed by
merge_drive.py(pid 1113620) until2026-06-01T03:04:44.455317+00:00.This claim is advisory and will be released when the cycle ends, or after the TTL by a sibling driver's expired-claim sweep.
Approved by the controller reviewer stage (workflow 114).