Skip to content

Update PowerShell dev actions and namespace handlers - #2849

Merged
Hillary Mutisya (hillary-mutisya) merged 5 commits into
microsoft:mainfrom
hillary-mutisya:actionMode2_part3
Aug 13, 2026
Merged

Update PowerShell dev actions and namespace handlers#2849
Hillary Mutisya (hillary-mutisya) merged 5 commits into
microsoft:mainfrom
hillary-mutisya:actionMode2_part3

Conversation

@hillary-mutisya

Copy link
Copy Markdown
Collaborator
  • add cancellation, structured failures, bounded repair, and flow reuse
  • register and implement all PowerShell namespaces
  • require confirmation for mutating actions with unattended default-deny
  • extract namespace actions into typed handlers with a shared registry
  • add routing, persistence, concurrency, sandbox, and runtime coverage
  • update Copilot dev-action routing and project documentation

- add cancellation, structured failures, bounded repair, and flow reuse
- register and implement all PowerShell namespaces
- require confirmation for mutating actions with unattended default-deny
- extract namespace actions into typed handlers with a shared registry
- add routing, persistence, concurrency, sandbox, and runtime coverage
- update Copilot dev-action routing and project documentation

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 expands the TypeAgent PowerShell dev-action and agent surface to support cancellable, structured, policy-aware execution, with a typed registry of namespace handlers and additional routing/persistence/concurrency/sandbox coverage.

Changes:

  • Add structured PowerShell failure metadata (errorCode/retryable/mayHaveSideEffects) and bounded “repair once” flow repair support.
  • Introduce typed PowerShell namespace action handlers (files/data/archives/processes/services/system/network) with a shared registry, plus manifest/schema/grammar updates.
  • Update Copilot dev-actions hook routing for Windows-only recording, client request IDs, abort-driven cancellation, and longer hook timeout.
Show a summary per file
File Description
ts/packages/dispatcher/dispatcher/src/reasoning/reasoningProfile.ts Updates PowerShell capability guidance to include bounded repair semantics.
ts/packages/copilot-plugin/test/hookDevActions.spec.ts Extends hook tests for Windows-only behavior, abort cancellation, and unattended denial defaults.
ts/packages/copilot-plugin/src/shared/typeagent-client.ts Adjusts ClientIO interaction behavior to default-deny unattended prompts.
ts/packages/copilot-plugin/src/hooks/hook-router.ts Adds SIGINT/SIGTERM abort wiring and passes AbortSignal into dev-actions hook.
ts/packages/copilot-plugin/src/hooks/hook-dev-actions.ts Adds Windows gating, clientRequestId submission, and abort-driven cancellation handling.
ts/packages/copilot-plugin/hooks.json Increases hook timeout to accommodate longer-running dev actions.
ts/packages/agentSdk/src/action.ts Extends ActionResultError with machine-readable errorCode and retry/side-effect metadata.
ts/packages/agents/powershell/test/powerShellStore.spec.ts Validates the new repairAndExecutePowerShellFlow action appears in the schema.
ts/packages/agents/powershell/test/actionHandler.spec.ts Adds namespace registration/execution coverage, confirmation policy tests, cancellation, concurrency, and sandbox/path policy tests.
ts/packages/agents/powershell/src/types/powerShellFailure.mts Introduces structured PowerShell failure creation and execution failure classification.
ts/packages/agents/powershell/src/types/powerShellAgentContext.mts Extracts a typed PowerShellAgentContext interface.
ts/packages/agents/powershell/src/store/powerShellStore.mts Adds RepairAndExecutePowerShellFlow to generated schema/type union list.
ts/packages/agents/powershell/src/schema/scriptActions.mts Adds RepairAndExecutePowerShellFlow type to the PowerShell action schema.
ts/packages/agents/powershell/src/namespaces/system/actionHandler.mts Adds static system namespace handler definitions.
ts/packages/agents/powershell/src/namespaces/services/actionHandler.mts Adds static services namespace handler definitions (with confirmation prompts for mutations).
ts/packages/agents/powershell/src/namespaces/processes/actionHandler.mts Adds static processes namespace handler definitions (with confirmation prompts for mutations).
ts/packages/agents/powershell/src/namespaces/network/actionHandler.mts Adds static network namespace handler definitions.
ts/packages/agents/powershell/src/namespaces/namespaceActionHandler.mts Adds shared handler implementation (sandboxing, confirmation, abort-aware execution).
ts/packages/agents/powershell/src/namespaces/files/filesSchema.agr Refines file grammar patterns (read/show/display variants).
ts/packages/agents/powershell/src/namespaces/files/actionHandler.mts Adds static file namespace handler definitions (with confirmation prompts for mutations).
ts/packages/agents/powershell/src/namespaces/data/dataSchema.agr Refines data grammar patterns for JSON display/read behaviors.
ts/packages/agents/powershell/src/namespaces/data/actionHandler.mts Adds static data namespace handler definitions (with confirmation prompts for mutations).
ts/packages/agents/powershell/src/namespaces/archives/actionHandler.mts Adds static archives namespace handler definitions (with confirmation prompts for mutations).
ts/packages/agents/powershell/src/namespaces/actionHandlerRegistry.mts Adds registry/execution routing for namespace handlers and registration introspection helpers.
ts/packages/agents/powershell/src/manifest.json Registers PowerShell sub-action manifests for additional namespaces.
ts/packages/agents/powershell/src/execution/powershellRunner.mts Adds AbortSignal support and explicit cancellation reporting in ScriptExecutionResult.
ts/packages/agents/powershell/src/actionHandler.mts Refactors PowerShell action handling for namespace routing, flow reuse/locking, repair-once, and abort-aware execution.
ts/packages/agents/powershell/scripts/scriptHost.ps1 Hardens allowed-path expansion and prefix checks to avoid sibling-path bypasses.
ts/packages/agents/powershell/benchmark/scenarios/dev-actions-routing.json Updates routing scenario expectations to include namespace schema identifiers.

Review details

Tip

Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (3)

ts/packages/agentSdk/src/action.ts:48

  • Repo convention (ts/CLAUDE.md) asks to avoid em-dashes (—) in comments. Replace the em-dash in this comment with a hyphen to match the style used elsewhere in the file.
    // Rich display to show in place of the plain `error` text (e.g. setup
    // instructions with a config snippet, which need markdown to survive
    // rendering). Optional — clients fall back to `error` when absent.
    errorDisplayContent?: DisplayContent | undefined;

ts/packages/agents/powershell/src/actionHandler.mts:1056

  • This overrides fallbackToReasoning to true for all failures, including powershell.policyDenied, powershell.cancelled, and powershell.partialSideEffects. That defeats the structured failure classification from createPowerShellExecutionFailure and can cause the reasoning loop to treat denied/cancelled actions as retryable.

This issue also appears on line 1196 of the same file.

            if (result.error !== undefined) {
                return { ...result, fallbackToReasoning: true };
            }

ts/packages/agents/powershell/src/actionHandler.mts:1198

  • Same as above: forcing fallbackToReasoning: true on any error masks policyDenied/cancelled/partialSideEffects failures that should not fall back to reasoning or auto-repair.
            if (result.error !== undefined) {
                return { ...result, fallbackToReasoning: true };
            }
  • Files reviewed: 29/29 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread ts/packages/agents/powershell/test/actionHandler.spec.ts Outdated
Comment thread ts/packages/copilot-plugin/src/shared/typeagent-client.ts
Comment thread ts/packages/copilot-plugin/src/hooks/hook-dev-actions.ts
Comment thread ts/packages/agents/powershell/scripts/scriptHost.ps1 Outdated
Comment thread ts/packages/agents/powershell/scripts/scriptHost.ps1 Outdated
Comment thread ts/packages/agents/powershell/src/actionHandler.mts Outdated
Comment thread ts/packages/agents/powershell/src/actionHandler.mts

@GeorgeNgMsft George Ng (GeorgeNgMsft) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left a few comments, I think two are optional, but the potential sandbox gap is worth addressing.

-  Add an executable parameter role, resolve bare executable names through PowerShell command resolution, canonicalize the resolved file, and enforce `allowedPaths`.
- Remove string-shape path inference and validate only parameters explicitly declared as paths.
- Split execution, persistence, activation, and usage accounting into distinct failure boundaries. Return `partialSideEffects` when execution succeeded but core completion failed.
Merged via the queue into microsoft:main with commit bf90702 Aug 13, 2026
32 of 33 checks passed
@hillary-mutisya
Hillary Mutisya (hillary-mutisya) deleted the actionMode2_part3 branch August 13, 2026 17:54
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.

4 participants