Skip to content

Fix: agenticUserTemplateManifest.json missing from zip on repeated publish runs#286

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-publish-command-error
Draft

Fix: agenticUserTemplateManifest.json missing from zip on repeated publish runs#286
Copilot wants to merge 2 commits intomainfrom
copilot/fix-publish-command-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

When the manifest/ directory already exists from a previous failed a365 publish run, agenticUserTemplateManifest.json was not reliably included in manifest.zip, causing a server-side BadRequest: File not found in the zip archive error.

Root causes

  • Zip candidate list omitted the file: candidateNames in zip creation was ["manifest.json", "color.png", "outline.png", "logo.png", "icon.png"]agenticUserTemplateManifest.json was never explicitly listed. It relied on a fallback that enumerates leftover directory files. On macOS, Finder creates .DS_Store when the user opens the folder to edit the manifest; . sorts before a, so .DS_Store filled the 4th slot instead.

  • No recovery when file is absent: If the manifest directory existed but agenticUserTemplateManifest.json was missing (old CLI version, very early partial failure), the subsequent File.ReadAllTextAsync threw FileNotFoundException with no recovery path.

Changes

  • ManifestTemplateService — New EnsureTemplateFile(workingDirectory, fileName): extracts a single embedded resource to the directory only if the file is not already there, leaving other files (including user-customized manifest.json) untouched.

  • PublishCommand — After the "extract-if-dir-missing" block, explicitly check for agenticUserTemplateManifest.json and call EnsureTemplateFile if absent.

  • PublishCommand — Add agenticUserTemplateManifest.json as the second entry in candidateNames so it is picked up deterministically:

    // Before
    string[] candidateNames = ["manifest.json", "color.png", "outline.png", "logo.png", "icon.png"];
    
    // After
    string[] candidateNames = ["manifest.json", "agenticUserTemplateManifest.json", "color.png", "outline.png", "logo.png", "icon.png"];
  • ManifestTemplateServiceTests — 4 new unit tests covering EnsureTemplateFile (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
    • Triggering command: /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)
    • Triggering command: /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)
    • Triggering command: /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
    • Triggering command: /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

This section details on the original issue you should resolve

<issue_title>a365 publish command fails when manifest directory exists already</issue_title>
<issue_description>### Description

when the /manifest directory already exists, e.g. because the publish command failed half way, the CLI will not include the agenticUserManifestTemplate.json in the zip, and throw an error like

ERROR: Package upload failed (BadRequest). Body:
{"Error":{"Code":"BadRequest","Message":"Manifest schema is not valid. Errors: Error parsing agentic user template: File not found in the zip archive."}}

To work around that, you have to remove the manifest directory altogether, then run a365 publish again, and it works.

Expected behavior

Would be nice if the agenticUserManifestTemplate.json got consistently included in the manifest.zip to make for a smooth process of pushing the blueprint to MAC.

SDK Version

1.1.94-preview+61107da00a

Language/Runtime

.NET 8

OS

macOS 15.7.3 (24G419)

How to Reproduce

Go through all the cli steps until a365 publish, but introduce an issue that'll make this step fail, e.g. the URLs have a regex validation that fails if they don't start with https://...

See how in the initial terminal output, the manifest.zip will include the agenticUserTemplate.... but when you run a365 publish again after fixing the issue with the URL, the above error will occur

Output

No response

Screenshots

No response

Code of Conduct

Comments on the Issue (you are @copilot in this section)


💡 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.

Co-authored-by: sellakumaran <147754920+sellakumaran@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix publish command failure when manifest directory exists Fix: agenticUserTemplateManifest.json missing from zip on repeated publish runs Feb 24, 2026
Copilot AI requested a review from sellakumaran February 24, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a365 publish command fails when manifest directory exists already

2 participants