Skip to content

fix(session): fix title generation for new sessions with client-provided UUID#63

Merged
cnjack merged 1 commit into
mainfrom
feat/title-mission
May 22, 2026
Merged

fix(session): fix title generation for new sessions with client-provided UUID#63
cnjack merged 1 commit into
mainfrom
feat/title-mission

Conversation

@cnjack
Copy link
Copy Markdown
Owner

@cnjack cnjack commented May 22, 2026

Summary

Fix title generation logic in Recorder for new sessions where a UUID is provided by the client (e.g., web UI) before the session file exists on disk.

Problem

Previously, SetUUID() unconditionally set r.resuming = true, which caused RecordUser() to skip title generation entirely. This meant new sessions created via the web interface (which provides a UUID upfront) would never get an auto-generated title.

Additionally, the title generation guard r.file == nil && !r.resuming was fragile — it relied on file creation state rather than explicitly tracking whether a title had already been generated.

Changes

  • SetUUID(): Only mark resuming = true if the session file already exists on disk. For brand-new sessions with a client-provided UUID, the recorder is left in "new" mode so the first user message still triggers title generation.
  • hasTitle field: New boolean field that explicitly tracks whether a title has been generated, replacing the implicit r.file == nil check in RecordUser().
  • RecordUser(): Updated to use !r.hasTitle && !r.resuming instead of r.file == nil && !r.resuming for the needsTitle check. Sets r.hasTitle = true after generating the title.

Testing

  • Verified that new sessions with a client-provided UUID now correctly generate a title on the first user message.
  • Verified that resumed sessions (existing file on disk) still skip title generation as expected.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Warning

Rate limit exceeded

@cnjack has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 35 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3458594c-b1b8-4623-b87f-841a70ace197

📥 Commits

Reviewing files that changed from the base of the PR and between c98d5f8 and 9cf1b73.

📒 Files selected for processing (1)
  • internal/session/session.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/title-mission

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.

@cnjack cnjack merged commit 7591c68 into main May 22, 2026
1 check passed
@cnjack cnjack deleted the feat/title-mission branch May 22, 2026 14:53
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