fix: preserve session start metadata
Summary
- accept optional
title,summary, andfirstPromptinPOST /agentmemory/session/start - use
titleas the fallback session label/first prompt so OpenCode-created sessions do not surface as raw IDs when prompt submission races session creation - keep explicit
summaryandfirstPromptvalues distinct when clients provide both - document the optional session labels in the API table
Fixes #244
Related
- This is intentionally scoped to #244. #306 touches the same endpoint for #259 agent/session attribution metadata, but does not handle the OpenCode
title->summary/firstPromptpath. Happy to rebase if #306 lands first.
Tests
npm run buildnpm testnpm test -- test/api-session-start.test.ts
@Zavianx is attempting to deploy a commit to the rohitg00's projects Team on Vercel.
A member of the Team first needs to authorize it.
The PR extends the session creation endpoint to accept and persist optional human-readable labels ( Session Label Initialization 🎯 2 (Simple) | ⏱️ ~12 minutes 🐰 Sessions now wear their names with pride, ✏️ Tip: You can configure your own custom pre-merge checks in the settings.📝 Walkthrough
Walkthrough
title, summary, firstPrompt) provided in the request body. A helper function normalizes and truncates these strings; summary and firstPrompt default to the title value when omitted. The endpoint behavior, test coverage, and API documentation are all updated together.Changes
Layer / File(s)
Summary
Preview helper and request contract
src/triggers/api.tsasSessionPreview(value, maxLength) normalizes whitespace and truncates strings; the api::session::start request body type now includes optional title, summary, and firstPrompt fields.
Session label computation and assignment
src/triggers/api.tsWhen creating a session, each label is converted to a truncated preview.
summary and firstPrompt fall back to the title preview when not explicitly provided; both are assigned to the session only if non-empty.
Documentation and test coverage
README.md, test/api-session-start.test.tsREADME API table documents the three new optional fields; test suite verifies that omitting
summary and firstPrompt causes them to inherit from title, and that explicit values are preserved in both response body and KV-persisted session.
No more IDs to hide or misguide,
From title springs summary and prompt so fine,
All three labels dance in perfect design! ✨🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name
Status
Explanation
Title check
✅ Passed
The title 'fix: preserve session start metadata' is concise and directly relates to the main change: accepting and preserving optional session metadata (title, summary, firstPrompt) in the POST /agentmemory/session/start endpoint.
Linked Issues check
✅ Passed
The pull request fully addresses issue
#244: api::session::start now reads and stores body.title as both summary and firstPrompt, resolving the raw ID display issue and race condition mentioned in the issue.
Out of Scope Changes check
✅ Passed
All changes are directly scoped to issue
#244: README documentation updates, API handler modifications to accept/process metadata fields, and comprehensive test coverage for the new functionality.
Docstring Coverage
✅ Passed
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
[!TIP]
💬 Introducing Slack Agent: The best way for teams to turn conversations into code.
Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
- Generate code and open pull requests
- Plan features and break down work
- Investigate incidents and troubleshoot customer tickets together
- Automate recurring tasks and respond to alerts with triggers
- Summarize progress and report instantly
Built for teams:
- Shared memory across your entire org—no repeating context
- Per-thread sandboxes to safely plan and execute work
- Governance built-in—scoped access, auditability, and budget controls
One agent for your entire SDLC. Right inside Slack.
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.
Comment @coderabbitai help to get the list of available commands and usage tips.