diff --git a/doc/plans/2026-10-10-chat-channels-refactor.md b/doc/plans/2026-10-10-chat-channels-refactor.md index ee5fa6e7a7..bba089b0c2 100644 --- a/doc/plans/2026-10-10-chat-channels-refactor.md +++ b/doc/plans/2026-10-10-chat-channels-refactor.md @@ -220,3 +220,16 @@ by the service. No state or registration moves in this slice. - Existing CI fixtures cover exact outbound ownership, interleaved control messages, consumed progress, interactions, committed failure replacement and issue-to-run lock order. Local database capacity remains blocked. + +### 2026-10-12 channel-folder reassessment: slice 4 + +Publication replacement is shared ownership logic: exact outbound links, run and +wake scope, consumed progress messages, interaction prompts and retained-source +authorization. Keep those queries together. The close-message provider allowlist +is shared dispatch metadata, not four separate implementations. + +Move the iMessage queued/working suppression policy and explanation to +`imessage-photon/publications.ts`. Preserve when endpoint lookup occurs and leave +all ownership queries unchanged. Baseline: 49 public-service publication and +Photon cases passed, including close-owned progress, interleaved Slack control, +Telegram confirmation and FIFO replacement. The same 49 cases passed after. Server typecheck and module boundaries pass. diff --git a/server/src/services/chat-channels/imessage-photon/publications.ts b/server/src/services/chat-channels/imessage-photon/publications.ts new file mode 100644 index 0000000000..d85b4410cb --- /dev/null +++ b/server/src/services/chat-channels/imessage-photon/publications.ts @@ -0,0 +1,9 @@ +import type { SafeChatPublicationPayload } from "@paperclipai/shared"; + +export function imessageProgressSupersessionReason( + progress: SafeChatPublicationPayload["progressState"], +): string | null { + return progress && ["queued", "working"].includes(progress) + ? "iMessage uses typing instead of progress bubbles" + : null; +} diff --git a/server/src/services/chat-channels/publication-replacement.ts b/server/src/services/chat-channels/publication-replacement.ts index 3d4daa0341..626161201a 100644 --- a/server/src/services/chat-channels/publication-replacement.ts +++ b/server/src/services/chat-channels/publication-replacement.ts @@ -1,3 +1,4 @@ +import { imessageProgressSupersessionReason } from "./imessage-photon/publications.js"; import { fastResponseRequests } from "@paperclipai/db"; import { @@ -74,9 +75,10 @@ export function createChatPublicationReplacement(db: Db, options: ChatPublicatio publication: typeof chatPublications.$inferSelect, ): Promise { const progress = publication.payload.progressState; - if (progress && ["queued", "working"].includes(progress)) { + const typingReason = imessageProgressSupersessionReason(progress); + if (typingReason) { const endpoint = await endpointRecord(publication.endpointId); - if (endpoint?.endpoint.provider === "imessage-photon") return "iMessage uses typing instead of progress bubbles"; + if (endpoint?.endpoint.provider === "imessage-photon") return typingReason; } if ( !progress ||