Skip to content

fix(orchestration-v2): restore generated thread titles - #5176

Open
Yusuf007R wants to merge 4 commits into
pingdotgg:t3code/codex-turn-mappingfrom
Yusuf007R:fix/orchestration-v2-title-generation
Open

fix(orchestration-v2): restore generated thread titles#5176
Yusuf007R wants to merge 4 commits into
pingdotgg:t3code/codex-turn-mappingfrom
Yusuf007R:fix/orchestration-v2-title-generation

Conversation

@Yusuf007R

@Yusuf007R Yusuf007R commented Aug 1, 2026

Copy link
Copy Markdown

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

  • Pass explicit title-generation intent with the first message or thread launch.
  • Persist the provisional title, regeneration marker, first message, and durable outbox effect together.
  • Run automatic and manual title generation through the same replay-safe worker.
  • Correlate generation requests so stale results cannot overwrite a manual rename or newer request.
  • Derive provisional titles consistently across web and mobile, including image-only messages.
  • Avoid changing reused-thread titles until their initial message has been accepted.

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

  • 107-test orchestration, contracts, client-runtime, and mobile title suite passed.
  • Final review fixes were revalidated with 49 focused and adjacent tests.
  • Server, contracts, client-runtime, web, and mobile typechecks passed.
  • Isolated Playwright testing verified image-only provisional titles and the transition to a generated title with no browser console errors.
  • Formatting and git diff --check passed.

Built with OpenAI Codex (GPT-5.6) in T3 Code.

Note

Restore durable thread title generation in orchestration-v2

  • Introduces a thread-title.generate effect type and ThreadTitleRegenerationService to handle initial and regenerate title generation as durable, effect-driven work rather than opportunistic background calls.
  • Adds a shared deriveThreadTitleSeed utility in @t3tools/client-runtime/operations that normalizes text, falls back to attachment names and context labels, and is now used consistently across mobile and web clients.
  • On first message dispatch, a provisional title is set immediately from the seed and a durable title generation effect is enqueued; completion is signaled via a new thread.title.regeneration.complete command that clears the regeneration marker.
  • Title-generation effects run in a separate lane from provider lifecycle effects on the same thread, allowing parallelism while keeping each lane serialized.
  • Behavioral Change: the web client no longer calls updateThreadMetadata directly on first send; title updates now flow exclusively through the orchestrator's effect pipeline.

Macroscope summarized c8a058f.


Note

Medium Risk
Touches orchestrator thread metadata, durable outbox claiming, and cross-client launch/dispatch contracts; behavior is well-tested but spans critical thread-creation paths.

Overview
Restores automatic thread title generation under orchestration V2 by moving it off the launch critical path and into a replay-safe effect pipeline, with shared provisional title derivation on clients.

Clients now send explicit titleSeed / generateTitle instead of inferring generation from "New thread". Web drops the first-send updateThreadMetadata title call; titles flow through message.dispatch and launch with titleSeed.

On the first message, the orchestrator sets a provisional title from the seed, arms titleRegeneration, and enqueues thread-title.generate (initial or regenerate). ThreadTitleRegenerationService replaces the event-stream worker and completes via thread.title.regeneration.complete, with request-id correlation so stale results cannot overwrite manual renames.

The effect outbox adds a separate per-thread lane for title work so provider-turn and other critical effects are not blocked. Mobile and web share deriveThreadTitleSeed (text, attachments, fallbacks) for live activity, outbox, and composer send paths.

Reviewed by Cursor Bugbot for commit c8a058f. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

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: 2e6eadc7-b570-4426-8ae1-f52bf3b1c9c1

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

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 1, 2026

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread apps/server/src/orchestration-v2/ThreadTitleRegenerationService.ts Outdated
@Yusuf007R
Yusuf007R marked this pull request as ready for review August 1, 2026 07:45

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ 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.

Comment thread apps/mobile/src/state/use-thread-outbox-drain.ts Outdated
Comment thread apps/server/src/orchestration-v2/ThreadLaunchService.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +591 to +593
...(input.titleSeed === undefined || projection.messages.length > 0
? {}
: { titleSeed: input.titleSeed }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@macroscopeapp

macroscopeapp Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@Yusuf007R
Yusuf007R marked this pull request as draft August 1, 2026 08:07
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 2, 2026
@Yusuf007R
Yusuf007R marked this pull request as ready for review August 2, 2026 07:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +2406 to +2412
yield* Ref.update(effects, (existing) => [
...existing,
pendingThreadTitleGenerationEffect(command.commandId, command.threadId, {
type: "initial",
messageId: command.messageId,
}),
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@maria-rcks
maria-rcks force-pushed the t3code/codex-turn-mapping branch from a543fd4 to 378615b Compare August 3, 2026 16:01
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant