feat(cancel): STOP-status task cancellation + relaunch-hole close (ORCH-090) #101
Reference in New Issue
Block a user
Delete Branch "feature/ORCH-090-stop-plane"
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?
ORCH-090 — Механизм отмены задачи: Plane-статус STOP (остановка + полный сброс)
Реализует ТЗ по
docs/work-items/ORCH-090/06-adr/ADR-001-stop-cancel-task.md(+ сквознойadr-0026).Что сделано
stop, fail-closed, нет в_DEFAULT_STATES) →handle_stop→stage_engine.cancel_task.launcher.stop_process, вынесен из_watchdog),cancel_jobs_for_task(терминальныйcancelled),remove_worktree+gitea.delete_remote_branch(никогдаmain, без force-push), durablestage='cancelled'+ тумбстон ключей#cancelled-<id>. Docs сохраняются.cancel.in_critical_windowfail-CLOSED,cancel_requested_at), применяется детерминированнымrun_deploy_finalizer.main/прод не трогаются.{done}→{done, cancelled}вserial_gate/task_deps/stages-сток + reaper/worker requeue-гарды.STAGE_TRANSITIONSexit-гейты /QG_CHECKS/check_*— без изменений.handle_status_startограничен стадиейanalysis; запуск пайплайна — только «To Analyse».stop_status_enabled(kill-switch) /stop_status_repos. БлокstopвGET /queue. Аддитивные колонкиcancelled_at/cancel_requested_at.Заметное уточнение ADR (для ревью)
ADR-001 D4 предлагал сохранить
plane_issue_idнетронутым, ноget_task_by_plane_id/create_task_atomicматчат поplane_id OR plane_issue_id— нетумбстоненныйplane_issue_idзаблокировал бы clean-slate re-create (BR-3/TR-4). Поэтомуplane_issue_idтоже тумбстонится; исходный UUID парсится из суффикса для аудита. Зафиксировано в коде/README/CLAUDE.Инфра-предусловие
Создать статус STOP с группой
cancelledна доске Plane проекта ORCH (его отсутствие = fail-safe no-op).Тесты
tests/test_stop_status.py(TC-01..TC-14 + D7, 26 кейсов; сигналы/git/gitea замоканы). Обновлены анти-регресс-тесты STAGE_TRANSITIONS 5 прошлых задач (терминал-стокcancelled). Полный регрессpytest tests/зелёный (1345 passed). Документация (architecture README / CLAUDE / README / .env.example / CHANGELOG) — в этом же PR.Refs: ORCH-090
🤖 Generated with Claude Code
Introduce the dedicated Plane STOP status as a single declarative task-cancel mechanism: stop the active agent (graceful SIGTERM cascade), cancel all jobs (terminal `cancelled`, never requeued), remove the worktree + delete the remote feature branch (never main, never force-push), drive the task to the new system-terminal state `cancelled` and tombstone the natural keys so a later "To Analyse" re-creates it from scratch (docs artefacts preserved). STOP during a critical merge/deploy window is deferred until the irreversible step finishes honestly. Also closes the relaunch hole: handle_status_start relaunch is gated to the `analysis` stage; the only pipeline-start entry point remains "To Analyse". Cross-cutting (adr-0026): the "task terminal" predicate is widened {done} -> {done, cancelled} in serial_gate / task_deps / stages sink + reaper/worker requeue guards. STAGE_TRANSITIONS exit-gates / QG_CHECKS / check_* are unchanged (`cancelled` is a sink, not a new edge). Additive, never-raise, restart-safe, under kill-switch ORCH_STOP_STATUS_ENABLED (off -> zero regression). New: src/cancel.py (leaf), src/gitea.py (delete_remote_branch), tasks columns cancelled_at/cancel_requested_at, jobs status `cancelled`, GET /queue `stop` block. Tests: tests/test_stop_status.py (TC-01..TC-14 + D7); full suite green (1345). Docs updated in-PR (architecture README, CLAUDE.md, README.md, .env.example, CHANGELOG). ADR-001 D4 refinement: plane_issue_id is tombstoned too (the lookup ORs on it) — original UUID recoverable from the parseable suffix. Refs: ORCH-090 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>6fc70ce435to5ca9b8fd62