_companyId mismatch between an SmsBuilder document and the FlowAction that references it.1008602312 (June 24, 2026). The error displayed in the activity feed was: Error: SMS template company mismatch for FlowAction 6a25e8cf2ee5be4f7c0a2693.renderSmsFromTemplate, when a FlowAction.actionTemplate contains a smsBuilderId, the system fetches the referenced SmsBuilder document and compares saved._companyId against smsFlowAction._companyId. If they don't match, it returns a hard error and sends nothing.FlowAction pointing to an SmsBuilder from a different company without any warning or error. The problem only surfaces when the flow fires on a real job.copyActionFlowToCompany.ts). That function collects smsBuilderId values from source FlowAction documents and attempts to copy each referenced SmsBuilder under the target company, building a mapping. If the SMS copy step silently fails (missing source doc, mapping gap, etc.) and the FlowAction is still saved with the original source smsBuilderId, the cross-company reference is baked into production data with no visible error._companyId comparison in renderSmsFromTemplate is correct behavior and should be preserved.FlowAction write) and copy time (prevent a FlowAction from being saved if its SMS mapping is incomplete).copyActionFlowToCompany abort the whole flow copy, skip that action, or save the action in a broken/draft state with a warning? Current behavior logs a warning but may proceed.attik monorepo / attik-backend)apps/backend/src/util/functions/actionFlows/renderSms.ts — Contains the _companyId mismatch check. No change needed here; the guard is correct.apps/backend/src/util/functions/actionFlows/copyActionFlowToCompany.ts — copySmsBuilders() and copyFlowActions() are the likely source of the broken state. When smsBuilderMapping doesn't contain a source ID, copyFlowActions logs a warning and proceeds without updating smsBuilderId, meaning the saved FlowAction retains the original cross-company ID.apps/backend/src/models/flowSchema.ts — FlowAction schema; consider whether a pre-save hook or route-level validation should enforce same-company ownership of actionTemplate.smsBuilderId.apps/backend/src/models/smsBuilderSchema.ts — SmsBuilder schema; reference point for _companyId field structure.attik monorepo / attik-frontend)apps/frontend/src/components/flowStatus/SmsSendModal.tsx — Surfaces SMS action state in the UI; may need to surface a degraded/broken state for actions with a cross-company template reference, similar to how broken service references are handled.6a25e8cf2ee5be4f7c0a2693Please authenticate to join the conversation.
Planned
Main App
About 5 hours ago
Linear
Get notified by email when there are changes.
Planned
Main App
About 5 hours ago
Linear
Get notified by email when there are changes.