Skip to content

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

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

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
@gwharris7 gwharris7 marked this pull request as ready for review March 4, 2026 08:02
@gwharris7 gwharris7 requested review from a team as code owners March 4, 2026 08:02
Copilot AI review requested due to automatic review settings March 4, 2026 08:02
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json as an explicit second entry in candidateNames in PublishCommand, guaranteeing it is always included in the zip regardless of other files present in the directory.
  • Added a new EnsureTemplateFile(workingDirectory, fileName) method to ManifestTemplateService that 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 EnsureTemplateFile covering: file already exists (no overwrite), file extracted when missing, extracted file is valid JSON, and invalid resource name returns false.

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

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

4 participants