Fix: agenticUserTemplateManifest.json missing from zip on repeated publish runs#286
Fix: agenticUserTemplateManifest.json missing from zip on repeated publish runs#286
Conversation
Co-authored-by: sellakumaran <147754920+sellakumaran@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where agenticUserTemplateManifest.json was missing from manifest.zip on repeated a365 publish runs — causing a server-side BadRequest: File not found in the zip archive error. When the manifest/ directory already exists from a prior partial run, the old code relied on a directory-enumeration fallback for the zip candidate list, which could be displaced by .DS_Store or similar files on macOS. Additionally, if the file was absent, no recovery path existed.
Changes:
- Added
agenticUserTemplateManifest.jsonas an explicit second entry incandidateNamesinPublishCommand, guaranteeing it is always included in the zip regardless of other files present in the directory. - Added a new
EnsureTemplateFile(workingDirectory, fileName)method toManifestTemplateServicethat extracts a single embedded resource only if the file is not already present, enabling recovery without overwriting user-customized files. - Added 4 unit tests for
EnsureTemplateFilecovering: file already exists (no overwrite), file extracted when missing, extracted file is valid JSON, and invalid resource name returnsfalse.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Microsoft.Agents.A365.DevTools.Cli/Services/ManifestTemplateService.cs |
New EnsureTemplateFile method for single-file embedded resource recovery |
src/Microsoft.Agents.A365.DevTools.Cli/Commands/PublishCommand.cs |
Recovery check for missing agenticUserTemplateManifest.json + explicit zip candidate entry |
src/Tests/.../Services/ManifestTemplateServiceTests.cs |
4 new unit tests for EnsureTemplateFile |
When the
manifest/directory already exists from a previous faileda365 publishrun,agenticUserTemplateManifest.jsonwas not reliably included inmanifest.zip, causing a server-sideBadRequest: File not found in the zip archiveerror.Root causes
Zip candidate list omitted the file:
candidateNamesin zip creation was["manifest.json", "color.png", "outline.png", "logo.png", "icon.png"]—agenticUserTemplateManifest.jsonwas never explicitly listed. It relied on a fallback that enumerates leftover directory files. On macOS, Finder creates.DS_Storewhen the user opens the folder to edit the manifest;.sorts beforea, so.DS_Storefilled the 4th slot instead.No recovery when file is absent: If the manifest directory existed but
agenticUserTemplateManifest.jsonwas missing (old CLI version, very early partial failure), the subsequentFile.ReadAllTextAsyncthrewFileNotFoundExceptionwith no recovery path.Changes
ManifestTemplateService— NewEnsureTemplateFile(workingDirectory, fileName): extracts a single embedded resource to the directory only if the file is not already there, leaving other files (including user-customizedmanifest.json) untouched.PublishCommand— After the "extract-if-dir-missing" block, explicitly check foragenticUserTemplateManifest.jsonand callEnsureTemplateFileif absent.PublishCommand— AddagenticUserTemplateManifest.jsonas the second entry incandidateNamesso it is picked up deterministically:ManifestTemplateServiceTests— 4 new unit tests coveringEnsureTemplateFile(file already exists, file extracted when missing, extracted file is valid JSON, invalid resource name returns false).Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
graph.microsoft.com/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/Agent365-devTools/Agent365-devTools/src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/bin/Release/net8.0/Microsoft.Agents.A365.DevTools.Cli.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/Agent365-devTools/Agent365-devTools/src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/bin/Release/net8.0/Microsoft.Agents.A365.DevTools.Cli.Tests.deps.json /home/REDACTED/work/Agent365-devTools/Agent365-devTools/src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/bin/Release/net8.0/testhost.dll --port 33889 --endpoint 127.0.0.1:033889 --role client --parentprocessid 4280 --telemetryoptedin false(dns block)/usr/bin/../../opt/az/bin/python3 /usr/bin/../../opt/az/bin/python3 -Im azure.cli rest --method GET --url REDACTED$filter=appId eq 'a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6'&$select=id --headers Authorization=****** Microsoft.Agents.A365.DevTools.Cli.Tests/Services/GraphApiServiceTokenTrimTests.cs Microsoft.Agents.A365.DevTools.Cli.Tests/Services/ManifestTemplateServiceTests.cs Micr�� Microsoft.Agents.A365.DevTools.Cli.Tests/Services/Requirements/FrontierPreviewRequirementCheckTelsb_release Microsoft.Agents.A365.DevTools.Cli.Tests/Services/InteractiveGraphAuthServiceTests.cs Microsoft.Agents.A365.DevTools.Cli.Tests/Services/ConfigurationWizardServiceWebAppNameTests.cs Microsoft.Agentslsb_release Microsoft.Agents-a Microsoft.Agents.A365.DevTools.Cli.Tests/Services/Helpers/DotNetProjectHelperTests.cs Microsoft.Agents.A365.DevTools.Cli.Tests/Services/Helpers/LoggerFactoryHelperTests.cs(dns block)/usr/bin/../../opt/az/bin/python3 /usr/bin/../../opt/az/bin/python3 -Im azure.cli rest --method GET --url REDACTED$filter=appId eq 'a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6'&$select=id --headers Authorization=******(dns block)login.microsoftonline.com/usr/bin/../../opt/az/bin/python3 /usr/bin/../../opt/az/bin/python3 -Im azure.cli login --tenant 12345678-1234-1234-1234-123456789012(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.