fix(orchestration-v2): restore generated thread titles - #5176
Conversation
Queue automatic and manual title generation through the durable V2 effect outbox, use the configured text-generation model, and cover web, desktop, and mobile send paths.
|
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.
Effect service conventions review of the new ThreadTitleRegenerationService and its call sites. One structural finding on the service module; the executor wiring, Foo["Service"] typing, environment-based dependency acquisition, and the test-only Layer.succeed/Layer.mock seams all look consistent with the conventions.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0bfd8c1. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0bfd8c1384
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...(input.titleSeed === undefined || projection.messages.length > 0 | ||
| ? {} | ||
| : { titleSeed: input.titleSeed }), |
There was a problem hiding this comment.
Keep a fallback for servers without title-seed support
When a current web client connects to a pre-change server, that server does not understand the new titleSeed field sent here; because ChatViewContent simultaneously removed its first-message updateThreadMetadata fallback, sending the first message to an existing empty server thread leaves its title as New thread (or can reject the command if the older RPC decoder treats the field strictly). Gate this path on a newly advertised environment capability and retain the metadata update for older remote servers.
AGENTS.md reference: AGENTS.md:L19-L21
Useful? React with 👍 / 👎.
ApprovabilityVerdict: Needs human review This PR restructures thread title generation into a durable effect system with new orchestration commands, services, and effect lanes. Two unresolved review comments identify potential latency (P1) and backward compatibility (P2) issues that warrant further examination before merging. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fdaaea1a23
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| yield* Ref.update(effects, (existing) => [ | ||
| ...existing, | ||
| pendingThreadTitleGenerationEffect(command.commandId, command.threadId, { | ||
| type: "initial", | ||
| messageId: command.messageId, | ||
| }), | ||
| ]); |
There was a problem hiding this comment.
Do not serialize first-turn startup behind title generation
For every newly launched thread, ThreadLaunchService dispatches the initial message with defer_start, so this becomes the only pending effect and is claimed before workspace preparation later enqueues provider-turn.start. The outbox permits only one running effect per thread, which means the agent cannot start until the title model call finishes or times out; a slow title provider therefore turns optional asynchronous metadata generation into first-turn latency for web, desktop, and mobile. Schedule title generation so it does not occupy the per-thread lane ahead of the released run.
AGENTS.md reference: AGENTS.md:L15-L17
Useful? React with 👍 / 👎.

Summary
Restores automatic title generation for new threads under orchestration V2.
A provisional title appears immediately from the first message or attachment, then a durable background effect replaces it with a generated title. Web, desktop, and mobile now use the same workflow.
Problem
During the V2 migration, the client assigned a useful provisional title before launch, while the server inferred title-generation intent from whether the title was still
"New thread".As a result, assigning the provisional title caused the server to skip generation, leaving some threads permanently titled from the first line of their first message.
Title regeneration also depended on a live event listener, so interrupted work could be lost during server shutdown or restart.
Solution
Compatibility
Automatic title generation requires a server containing the new V2 title-generation workflow.
New clients connected to older servers can still create threads and send messages, but those threads retain the older server’s title behavior. This is intentional graceful degradation; the client does not maintain a second, non-atomic title-generation fallback.
The existing version-drift UI directs users to update the connected server when they want the latest behavior.
User-facing behavior
Before: a new thread could remain permanently titled from the first line of its first message.
After: the provisional title appears immediately and is asynchronously replaced by a generated title.
There are no layout or styling changes.
Verification
git diff --checkpassed.Built with OpenAI Codex (GPT-5.6) in T3 Code.
Note
Restore durable thread title generation in orchestration-v2
thread-title.generateeffect type andThreadTitleRegenerationServiceto handle initial and regenerate title generation as durable, effect-driven work rather than opportunistic background calls.deriveThreadTitleSeedutility in@t3tools/client-runtime/operationsthat normalizes text, falls back to attachment names and context labels, and is now used consistently across mobile and web clients.thread.title.regeneration.completecommand that clears the regeneration marker.updateThreadMetadatadirectly on first send; title updates now flow exclusively through the orchestrator's effect pipeline.Macroscope summarized 851e4f5.
Note
Medium Risk
Touches orchestration command handling, effect outbox claiming, and thread metadata across all clients; incorrect correlation or lane logic could leave wrong titles or delay provider work, but behavior is heavily tested and scoped to metadata/async effects.
Overview
Restores automatic thread titles after the V2 migration skipped generation whenever clients already set a provisional title from the first message.
Clients now share
deriveThreadTitleSeed(text, attachments, fallbacks) across web, mobile, and client-runtime, and passtitleSeedplusgenerateTitleon launch/firstmessage.dispatchinstead of inferring intent from"New thread". Web drops the separate pre-send metadata update that duplicated title logic.On the server, the orchestrator applies the seed immediately, arms
titleRegeneration, enqueuesthread-title.generate(initial or regenerate), and finishes throughthread.title.regeneration.completeso stale completions cannot overwrite a manual rename.ThreadTitleRegenerationServiceis no longer an event-stream worker;EffectWorkerruns generation as a replay-safe outbox effect. The outbox serializes title effects separately from provider/critical work on the same thread so generation does not block turns.ThreadLaunchServiceremoves synchronous title generation from the provisioning path; failed reused-thread launches no longer change titles before the message is accepted.Reviewed by Cursor Bugbot for commit 851e4f5. Bugbot is set up for automated code reviews on this repo. Configure here.