Skip to content

fix(server): log why AI title generation failed - #192

Merged
GoDiao merged 1 commit into
GoDiao:mainfrom
pcbeingused333:fix/title-generation-log-failures
Oct 26, 2026
Merged

GoDiao merged 1 commit into
GoDiao:mainfrom
pcbeingused333:fix/title-generation-log-failures

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #176

generateTitle returned null without a trace for several different causes, so a session that kept its placeholder title gave no hint why. It now logs one console.warn line per failed attempt with the session id, the provider id, the model and the reason:

  • no provider, no base URL or API key, or no model to use
  • the upstream request failed: HTTP status and a short excerpt of the error (a 400 for an unknown model id now shows up)
  • the reply has no text block
  • the reply is not a usable title: a short excerpt of the reply
  • any exception, replacing the empty catch

The return value and the placeholder title behave as before. generateTitle takes an optional sessionId for the log line; the WebSocket handler passes it.

Tests in title-service.test.ts cover an upstream 400, a non-title reply and a missing provider; they fail without the change. bun test for that file and tsc --noEmit pass.

This change was prepared with Claude Code (AI-assisted); the tests above were run.

🤖 Generated with Claude Code

Fixes GoDiao#176

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@GoDiao GoDiao left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @pcbeingused333, this is exactly what #176 asked for! One line per failed attempt with the session, provider, model and reason, the empty catch gone, and the return value unchanged. We checked that the three new tests fail on main and that they restore console.warn and stop their servers.

Approving. Thanks again!

@GoDiao
GoDiao merged commit 70b8321 into GoDiao:main Oct 26, 2026
4 checks passed
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.

Log why session title generation failed

2 participants