Skip to content

fix: skip share prompt when analysis parsing fails#65

Merged
pi3-code merged 2 commits intomainfrom
fix/skip-export-on-failed-analysis
Mar 5, 2026
Merged

fix: skip share prompt when analysis parsing fails#65
pi3-code merged 2 commits intomainfrom
fix/skip-export-on-failed-analysis

Conversation

@Treelovah
Copy link
Contributor

Summary

When analysis fails to parse the LLM response, promptExport() was still showing the "Share results?" menu because it only checked if (!analysis) — but a parseFailed analysis is still a truthy object, just one full of zeroed scores and empty findings. Nobody wants to copy a blank share card to their clipboard.

Now parseFailed analysis is treated the same as no analysis: skip the export menu, tell the user to retry with oasis analyze <id>.

Test plan

  • Run a benchmark with analysis enabled against a model likely to produce malformed JSON
  • Verify the share prompt is skipped and retry instructions are shown
  • Run a benchmark with successful analysis and verify share prompt still works normally

promptExport() was checking `if (!analysis)` but a parseFailed
analysis still passes that — it's an object, just a useless one
with zeroed scores and empty findings. So the CLI would happily
ask "Share results?" and offer to copy a blank card to clipboard.

Now we treat parseFailed the same as no analysis: skip the export
menu entirely and tell the user to retry with `oasis analyze`.
@pi3-code pi3-code self-requested a review March 5, 2026 18:58
Copy link
Contributor

@pi3-code pi3-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled the branch, built it, ran the full test suite, and confirmed the bug locally. The parseFailed stub is truthy, so the previous guard was missing it. This fix works as expected.

Approving.

While reviewing I noticed two related spots where the same parseFailed stub leaks through:

  • run-flow.ts:562 — printAnalysisSummary still runs on parseFailed, so the user may see a "STRATEGY ASSESSMENT" section with zeros right after the spinner reports failure.
  • run.ts:360 — similar pattern.

I can open a small follow-up PR to guard these paths and add a test for promptExport.

@pi3-code pi3-code merged commit 7d5f82d into main Mar 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants