Skip to content

Commit 46ab601

Browse files
mrobinson2claude
andcommitted
fix(session-registry): drop custom taskKey from sessions.create to avoid upstream contract mismatch
Removes `taskKey: discord-thread-${threadId}` from the `ctx.agents.sessions.create()` call in `spawnAgentInThread`. PaperClip's plugin-host honors arbitrary taskKey values at create time, but every subsequent SDK op (sendMessage/list/close) filters sessions by `taskKey LIKE 'plugin:${pluginKey}:session:%'`. Custom keys orphan the session — sendMessage immediately throws `Session not found`, falling through to the ACP fallback which has no consumer in default installs. The custom taskKey was decorative (grepped — never read elsewhere in the plugin). Dropping it lets the host generate the prefixed default form so downstream ops succeed. Fixes #49. Related: paperclipai/paperclip#6156 (upstream root cause). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6a18c6b commit 46ab601

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/session-registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ export async function spawnAgentInThread(
274274
let transport: TransportKind = "native";
275275

276276
try {
277+
// Do not pass a custom `taskKey` — host's sendMessage/list/close filter on `plugin:${pluginKey}:session:%`, so any user-supplied key becomes invisible to subsequent SDK calls.
277278
const session = await ctx.agents.sessions.create(agentId, companyId, {
278-
taskKey: `discord-thread-${threadId}`,
279279
reason: `Spawned in Discord thread for: ${taskPrompt.slice(0, 200)}`,
280280
});
281281
sessionId = session.sessionId;

0 commit comments

Comments
 (0)