* feat(tools): add merge_pr TS tool wrapper * refactor(run-pipeline): replace raw gh pr merge with merge_pr tool * fix(scripts): update pipeline-status MERGE NEXT action * docs(handoff): add pr-16 handoff + ADR-010 * fix(handoff): remove dangling ADR-012/ADR-016 references * docs(handoff): set PR number 30 * docs(project-map): add merge-pr.ts tool (PR#30) --------- Co-authored-by: opencode-agent <agent@slaid098.dev>
3.5 KiB
3.5 KiB
ADR-010: merge_pr tool wrapper for orchestrator model
Статус
Accepted
Контекст
MERGE phase выполнялась main agent'ом через raw gh pr merge (см. run-pipeline/SKILL.md Rules + pipeline-status.py NEXT_ACTIONS["MERGE"]). Это конфликтует с pure-orchestrator моделью: main agent = plan/delegate/verify, НЕ исполняет mutations напрямую. Tool-led philosophy (обёртка side-effects в tools, imported из приватного репо как принцип без локального ADR) предписывает: (1) сохранить orchestrator-контракт, (2) дать uniform API surface, (3) централизовать guard logic.
Дополнительно: config/ paths в run-pipeline/SKILL.md (config/scripts/scaffold-handoff.sh) stale после PR#23 (миграция config/ → .opencode/). Phase 0 "load issue skill" ambiguity — противоречит PR#28 issue-skill rewrite (full subagent delegation).
Решение
- Created
merge_prTS tool (.opencode/tools/merge-pr.ts) — wrapper дляgh pr merge N --squash --delete-branchчерезspawnSync. Built with@opencode-ai/plugintool({...})pattern (matchingpipeline-status.ts,spec-status.ts), auto-discovered из.opencode/tools/— без регистрации вopencode.json. run-pipeline/SKILL.md: replaced rawgh pr mergeв Rules →merge_pr({ pr_number: M })tool call; added explicitTemplate F (merge)MERGE phase section (tool call, error handling, re-loop).run-pipeline/SKILL.mdPhase 0: "load issue skill" → "dispatch subagent (general) with instruction to loadissueskill" (pure orchestrator).run-pipeline/SKILL.mdTemplate A:config/scripts/scaffold-handoff.sh→.opencode/scripts/scaffold-handoff.sh.pipeline-status.pyNEXT_ACTIONS["MERGE"]: "смержить PR (gh pr merge N...)" → "вызвать merge_pr tool ({pr_number: N})...". PlaceholderNдляget_next_actionreplace.- Тест
test_get_next_actionMERGE assertion обновлён.
Альтернативы
- Dedicated merger subagent — отклонено. Subagent = task executor с own context, ослабляет security guard (merge by main agent, НЕ subagent — established guard).
merge_prtool вызывается main agent'ом напрямую — preserves guard + orchestrator-контракт. - Explicit exception в AGENTS.md ("main agent may run gh pr merge") — отклонено. Violates pure-orchestrator model, создаёт precedent для других raw-bash exceptions.
- Keep raw bash + документировать — отклонено. Orchestrator conflict не resolved, tool-led philosophy не honoured.
check-permissions.pyruntime merge guard в tool — рассмотрено, отложено.check-permissions.pyсейчас только linting (CI-time), не runtime guard. Реализация runtime guard — follow-up (potential ADR).
Связанные
- Tool-led philosophy — referenced из приватного репо как принцип (без локального ADR-номера).
- PR#28 (issue-skill full subagent delegation) — Phase 0 ambiguity resolved в том же направлении.
- PR#29 (commands rename:
/pipeline-driver→/run-pipeline) — tool names (pipeline_status,merge_pr) independent от command names. - Issue #10 (AGENTS.md orchestrator rewrite) — pending, references
/run-pipeline.