The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(sessions): check an explicit export --session-id once in _cmd_export
kshitijk4poor2dbe76a9785d
diff --git a/hermes_cli/sessions_cmd.py b/hermes_cli/sessions_cmd.pyindex 8e6ef41cd0c..fa00c0008b6 100644--- a/hermes_cli/sessions_cmd.py+++ b/hermes_cli/sessions_cmd.py@@ -331,6 +331,8 @@ def _cmd_export(db, args):# A backup includes protected rows; prune's keep rules must not omit them.filters["archived"] = Nonefilters["include_pinned"] = True+ if args.session_id and not db.resolve_session_id(args.session_id):+ return _not_found(args.session_id)def _redact(data):if not args.redact or data is None:@@ -366,7 +368,7 @@ def _cmd_export(db, args):return Falsedef _collect_sessions():- """Return exported sessions, a failure exit code, or None for a dry-run preview."""+ """--session-id / filters / bare export -> redacted session dicts, or None after printing an error."""def _one(session_id):return _redact(db.export_session(session_id, **projection))if args.session_id:@@ -375,7 +377,8 @@ def _cmd_export(db, args):return Nonedata = _one(resolved) if resolved else Noneif not data:- return _not_found(args.session_id)+ _not_found(args.session_id)+ return Nonereturn [data]if filters:candidates = db.list_prune_candidates(**filters)@@ -436,8 +439,6 @@ def _export_flat(kind, args, collect):print(message)returnsessions = collect()- if isinstance(sessions, int):- return sessionsif sessions is not None:from hermes_cli.session_export import default_save_filenamename = (default_save_filename(sessions[0].get("id", ""), args.format) if len(sessions) == 1@@ -456,8 +457,6 @@ def _export_trace(db, args, filters):if not session_id:print("No session found to export. Pass --session-id.")return- if session_id and not db.resolve_session_id(session_id):- return _not_found(session_id)from agent.trace_upload import TraceRedactionError, build_trace_jsonl, upload_session_traceredact_trace = not getattr(args, "no_redact", False)if getattr(args, "upload", False):@@ -559,8 +558,6 @@ def _export_markdown_single(db, args, export_one, output_dir, lineage_is_logical"""--session-id markdown export, optionally + verified delete of it and its delegates."""from hermes_cli.session_export_md import verify_export_fileresolved_session_id = db.resolve_session_id(args.session_id)- if not resolved_session_id:- return _not_found(args.session_id)delete_target_ids = (db.get_session_delete_targets(resolved_session_id) if args.delete_after_verified else [resolved_session_id])