t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Fix session renaming bug

Open kridaydave opened this issue 4 months ago • 4 comments

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 via isDefaultThreadTitle)
  • Sanitize provider titles — strip control characters and truncate at 500 chars
  • Unify title policy — ProviderCommandReactor.canReplaceThreadTitle now delegates to the shared isDefaultThreadTitle instead 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.updated from overwriting user-chosen titles.

Provider title updates in runtime ingestion now run only when the current title is still the default ("New thread" via isDefaultThreadTitle), and the incoming name is passed through sanitizeTitle (control-character stripping, 500-char cap) before thread.meta.update is dispatched. Custom titles are left unchanged; empty or whitespace-only provider names are ignored.

Shared title helpers live in @t3tools/shared/threadTitle and replace the server’s local default constant in ProviderCommandReactor.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 threadTitle module (threadTitle.ts) exporting DEFAULT_THREAD_TITLE, isDefaultThreadTitle, and sanitizeTitle utilities.
  • Updates the thread.metadata.updated handler 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 canReplaceThreadTitle in ProviderCommandReactor.ts to use isDefaultThreadTitle instead 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.

kridaydave avatar Jul 26 '26 05:07 kridaydave

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.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f45fc325-e595-4add-ad83-c68a1a5937fc

You can disable this status message by setting the reviews.review_status to false in 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jul 26 '26 05:07 coderabbitai[bot]

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.

macroscopeapp[bot] avatar Jul 26 '26 05:07 macroscopeapp[bot]

Sorry for the extreme commits :3

kridaydave avatar Jul 26 '26 05:07 kridaydave

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.

juliusmarminge avatar Jul 30 '26 15:07 juliusmarminge