fix: pipeline-start bugs (ET-006) — fetch description on status-start + work_item_id collision guard #11

Merged
admin merged 3 commits from fix/pipeline-start-bugs into main 2026-06-03 21:14:45 +03:00
Owner

Fixes 2 pipeline-start bugs surfaced by the ET-006 live run.

BUG 1 — issue.updated without description -> QG-0 blocked

Plane issue.updated (status change) ships only changed fields; description was empty -> QG-0 wrongly blocked. start_pipeline now pulls the full description from the Plane issue detail API (reusing fetch_issue_sequence_ids GET endpoint + shared token) when the payload field is empty/short. Empty API -> honest QG-0 fail.
Files: src/plane_sync.py (new fetch_issue_description), src/webhooks/plane.py start_pipeline.

BUG 2 — work_item_id collision + worktree desync

2a: ensure_unique_work_item_id() guard LAYERED ON TOP of M-6 derive (derive untouched) — bumps to next free id if the derived ET-NNN is already in tasks. src/db.py + start_pipeline.
2b (defense-in-depth): if the branch is already owned by another task, disambiguate with the unique work_item_id+plane id so two tasks never share a worktree.

Tests

5 new tests in tests/test_pipeline_start_bugs.py. Suite: 195 passed (190 baseline + 5 new), 9 pre-existing failures unchanged.

Do NOT merge — merge after live verification + live run #6.

Fixes 2 pipeline-start bugs surfaced by the ET-006 live run. ## BUG 1 — issue.updated without description -> QG-0 blocked Plane issue.updated (status change) ships only changed fields; description was empty -> QG-0 wrongly blocked. start_pipeline now pulls the full description from the Plane issue detail API (reusing fetch_issue_sequence_ids GET endpoint + shared token) when the payload field is empty/short. Empty API -> honest QG-0 fail. Files: src/plane_sync.py (new fetch_issue_description), src/webhooks/plane.py start_pipeline. ## BUG 2 — work_item_id collision + worktree desync 2a: ensure_unique_work_item_id() guard LAYERED ON TOP of M-6 derive (derive untouched) — bumps to next free id if the derived ET-NNN is already in tasks. src/db.py + start_pipeline. 2b (defense-in-depth): if the branch is already owned by another task, disambiguate with the unique work_item_id+plane id so two tasks never share a worktree. ## Tests 5 new tests in tests/test_pipeline_start_bugs.py. Suite: 195 passed (190 baseline + 5 new), 9 pre-existing failures unchanged. Do NOT merge — merge after live verification + live run #6.
admin added 3 commits 2026-06-03 21:13:27 +03:00
Plane issue.updated (status -> In Progress) ships only changed fields, so the
webhook payload has no description and QG-0 wrongly blocked issues. start_pipeline
now pulls the full description from the Plane issue detail API (reusing the same
GET endpoint + shared token as fetch_issue_sequence_id) when the payload field is
empty/short, before QG-0 runs. Empty API -> honest QG-0 fail (truly empty ticket).
ET-006 was handed to two different tasks because M-6 derives work_item_id from
the Plane sequence_id, which can collide -> the two tasks shared a branch/worktree
slug prefix and stepped on each other.

2a: ensure_unique_work_item_id() is a uniqueness-guard LAYERED ON TOP of the M-6
derive (derive is untouched): if the derived ET-NNN already exists in tasks for
the repo, it walks forward to the next free number. Applied in start_pipeline
after the derive.

2b (defense-in-depth): worktree is keyed by branch; if the resulting branch is
already owned by another task in the repo, disambiguate it with the unique
work_item_id + plane id so two tasks can never share a worktree.
- test_status_start_fetches_description: empty payload description -> pulled from
  Plane API (mocked) -> QG-0 passes, analyst enqueued.
- test_status_start_empty_api_still_blocks: empty API -> honest QG-0 fail.
- test_work_item_id_uniqueness: ET-006 taken -> next free id, per-repo isolation.
- test_collision_reassigns_in_start_pipeline: end-to-end collision reassignment.
- test_worktree_per_task: two tasks never share a worktree path.
admin merged commit cd73c75cda into main 2026-06-03 21:14:45 +03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/orchestrator#11