Fix session renaming bug
Provider-emitted thread.metadata.updated events were unconditionally overwriting thread titles, reverting user custom renames and blocking auto-titling from working reliably.
The fix:
- Guard provider title updates — only apply a provider's thread title when the current title is still the default
"New thread"(checked viaisDefaultThreadTitle) - Sanitize provider titles — strip control characters and truncate at 500 chars
- Unify title policy —
ProviderCommandReactor.canReplaceThreadTitlenow delegates to the sharedisDefaultThreadTitleinstead of its own local constant - Tests — unit tests for
isDefaultThreadTitle/sanitizeTitle, integration tests for default/custom/missing/empty title scenarios
[!NOTE] Medium Risk Changes orchestration thread metadata behavior that users see in the UI, but the logic is narrowly scoped with clear guards and broad test coverage.
Overview Fixes provider-driven session renaming by stopping
thread.metadata.updatedfrom overwriting user-chosen titles.Provider title updates in runtime ingestion now run only when the current title is still the default (
"New thread"viaisDefaultThreadTitle), and the incoming name is passed throughsanitizeTitle(control-character stripping, 500-char cap) beforethread.meta.updateis dispatched. Custom titles are left unchanged; empty or whitespace-only provider names are ignored.Shared title helpers live in
@t3tools/shared/threadTitleand replace the server’s local default constant inProviderCommandReactor.canReplaceThreadTitle. Integration expectations were updated so a non-default harness title ("Thread") is not renamed by provider metadata; new tests cover default apply, custom reject, and missing/empty/sanitized-empty names.Reviewed by Cursor Bugbot for commit acd29c498188b9a673943f685c1154b9839712ee. Bugbot is set up for automated code reviews on this repo. Configure here.
[!NOTE]
Fix session renaming bug by preventing providers from overwriting user-customized thread titles
- Adds a shared
threadTitlemodule (threadTitle.ts) exportingDEFAULT_THREAD_TITLE,isDefaultThreadTitle, andsanitizeTitleutilities.- Updates the
thread.metadata.updatedhandler in ProviderRuntimeIngestion.ts to only apply provider-proposed names when the current thread title is the default; the proposed name is also sanitized before use.- Updates
canReplaceThreadTitlein ProviderCommandReactor.ts to useisDefaultThreadTitleinstead of a local constant.- Behavioral Change: Provider-driven renames are now silently ignored if the user has already set a custom title, or if the sanitized proposed name is empty.
Macroscope summarized acd29c4.
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
f45fc325-e595-4add-ad83-c68a1a5937fcYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
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 @coderabbitai help to get the list of available commands.
Approvability
Verdict: Approved
Straightforward bug fix that prevents provider-initiated title updates from overwriting user-customized thread titles. The change is well-scoped, introduces simple utility functions, and includes comprehensive test coverage for the new behavior.
You can customize Macroscope's approvability policy. Learn more.
Sorry for the extreme commits :3
Closing in favor of #2829 (orchestration V2).
#2829 deletes the V1 orchestration layer this PR builds on — apps/server/src/orchestration/**, provider/Layers/*Adapter.ts and provider/Services/** are removed and replaced by apps/server/src/orchestration-v2/**, with the IPC surface renamed to ORCHESTRATION_V2_WS_METHODS. The files this PR touches either no longer exist or are rewritten, so it can't be rebased — it would need reimplementing against the V2 adapters.
This is not a judgement on the change itself. Several of these are real gaps we still want fixed; the base just moved out from under them.
Once #2829 merges, please rebase onto main, port the change to the V2 equivalent, and reopen (or open a fresh PR). Ping me and I'll prioritise the review.