feat(plane): unified status-comment format with duration line (ORCH-016) #34

Merged
admin merged 9 commits from feature/ORCH-016-plane into main 2026-06-05 17:50:48 +03:00
Owner

Summary

Все агенты (analyst..deployer) теперь пишут финальный коммент в Plane через единый хелпер usage.build_status_comment(...). Формат HTML: заголовок "{icon} {Role} — {описание}", опциональная строка Verdict/Status из YAML-frontmatter артефакта, строка "Длительность: 4m 12s" (явный duration_s от launcher; fallback из agent_runs для аналитика), HTML-блок Документы, тех-хвост tokens · cost.

  • Новые: build_status_comment, fmt_duration, get_agent_duration в src/usage.py; src/frontmatter.py (defensive YAML reader).
  • usage_comment(...) → deprecated wrapper (legacy тесты продолжают работать). artifact_links(...) → HTML
  • .
  • stage_engine._build_analyst_ready_comment → обёртка над unified helper.
  • launcher._post_usage_comments принимает duration_s, резолвит stage и worktree_root.

QG_CHECKS и STAGE_TRANSITIONS не менялись (TC-20 snapshot гард).

Test plan

  • pytest tests/test_fmt_duration.py — TC-21/TC-22 (table boundary + edge cases)
  • pytest tests/test_status_comment_format.py — TC-01..TC-10, TC-12, TC-23 (per-agent format)
  • pytest tests/test_analyst_comment_regression.py — TC-11 (analyst-specific regression)
  • pytest tests/test_status_comment_duration_db_fallback.py — TC-24, TC-25 (DB fallback)
  • pytest tests/test_post_usage_comments_integration.py — TC-13..TC-15 (integration with launcher)
  • pytest tests/test_status_comment_authorship.py — TC-19 (per-agent bot tokens)
  • pytest tests/test_qg_registry_snapshot.py — TC-20 (QG/stage immutability)
  • pytest tests/test_status_comment_dedup_regression.py — TC-17 (dedup contract)
  • pytest tests/test_notify_done_regression.py — TC-18 (deploy→done не сломан)
  • pytest tests/test_analyst_status_only_regression.py — TC-16 (status-only verdict не регрессирует)
  • pytest tests/test_analyst_comment.py — pre-existing BUG-C регрессия зелёная
  • pytest tests/test_usage.py — pre-existing usage format regression зелёная
  • staging: визуальная проверка коммента в Plane (R-2: рендер /
    /
      ) — выполняется в стадии deploy-staging

    Refs: ORCH-016

## Summary Все агенты (analyst..deployer) теперь пишут финальный коммент в Plane через единый хелпер usage.build_status_comment(...). Формат HTML: заголовок "{icon} {Role} — {описание}", опциональная строка Verdict/Status из YAML-frontmatter артефакта, строка "Длительность: 4m 12s" (явный duration_s от launcher; fallback из agent_runs для аналитика), HTML-блок Документы, тех-хвост <sub>tokens · cost</sub>. - Новые: build_status_comment, fmt_duration, get_agent_duration в src/usage.py; src/frontmatter.py (defensive YAML reader). - usage_comment(...) → deprecated wrapper (legacy тесты продолжают работать). artifact_links(...) → HTML <li><a>. - stage_engine._build_analyst_ready_comment → обёртка над unified helper. - launcher._post_usage_comments принимает duration_s, резолвит stage и worktree_root. QG_CHECKS и STAGE_TRANSITIONS не менялись (TC-20 snapshot гард). ## Test plan - [x] pytest tests/test_fmt_duration.py — TC-21/TC-22 (table boundary + edge cases) - [x] pytest tests/test_status_comment_format.py — TC-01..TC-10, TC-12, TC-23 (per-agent format) - [x] pytest tests/test_analyst_comment_regression.py — TC-11 (analyst-specific regression) - [x] pytest tests/test_status_comment_duration_db_fallback.py — TC-24, TC-25 (DB fallback) - [x] pytest tests/test_post_usage_comments_integration.py — TC-13..TC-15 (integration with launcher) - [x] pytest tests/test_status_comment_authorship.py — TC-19 (per-agent bot tokens) - [x] pytest tests/test_qg_registry_snapshot.py — TC-20 (QG/stage immutability) - [x] pytest tests/test_status_comment_dedup_regression.py — TC-17 (dedup contract) - [x] pytest tests/test_notify_done_regression.py — TC-18 (deploy→done не сломан) - [x] pytest tests/test_analyst_status_only_regression.py — TC-16 (status-only verdict не регрессирует) - [x] pytest tests/test_analyst_comment.py — pre-existing BUG-C регрессия зелёная - [x] pytest tests/test_usage.py — pre-existing usage format regression зелёная - [ ] staging: визуальная проверка коммента в Plane (R-2: рендер <sub>/<br>/<ul>) — выполняется в стадии deploy-staging Refs: ORCH-016
admin added 5 commits 2026-06-05 15:39:39 +03:00
docs: init ORCH-016 business request
All checks were successful
CI / test (push) Successful in 11s
3cb10be03f
analyst(ET): auto-commit from analyst run_id=93
All checks were successful
CI / test (push) Successful in 11s
0f4d8714dd
analyst(ET): auto-commit from analyst run_id=94
All checks were successful
CI / test (push) Successful in 13s
57a3f6c9f7
architect(ET): auto-commit from architect run_id=95
All checks were successful
CI / test (push) Successful in 12s
1150cd9144
feat(plane): unified status-comment format with duration line (ORCH-016)
All checks were successful
CI / test (push) Successful in 11s
CI / test (pull_request) Successful in 12s
0663da6e4c
Все агенты (analyst..deployer) теперь пишут финальный коммент через единый
хелпер usage.build_status_comment(...) — заголовок «{icon} {Role} — {описание}»,
опциональная строка Verdict/Status из YAML-frontmatter, строка
«Длительность: 4m 12s» (явный duration_s от launcher, fallback из agent_runs
для аналитика), HTML-блок Документы, тех-хвост <sub>tokens · cost</sub>.

- Новые публичные функции в src/usage.py: build_status_comment, fmt_duration,
  get_agent_duration. usage_comment(...) → тонкая deprecated-обёртка (legacy
  тесты в tests/test_usage.py продолжают работать). artifact_links(...)
  переписан на HTML <li><a>…</a></li> (breaking change для внутреннего API,
  но единственный внешний клиент — _post_usage_comments — мигрирован).
- Новый модуль src/frontmatter.py: defensive YAML reader, никогда не raise.
- stage_engine._build_analyst_ready_comment(...) теперь тонкая обёртка над
  build_status_comment(agent="analyst", ...); task_id пробрасывается из
  _handle_analysis_approved_flow для DB-фоллбэка длительности (AC-14).
- launcher._post_usage_comments(...) принимает duration_s, резолвит stage из
  tasks для deployer и worktree_root для AC-8 graceful skipping.

Тесты (16 файлов, 56 новых тестовых функций, покрывают TC-01..TC-25):
fmt_duration table, build_status_comment по всем агентам, DB-фоллбэк,
authorship под per-agent ботами, дедуп-инвариант, regression на
status-only verdict аналитика и финальный notify_done, snapshot
QG_CHECKS + STAGE_TRANSITIONS.

Документация: docs/architecture/README.md (раздел Plane Sync),
CHANGELOG.md (Unreleased Added/Changed).

Refs: ORCH-016

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
admin added 1 commit 2026-06-05 15:44:24 +03:00
reviewer(ET): auto-commit from reviewer run_id=97
All checks were successful
CI / test (push) Successful in 12s
CI / test (pull_request) Successful in 11s
1778d8f8b8
admin added 1 commit 2026-06-05 15:46:43 +03:00
tester(ET): auto-commit from tester run_id=98
All checks were successful
CI / test (push) Successful in 11s
CI / test (pull_request) Successful in 12s
2fc3206f83
admin added 1 commit 2026-06-05 15:49:45 +03:00
deployer(ORCH-016): staging gate SUCCESS (10/10 checks PASS)
All checks were successful
CI / test (push) Successful in 11s
CI / test (pull_request) Successful in 11s
d4b02ef728
Ran scripts/staging_check.py --base-url http://localhost:8501 --mode stub
against the live orchestrator-staging instance. All blocks green:
  - SMOKE (A1-A3): health, queue, ORCH_STAGING=true
  - ACCESS (B4-B6): Plane sandbox, Gitea sandbox, registry isolation
  - E2E   (C7-C9b): webhook -> branch -> analyst job enqueued
  - CLEANUP: branch + Plane issue deleted, no leftover task rows

Verdict (machine-readable, YAML frontmatter): staging_status: SUCCESS

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
admin added 1 commit 2026-06-05 15:52:11 +03:00
deployer(ORCH-016): deploy stage SUCCESS (artifact-only verdict)
All checks were successful
CI / test (push) Successful in 11s
CI / test (pull_request) Successful in 11s
7481ce334e
Pre-conditions met:
- 12-review.md: APPROVED
- 13-test-report.md: PASS
- 15-staging-log.md: staging_status=SUCCESS (10/10)

Self-hosting policy honored: prod-container orchestrator:8500
NOT restarted in stage scope (CLAUDE.md). Real prod docker
pull/restart is delegated to scripts/orchestrator-deploy-hook.sh
(ORCH-36) on PR merge to main.

Quality Gate field: deploy_status: SUCCESS (uppercase) in
14-deploy-log.md frontmatter.
admin merged commit 8da571de86 into main 2026-06-05 17:50:48 +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#34