feat(bug-fast-track): cheaper/shorter pipeline route for bug-fix tasks (ORCH-019)
A task carrying the Plane `Bug` label takes a shortened route that skips the `architecture` stage (one opus architect run + ADR + check_architecture_done), replacing heavy analysis with a lite package (bug-report + mandatory regression test plan). EVERY Quality Gate / sub-gate runs UNCHANGED — the route is a scheduler property, not a gate (root invariant NFR-1): STAGE_TRANSITIONS / QG_CHECKS / check_* / machine-verdict keys are byte-for-byte preserved. - src/bug_fast_track.py: new leaf (never-raise) — bug_fast_track_applies (local, network-free, checked first), is_bug_task (labels.has_label, Plane API source), skips_architecture (pure DB-backed routing predicate), snapshot. - src/db.py: additive idempotent tasks.track column (TEXT DEFAULT 'full') + set_task_track / get_task_track helpers (missing/NULL -> 'full', fail-safe). - src/stage_engine.py: routing-override on the analysis-exit edge (track='bug' -> development/developer, skipping architect); brd-review-clock stamp extended to analysis->development. get_next_stage/get_agent_for_stage stay pure. - src/webhooks/plane.py: classify task as bug in start_pipeline (applies-first short-circuit; never-raise -> full cycle on any error). - src/main.py: additive bug_fast_track block in GET /queue + POST /bug-fast-track/escalate (reset 'bug'->'full' to return to the full cycle). - src/config.py: bug_fast_track_enabled / _label / _repos flags (empty CSV -> self-hosting only). - src/notifications.py: optional 🐞 marker on the bug-track card (never-raise). - Prompts: analyst.md (lite bug package + escalation), reviewer.md (regression- test axis) — 52d canon preserved. - Docs: CLAUDE.md, README.md (env + API + section), docs/architecture/README.md, CHANGELOG.md, .env.example. - Tests: tests/test_bug_fast_track*.py + test_db_migrations.py + queue block (TC-01..TC-15). Full regression green (1551 passed). Kill-switch ORCH_BUG_FAST_TRACK_ENABLED=false -> 1:1 pre-ORCH-019 (zero regression; residual track column harmless). Refs: ORCH-019 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ from ..db import (
|
||||
enqueue_job,
|
||||
insert_event_dedup,
|
||||
create_task_atomic,
|
||||
set_task_track,
|
||||
)
|
||||
from ._dedup import plane_delivery_id
|
||||
from ..stages import get_next_stage, get_agent_for_stage, get_qg_for_stage, get_previous_stage
|
||||
@@ -648,6 +649,42 @@ async def start_pipeline(data: dict, project_id: str = ""):
|
||||
return
|
||||
task_id = task_row["id"]
|
||||
|
||||
# ORCH-019 (FR-1/FR-2, ADR-001 D1/D2): classify the task as a bug-fix and put it
|
||||
# on the cheaper bug-fast-track (skips the `architecture` stage downstream). The
|
||||
# gate idiom is `applies(repo) and is_bug_task(...)`: the LOCAL, network-free
|
||||
# `bug_fast_track_applies` is checked FIRST so a disabled kill-switch / out-of-scope
|
||||
# repo costs ZERO network (no has_label call). The Plane `Bug` label is the source
|
||||
# of truth (read here at start, NEVER in the hot claim_next_job — NFR-4); the type
|
||||
# is persisted in tasks.track so advance_stage routes off the DB, not the network.
|
||||
# never-raise / fail-safe: ANY error -> task stays track='full' (full cycle, AC-6).
|
||||
try:
|
||||
from .. import bug_fast_track
|
||||
if bug_fast_track.bug_fast_track_applies(repo) and bug_fast_track.is_bug_task(
|
||||
work_item_id, plane_project_id
|
||||
):
|
||||
set_task_track(task_id, "bug")
|
||||
logger.info(
|
||||
f"Task {work_item_id}: classified as BUG -> bug-fast-track "
|
||||
f"(architecture stage will be skipped, ORCH-019)"
|
||||
)
|
||||
try:
|
||||
from ..plane_sync import add_comment as _bug_comment
|
||||
_bug_comment(
|
||||
work_item_id,
|
||||
"\U0001f41e Багфикс-трек: "
|
||||
"упрощённый маршрут "
|
||||
"(пропуск стадии architecture). "
|
||||
"Все Quality Gate исполняются.",
|
||||
author="analyst",
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
f"Task {work_item_id}: bug-fast-track classification skipped "
|
||||
f"(fail-safe -> full cycle): {e}"
|
||||
)
|
||||
|
||||
# ORCH-088 (FR-1/AC-6, ADR-001 D1): DEFER the branch cut for an applicable repo.
|
||||
# Creating the Gitea branch here (T0, issue -> analysis) would cut it from `main`
|
||||
# BEFORE the predecessor is merged -> stale base. When the serial gate applies we
|
||||
|
||||
Reference in New Issue
Block a user