Skip to content

SessionsJobHandler: every successfully processed job logs two "no handler" WARNINGs #116

Open

Description

@mc-ccaa

Problem

Every job that a SessionsJobHandler subclass processes successfully logs two WARNINGs saying it wasn't handled:

WARNING blueprint.agents.handler.handler_chain - No handler processed event 'sessions.job.created.probe_job'
WARNING blueprint.agents.io.api.eventing.sessions_bus - No handler found for job type probe_job (job_id=…)

The job did complete. In a local run with 120 jobs, the agent logged 200 of these WARNINGs for 100 completed jobs. They hide the real case these messages exist for, an agent that has no handler for a job type it receives.

Cause

  • SessionsJobHandler.handle_event handles the whole job lifecycle itself (start, complete or fail), then returns None (src/blueprint/agents/handler/sessions_job_handler.py, end of handle_event).
  • HandlerChain._dispatch reads None as "pass to the next handler". When no handler returns a result, it logs No handler processed event and returns None.
  • SessionsBus._process_job_notification gets a result with status no_handler_found and logs No handler found for job type.

This has been the behaviour since SessionsJobHandler was added (#19), so every agent built on it is affected.

Fix

handle_event should return a result that says "handled" instead of None on every terminal path: completed, failed and cancelled. The handler also publishes nothing, because the job result goes to the sessions service. HandlerResult.skipped or a dedicated "handled, nothing to publish" result fits that.

Check this against #115. It reworks what happens to a handler's result when no publishing service exists (event_bus = "sessions", #40), and a non-None result from this handler takes exactly that path.

Acceptance criteria

  • A job completed, failed or cancelled by a SessionsJobHandler logs neither WARNING.
  • A job type with no matching handler still logs both.
  • A job left pending for redelivery (RetryableHandlerError) keeps its current behaviour.
  • Tests pin each case.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions