fix(server): keep regenerated titles on topic - #5365
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 33688e6. Configure here.
ApprovabilityVerdict: Needs human review This PR changes runtime behavior for thread title regeneration by modifying both the context construction (pinning first user message when truncated) and the LLM prompt guidance. While well-tested and self-contained, changes to how generated titles are produced warrant human review. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
bc60735 to
224145f
Compare
## What's Changed * fix(web): better right panel (new diffs styling) by @maria-rcks in pingdotgg/t3code#5260 * fix(server): keep regenerated titles on topic by @t3dotgg in pingdotgg/t3code#5365 * refactor(server): make title prompts plaintext by @t3dotgg in pingdotgg/t3code#5368 * feat(web): configurable fonts and sizes under Settings → Appearance by @StiensWout in pingdotgg/t3code#5103 * feat(sidebar-v2): bring back thread pinning by @t3dotgg in pingdotgg/t3code#5312 * feat(web): make pairing QR codes actually scannable, with endpoint choice by @t3dotgg in pingdotgg/t3code#5360 * fix(desktop,web): improve in-app browser shortcuts and URL behavior by @t3dotgg in pingdotgg/t3code#4703 * fix(web): prevent legacy model picker layout shift by @FllipEis in pingdotgg/t3code#5349 * fix(server): allow remote updates with database migrations by @t3dotgg in pingdotgg/t3code#5374 **Full Changelog**: pingdotgg/t3code@v0.0.32-nightly.20260804.1000...v0.0.32-nightly.20260805.1002 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.32-nightly.20260805.1002
- Port thread pinning (#5312) into the orchestration-v2 command pipeline: thread.pin/unpin commands, thread.pinned/unpinned events, pinnedAt on the v2 thread state and projected shells, promotion semantics (pin clears settle/snooze, settle clears pin) matching the v1 decider, and client pin/unpin operations in the v2 dispatch style. - Port the regenerated-title context anchoring (#5365) into ThreadTitleRegenerationService: pin the first user message ahead of the retained tail when the digest is truncated. - Re-apply the right-panel controls positioning from #5260 to the v2 ChatView title bar controls. - Repair merge artifacts: committed conflict markers in BranchToolbar, duplicate capability keys, duplicate CommandPalette import, v1 turn naming in DiffPanel's focus-refresh effect, onSend signature merge. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 9bd2a4c)

Regenerated titles can drift toward the latest assistant finding or operational follow-up, especially after the original request falls out of the recent context window.
This gives regeneration its own subject-selection guidance and keeps the opening user message inside the existing 8,000-character budget alongside the recent tail. Opening image context is retained too.
Testing
vp test run apps/server/src/textGeneration/TextGenerationPrompts.test.ts apps/server/src/orchestration/Layers/ProviderCommandReactor.test.tsgit diff --checkGenerated by GPT-5.6 Sol (high reasoning) through the Codex harness in T3 Code.
Note
Low Risk
Localized server-side title regeneration and prompt text; behavior is covered by tests and does not touch auth, persistence, or provider session logic.
Overview
Regenerated thread titles were drifting toward the latest assistant finding or operational detail when long threads exceeded the title model’s context window.
Context assembly (
formatThreadTitleContextinProviderCommandReactor) now, when the 8,000-character budget is exceeded, pins the first USER section (up to 2,000 chars, with[First user message truncated]if needed), then[Earlier content truncated]and the recent message tail. Title-generation attachments prefer the first user message’s first image plus recent retained images (up to four, deduped).Regeneration prompts (
buildThreadTitlePrompt) use separate guidance and editorial rules: prioritize the user’s durable goal, don’t elevate a single assistant finding unless the user adopts it, and addafterRulesexamples (e.g. subagent-monitoring review vs. one Codex bug). First-turn title prompts are unchanged.Tests cover long-thread pinning, attachment selection, and updated prompt expectations.
Reviewed by Cursor Bugbot for commit 224145f. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix thread title regeneration to stay on topic by pinning the first user message
buildThreadTitlePromptin TextGenerationPrompts.ts with regeneration-specific instruction wording, guidance, and rules that direct the model to identify the durable thread subject from USER messages rather than promoting transient assistant findings.formatThreadTitleContextin ProviderCommandReactor.ts so that when the context exceeds 8,000 chars, the first USER message section is pinned at the start (capped at 2,000 chars), followed by[Earlier content truncated]and the recent tail.afterRulesfield toPromptFromMessageInputso regeneration prompts can append worked examples (e.g. distinguishing a durable bug topic from a transient subagent-monitoring state) directly after the rules block.Macroscope summarized 224145f.