fix: skip RESOLUTION section in PSA export for incomplete sessions

Mid-session "Copy for Ticket" no longer shows a misleading Resolution
section that echoed the last step's answer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael Chihlas
2026-02-13 10:50:55 -05:00
parent 1869da4fcb
commit f8a14d8b4c

View File

@@ -429,21 +429,22 @@ def generate_psa_export(session: Session, options: SessionExport) -> str:
lines.append("No steps recorded.") lines.append("No steps recorded.")
lines.append("") lines.append("")
# Resolution # Resolution — only for completed sessions
lines.append("--- RESOLUTION ---") if session.completed_at:
_raw_notes = getattr(session, 'outcome_notes', None) lines.append("--- RESOLUTION ---")
outcome_notes = _raw_notes if isinstance(_raw_notes, str) else '' _raw_notes = getattr(session, 'outcome_notes', None)
if outcome_notes.strip() and options.include_outcome_notes: outcome_notes = _raw_notes if isinstance(_raw_notes, str) else ''
lines.append(outcome_notes.strip()) if outcome_notes.strip() and options.include_outcome_notes:
elif session.decisions: lines.append(outcome_notes.strip())
last_decision = session.decisions[-1] elif session.decisions:
resolution = last_decision.get("answer") or last_decision.get("question", "No resolution recorded") last_decision = session.decisions[-1]
lines.append(resolution) resolution = last_decision.get("answer") or last_decision.get("question", "No resolution recorded")
else: lines.append(resolution)
lines.append("No resolution recorded.") else:
if outcome_label: lines.append("No resolution recorded.")
lines.append(f"Outcome: {outcome_label}") if outcome_label:
lines.append("") lines.append(f"Outcome: {outcome_label}")
lines.append("")
# Next Steps # Next Steps
_raw_next = getattr(session, 'next_steps', None) _raw_next = getattr(session, 'next_steps', None)