fix: pass entity_id on multi-skill batch upload, consistent identifier format

This commit is contained in:
Danny Avila 2026-04-14 21:43:41 -04:00
parent c2e24eaf26
commit c85ce2161e

View file

@ -368,10 +368,14 @@ export async function primeInvokedSkills(
if (allFileStreams.length > 0) {
try {
// Use first skill's ID as entity_id — scopes the shared session to a
// stable key so freshness checks with ?entity_id= pass session auth.
const batchEntityId = skillsWithFiles[0]._id.toString();
const result = await deps.batchUploadCodeEnvFiles({
req: deps.req,
files: allFileStreams,
apiKey,
entity_id: batchEntityId,
});
sessions = new Map();
@ -399,13 +403,10 @@ export async function primeInvokedSkills(
`[primeInvokedSkills] No skill record found for filename "${f.filename}"`,
);
}
const entityId = record?.skill._id?.toString() ?? '';
return {
skillId: record?.skill._id ?? '',
relativePath: relPath,
codeEnvIdentifier: entityId
? `${result.session_id}/${f.fileId}?entity_id=${entityId}`
: `${result.session_id}/${f.fileId}`,
codeEnvIdentifier: `${result.session_id}/${f.fileId}?entity_id=${batchEntityId}`,
};
})
.filter((u) => u.skillId !== '');