Skip to content

Unify asynchronous PowerShell cmdlet lifecycle - #413

Merged
PrzemyslawKlys merged 24 commits into
v2-speedygonzalesfrom
codex/canonical-async-pscmdlet
Jul 26, 2026
Merged

Unify asynchronous PowerShell cmdlet lifecycle#413
PrzemyslawKlys merged 24 commits into
v2-speedygonzalesfrom
codex/canonical-async-pscmdlet

Conversation

@PrzemyslawKlys

@PrzemyslawKlys PrzemyslawKlys commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary - synchronize the repo-local AsyncPSCmdlet with the canonical implementation in EvotecIT/PSPublishModule#630 - start asynchronous hooks on the PowerShell pipeline thread and marshal post-await output, prompts, and errors back to it - add safe terminating errors, ShouldContinue, credential prompts, cancellation, scheduler/context isolation, and extensible disposal - keep the source copy local to this repository; no runtime or package dependency is introduced - preserve repository-specific helpers and extension points where present ## Compatibility Cmdlet names and parameters are unchanged. Asynchronous hooks must remain async end to end and must not block with Task.Wait, Task.Result, or Task.WaitAll. ## Verification PSParseHTML.PowerShell Release build on .NET Framework and .NET 8; HtmlTinkerX validation and failure-evidence helpers remain intact. ## Review follow-through The synchronized source now includes nullable typed prompt replies, complete interaction overloads, late-callback rejection, cancellation-on-dispose, immediate pump-failure propagation, and correct separation of pipeline-stop versus operation-local cancellation while retaining browser validation and failure-evidence helpers.

Final async lifecycle semantics

Synchronous PowerShell calls restore the host synchronization context before queued work is drained or the base API is invoked. Queue admission and hook completion are serialized, preserving records admitted before completion while rejecting stale producers afterward. Reentrant drains preserve FIFO order, including context-free captured callbacks made while a lazy queued item is actively being pumped.

Hook completion wakes the pump immediately. Direct downstream stops cancel work already started with the cmdlet token, cancellation-source disposal waits until cancellation callbacks return, and derived synchronous EndProcessing overrides can continue interacting with the pipeline after calling the base implementation. Pipeline-thread ownership uses volatile publication, captured callbacks drop cleanly after stop, and progress snapshots retain optional runtime Total values.

Queued host interactions now atomically arbitrate cancellation against the pipeline claim: canceled unclaimed requests never enter the host, while a claimed prompt keeps its reply observed. Completed and failing synchronous hooks drain all causally reentrant records, and a synchronous pipeline stop cancels the shared token before rethrow.

PSPublishModule remains the canonical source owner. Consumer repositories retain namespace-adjusted local source copies and their repository-specific interfaces, helpers, formatting, and split-file conventions without adding a runtime package dependency.

Final validation

PSParseHTML.PowerShell Release build passed at the exact head.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52036f7b70

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.cs Outdated
Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.cs Outdated
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0.68966% with 864 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.16%. Comparing base (075e717) to head (f64a397).
⚠️ Report is 3 commits behind head on v2-speedygonzales.

Files with missing lines Patch % Lines
...arseHTML.PowerShell/Communication/AsyncPSCmdlet.cs 1.72% 342 Missing ⚠️
...PowerShell/Communication/AsyncPSCmdlet.Pipeline.cs 0.00% 237 Missing ⚠️
...owerShell/Communication/AsyncPSCmdlet.Execution.cs 0.00% 164 Missing ⚠️
...rces/PSParseHTML.PowerShell/CmdletOptimizeEmail.cs 0.00% 80 Missing ⚠️
...erShell/Communication/AsyncPSCmdlet.HtmlBrowser.cs 0.00% 32 Missing ⚠️
...werShell/Communication/InternalLoggerPowerShell.cs 0.00% 9 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##           v2-speedygonzales     #413      +/-   ##
=====================================================
- Coverage              52.57%   51.16%   -1.41%     
=====================================================
  Files                    414      417       +3     
  Lines                  29943    30699     +756     
  Branches                6025     6133     +108     
=====================================================
- Hits                   15742    15708      -34     
- Misses                 12558    13361     +803     
+ Partials                1643     1630      -13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2edb4578a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.cs Outdated
Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.cs Outdated
Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 567f8d7a56

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4ad724cd7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dde9f51747

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.Pipeline.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb05f98c1f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2bad031d1d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.Pipeline.cs Outdated
Comment thread Sources/PSParseHTML.PowerShell/Communication/AsyncPSCmdlet.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd7887a7c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/PSParseHTML.PowerShell/CmdletOptimizeEmail.cs Outdated
Comment thread Sources/PSParseHTML.PowerShell/CmdletOptimizeEmail.cs Outdated
@PrzemyslawKlys
PrzemyslawKlys merged commit 17c6004 into v2-speedygonzales Jul 26, 2026
15 of 17 checks passed
@PrzemyslawKlys
PrzemyslawKlys deleted the codex/canonical-async-pscmdlet branch July 26, 2026 10:00
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.

1 participant