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:
2026-06-10 03:47:49 +03:00
committed by orchestrator-deployer
parent bc04186b93
commit 50bcae765a
22 changed files with 1392 additions and 5 deletions

View File

@@ -794,6 +794,34 @@ class Settings(BaseSettings):
auto_label_repos: str = ""
auto_label_states_ttl_s: int = 300
# ORCH-019: bug-fast-track — a cheaper/shorter pipeline route for bug-fix tasks.
# A task carrying the Plane label `bug_fast_track_label` (default `Bug`) skips
# the whole `architecture` stage (one opus `architect` run + ADR + the
# check_architecture_done exit-gate): the routing-override in advance_stage maps
# the analysis -> architecture edge to analysis -> development for a task whose
# tasks.track == 'bug'. EVERY Quality Gate / sub-gate (CI/review/tester/staging/
# deploy + security/merge/coverage/image-freshness/merge-verify) runs UNCHANGED
# — the route is a scheduler property, NOT a gate (root invariant NFR-1).
# Recognition reuses the proven ORCH-089 label apparatus (labels.has_label ->
# plane_sync), read ONLY in start_pipeline (never in the hot claim_next_job).
# Additive leaf (src/bug_fast_track.py, never-raise) + an additive idempotent
# tasks.track column; STAGE_TRANSITIONS / QG_CHECKS / check_* / verdict-keys are
# NOT touched. fail-safe -> full cycle on any error/ambiguity/disabled flag. See
# docs/work-items/ORCH-019/06-adr/ADR-001-bug-fast-track.md and the cross-cutting
# docs/architecture/adr/adr-0032-bug-fast-track.md.
# bug_fast_track_enabled -> kill-switch (env ORCH_BUG_FAST_TRACK_ENABLED).
# False -> start_pipeline AND advance_stage are 1:1 as
# before ORCH-019 (skips_architecture always False,
# has_label never consulted) — zero regression (AC-6).
# bug_fast_track_label -> Plane label name that activates the track (env
# ORCH_BUG_FAST_TRACK_LABEL; default `Bug`).
# bug_fast_track_repos -> CSV scope (env ORCH_BUG_FAST_TRACK_REPOS). Empty ->
# self-hosting only (orchestrator), the safe default
# (D6); non-empty -> only the listed repos.
bug_fast_track_enabled: bool = True
bug_fast_track_label: str = "Bug"
bug_fast_track_repos: str = ""
# Telegram notifications
telegram_bot_token: str = ""
telegram_chat_id: str = ""