Skip to content

fix: await session title generation before returning#19293

Closed
joaobibiano wants to merge 1 commit intoanomalyco:devfrom
joaobibiano:fix/session-title-generation
Closed

fix: await session title generation before returning#19293
joaobibiano wants to merge 1 commit intoanomalyco:devfrom
joaobibiano:fix/session-title-generation

Conversation

@joaobibiano
Copy link
Copy Markdown

Issue for this PR

Closes #

Type of change

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

What does this PR do?

New sessions generate their thread title in the background. The prompt loop could finish before that work completed, which left some sessions stuck on the default New session - ... title even though the title model was available.

This change tracks the title-generation promise inside the session loop, reuses the session abort signal, and waits for the title update before returning. It also adds a regression test that simulates a slower title model so the race stays covered.

How did you verify your code works?

  • bun test test/session/prompt.test.ts
  • bun typecheck

Screenshots / recordings

N/A

Checklist

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

@github-actions github-actions bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Mar 26, 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

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

What needs to be fixed:

  • No issue referenced. Please add Closes #<number> linking to the relevant issue.

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
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search results, I found one potentially related PR:

Related PR:

Why it's related:
This PR addresses a similar issue with session titles staying at the default "New session - ..." value. Your current PR (#19293) fixes the underlying race condition by awaiting the title generation promise before returning, while PR #19177 appears to be a fallback mechanism for when titles remain at their default value. These PRs may be addressing the same root cause or could be complementary fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant