Plan: Show release context in plan comment#
Summary#
When a task belongs to an active release, append a ## Release Context section to the existing ## Agent Plan comment. This surfaces release key, title, RC branch target, and machine-readable metadata so developers and reviewers immediately see the release association at plan time.
Files#
| File | Action | Description |
|---|---|---|
src/release/release.service.ts | modify | Expand findActiveForTask() return type to include key, title, status, directive |
src/github/github.service.ts | modify | Add findCommentByPrefix() method to locate comments by heading prefix |
src/hooks/phase-hooks.service.ts | modify | Inject ReleaseService, modify onPlanComplete() to find plan comment and edit it with release context |
src/hooks/phase-hooks.module.ts | modify | Import ReleaseModule to make ReleaseService available |
src/release/release.service.spec.ts | modify | Assert new fields in findActiveForTask() return value |
src/hooks/phase-hooks.service.spec.ts | modify | Add tests for release context appended/skipped in onPlanComplete() |
Steps#
- Expand
findActiveForTask()return type — addkey,title,status,directivefields from thereleaseentity to the returned object inrelease.service.ts:95-117. Updaterelease.service.spec.tsassertions. - Add
findCommentByPrefix()toGitHubService— new method atgithub.service.tsthat callsGET /repos/{owner}/{repo}/issues/{issueNumber}/comments, iterates to find a comment whose body starts with the given prefix, returns{ id: number; body: string } | null. - Wire release context into
onPlanComplete()— importReleaseModuleinphase-hooks.module.ts. InjectReleaseServiceinPhaseHooksService. InonPlanComplete(): callfindActiveForTask(task.taskId); if null, post the existing simple comment. If active, callfindCommentByPrefix(owner, repo, task.issue, '## Agent Plan')to locate the plan comment; build the## Release Contextsection (human-readable text + collapsed JSON metadata block); edit the plan comment viaeditComment()appending the section. If the plan comment is not found, post release context as a standalone comment. - Unit tests — in
phase-hooks.service.spec.ts: mockReleaseService.findActiveForTask()returning null (no release context added) and returning release config (plan comment edited with release context). VerifyfindCommentByPrefixandeditCommentare called correctly.
Verification#
- Run
npm run test— all existing + new tests pass - Run
npm run lint— zero warnings - Run
npm run build— compiles cleanly
Risks#
- Plan comment not yet posted when
onPlanComplete()fires — the Claude skill posts the plan comment, but there may be a race if the comment hasn't propagated. Mitigation: iffindCommentByPrefixreturns null, post release context as a separate comment (graceful fallback). - GitHub API pagination — issues with many comments may require pagination in
findCommentByPrefix. Mitigation: useper_page=100and paginate if needed; plan comments are typically recent.