Repository navigation
fix(server): title prompt names the session and uses the user's language - #285
Conversation
Tell the session-title model this is naming, not conversation: never answer or fulfill the message, and write the title in the user's primary language. Closes GoDiao#277
GoDiao
left a comment
There was a problem hiding this comment.
Thanks @inverteum, and welcome to DreamCoder! The change is in the right place, the test fails without the new line and passes with it, and it restores the env and fetch it touches. A few things before we merge.
Should fix
1. With this wording, Chinese messages still get English titles. We ran the optional before/after sample from #277 through OpenRouter: the PR's system prompt, temperature 0, one run per message and model, so the sample is small. Three Chinese messages, all with English code words in them like most real ones:
帮我看看为什么 bun test 在 CI 上失败?你好,请问 React 的 useEffect 和 useLayoutEffect 有什么区别?把 src/server 里所有的 console.log 换成 logger,然后跑一下测试
| System prompt | Chinese title for a Chinese message |
|---|---|
| This PR | 1/12 (DeepSeek V3.1 0/3, Kimi K2 0/3, Qwen2.5-72B 0/3, GPT-4.1-mini 1/3) |
| Reworded, plus a Chinese example (below) | 7/9 (DeepSeek 2/3, Kimi 2/3, GPT 3/3) |
| Same rewording moved to the end of the prompt, no Chinese example | 6/9 (DeepSeek 3/3, Kimi 0/3, GPT 3/3) |
A German message got a German title in 3 of 4 runs with the PR's wording, and English messages stayed English in every variant. Our guess, not separately tested: all the examples are English, and the English words in the message make "primary language" read as English. The "don't answer" line made no measurable difference, because these models didn't answer the message before the change either; it's still worth keeping.
The variant that did best replaces the language sentence with
Write the title in the language the user writes in, even when the message contains English code, commands or product names: a Chinese message gets a Chinese title.
and adds one example after the good ones:
{"title": "排查 CI 上的测试失败"}
Please use that or something that does at least as well, and update the phrases the test checks to match.
2. CHANGELOG entry. Entries for external PRs reference the PR and end with a thank-you, so this one should end with (#285). Thanks @inverteum. It would also read better as what the user sees, for example "Session titles are written in the language of your message instead of English, and no longer answer the message."
3. Mark T-SYS-09 as fixed. docs/features/harness/prompt/system.md (T-SYS-09, around line 209 on main) still lists it as open. Fixed findings in that file have a status line right under the heading, for example - 状态:已修复(#270):.... Please add - 状态:已修复(#285): followed by what changed.
Merge conflict
The PR now conflicts with main. Only CHANGELOG.md conflicts: main added entries at the top of ### Fixed, so keep both. titleService.ts and the test merge cleanly. #290 changed sendToUpstream's signature, but your test captures the real request on a local server, so it isn't affected; with your change applied on current main, bun test title-service passes (19 tests).
Note
The terminal CLI has a copy of the same prompt in src/utils/sessionTitle.ts (SESSION_TITLE_PROMPT). The desktop app never uses it, and #277 is about the server only, so leave it as is.
Reword the language sentence, keep the don't-answer line, add a Chinese good example, update the title-service regression phrases, rewrite the CHANGELOG Fixed entry for GoDiao#285, and mark T-SYS-09 fixed.
GoDiao
left a comment
There was a problem hiding this comment.
Thanks @inverteum, all three points are in: the language sentence and the Chinese example, the test phrases that go with them, the CHANGELOG entry and the T-SYS-09 status line. The merge with main is clean, bun test title-service passes here (19 tests), and CI is green.
We'll be opening more features and issues soon, and you're very welcome to keep contributing. If you find DreamCoder useful, a star on the repo would be much appreciated.
What
Adds two instructions to the server session-title system prompt in
src/server/services/titleService.ts(T-SYS-09 / #277):Also adds a regression test that captures the upstream
systemfield and asserts those phrases are present, and a CHANGELOG entry under## [Unreleased]→ Fixed.Why
Without those lines, a model may answer the first user message instead of naming the session (long answers are discarded and the placeholder title stays), or produce an English title for a non-English conversation.
How it was tested
mainprompt text and passes with this change.bun run prepare:ripgrepbun test ./src/server/__tests__/title-service.test.ts: 16 pass, 0 failbun test --randomize --seed=1 ./src/server/__tests__/title-service.test.ts: 16 pass, 0 failcd desktop && bun run lint: passcd desktop && bun run test -- --run: 3119 pass, 4 skipped, 0 failbun test: 2889 pass, 2 skip, 21 fail. All 21 failures are 5s timeouts in SessionService / Sessions API / ArtifactService worktree and artifact tests. None are intitle-service. A sample of one of those timed-out tests (should move repository metadata into the CLI worktree transcript) passes when run alone (101 ms). These look like full-suite resource contention in this Linux environment, not regressions from this prompt-text change.Scope
Does not change #279, #274, or other #270 sub-issues.
Closes #277