fix(kanban): stop workers after lifecycle handoff - #85408
Conversation
|
@kshitijk4poor Ready for maintainer review when convenient. GitHub is holding the first-time-contributor CI runs for approval. The focused Kanban suite passed locally (396 passed, 2 skipped), the lifecycle/receipt suite passed (40 passed, 1 skipped), and the exact head is e8ffec8. |
|
Focused independent validation on the PR HEAD ( I also checked the handoff ordering: the lifecycle calls are sequential barriers, the successful result is durably flushed before later segments are cancelled, and the conversation loop exits before another model turn. I did not find a counterexample in that scoped contract. This is not yet a current-main validation: the branch has a real content conflict in |
|
I found and reproduced two ownership races that are not covered by the current 284-test suite:
I prepared a narrow extension on top of the author's exact HEAD, preserving the original commit and targeting the author's branch: ataraxiaone#1 The extension captures the guarded run before transition, requires exact dispatcher task+run equality before latching, and revalidates/clears the latch at both consumption points. Added deterministic regressions cover wrong-task, wrong-run, missing-run, post-commit successor, stale-latch successor, and effective-runtime-vs-requested-config provenance. Validation: focused suite |
fix(kanban): stop workers after lifecycle handoff Good, well-tested design: trusted runtime identity stamped over model-supplied metadata, the latch + cancelled-result plumbing across segments, and the dispatcher-owned context gate.
|
What does this PR do?
Stops a Kanban worker immediately after it successfully hands custody off through
complete,block,request-review, orrequest-changes, and binds the actual runtime provider/model/API mode/session to the corresponding durable run receipt.This closes two concrete failure modes observed in a bounded native-Kanban campaign:
The lifecycle latch is deliberately narrow: it requires both a real
HERMES_KANBAN_TASKand a dispatcher-owned worker context. Ordinary orchestrators, delegated children, inherited cron contexts, and failed lifecycle calls do not stop.Related Issue
Related to #82591. This is a bounded lifecycle/receipt hardening slice, not closure of that epic.
Type of Change
Changes Made
How to Test
scripts/run_tests.sh $(python3 -c 'import glob; print(" ".join(sorted(glob.glob("tests/**/*kanban*.py", recursive=True))))')scripts/run_tests.sh tests/run_agent/test_run_agent.py::TestConcurrentToolExecution::test_invoke_tool_dispatches_to_handle_function_call tests/tools/test_kanban_runtime_receipts.py tests/run_agent/test_tool_batch_segmentation.pypython3 -m compileall -q agent hermes_cli model_tools.py tools/kanban_tools.pyuv run --with ruff ruff check agent/agent_init.py agent/agent_runtime_helpers.py agent/conversation_loop.py agent/tool_executor.py hermes_cli/kanban_db.py model_tools.py tools/kanban_tools.py tests/run_agent/test_run_agent.py tests/run_agent/test_tool_batch_segmentation.py tests/tools/test_kanban_runtime_receipts.pygit diff --check origin/main...HEADLocal results on macOS 15.7.8 / Python 3.11.15:
Checklist
Code
Documentation & Housekeeping
cli-config.yaml.exampleupdate is N/A; no config keys changedCONTRIBUTING.md/AGENTS.mdupdate is N/AScreenshots / Logs
No UI change. The PR is covered by canonical tests and an independently reviewed live-campaign evidence packet. No credentials, external source-system writes, or production mutations are part of this patch.