Skip to content

Python: Use pass instead of ... for empty class bodies and methods in workflows#4264

Open
Copilot wants to merge 5 commits intomainfrom
copilot/update-empty-class-methods
Open

Python: Use pass instead of ... for empty class bodies and methods in workflows#4264
Copilot wants to merge 5 commits intomainfrom
copilot/update-empty-class-methods

Conversation

Copy link
Contributor

Copilot AI commented Feb 25, 2026

Motivation and Context

Style consistency: replace ... with pass for empty method bodies across the workflow and orchestrations packages, using raise NotImplementedError for abstract methods and preserving ... only where idiomatically required (e.g., @overload stubs and default argument sentinels).

Description

  • packages/core/agent_framework/_workflows

    • _executor.py: on_checkpoint_restore concrete no-op default hook uses pass
    • _checkpoint.py: All 6 CheckpointStorage Protocol method stubs use pass
    • _runner_context.py: All 19 RunnerContext Protocol method stubs use pass
    • _agent.py: No changes — only @overload stubs and = ... default argument sentinels, which are idiomatic and left unchanged
  • packages/orchestrations

    • _magentic.py: 4 @abstractmethod stubs in MagenticManagerBase use raise NotImplementedError (explicit and type-checker safe)

@overload stubs and ... used as default argument sentinels are left unchanged — those are idiomatic/intentional.

Concrete no-op hook (pass):

async def on_checkpoint_restore(self, state: dict[str, Any]) -> None:
    """Hook called when the workflow is restored from a checkpoint."""
    pass

Protocol method stub (pass):

async def save(self, checkpoint: WorkflowCheckpoint) -> CheckpointID:
    """Save a checkpoint and return its ID."""
    pass

Abstract method (raise NotImplementedError):

@abstractmethod
async def plan(self, magentic_context: MagenticContext) -> Message:
    """Create a plan for the task."""
    raise NotImplementedError

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? No.
Original prompt

This section details on the original issue you should resolve

<issue_title>Python: Use pass instead of ... for empty class bodies and methods in workflows</issue_title>
<issue_description>## Summary

Style consistency: use pass instead of ... for empty class and method bodies.

Scope

  • packages/core/agent_framework/_workflows
  • packages/orchestrations

Action Items

One commit per package:

  • packages/core/agent_framework/_workflows
  • packages/orchestrations</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…package

Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
Copilot AI changed the title [WIP] Use pass instead of ... for empty class bodies and methods Python: Use pass instead of ... for empty class bodies and methods in workflows Feb 25, 2026
@TaoChenOSU TaoChenOSU added python workflows Related to Workflows in agent-framework labels Feb 25, 2026
@TaoChenOSU TaoChenOSU moved this to In Progress in Agent Framework Feb 25, 2026
@TaoChenOSU TaoChenOSU marked this pull request as ready for review February 25, 2026 21:47
Copilot AI review requested due to automatic review settings February 25, 2026 21:47
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 aims to standardize placeholder implementations in the Python workflow/orchestration code by replacing ... with pass in empty method bodies, primarily within workflow-related interfaces and abstract classes.

Changes:

  • Replaced ... with pass in workflow executor no-op hook (Executor.on_checkpoint_restore).
  • Replaced ... with pass in workflow Protocol interface method stubs (CheckpointStorage, RunnerContext).
  • Replaced ... with pass in abstract method stubs for the Magentic orchestration manager base.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
python/packages/orchestrations/agent_framework_orchestrations/_magentic.py Updates abstract method placeholders in MagenticManagerBase to use pass.
python/packages/core/agent_framework/_workflows/_runner_context.py Updates RunnerContext Protocol method stubs to use pass.
python/packages/core/agent_framework/_workflows/_executor.py Updates default Executor.on_checkpoint_restore hook to use pass.
python/packages/core/agent_framework/_workflows/_checkpoint.py Updates CheckpointStorage Protocol method stubs to use pass.

…r abstract methods in magentic

Co-authored-by: TaoChenOSU <12570346+TaoChenOSU@users.noreply.github.com>
@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/_workflows
   _executor.py1771293%210, 334, 336, 345, 365, 368, 475, 480, 490, 649, 730–731
packages/orchestrations/agent_framework_orchestrations
   _magentic.py58910083%63–72, 77, 81–92, 257, 268, 272, 292, 353, 362, 364, 406, 423, 432–433, 435–437, 439, 450, 477, 482, 487, 492, 592, 594, 634, 682, 718–720, 722, 730–733, 737–740, 801–804, 895, 901, 907, 949, 987, 1019, 1036, 1047, 1102–1103, 1107–1109, 1133, 1157–1158, 1171, 1187, 1209, 1257–1258, 1296–1297, 1460, 1463, 1472, 1475, 1480, 1531–1532, 1573–1574, 1622, 1652, 1710, 1724, 1735
TOTAL22150276387% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4668 247 💤 0 ❌ 0 🔥 1m 19s ⏱️

@moonbox3
Copy link
Contributor

@copilot I still see ... used instead of pass in the following:

  • /_workflows/_agent.py
  • /_workflows/_runner_context.py
  • /_workflows/_checkpoint.py

…rotocol stubs

Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 26, 2026

@copilot I still see ... used instead of pass in the following:

  • /_workflows/_agent.py
    ...

Done in commit 75114e3_checkpoint.py and _runner_context.py Protocol stubs now use pass.

For _agent.py, the remaining ... usages are all @overload stubs and a = ... default argument sentinel — those are idiomatic Python and not empty method bodies, so they're left unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python workflows Related to Workflows in agent-framework

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Python: Use pass instead of ... for empty class bodies and methods in workflows

5 participants