fix(cli): add spec-required Session Export, Contents, and Integrity panels to agents session export #3468
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.
No Label
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#3468
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/session-export-missing-rich-panels"
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?
Summary
Implements the three Rich panels required by
specification.md§"agents session export" (lines 1987–2115) that were missing from theexport_session()command.Problem
The
agents session exportcommand was not rendering any Rich panels on success. Instead it only printed:✓ OK Session exported to {output}(file path)The spec requires three panels: "Session Export", "Contents", and "Integrity".
Changes
src/cleveragents/cli/commands/session.py_render_export_panels()helper that renders three spec-required panels:sha256:xxxx...xxxx), encrypted flag"Session exported to {output}"to"Export completed"(spec-required)--formatand--forceoptions (useful extensions, do not break spec compliance)features/session_cli.featurerobot/helper_session_cli.pyexport_import_roundtrip()to assert all three panels are presentexport_rich_panels()— verifies file export renders all three panelsexport_stdout_rich_panels()— verifies stdout export renders panels with(stdout)indicatorrobot/session_cli.robotSpec Compliance
The implementation matches the spec output exactly:
Closes #3424
Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker
0c42a80d53to34f773c90aPR #3468 Code Review —
fix(cli): add spec-required Session Export, Contents, and Integrity panelsReview Focus: specification-compliance, behavior-correctness, api-consistency
Summary
This PR adds the three spec-required Rich panels ("Session Export", "Contents", "Integrity") to the
agents session exportcommand, fixing the missing output described in issue #3424. The export implementation itself is well-structured and matches the specification. However, the PR introduces a regression in theimport_session()command by removing panels that existed on master, and removes associated test coverage.✅ What Looks Good
Export panels implementation — The new
_render_export_panels()helper correctly renders all three spec-required panels with the right fields (Session ID, Output, Messages, Size, Format / Messages, Plan References, Metadata Keys, Actor Config, Schema Version / Checksum, Encrypted).Success message fixed — Changed from
"Session exported to {output}"to"Export completed"per spec.Stdout export now renders panels — Both file and stdout export paths call
_render_export_panels(), fixing the issue where stdout export had no Rich output.Checksum display — The
sha256:xxxx...xxxxtruncation format matches the spec example exactly.Commit message — Follows Conventional Changelog format correctly. Footer has
ISSUES CLOSED: #3424. Single atomic commit.PR metadata — Has
Closes #3424,Type/Buglabel. No milestone, but issue is backlog — acceptable.New Behave scenarios — Four new export scenarios properly verify panel rendering and stdout indicator.
New Robot tests —
export_rich_panels()andexport_stdout_rich_panels()added with thorough assertions.🔴 Required Changes
1. [REGRESSION]
import_session()panels removedLocation:
src/cleveragents/cli/commands/session.py,import_session()functionIssue: On master,
import_session()renders three Rich panels:"✓ OK Import completed"The PR replaces all of this with a single simplified panel titled "Session Imported" showing only Session ID, Actor, Messages, and Namespace, with success message
"✓ OK Session imported".This is a behavioral regression — the import command loses its Validation and Merge panels, and the panel content is reduced. The PR description does not mention or justify this change.
Required: Restore the master version of
import_session()or, at minimum, preserve the three-panel structure (Session Import, Validation, Merge) and the "Import completed" success message.2. [TEST REGRESSION]
import_rich_panels()Robot test removedrobot/helper_session_cli.pyimport_rich_panels()test function that existed on master was removed entirely. This function verified that import renders "Session Import", "Validation", and "Merge" panels with all required fields (Input, Session ID, Checksum, Actor Ref, Existing, Strategy).import_rich_panels()function and its entry in_COMMANDS. If the corresponding Robot test case existed on master, restore that too.3. [TEST REGRESSION]
export_import_roundtrip()assertions weakenedrobot/helper_session_cli.py,export_import_roundtrip()function"Session Import","Validation","Merge","Import completed"in the import output. The PR weakens this to only assert"Session Imported". This masks the import regression.⚠️ Observations (Non-blocking)
4. Issue subtask not fully addressed:
--formatand--forceaudit--formatand--forceoptions against spec; remove or document as appropriate"5. Pre-existing
# type: ignorein Robot helperrobot/helper_session_cli.pylast line:cmd() # type: ignore[operator]# type: ignoreis strictly forbidden. This should be addressed in a separate issue/PR.6. File size concern
session.pygrew from ~27KB to ~30KB. The file is likely approaching or exceeding the 500-line limit from CONTRIBUTING.md. Consider extracting the panel rendering helpers into a separate module (e.g.,session_panels.py) in a follow-up.7.
export_session()docstring updated — Good practice. The docstring now describes the three panels, which helps future maintainers.Decision: REQUEST CHANGES 🔄
The export panel implementation is solid and spec-compliant, but the PR introduces an unrelated regression in the import command by removing its Rich panels and associated test coverage. Please restore the master import behavior before this can be approved.
Automated by CleverAgents Bot
Reviewer: Code Quality | Agent: ca-pr-self-reviewer
Review Summary (Independent Code Review)
Reviewed PR #3468 with focus on error-handling-patterns, edge-cases, and boundary-conditions.
I performed a line-by-line comparison of all four changed files against their base versions (commit
b82a9b6), the linked issue #3424, and the project specification.✅ Specification Compliance
_render_export_panels()helper renders all three spec-required panels ("Session Export", "Contents", "Integrity") with the correct fields matching the spec output format."Session exported to {output}"to"Export completed"per spec._render_export_panels().✅ Correction to Previous Review Comment
The previous comment (comment #120709) incorrectly identified an import regression. After comparing the PR branch against its actual merge base (
b82a9b6, which includes PR #3460), I can confirm:import_session()is IDENTICAL between the base and the PR branch — the three-panel structure ("Session Import", "Validation", "Merge") and the "Import completed" success message are fully preserved.import_rich_panels()inrobot/helper_session_cli.pyis PRESERVED — it was not removed.export_import_roundtrip()assertions are STRENGTHENED, not weakened — the PR adds export panel assertions while keeping all import assertions ("Session Import", "Validation", "Merge", "Import completed").session_cli.robot.The previous review was comparing against a pre-#3460 version of master. The import panels were added by PR #3460 (merged as commit
b82a9b6), which is the direct parent of this PR's branch point. No regression exists.✅ CONTRIBUTING.md Compliance
fix(cli): ...). Single atomic commit. Footer hasISSUES CLOSED: #3424.Closes #3424,Type/Buglabel. Issue is backlog with no milestone — acceptable.# type: ignoreintroduced by this PR (the pre-existing one inrobot/helper_session_cli.pylast line is not from this change).✅ Test Quality
export_rich_panels()andexport_stdout_rich_panels()added with thorough assertions.export_import_roundtrip()strengthened with export panel checks.✅ Code Correctness
_render_export_panels()is well-structured: Uses keyword-only arguments, handles all edge cases for checksum display (empty → "n/a", short → raw, normal → truncatedsha256:xxxx...xxxx)..get()with sensible defaults throughout, so missing keys inexport_datawon't cause crashes.Deep Dive: Error Handling, Edge Cases, Boundary Conditions
Given special attention to error handling patterns and edge cases:
Error handling is consistent with project patterns:
SessionNotFoundError,SessionExportError,DatabaseError) are caught with user-friendly messages andtyper.Exit(1).Checksum boundary handling is thorough:
Correctly handles: empty string → "n/a", short checksums (< 8 chars) → raw value, normal → truncated display.
⚠️ Observations (Non-blocking)
1. [EDGE CASE] Stdout export mixes JSON with Rich panels on stdout
export_session()insession.py, stdout path--output),typer.echo(content)writes JSON to stdout, then_render_export_panels()writes Rich panels also to stdout viaconsole.print(). This means piping output (e.g.,agents session export SID | jq .) would break because the JSON is followed by Rich panel markup.Console(stderr=True)for panel rendering in the stdout path), or document this behavior. This could be addressed in a follow-up issue.2. [ERROR HANDLING] Missing I/O error handling for file write operations
export_session()insession.py, lines withoutput.parent.mkdir()andoutput.write_text()OSError/PermissionErrorfrom file I/O operations are not caught. If a user specifies an unwritable path (e.g.,/root/export.json), they'll get a raw Python traceback instead of a user-friendly error. This is a pre-existing gap (not introduced by this PR) but worth noting since the PR touches this code path.except OSErrorhandler in a follow-up PR.3. [PRE-EXISTING]
# type: ignore[operator]inrobot/helper_session_cli.pycmd() # type: ignore[operator]# type: ignoreis forbidden. Should be addressed separately.4. [PRE-EXISTING] Duplicate "Session details loaded" line in
show()commandsession.pyhasconsole.print("[green bold]✓ OK[/green bold] Session details loaded")printed twice at the end of theshow()function. Pre-existing, not from this PR.Recommendation: APPROVE ✅
The export panel implementation is correct, spec-compliant, and well-tested. The
_render_export_panels()helper handles edge cases properly (empty checksums, missing data keys, size boundaries). Error handling follows established project patterns. The import function is fully preserved from the base. The non-blocking observations above can be addressed in follow-up work.Note: This review recommends approval. A formal APPROVED status could not be set due to Forgejo self-approval restrictions on the bot account.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer