--- kind: task slug: worker-draft-pr title: Worker opens draft PR via forge adapter on implementer success plan_slug: automation-foundation epic_slug: apps-worker-v1 status: ready priority: P1 tenant_id: global owner: unassigned cursor_todo_id: null updated_at: "2026-08-12" agent_prompt: | Epic 7 gap: apps/worker never calls the forge adapter to open a PR. Wire createPullRequest (or equivalent) after a successful implementer session. Use connected repo from convoy/workspace. Branch naming must match Epic 8 conventions. claim_task / complete_task this task; run pnpm lint && pnpm type-check && pnpm test. --- # Task summary When an implementer `role_dispatch` job succeeds, open a **draft PR** on the connected forge (GitHub/Forgejo) from the worktree branch, and store PR URL/metadata on the convoy for Mission Control and Epic 8 webhooks. ## Description Gap check (2026-08-12): `Task-worker-minimal-tool-loop` was marked `done` and checkpoints shipped, but `apps/worker` has **no** forge PR call. Epic 7 acceptance (“branch + PR draft output”) and Epic 8 dogfood both require this. ### Behavior - After successful implementer session (and before worktree teardown): push branch if needed, call forge adapter `createPullRequest` (draft). - PR body includes convoy slug, brief id, echodo marker for webhooks (`echodo-convoy: `). - Persist PR url / number on convoy content or `convoy_events` metadata. - Non-implementer roles skip PR creation. - Failures: log + mark run notes; do not silently claim success if PR was required. ### Dependencies - Epic 3 forge adapters - Worktree + branch from worker tool loop ## Subtasks - [ ] Resolve `repo_links` for convoy workspace - [ ] Push worktree branch with stored credentials pattern - [ ] `createPullRequest` draft via adapter - [ ] Write PR metadata for Mission Control detail panel - [ ] Document branch + marker convention in `docs/worker.md` ## Estimation M ## Acceptance criteria - [ ] Successful implementer job produces a draft PR URL on a connected test repo - [ ] PR body contains convoy marker consumable by Epic 8 - [ ] Planning-only roles do not open PRs - [ ] Mission control detail can show PR link when present ## Links - Epic: `./Epic-apps-worker-v1.md` - Blocks: Epic 8 webhook dogfood - Related: [Task-worker-minimal-tool-loop](./Task-worker-minimal-tool-loop.md)