Skip to content

D-43840 Support abort signal in container python plugin - #23

Merged
balaji-digital-ai merged 3 commits into
mainfrom
D-43840
Oct 28, 2026
Merged

balaji-digital-ai merged 3 commits into
mainfrom
D-43840

Conversation

@tgreblicki-notch

@tgreblicki-notch tgreblicki-notch commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Adds support for abort signal in python sdk.
It also add worker thread for task execution to enable abort of blocking task executions.

https://www7.v1host.com/V1Production/defect.mvc/Summary?oidToken=Defect%3A3648730

Testing

Container and non container plugins should be tested.

  • Task execution works
  • Results are properly reported back to xlr
  • Tasks can be aborted
  • If plugin exits system main thread should preserve exit code

support SIGABRT for aborting tasks, update unit tests and docs
@upwind-code-us

upwind-code-us Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Upwind Upwind Code Scan - ⚠️ Warn

5 newly introduced vulnerabilities · 0 resolved · 5 total in this PR vs main

Total breakdown: 🔶 2 High | 🟡 3 Medium


🔶 High · 2 findings
CVE Package Version Fix
CVE-2026-97689 urllib3 2.7.0 2.8.0
CVE-2026-97687 urllib3 2.7.0 2.8.0

🟡 Medium · 3 findings
CVE Package Version Fix
CVE-2026-49264 oauthlib 3.3.1 4.0.0
CVE-2026-49265 oauthlib 3.3.1 4.0.0
CVE-2026-97688 urllib3 2.7.0 2.8.0

View full analysis in Upwind Console

Scan completed in 15s

Scan history (1 scan)
Commit Scanned at New Resolved Net
458c4f3 < 2026-10-06 14:21 UTC +5 0 +5

Last scanned: 458c4f3 · 2026-10-06 14:21 UTC

@upwind-code-us

upwind-code-us Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Upwind Upwind IaC Scan - ✅ Passed

0 misconfigurations detected

No default-branch baseline yet — showing all findings.

View full analysis in Upwind Console →

Scan completed in 2s

Scan history (1 scan)
Commit Scanned at New Resolved Net
458c4f3 < 2026-10-06 14:21 UTC 0 0 0

Last scanned: 458c4f3 · 2026-10-06 14:21 UTC

@upwind-code-us

upwind-code-us Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Upwind Upwind Secrets Scan

✅ No secrets found in this repository

Scan completed in 2s.


Scan history (2 scans)
Commit Scanned at New Resolved Net
458c4f3 2026-10-06 14:21 UTC +2 0 +2
eeb9d3b < 2026-10-26 16:01 UTC 0 0 0

Last scanned: eeb9d3b · 2026-10-26 16:01 UTC

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Signal/reporting races and worker-thread exit semantics can prevent reliable abort completion or produce incorrect results.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)
What changed in this PR

Adds abort-signal support and worker-thread task execution to the Python integration SDK.

Changes:

  • Adds cooperative abort state and updated abort semantics.
  • Handles SIGABRT/SIGTERM while tasks run in worker threads.
  • Adds documentation and abort-focused tests.
File Description
digitalai/​release/​integration/​base_task.py Adds abort state and context initialization.
digitalai/​release/​integration/​wrapper.py Adds threaded execution, signal handling, and guarded reporting.
tests/​release/​integration/​test_base_task.py Tests new abort behavior.
tests/​release/​integration/​test_wrapper_abort.py Tests signal and threading behavior.
tests/​release/​integration/​blocking_task.py Provides the blocking-task fixture.
docs/​examples.md Documents cooperative cancellation.
docs/​classes/​base_task.md Updates the BaseTask API reference.

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

Comment on lines +260 to +263
# Give the task time to enter its blocking sleep(30) call.
time.sleep(1.0)
start = time.monotonic()
proc.send_signal(signal.SIGABRT)

Copilot AI 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.

🟡 Changes recommended

Abort handling can interrupt result persistence, fail to terminate after reporting errors, or report success for supported abort-hook overrides.

2 open issues
2 previously missed issues

In code that hasn't changed since last review

Medium severity Set aborted status for AbortException overrides

digitalai/​release/​integration/​wrapper.py:137

An overridden abort() that raises AbortException directly can report success because this handler leaves the output context at its default exit code of 0. This override is explicitly supported by docs/classes/base_task.md:110, but this branch does not apply the aborted status used by BaseTask.execute_task(). Set exit code 1 and "Abort requested" here before reporting.

Medium severity Force exit even when abort reporting fails

digitalai/​release/​integration/​wrapper.py:148

If reporting raises, for example when update_output_context() serializes a nested output value that is not JSON-serializable, the handler never reaches os._exit(1). In daemon mode, run() catches the exception and starts its watcher in finally, leaving the process running despite the abort. Log reporting failures and put the forced exit in a finally block so a reporting exception cannot prevent termination.

2 resolved since last review

Review effort: Balanced

with _report_lock:
if _result_reported:
return False
_result_reported = True
@balaji-digital-ai
balaji-digital-ai merged commit 75990ee into main Oct 28, 2026
5 checks passed
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