fix(cli): fix automation-profile add JSON/YAML output format #6598
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!6598
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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
agents automation-profile addJSON/YAML output uses wrong schema — uses groupedshowformat instead of spec-required flatthresholds/flagsstructure withcreatedtimestamp #6345PR 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
893247e2735f863b0f1c✅ 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
5f863b0f1cd7fe9cbf49✅ 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
d7fe9cbf49b455909ebcReview 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
b455909ebc64298f901a(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).