Skip to content

fix: print empty session json#30148

Closed
he-yufeng wants to merge 1 commit into
anomalyco:devfrom
he-yufeng:fix/session-list-empty-json
Closed

fix: print empty session json#30148
he-yufeng wants to merge 1 commit into
anomalyco:devfrom
he-yufeng:fix/session-list-empty-json

Conversation

@he-yufeng
Copy link
Copy Markdown

@he-yufeng he-yufeng commented May 31, 2026

Issue for this PR

Fixes #30100

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

session list --format json printed empty stdout when no sessions existed, which makes the command invalid for scripts expecting JSON. This keeps the output machine-readable by returning [] for the empty list case and adds a CLI smoke regression.

How did you verify your code works?

  • bun --cwd packages\opencode test test\cli\smokes\read-only.test.ts -t "session list json"
  • bun --cwd packages\opencode typecheck
  • bunx prettier --check packages\opencode\src\cli\cmd\session.ts packages\opencode\test\cli\smokes\read-only.test.ts
  • bunx oxlint packages\opencode\src\cli\cmd\session.ts packages\opencode\test\cli\smokes\read-only.test.ts (existing warning only, no errors)
  • git diff --check

Screenshots / recordings

N/A; this is CLI JSON output behavior.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels May 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 1, 2026
@github-actions github-actions Bot closed this Jun 1, 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.

opencode session list --format json produces empty stdout when spawned from Node.js/Electron on Windows

1 participant