Repository navigation
fix: honor workflow --cwd over sticky parent -C - #10763
Conversation
Parent -C/--cwd was sticky across workflow re-entry, so nested project authoring ignored step --cwd and split azure.yaml under azd -C. Fixes #10670
|
Azure Pipelines: Successfully started running 3 pipeline(s). 24 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
There was a problem hiding this comment.
🟡 Changes recommended
The new working-directory override is not restored when pre-run or run execution fails, allowing later workflow and error handling to use the wrong project root; the error path needs a fix and regression test.
1 open issue
What changed in this PR
This pull request fixes workflow re-entry so an explicit step-level --cwd overrides a sticky parent -C/--cwd, keeping nested agent scaffolding and project files in the intended directory.
Changes:
- Excludes
cwdfrom propagated workflow global arguments. - Applies step-level working-directory overrides and restores the parent value.
- Adds regression coverage for override behavior and argument extraction.
- Clarifies nested scaffolding behavior in the agents extension.
A correctness issue remains: failed workflow steps can bypass PersistentPostRunE, leaving the overridden working-directory state unrecovered.
This pull request requires changes.
| File | Summary |
|---|---|
cli/azd/extensions/azure.ai.agents/internal/cmd/init.go |
Clarifies why positional targets are preferred for nested scaffolding. |
cli/azd/cmd/root.go |
Applies step-level cwd values and restores the parent state. |
cli/azd/cmd/root_test.go |
Tests step --cwd precedence and parent restoration. |
cli/azd/cmd/container.go |
Omits the parent cwd from workflow global arguments. |
cli/azd/cmd/container_test.go |
Verifies that extracted workflow arguments exclude cwd. |
Review effort: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
The PR number and complete review history are unavailable, so the mandatory extension user-contract pass cannot verify prior threads or the approved experiences-spec status.
No open issues 🎉
1 resolved since last review
Review effort: Lite
There was a problem hiding this comment.
🟡 Changes recommended
Two critical issues remain: the fallback global options are not registered for dependency injection, and the test setup cannot reach the intended restore-error path because the parent directory is not removable.
2 open issues
Review effort: Lite
azure.ai.agents PR buildNote This is an unsigned development build. Install it only if you trust this PR. Install the extension: azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/10763/azure-ai-agents.zip"
|
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Victor Vazquez (vhvb1989)
left a comment
There was a problem hiding this comment.
Reviewed the cwd precedence fix against the historical init directory semantics. Step-level -C/--cwd correctly takes precedence over the parent selection, while existing init folder-creation behavior remains unchanged.


Summary
azd -C <dir> ai agent initcould scaffold the agent under a nested folder while nested project authoring stayed in the parent-Cdirectory. That splitazure.yamland failed withservice not found.Root cause: the parent
-C/--cwdstayed sticky on workflow re-entry.extractGlobalArgsalso re-appended the parent cwd after a step's--cwd, andPersistentPreRunEused the pre-parsedGlobalCommandOptionsvalue instead of the step flag.Changes
cwdfrom workflowextractGlobalArgs, matching the existingenvironmentexclusion.--cwdthat differs from the sticky parent value, use it for that step and restore the parent value afterward.Fixes #10670
E2E
TestRootCmd_WorkflowStepCwdOverridesStickyParentTest_workflowCmdAdapter_ContextPropagation/ExtractGlobalArgsOmitsCwd--cwdomitted from globalArgsTestRootCmd_CwdRelativePathResolvedToAbsolute/ absolute