A dream consolidates an entire (observer, observed) collection, not a
single session — its payload.session_name is a config/context hint set to
the session of the most recent explicit document (see
DreamScheduler._execute_dream). Dream queue items therefore carry
session_id=None and a work_unit_key with no session component, so neither
delete in delete_session reaches them.
That left pending dreams pointing at a deleted session, where run_dream's
config resolution raises ResourceNotFoundException and the task errors out
for no good reason. Strip the stale hint instead of dropping the dream, so
it runs workspace-scoped — a state the orchestrator already supports (the
manual dream route enqueues it whenever session_id is omitted).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>