fix: validate inline agent files and skills in the workflow checklist (#39137)

This commit is contained in:
Joel
2026-07-16 08:39:20 +00:00
committed by GitHub
parent cd98193234
commit d876f6dba5
4 changed files with 239 additions and 4 deletions
@@ -46,6 +46,45 @@ describe('agent composer store conversions', () => {
])
})
it('should preserve missing file and skill references without file ids in autosave config', () => {
const baseConfig = {
config_files: [
{
file_id: '',
file_kind: 'upload_file',
is_missing: true,
name: 'missing.pdf',
},
],
config_skills: [
{
file_id: '',
file_kind: 'tool_file',
is_missing: true,
name: 'Missing Skill',
},
],
} satisfies AgentSoulConfig
const formState = agentSoulConfigToFormState(baseConfig)
const autosaveConfig = formStateToAgentSoulConfig({ baseConfig, formState })
expect(autosaveConfig.config_files).toEqual([
expect.objectContaining({
file_id: '',
is_missing: true,
name: 'missing.pdf',
}),
])
expect(autosaveConfig.config_skills).toEqual([
expect.objectContaining({
file_id: '',
is_missing: true,
name: 'Missing Skill',
}),
])
})
it('rebases draft baselines through the composer state action', () => {
const store = createStore()
const nextDraft = {
@@ -452,7 +452,7 @@ const toConfigSkillConfigs = (
return skills.flatMap((skill) => {
const existing = existingByName.get(skill.name)
const fileId = skill.fileId ?? existing?.file_id
if (!fileId) return []
if (!fileId && !skill.isMissing) return []
return [
{
@@ -463,6 +463,7 @@ const toConfigSkillConfigs = (
size: skill.size ?? existing?.size,
hash: skill.hash ?? existing?.hash,
mime_type: skill.mimeType ?? existing?.mime_type,
...(skill.isMissing ? { is_missing: true } : {}),
},
]
})
@@ -480,7 +481,7 @@ const toConfigFileConfigs = (
const configName = file.configName ?? file.name
const existing = existingByName.get(configName)
const fileId = file.fileId ?? existing?.file_id
if (!fileId) return []
if (!fileId && !file.isMissing) return []
return [
{
@@ -490,6 +491,7 @@ const toConfigFileConfigs = (
size: file.size ?? existing?.size,
hash: file.hash ?? existing?.hash,
mime_type: file.mimeType ?? existing?.mime_type,
...(file.isMissing ? { is_missing: true } : {}),
},
]
})