Skip to content

Conversation

@gregberns
Copy link

@gregberns gregberns commented Nov 7, 2025

There's a 500 when POST /session is called. The server requires a body to be included - but currently there's an empty payload.


POST | /session | Create session | body: { parentID?, title? }, returns Session
-- | -- | -- | --

POST	/session	Create session	body: { parentID?, title? }, returns [Session](https://github.com/sst/opencode/blob/dev/packages/sdk/js/src/gen/types.gen.ts)

Summary by CodeRabbit

  • New Features
    • Enhanced session creation with support for optional parent ID and title parameters.

@coderabbitai
Copy link

coderabbitai bot commented Nov 7, 2025

Walkthrough

The createSession API method in the service layer has been enhanced to accept optional configuration parameters (parentID and title), which are now serialized and sent in the POST request body to /session.

Changes

Cohort / File(s) Change Summary
Session API Enhancement
src/services/api.ts
Updated createSession method signature to accept optional options parameter containing parentID and title fields; request body now includes JSON-serialized options or empty object.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify that the JSON serialization handles both cases correctly (options provided and undefined)
  • Confirm the API endpoint /session supports the new request body parameters
  • Check that existing callers of createSession remain compatible with the optional parameter

Poem

🐰 A session now blooms with options so bright,
Parent IDs and titles, held snug and tight,
From parameters optional, our API takes flight,
No breaking of code—just features done right!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely identifies the main issue being fixed: adding a missing request body to the create session endpoint to resolve a 500 error.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/services/api.ts (1)

63-68: The original review comment is accurate and well-founded. Verification confirms:

  1. Backward compatibility: The only call site is src/stores/sessionStore.ts:32, which calls createSession() with no arguments. The optional parameter ensures full compatibility.

  2. Ternary simplification: The suggestion is valid. Both options ? JSON.stringify(options) : JSON.stringify({}) and JSON.stringify(options || {}) produce identical results, so the simplification is correct.

The review comment appropriately flags an optional refactoring opportunity while approving the core fix.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0ab3c85 and 4782945.

📒 Files selected for processing (1)
  • src/services/api.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/services/api.ts (1)
src/services/types.ts (1)
  • Session (2-10)

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.

1 participant