fix: keep thread placement metadata cold

This commit is contained in:
Shakker
2026-04-26 08:11:55 +01:00
parent 2e101e8413
commit 8b32c31252
3 changed files with 10 additions and 25 deletions

View File

@@ -0,0 +1 @@
export const defaultTopLevelPlacement = "child" as const;

View File

@@ -7,7 +7,7 @@ import {
normalizeOptionalLowercaseString,
normalizeOptionalString,
} from "../shared/string-coerce.js";
import { getChannelPlugin, getLoadedChannelPlugin, normalizeChannelId } from "./plugins/index.js";
import { getLoadedChannelPlugin, normalizeChannelId } from "./plugins/index.js";
import { parseExplicitTargetForChannel } from "./plugins/target-parsing.js";
import {
resolveBundledChannelThreadBindingDefaultPlacement,
@@ -233,11 +233,7 @@ export function resolveChannelDefaultBindingPlacement(
}
const pluginPlacement =
resolveRuntimeChannelPlugin(channel)?.conversationBindings?.defaultTopLevelPlacement;
return (
pluginPlacement ??
resolveBundledChannelThreadBindingDefaultPlacement(channel) ??
getChannelPlugin(channel)?.conversationBindings?.defaultTopLevelPlacement
);
return pluginPlacement ?? resolveBundledChannelThreadBindingDefaultPlacement(channel);
}
export function resolveCommandConversationResolution(
@@ -405,23 +401,6 @@ export function resolveInboundConversationResolution(
return artifactResolution;
}
const bundledPlugin = getChannelPlugin(channel);
const bundledConversation =
bundledPlugin !== plugin
? bundledPlugin?.messaging?.resolveInboundConversation?.(resolverParams)
: undefined;
const bundledResolution = normalizeResolutionTarget({
channel,
accountId,
conversation: bundledConversation,
source: "inbound-bundled-plugin",
threadId,
plugin: bundledPlugin ?? plugin,
});
if (bundledResolution || bundledConversation === null) {
return bundledResolution;
}
const parentConversationId =
resolveChannelTargetId({
channel,

View File

@@ -5,7 +5,8 @@ import {
resolveThreadBindingLifecycle as resolveSharedThreadBindingLifecycle,
type ThreadBindingLifecycleRecord,
} from "../shared/thread-binding-lifecycle.js";
import { getChannelPlugin } from "./plugins/index.js";
import { getLoadedChannelPlugin } from "./plugins/index.js";
import { resolveBundledChannelThreadBindingDefaultPlacement } from "./plugins/thread-binding-api.js";
export {
resolveThreadBindingLifecycle,
@@ -64,7 +65,11 @@ function resolveDefaultTopLevelPlacement(channel: string): "current" | "child" {
if (!normalized) {
return "current";
}
return getChannelPlugin(normalized)?.conversationBindings?.defaultTopLevelPlacement ?? "current";
return (
getLoadedChannelPlugin(normalized)?.conversationBindings?.defaultTopLevelPlacement ??
resolveBundledChannelThreadBindingDefaultPlacement(normalized) ??
"current"
);
}
function normalizeBoolean(value: unknown): boolean | undefined {