feat(agents): inform agent of parent PR base in stacked dispatch #464

Closed
opened 2026-04-27 13:51:46 +00:00 by claude-desktop · 1 comment
Collaborator

User story

As an agent author, I want the system prompt to tell the agent when its base is a parent PR (not main), and what to expect from rebase cascades, so that the agent doesn't make assumptions about main HEAD when implementing the issue.

Acceptance criteria

Prompt template

  • Default system_prompt_template (Phase 2b) gains a conditional block: when ${parent_pr} is set, append: "Your work is stacked on PR #${parent_pr}. Your base branch is pr/${parent_pr}, not main. When the parent PR merges or its head SHA moves, your PR will be automatically rebased — do not panic if you see an unexpected synchronized event."
  • Per-type templates updated to include the same conditional (or a shared partial)
  • Tests cover: var set vs. unset rendering both paths correctly

Verification

  • End-to-end smoke (manual or scripted): dispatch an issue whose blocker has an open PR; observe agent's first message references the parent PR base correctly

Out of scope

  • Visual diff in dashboard showing stack relationship (separate ticket)
  • Telling the agent the depth of the stack (parent only — keep simple)

References

  • Depends on Phase 2b (system_prompt_template) — #451
  • Depends on parent-PR detection story (#462) for parent_pr var passed through
  • Parent epic: #461
## User story As an agent author, I want the system prompt to tell the agent when its base is a parent PR (not main), and what to expect from rebase cascades, so that the agent doesn't make assumptions about `main` HEAD when implementing the issue. ## Acceptance criteria ### Prompt template - [ ] Default `system_prompt_template` (Phase 2b) gains a conditional block: when `${parent_pr}` is set, append: "Your work is stacked on PR #${parent_pr}. Your base branch is `pr/${parent_pr}`, not `main`. When the parent PR merges or its head SHA moves, your PR will be automatically rebased — do not panic if you see an unexpected `synchronized` event." - [ ] Per-type templates updated to include the same conditional (or a shared partial) - [ ] Tests cover: var set vs. unset rendering both paths correctly ### Verification - [ ] End-to-end smoke (manual or scripted): dispatch an issue whose blocker has an open PR; observe agent's first message references the parent PR base correctly ## Out of scope - Visual diff in dashboard showing stack relationship (separate ticket) - Telling the agent the depth of the stack (parent only — keep simple) ## References - Depends on Phase 2b (`system_prompt_template`) — `#451` - Depends on parent-PR detection story (`#462`) for `parent_pr` var passed through - Parent epic: `#461`
Collaborator

🤖 Auto-assigned to boss (heuristic: area:agents → boss (architecture-touching)). Reply /unassign to reroute.

🤖 Auto-assigned to **boss** (heuristic: area:agents → boss (architecture-touching)). Reply `/unassign` to reroute.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#464
No description provided.