AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-470
  5. plan
  6. plan.md
plan.md(3.1 KB)· Apr 13, 2026· 2 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks

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#

FileActionDescription
src/release/release.service.tsmodifyExpand findActiveForTask() return type to include key, title, status, directive
src/github/github.service.tsmodifyAdd findCommentByPrefix() method to locate comments by heading prefix
src/hooks/phase-hooks.service.tsmodifyInject ReleaseService, modify onPlanComplete() to find plan comment and edit it with release context
src/hooks/phase-hooks.module.tsmodifyImport ReleaseModule to make ReleaseService available
src/release/release.service.spec.tsmodifyAssert new fields in findActiveForTask() return value
src/hooks/phase-hooks.service.spec.tsmodifyAdd tests for release context appended/skipped in onPlanComplete()

Steps#

  1. Expand findActiveForTask() return type — add key, title, status, directive fields from the release entity to the returned object in release.service.ts:95-117. Update release.service.spec.ts assertions.
  2. Add findCommentByPrefix() to GitHubService — new method at github.service.ts that calls GET /repos/{owner}/{repo}/issues/{issueNumber}/comments, iterates to find a comment whose body starts with the given prefix, returns { id: number; body: string } | null.
  3. Wire release context into onPlanComplete() — import ReleaseModule in phase-hooks.module.ts. Inject ReleaseService in PhaseHooksService. In onPlanComplete(): call findActiveForTask(task.taskId); if null, post the existing simple comment. If active, call findCommentByPrefix(owner, repo, task.issue, '## Agent Plan') to locate the plan comment; build the ## Release Context section (human-readable text + collapsed JSON metadata block); edit the plan comment via editComment() appending the section. If the plan comment is not found, post release context as a standalone comment.
  4. Unit tests — in phase-hooks.service.spec.ts: mock ReleaseService.findActiveForTask() returning null (no release context added) and returning release config (plan comment edited with release context). Verify findCommentByPrefix and editComment are 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: if findCommentByPrefix returns null, post release context as a separate comment (graceful fallback).
  • GitHub API pagination — issues with many comments may require pagination in findCommentByPrefix. Mitigation: use per_page=100 and paginate if needed; plan comments are typically recent.
ContextPrd