Scheduler rewrite made BaseTask.on_success/on_error dead hooks: subclass terminal bookkeeping silently no-ops #120
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/a0-symbolics#120
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Commit
0b62cccb("fix: isolate scheduler run contexts", PR #111) madeBaseTask.on_success,BaseTask.on_error(and thePlannedTaskpass-through overrides athelpers/task_scheduler.py:596-602) dead code:_execute_tasknow calls_finish_run(...)directly on all terminal paths and nothing callson_success/on_erroranymore (verified by grep acrosshelpers/,tools/,api/,extensions/,plugins/at mainbba5dcba).Consequences
on_error'slast_result=f"ERROR: {error}"/on_success'slast_result=resultformatting is now duplicated in_finish_runwith different wording ("ERROR: …"vsf"{label}: {result}"), so any external caller or subclass relying on those hooks silently no-ops.on_success/on_errorfor custom bookkeeping (documented extension points onBaseTask) are never invoked on the new terminal path — onlyon_run/on_finishstill fire._finish_run's guardedupdate_task_by_uuidcovers the main path, buton_finishcan still clobber state viaupdate_task(self.uuid, updated_at=...)without guards (benign today, fragile tomorrow).Location
helpers/task_scheduler.py:342-366(on_error/on_success— now uncalled),:596-602(PlannedTaskoverrides),:947-982(_finish_run— the actual terminal path),:1180-1195(error path calls_finish_runonly).bba5dcba; regression introduced in0b62cccb(2026-09-06).Repro
AdHocTaskwithasync def on_success(self, result): log.append(result).TaskScheduler.run_task_by_uuid.logstays empty because_execute_task→_finish_runnever touches the hook.Suggested fix
Either (a) call
current_task.on_success(result)/await current_task.on_error(...)from the corresponding terminal branches of_execute_task(and let_finish_runremain the single state writer, demoting the hook bodies to no-ops to avoid double-writes), or (b) deleteon_success/on_erroroutright and document_finish_runas the only terminal hook — but then migrate thePlannedTaskoverrides and any out-of-tree subclass guidance in the DOX.