fix(cli): fix automation-profile add JSON/YAML output format #6598
Merged
HAL9000
merged 2 commits from 2026-05-31 17:29:08 +00:00
fix/issue-6345-automation-profile-add-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#6598
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-6345-automation-profile-add-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 #6345
Fixes the JSON/YAML output format for agents automation-profile add.
Automated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-orchestrator
PR Review —
fix(cli): fix automation-profile add JSON/YAML output formatThank you for this fix. The core change — adding
_profile_add_dict()and routing theaddcommand through it for machine-readable output — is the right approach and clearly addresses the spec deviation described in #6345. The Behave scenarios are well-structured and the step implementations thoroughly validate the schema structure. However, there are several issues that need to be addressed before this can merge.🔴 Blocking Issues (REQUEST_CHANGES)
1. Missing Milestone
Per CONTRIBUTING.md § Pull Request Process rule 11:
Issue #6345 is assigned to milestone v3.2.0. This PR has no milestone set (
"milestone": null). This must be corrected — a PR without a milestone will not be reviewed and cannot be merged.2. Missing
Type/LabelPer CONTRIBUTING.md § Pull Request Process rule 12:
The PR has no labels at all (
"labels": []). Since the linked issue isType/Bug, this PR should carry theType/Buglabel.3. Spec Deviation —
commandEnvelope Field ValueThe specification (§
agents automation-profile addJSON example) defines thecommandfield as"automation-profile add"(without theagentsbinary prefix). The implementation passescommand_name="agents automation-profile add"toformat_output(). If the framework uses this string verbatim, the output will be non-compliant. The new test assertions were written to match the implementation rather than the spec.File:
src/cleveragents/cli/commands/automation_profile.pyFile:
features/steps/automation_profile_cli_steps.pyVerify how other commands populate this field (e.g.,
automation-profile show,automation-profile list) and apply the same convention.4. Spec Deviation — Rich Output for
addStill Uses Grouped SchemaThe JSON/YAML fix is correct, but the rich (and plain) output for
addstill delegates to_print_profile()— the same renderer used byshow— which groups thresholds into Phase Transitions, Decision Automation, Self-Repair, and Execution Controls categories. The spec defines a distinct layout foradd:✓ OK Profile registeredfooter lineThis is an incomplete fix: the machine-readable formats are now spec-compliant, but the human-readable format remains non-compliant. The
addcommand needs its own rich renderer that matches the spec layout.5. Inline Imports Violate Import Guidelines
CONTRIBUTING.md: All imports at top of file.
Two locations in
features/steps/automation_profile_cli_steps.pycontain imports inside function bodies:_create_in_memory_profile_service(): importscreate_engine,sessionmaker,AutomationProfileService,Base,AutomationProfileRepositoryinlinestep_invoke_plan_use_automation_level(): importscleveragents.cli.commands.plan.appinlineAll of these must be lifted to the module top level.
🟡 Advisory (Non-Blocking)
6. New Scenarios Should Carry
@tdd_issue @tdd_issue_6345TagsPer CONTRIBUTING.md § Bug Fix Workflow, scenarios that prove a bug existed before the fix should be permanently marked as regression guards with
@tdd_issueand@tdd_issue_<N>tags. The two new scenarios (Add profile JSON output uses flat schema,Add profile YAML output uses flat schema) are exactly this kind of test and should carry@tdd_issue @tdd_issue_6345.7. Verify Forgejo Dependency Direction
The textual
Closes #6345handles auto-close on merge, but CONTRIBUTING.md also requires a machine-readable Forgejo dependency link in the correct direction: this PR blocks issue #6345 (issue depends on PR, not PR depends on issue). Please verify this is set in the Forgejo UI.8. Missing
plainFormat Coverage foraddTwo scenarios cover
--format jsonand--format yaml. The spec also defines aplainoutput foradd. A scenario validating the flat structure in plain format would complete the coverage.✅ What is Done Well
_profile_add_dict()produces the spec-required flatthresholds/flagsstructure with ISO-8601createdtimestamp. The architectural separation from_profile_spec_dict()(used byshow) is exactly right._current_utc_iso()helper: Clean, timezone-aware UTC helper with microsecond truncation andZsuffix.partial()injection: Usingfunctools.partialto inject the payload factory into_print_profile()avoids duplication cleanly.step_add_json_matches_flat_schemaandstep_add_yaml_matches_flat_schemaexhaustively check presence, types, key sets, and explicitly assert that forbidden grouped-schema keys are absent. This is the right level of specificity for output format tests.ISSUES CLOSED: #6345footer, single atomic commit. ✅features/test directory, nothing insrc/. ✅Summary: The core JSON/YAML schema fix is solid and the test coverage logic is thorough. Before merge: assign milestone v3.2.0, add
Type/Buglabel, align thecommandenvelope field to spec, fix the rich output foradd, and move inline imports to top-level.Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
893247e273to5f863b0f1c✅ Addressed the review feedback and lint failures:
automation_profile.pyto emit spec-compliant envelopes: the JSON/YAMLcommandfield is now"automation-profile add", rich/plain output render the spec layout (header with created timestamp, flat threshold/flag listing, and success footer), and non-rich formats share the new payload factory. Added a dedicated rich renderer to keepshowoutput untouched.@tdd_issue @tdd_issue_6345, and added a plain-format scenario to lock the created timestamp/flat schema.Type/Buglabel, and rerannox -s lintafter reordering imports—ruffpasses locally now.Branch has been force-updated with the amended commit.
Automated by CleverAgents Bot
Supervisor: Implementation | Agent: implementation-pool-supervisor
Hi! Thanks for the updates that align the automation-profile add command with the spec. I noticed one blocker before this can merge:
automation-profile add --format plainoutput begins with the headingProfile Registeredbefore the key/value body. In the updated implementation, the non-rich path just streams the data dict, so that heading never appears, which will both violate the spec and make the new Behave step"Profile Registered"fail. Could you restore that heading (and the success message) for plain output while keeping the new schema for JSON/YAML? One option would be to print the success message explicitly whenfmtis plain/table before callingformat_output, or pass an envelope/message viaformat_output.Once that’s addressed I’m happy to take another look!
Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
5f863b0f1ctod7fe9cbf49✅ Restored the plain-format success heading and footer for
agents automation-profile addwhile keeping the JSON/YAML schema intact. Added a dedicated plain renderer so the heading (Profile Registered/Profile Updated) and[OK]status now match the spec example at docs/specification.md §“Plain”. Confirmed coverage by rerunning the automation profile Behave suite:Please let me know if you spot anything else that needs attention!
Automated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-pool-supervisor
d7fe9cbf49tob455909ebcReview Summary
b455909eis still red:CI / unit_tests (pull_request)is failing after 5m31s, which trips the aggregatedCI / status-check (pull_request)gate as well.v3.2.0,Type/Buglabel, Conventional Changelog commit message,Closes #6345, Behave coverage for the CLI contract).Required Actions
CI / unit_tests (pull_request)job, then rerun the pipeline so the overall status becomes green.Happy to re-review when the tests pass.
Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer
Code Review: REQUEST CHANGES
Status Overview
This is a re-review of the same head commit
b455909e. The previous HAL9001 review (2026-04-13) already issuedREQUEST_CHANGESon this commit with a single blocker: theCI / unit_tests (pull_request)job is failing. That blocker has not been resolved — the workflow run #17857 on this commit still showsfailureafter 5m33s.🔴 Blocking Issue
1. CI is still failing on head commit
b455909eWorkflow run #17857 (
CI / unit_tests (pull_request)) completed withfailurestatus on 2026-04-12. The overallCI / status-checkgate is therefore also red. This PR cannot be merged until CI passes.Required action: Investigate the failing
unit_testsjob, fix the root cause, push a new commit, and re-trigger CI. Once the pipeline is green, request another review pass.✅ Previously Resolved Issues (Confirmed in Current Diff)
All items from the first review have been addressed in the current diff:
Type/Bugapplied ✅commandenvelope field: Now correctly"automation-profile add"(not"agents automation-profile add") ✅_render_profile_add_richand_render_profile_add_plainadded with spec-compliant layout (header panel withCreated:, flat threshold/flag table,✓ OKfooter) ✅automation_profile_cli_steps.py✅@tdd_issue @tdd_issue_6345✅Profile Registered,Created:, andrequire_checkpoints: true✅fix(cli):prefix,ISSUES CLOSED: #6345footer, single atomic commit ✅Code Quality Notes (Non-Blocking)
Performance / Resource Management (primary focus)
_current_utc_iso()callsdatetime.now(UTC)at call time and is invoked once peradd_profile()call — this is correct and lightweight. No concern._render_profile_add_richand_render_profile_add_plainboth iteratethreshold_entries(14 items) twice — once to build the list, once to render. This is negligible for a CLI command but could be a single-pass loop. Non-blocking.partial()injection ofcreated_isointo renderers is clean and avoids repeated timestamp calls. ✅_profile_add_dictfunction builds two dicts (thresholds,flags) from profile attributes — straightforward, no resource concern.Test Coverage
step_add_json_matches_flat_schemaandstep_add_yaml_matches_flat_schemaexhaustively validate key sets, types, forbidden keys, and message envelope. This is the right level of specificity. ✅Profile Registered,Created:, and a sample flag value — sufficient for regression protection. ✅Summary
The implementation is correct and all previous review feedback has been addressed. The sole remaining blocker is the failing CI pipeline. Fix the test failures, push a green build, and this PR is ready to merge.
Automated by CleverAgents Bot
Reviewer: PR Reviewer | Agent: pr-reviewer
Code Review Decision: REQUEST CHANGES
Blocker: CI is still failing on head commit
b455909e. Workflow run #17857 (CI / unit_tests (pull_request)) showsfailureafter 5m33s — same failure that was flagged in the previous review on 2026-04-13. No new commit has been pushed since then.All other issues from prior reviews have been resolved:
Type/Buglabel ✅commandenvelope field corrected to"automation-profile add"✅@tdd_issue @tdd_issue_6345tags on regression scenarios ✅Required action: Fix the failing
unit_testsjob, push a new commit, confirm CI is green, then request another review.Automated by CleverAgents Bot
Reviewer: PR Reviewer | Agent: pr-reviewer
Review Summary
Blocking Issue
b455909e. Workflow run #12942 shows CI / unit_tests (pull_request) failing after 5m31s, which keeps the aggregated CI / status-check gate in failure (commit status endpoint reportsstate: failure).Required Actions
Happy to re-review once CI is green.
Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-reviewer [AUTO-REV-6598]
Code Review: REQUEST CHANGES
🔴 Blocking Issue
1.
CI / unit_tests (pull_request)is still failingWorkflow run #12942 on head commit
b455909ebc142c13d1bd5d731b290df6aaeb3f53shows:CI / lintCI / typecheckCI / securityCI / qualityCI / integration_testsCI / e2e_testsCI / coverageCI / buildCI / benchmark-regressionCI / unit_testsCI / status-checkThe
unit_testsjob has been failing since this commit was first pushed (2026-04-12). No new commit has been pushed since then. The aggregatedCI / status-checkgate is therefore red, and this PR cannot be merged.Required action: Investigate the failing
unit_testsjob (run #12942, job #4), fix the root cause, push a new commit, and confirm CI is fully green before requesting another review.✅ All Other Criteria Pass
Criteria 1–12 Assessment
unit_testsfailingdocs/specification.md_profile_add_dict()produces correct flatthresholds/flags/createdschematype: ignoresuppressionsfeatures/(no pytest)features/automation_profile_cli.feature+ stepssrc/cleveragents/features/steps/fix(cli): fix automation-profile add JSON/YAML output formatCloses #NCloses #6345in PR body@tdd_expected_failtag removed@tdd_issue @tdd_issue_6345(correct)🟡 Advisory (Non-Blocking)
A.
features/steps/automation_profile_cli_steps.pyexceeds 500 linesThe file is now ~700+ lines (31,299 bytes). The +192 net additions in this PR pushed it over the 500-line limit. This is a pre-existing issue that this PR worsened. Consider splitting step definitions into multiple focused files in a follow-up PR (e.g.,
automation_profile_add_steps.py,automation_profile_list_steps.py).B. Branch name deviates from convention
Branch
fix/issue-6345-automation-profile-add-outputusesfix/prefix instead of the requiredbugfix/mN-nameconvention (expected:bugfix/m3-automation-profile-add-output). This was not flagged in previous reviews and is not a merge blocker, but should be followed in future branches.✅ Implementation Quality (Confirmed)
_profile_add_dict()correctly produces the spec-required flatthresholdsdict (11 keys) andflagsdict (3 keys) with ISO-8601createdtimestamp. Forbidden grouped-schema keys (phase_transitions,decision_automation,self_repair,execution_controls,schema_version,guards) are absent fromaddoutput. ✅commandenvelope field: Correctly set to"automation-profile add"(not"agents automation-profile add"). ✅_render_profile_add_rich()renders spec-compliant header panel (Name, Description, Created), flat threshold/flag table, and✓ OKfooter. ✅_render_profile_add_plain()emits heading,Created:timestamp, flat key/value listing, and[OK]footer. ✅partial()injection: Clean use offunctools.partialto injectcreated_isointo renderers without repeated timestamp calls. ✅Type/Bug✅@tdd_issue @tdd_issue_6345on all three new scenarios ✅Summary
The implementation is correct and complete. All review feedback from prior rounds has been addressed. The sole remaining blocker is the failing
CI / unit_testsjob. Fix the test failures, push a green build, and this PR is ready to merge.Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-review-pool-supervisor
Code Review Decision: REQUEST CHANGES
Head commit:
b455909ebc142c13d1bd5d731b290df6aaeb3f53Sole blocker:
CI / unit_tests (pull_request)is failing (5m31s) in workflow run #12942. The aggregatedCI / status-checkgate is therefore red. All other CI jobs pass (lint ✅, typecheck ✅, security ✅, coverage ✅, integration_tests ✅, e2e_tests ✅, benchmark-regression ✅).All other review criteria are satisfied — implementation is spec-compliant, tests are thorough Behave scenarios, imports are at module top, no type suppressions, layer boundaries respected, commit format correct, milestone and label assigned.
Required action: Fix the failing
unit_testsjob, push a new commit, confirm CI is fully green, then request another review.Automated by CleverAgents Bot
Supervisor: PR Review Pool | Agent: pr-review-pool-supervisor
b455909ebcto64298f901a(attempt #5, tier 1)
🔧 Implementer attempt —
resolved.Pushed 1 commit:
5eafb69.Files touched:
src/cleveragents/cli/commands/automation_profile.py.event occurred 2026-05-31T14:28:21.369287+00:00
🌱 Grooming: proceed — PR cleared for processing.
(check
no_duplicates, categoryno_duplicates)PR #6598 is a focused fix for automation-profile add JSON/YAML output format (closes #6345). Comprehensive scan of 486 open PRs reveals no duplicate: many output-format fixes exist but target different commands (plan execute, project context, session management); the only automation-profile-related PR (#8289) addresses a different feature (precedence chain). No other PR references issue #6345. This is a unique fix with no topical overlap.
event occurred 2026-05-31T14:43:00.320740+00:00
📋 Estimate: tier 1.
CLI output format fix across 3 files with +419/-20 lines. The substantial additions suggest new Behave test scenarios were added, but CI shows 1 scenario failing in unit_tests (setup/teardown error). Implementer needs cross-file context to both understand the JSON/YAML formatting fix and debug the broken test — standard tier-1 work.
(attempt #4, tier 1)
event occurred 2026-05-31T14:55:52.287527+00:00
🔧 Implementer attempt —
rebased.Pushed 1 commit:
64298f9.✅ Approved
Reviewed at commit
5eafb69.Confidence: high.
Claimed by
merge_drive.py(pid 406426) until2026-05-31T18:59:02.515543+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 107).