The best way to control Claude Code, Codex and more from any computer or phone
fix(server): Claude /rename now retitles the T3 thread (#36879)
Julius Marminge committed
Nov 14, 2026 at 11:17 UTC
56b9dbc87bdfb1468d18a821cc528bdf23b3c3bb
2 files changed
+76
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+44
@@ -3815,6 +3815,50 @@ describe("ClaudeAdapterV2 background wake turns", () => {
3815
),
3816
);
3817
3818
+ it.effect("a native /rename retitles the thread without renaming it back", () =>
3819
+ Effect.gen(function* () {
3820
+ const harness = yield* makeWakeHarnessWithOptions();
3821
+ yield* startTurn(harness, "First title", 1);
3822
+ yield* harness.offerAndWait(
3823
+ claudeSdkFrame({
3824
+ type: "system",
3825
+ subtype: "session_title_changed",
3826
+ title: "Native title",
3827
+ uuid: "title-changed-1",
3828
+ session_id: WAKE_NATIVE_SESSION,
3829
+ }),
3830
+ );
3831
+ yield* harness.offerAndWait({
3832
+ ...makeResultFrame({
3833
+ uuid: "title-result-1",
3834
+ result: "Session renamed to: Native title",
3835
+ numTurns: 0,
3836
+ }),
3837
+ local_command: "rename",
3838
+ } as SDKMessage);
3839
+ yield* Queue.take(harness.terminalReceipts);
3840
+ assert.deepEqual(
3841
+ harness.events.flatMap((event) =>
3842
+ event.type === "app_thread.created" ? [event.appThread.title] : [],
3843
+ ),
3844
+ ["Native title"],
3845
+ );
3846
+
3847
+ yield* startTurn(harness, "Native title", 2);
3848
+ assert.deepEqual(harness.renameCalls, []);
3849
+ yield* finishTurn(harness, 2);
3850
+ }).pipe(
3851
+ Effect.provide(
3852
+ Layer.mergeAll(
3853
+ IdAllocator.layer,
3854
+ McpProviderSessions.layer,
3855
+ NodeServices.layer,
3856
+ NodeCrypto.layer,
3857
+ ),
3858
+ ),
3859
+ ),
3860
+ );
3861
+
3862
it.effect("renames a resumed session whose stored title is stale", () =>
3863
Effect.gen(function* () {
3864
const harness = yield* makeWakeHarnessWithOptions();
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+32
@@ -4937,6 +4937,8 @@ interface ActiveClaudeTurnContext {
4937
// Set while this turn's latest compaction status reports a failure, with
4938
// Claude's error text when it sent one.
4939
compactionFailure: { readonly message: string | undefined } | null;
4940
+ // The title a `session_title_changed` frame reported; a `/rename` result applies it to the thread.
4941
+ nativeSessionTitle: string | null;
4942
// Steers end segments whose usage is excluded from the final result; bill them too, oldest first.
4943
readonly steeredSegmentUsage: Array<SDKResultMessage["usage"]>;
4944
// Set as finalization starts: a steer admitted later would stay pending
@@ -11122,6 +11124,35 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
11124
}
11125
}
11126
11127
+ if (
11128
+ message.type === "system" &&
11129
+ (message.subtype as string) === "session_title_changed" &&
11130
+ "title" in message &&
11131
+ typeof message.title === "string"
11132
+ ) {
11133
+ context.nativeSessionTitle = normalizeClaudeSessionTitle(message.title);
11134
+ }
11135
+
11136
+ if (
11137
+ message.type === "result" &&
11138
+ message.subtype === "success" &&
11139
+ !message.is_error &&
11140
+ message.local_command === "rename" &&
11141
+ context.nativeSessionTitle !== null
11142
+ ) {
11143
+ const title = context.nativeSessionTitle;
11144
+ context.nativeSessionTitle = null;
11145
+ // The native session already has this title; the next turn must not send it back.
11146
+ appliedSessionTitles.set(liveQuery.nativeThreadId, title);
11147
+ if (title !== context.input.appThread.title) {
11148
+ yield* emitProviderEvent({
11149
+ type: "app_thread.created",
11150
+ driver: CLAUDE_PROVIDER,
11151
+ appThread: { ...context.input.appThread, title },
11152
+ });
11153
+ }
11154
+ }
11155
+
11156
if (message.type === "system" && message.subtype === "task_progress") {
11157
const progress = message.description.trim();
11158
const isBackgroundTask = yield* hasPendingBackgroundTaskOnNativeThread(
@@ -12987,6 +13018,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
13018
rateLimitResetTimes: new Map(),
13019
latestAssistantRateLimit: null,
13020
compactionFailure: null,
13021
+ nativeSessionTitle: null,
13022
steeredSegmentUsage: [],
13023
steersClosed: false,
13024
steeredLedgerUsage: { inputTokens: 0, outputTokens: 0 },