fix(cli): fix project context show JSON/YAML output fields #6680
Merged
HAL9000
merged 6 commits from 2026-06-01 01:34:53 +00:00
fix/issue-6323-project-context-show-output into master
Labels
Clear 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
Needs Feedback
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
Controller deferred this PR; awaiting Phase 6+ scope-evaluator or operator re-enablement.
Auto-agents controller manages this PR/issue (see tools/controller/deploy/RUNBOOK.md). Remove this label to abandon controller management.
PR blocked by an open issue dependency. Operator must close the dep (or remove the dependency link) before the merge driver can act. Auto-cleared by merge_drive when no open deps remain.
Most recent merge cycle hit CI timeout. Driver excludes this PR while last merge_cycle row is < 30 min old; label persists thereafter as visible history.
Currently being processed by an implementer worker.
Currently being processed by the merge driver.
Currently being processed by a reviewer worker.
Merge driver heartbeat stale; pipeline halted. Closed automatically on next clean tick.
Detected master commit violating the strict merge invariant. Tracked as an issue (not a PR label); kept here for label completeness.
In-cycle escalation: most recent attempt ran at the Tier 0 slot (`tier-0`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 1 slot (`tier-1`). Slot's model defined in .opencode/models/tiers.yaml.
In-cycle escalation: most recent attempt ran at the Tier 2 slot (`tier-2`). Slot's model defined in .opencode/models/tiers.yaml. Gated behind IMPLEMENTER_ESCALATION_TIER2_ENABLED.
In-cycle escalation: most recent attempt ran at the Tier -1 slot (`tier-min`). Slot's model defined in .opencode/models/tiers.yaml. Suffix is ``-min`` (not ``--1``) so the Forgejo UI reads naturally.
Tracking issues used by the AI Automation system for agents to communicate and report.
Rebase conflict needs LLM conflict-resolver.
Failing CI needs implementer attention.
Documenting a driver incident or rollback.
Reviewer has APPROVED this PR and no later REQUEST_CHANGES is outstanding. The merge driver requires this label to even consider a PR for merging. Set by the reviewer worker on APPROVE; cleared on REQUEST_CHANGES.
Train repeatedly lost master-tempo races. Driver excludes via merge_cycle until cooldown elapses; label persists as visible history.
Revert PR backing out an invariant violation. Fast-tracked through the merge driver.
Sentinel PR duplicated from upstream into a personal fork by tools/duplicate_prs_to_fork.py for pipeline testing. Lives only in the fork; the canonical pipeline never sees it.
No implementer activity for N days. Flagged for human review. Auto-cleared on next push to head branch.
Repeatedly fails on current master (>= 3 ci-fail-on-rebased-sha releases in 12 h). Excluded from driver until human triage.
A ticket in a blocked state and unable to complete until some other task is completed first.
Bounty
$100
A bounty of $100 for any open-source contributor who provides a MR that solves this issue
Bounty
$1000
A bounty of $1000 for any open-source contributor who provides a MR that solves this issue
Bounty
$10000
A bounty of $10000 for any open-source contributor who provides a MR that solves this issue
Bounty
$20
A bounty of $20 for any open-source contributor who provides a MR that solves this issue
Bounty
$2000
A bounty of $2000 for any open-source contributor who provides a MR that solves this issue
Bounty
$250
A bounty of $250 for any open-source contributor who provides a MR that solves this issue
Bounty
$50
A bounty of $50 for any open-source contributor who provides a MR that solves this issue
Bounty
$500
A bounty of $500 for any open-source contributor who provides a MR that solves this issue
Bounty
$5000
A bounty of $5000 for any open-source contributor who provides a MR that solves this issue
Bounty
$750
A bounty of $750 for any open-source contributor who provides a MR that solves this issue
MoSCoW
Could have
Could have feature in order to satisfy the epic/legendary.
MoSCoW
Must have
Must have feature in order to satisfy the epic/legendary.
MoSCoW
Should have
Should have feature in order to satisfy the epic/legendary.
There are questions in the ticket that can not be completed until the project owner provides clarity.
Points
1
1 man-hours worth of work for an expert with no learning curve.
Points
13
13 man-hours worth of work for an expert with no learning curve.
Points
2
2 man-hours worth of work for an expert with no learning curve.
Points
21
21 man-hours worth of work for an expert with no learning curve.
Points
3
3 man-hours worth of work for an expert with no learning curve.
Points
34
34 man-hours worth of work for an expert with no learning curve.
Points
5
5 man-hours worth of work for an expert with no learning curve.
Points
55
55 man-hours worth of work for an expert with no learning curve.
Points
8
8 man-hours worth of work for an expert with no learning curve.
Points
88
88 man-hours worth of work for an expert with no learning curve.
Priority
Backlog
This ticket has backlogged priority and is not to be worked on yet
Priority
CI Blocker
Critical priority issue that blocks CI/CD pipeline and prevents PR merges
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
When an epic or legendary is in review it must be signed off by owner, tech lead, and scrum master before being marked as completed.
A ticket for learning a tool or technology that is needed to be able to do future planning and design.
State
Completed
The ticket has been fully implemented, completed, and merged with the source code. This label should only be applied once a ticket is closed.
State
Duplicate
A ticket that represents the same content as an existing ticket.
State
In Progress
A ticket that is actively being developed.
State
In Review
A ticket that has had some code completed to implement but is waiting to pass peer review and is not yet merged in.
State
Paused
This ticket's work started but wasn't finished. It's on hold (likely in a feature branch) and will be resumed later, either due to a blocker or a delay.
State
Unverified
All new tickets start in this state. A developer may set it to show the ticket is unverified. This means we haven't agreed to work on it. It will either move to a verified state or be closed as wontdo.
State
Verified
The issue has been verified by a developer as legitimate. It will be worked on and verified tickets are now considered part of the backlog.
State
Wont Do
This ticket has been decided it wont be done. This may mean the bug has been determined to not be real (cant verify) or the feature is one we have decided we dont want to adopt.
Type
Automation
Any edits or discussion about the AI automated coding system.
Type
Bug
Something that doesnt work as intended.
Type
Discussion
Anytime a ticket represents a discussion about a subject and doesnt fall into one of the other categories.
Type
Documentation
An error or improvement needed in the documentation.
Type
Epic
Any first tier epic. That is, an epic which contains only issues as children and will not have sub-epics.
Type
Feature
Some new functionality not present.
Type
Legendary
A type of Epic which will contain other Epics.
Type
Refactor
A code change that restructures existing code without changing its external behavior.
Type
Support
Someone needs help using the project.
Type
Task
A generic task that doesnt fit into the other type categories.
Type
Testing
Work exclusively focusing on fixing or expanding testing.
Projects
Clear projects
No project
Assignees
aditya (Aditya Chhabra)
aleenaumair (Aleena Umair)
brent.edwards (Brent Edwards)
CoreRasurae (Luis Mendes)
drew (Drew Morris)
eugen.thaci (Eugen Thaci)
freemo (Jeffrey Phillips Freeman)
HAL9000 (HAL 9000)
HAL9001 (HAL9001)
hamza.khyari (Hamza Khyari)
hurui200320 (Rui Hu)
justin.morris
khird (Kyle Hird)
org.cleveragents
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cleveragents/cleveragents-core#6680
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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
PR Review:
fix(cli): fix project context show JSON/YAML output fieldsSummary
This PR addresses issue #6323 — the
agents project context showcommand was emitting raw internal dict structures (withdefault_view,strategize_view,acms_configkeys) instead of the spec-required structured envelope. The implementation now correctly buildscontext_policy,limits,summarization, andcurrent_usagesections and delegates toformat_output()for the JSON/YAML path.Overall the fix is on the right track and the core logic is sound, but I must request changes due to several concrete issues that block a clean merge.
✅ Strengths
structured_dataincontext_show()now matches the spec'scontext_policy,limits,summarization, andcurrent_usagelayout.features/, steps infeatures/steps/, no pytest-style tests.Closes #6323— issue reference is present and valid.@tdd_issue/@tdd_issue_6323tags — correctly applied since this is a bug-fix scenario.❌ Issues Requiring Changes
1. 🔴 CRITICAL —
# type: ignore[no-any-return]in production code (project_context.pyline 111)CONTRIBUTING.md §Type Safety is unambiguous:
This suppression must be removed and the return type narrowed properly (e.g., explicitly annotate
_json.loadstodict[str, Any]with a cast or a typed intermediate variable).2. 🔴 CRITICAL —
messagesfield format mismatch vs. specThe test assertion in
_issue6323_assert_payload()checks:But the spec at
docs/specification.mdlines 4067 and 4106 shows:The spec uses bare string arrays for
messagesinproject context show, not{"level": ..., "text": ...}objects. All other command examples (e.g.info,version) use the{level, text}object form — butproject context showexplicitly uses bare strings in the spec. The tests enforce the object form, which contradicts the spec. Either the tests or theformat_output()call must align with the spec. This is a spec compliance issue per CONTRIBUTING.md §Specification-First Development.3. 🔴 CRITICAL —
indexed_resourcescount is wrong instep_issue6323_seed_usageThe test seeds
1 hot + 12 warm + 47 cold = 60fragments across 60 distinctresource_idvalues (res:hot,res:warm-0…res:warm-11,res:cold-0…res:cold-46), yet the expected value is:But the spec example shows
"indexed_resources": 1— meaning "number of distinct resources", not "number of fragments". The production code computes:which correctly gives a distinct-resource count. With 60 unique resource IDs the test will pass, but it validates a count of 60 against an expected of 60, not the semantically correct count of "distinct physical resources." This test does not catch the semantic mismatch with the spec. The seeding and assertion need to reflect the actual domain intent (multiple fragments can reference the same resource_id) or the test is vacuous for this field.
4. 🟡 MEDIUM — Missing milestone on PR
CONTRIBUTING.md §Pull Request Process requirement 11:
This PR has
milestone: null. Issue #6323 also has no milestone, but that is not a valid justification for skipping the milestone on the PR — if the issue lacks a milestone a maintainer should assign one before the PR is submitted. Both issue and PR must have a milestone.5. 🟡 MEDIUM — Missing
Type/label on PRCONTRIBUTING.md §Pull Request Process requirement 12:
This PR has
labels: []. AType/Buglabel (matching the issue) must be applied.6. 🟡 MEDIUM — Missing Forgejo dependency link
CONTRIBUTING.md §Pull Request Process requirement 1:
The
Closes #6323keyword in the body is present, but the Forgejo machine-readable dependency (PR blocks issue, issue depends on PR) has not been set up.7. 🟡 MEDIUM — File exceeds 500-line limit
src/cleveragents/cli/commands/project_context.pyis now 1,348 lines. CONTRIBUTING.md §General Principles states:The
context_showfix added ~150 net lines, taking an already-large file further over the limit. The commands should be split across multiple focused modules (e.g.project_context_show.py,project_context_set.py, etc.) or at minimum this file needs to be decomposed in a follow-up issue. If this file was already over the limit before the PR, the PR should not widen the gap — a new issue should track the decomposition and be linked from here.8. 🟡 MEDIUM — Integration tests (Robot Framework) not included
CONTRIBUTING.md §Testing Philosophy:
This PR includes only Behave (unit BDD) tests. There are no corresponding Robot Framework integration tests for the fixed
project context showbehaviour. The definition of done requires integration test coverage as well.9. 🟡 MEDIUM — Missing
ISSUES CLOSEDfooter in commit messageCONTRIBUTING.md §Commit Hygiene:
The commit message footer must include
ISSUES CLOSED: #6323. The PR body usesCloses #6323, but the commit message itself must also carry the footer.10. 🟡 MEDIUM —
context_show()PLAIN format handler is inconsistentIn
context_show(), the PLAIN path callsformat_output()and then additionally prints[OK] Context policy loadeddirectly:This would double-print the success message if
format_output()already includes it. The checkif rendered: console.print(rendered)suggests it may not emit the message, but this needs verification — it is fragile and not consistent with how other commands handle the PLAIN format. The extra branch should be removed and themessagesparameter passed toformat_output()should be the single source of truth.Minor Notes
_load_policy_jsonis called multiple times within a single command execution (e.g. in_write_policythen again incontext_setfor theextra_fieldsmerge). This causes redundant DB round-trips and should be consolidated._run_with_containerhelper patchesformat_outputatcleveragents.cli.commands.project_context.format_outputbut re-implements it inline. This is fragile — ifformat_outputchanges its signature the patch won't catch it. Prefer importing the real function and only mocking the container.Checklist Against Merge Requirements
Closes #6323present# type: ignoreType/labelISSUES CLOSED:type: ignoresuppressionmessagesformatAutomated 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
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 UAT: `agents project context show` JSON/YAML output missing `current_usage` section and wrong top-level structure (#6323)bugfix/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 UAT: `agents project context show` JSON/YAML output missing `current_usage` section and wrong top-level structure (#6323)bugfix/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.
e1335a71a0to2a6dc54145(attempt #5, tier 1)
🔧 Implementer attempt —
ci-not-ready.2a6dc54145to049ae68e65(attempt #6, tier 1)
🔧 Implementer attempt —
rebased.Pushed 1 commit:
049ae68.049ae68e65to492085c689(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***".971752ec5fto5e024d1b03(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.5e024d1b03to57cb71e424(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).