Skip to content

fix: actionable diagnostics for empty feed/inbox results#5

Merged
1a35e1 merged 1 commit into1a35e1:mainfrom
cosmicallycooked:fix/empty-feed-diagnostics
Feb 23, 2026
Merged

fix: actionable diagnostics for empty feed/inbox results#5
1a35e1 merged 1 commit into1a35e1:mainfrom
cosmicallycooked:fix/empty-feed-diagnostics

Conversation

@cosmicallycooked
Copy link
Copy Markdown
Contributor

Bug

When sonar feed or sonar inbox returns zero results, the CLI outputs a single dim line:

No tweets found in this window.
Inbox is empty.

Neither message explains why the result is empty or what the operator should do next. Common root causes include: no interests configured, ingest hasn't run, time window too narrow, all inbox items already actioned, or an auth/quota issue — none of which are surfaced.

For agents consuming --json output the situation is worse: an empty array [] on stdout is indistinguishable from a genuinely quiet period versus a broken data pipeline.

Fix

Terminal (non-JSON) path

sonar feed — context-aware numbered checklist tailored to --kind:

  • bookmarks kind → directs to sonar ingest bookmarks + monitor
  • All other kinds → widen window, check interests, trigger ingest, run matching, check account

sonar inbox — adapts to the active --status filter:

  • If a specific status is set, first step is sonar inbox --all (maybe items exist under a different status)
  • Then: verify interests, ingest, match, monitor, check account

Both render with a yellow header so empty is visually distinct from a normal (populated) result.

JSON path

When result is empty in --json mode, a structured diagnostic is written to stderr (stdout still receives the valid empty JSON array []). This means:

  • Piped agents get a machine-readable empty array and can proceed
  • Humans reading stderr (or agents that check it) see labelled causes and remediation commands
  • Exit code is still 0 — empty is not an error

Example output (terminal)

sonar feed --hours 1
No tweets found.
No network tweets matched your interests in the last 1h.
Things to check:
  1. Widen the window:         sonar feed --hours 48 or --days 7
  2. Check interests exist:    sonar interests
  3. Trigger ingest if stale:  sonar ingest tweets
  4. Check ingest progress:    sonar ingest monitor
  5. Run matching:             sonar interests match
Account status and quota: sonar account

Example output (JSON stderr)

sonar feed --json 2>&1 1>/dev/null
[sonar feed] Empty result — possible causes:
  • No tweets matched your interests in the last 12h.
  • Check interests are configured: sonar interests
  • Ingest may be stale: sonar ingest tweets && sonar ingest monitor
  • Widen the window: sonar feed --hours 48
  • Account/quota status: sonar account

The root problem: 'No tweets found in this window.' and 'Inbox is empty.'
give no guidance on why the result is empty or what to do next. For agents
consuming --json output there is also no signal that the empty result might
indicate a configuration or data-pipeline problem vs. a genuine quiet period.

Changes:

src/commands/feed.tsx
- Terminal (non-json) empty state now renders a yellow header + numbered
  checklist tailored to the --kind flag:
    bookmarks  → remind to run 'sonar ingest bookmarks'
    default / followers / following  → widen window, check interests,
      trigger ingest, run matching, check account
- JSON mode: when result is empty, a structured diagnostic is written to
  stderr (stdout still receives the valid empty JSON array []). This lets
  piped agents distinguish an empty result from an error while still
  giving a human operator reading stderr actionable next steps.

src/commands/inbox/index.tsx
- Terminal empty state renders a yellow header + numbered checklist that
  adapts to the active --status filter:
    • If a specific status is set, first step is 'try --all'
    • Then: check interests, ingest, match, monitor, account
- JSON mode: same stderr-diagnostic pattern as feed — empty array on
  stdout, structured hint on stderr with status label, causes, and
  remediation commands.
@1a35e1 1a35e1 self-requested a review February 23, 2026 15:21
@cosmicallycooked
Copy link
Copy Markdown
Contributor Author

@1a35e1 PR is approved and ready to merge.

@1a35e1 1a35e1 merged commit 0aca561 into 1a35e1:main Feb 23, 2026
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