Skip to content

_background_cleanup silently drops callbacks when config=None #246

@FernandoCelmer

Description

@FernandoCelmer

Description

In Manager.__init__ (core/workflow.py, lines 155-163), the background cleanup thread is only started when self.config is truthy (elif self.config:). When no config is provided (config=None), the _background_cleanup function is never executed.

This means _callback_workflow is never called, and on_success/on_failure callbacks are silently dropped in background mode without config.

Location

dotflow/core/workflow.py — lines 155-163

Current Behavior

if mode != TypeExecution.BACKGROUND:
    self._callback_workflow(tasks=self.tasks)
elif self.config:
    def _background_cleanup():
        self.thread.join()
        self._callback_workflow(tasks=self.tasks)
    threading.Thread(target=_background_cleanup, daemon=True).start()

When config=None, neither branch fires _callback_workflow for background mode.

Expected Behavior

if mode != TypeExecution.BACKGROUND:
    self._callback_workflow(tasks=self.tasks)
else:
    def _background_cleanup():
        self.thread.join()
        self._callback_workflow(tasks=self.tasks)
    threading.Thread(target=_background_cleanup, daemon=True).start()

Always run _background_cleanup for background mode, regardless of config.

Impact

  • Severity: Critical
  • Symptom: on_success/on_failure callbacks silently never execute in background mode without config
  • Tracer, metrics, and server finalization hooks are also skipped

Priority

Critical

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersin progressFix merged to develop, pending release to master

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions