Skip to content

Implementation workflow appends branch suffix on approved spec PR branch #450

@captainsafia

Description

@captainsafia

Summary

When an implementation is started on top of an approved spec PR, the implementation agent can push to a suffixed branch such as oz-agent/spec-issue-447-auto-implement-routing even though the spec PR was created on oz-agent/spec-issue-447.

This leaves the outer workflow looking at the approved spec PR branch while the agent has pushed implementation changes somewhere else.

Observed behavior

For issue 447:

  • spec creation uses oz-agent/spec-issue-447
  • implementation runs with the approved spec PR branch as the target branch
  • the agent writes/pushes pr-metadata.json.branch_name as oz-agent/spec-issue-447-auto-implement-routing

Why this happens

The branch contracts are inconsistent:

  • core/workflows/create_spec_from_issue.py hard-codes spec branches as oz-agent/spec-issue-{issue_number} and asks the spec agent to use that branch exactly.
  • core/workflows/create_implementation_from_issue.py sets target_branch to the approved spec PR head branch when a plan-approved PR is selected, so the target branch is also oz-agent/spec-issue-447.
  • The implementation prompt still says pr-metadata.json.branch_name may append a descriptive slug as long as it starts with {target_branch}.
  • .agents/skills/implement-issue/SKILL.md strengthens that by saying the branch name must contain a short auto-generated suffix.
  • apply_create_implementation_result only accepts branch-name overrides when there is no selected approved spec PR. In the approved-spec case, it ignores the suffixed metadata branch and checks the original spec branch for updates.

The result is that the agent can follow its prompt/skill instructions and still produce a branch the outer workflow does not use for the approved-spec implementation path.

Recommended fix

Make the implementation branch contract conditional:

  1. When selected_spec_pr_number is present, instruct the agent to use {target_branch} exactly.
    • pr-metadata.json.branch_name must equal {target_branch}.
    • Do not append a descriptive suffix.
    • Commit and push implementation changes directly to the approved spec PR branch.
  2. When there is no approved spec PR selected and the workflow is creating or updating a standalone implementation PR, continue allowing {target_branch}-<descriptive-slug>.
  3. Update .agents/skills/implement-issue/SKILL.md so the suffix requirement only applies to standalone implementation branches, not approved spec PR branches.
  4. Add or update tests covering both paths:
    • approved spec PR path rejects or does not request suffixes
    • standalone implementation path still allows suffixes such as oz-agent/implement-issue-447-add-routing

Expected behavior

For plan-approved implementations, the implementation agent should push to the approved spec PR branch exactly, so spec and implementation changes remain in one PR as intended.

Metadata

Metadata

Assignees

Labels

area:workflowGitHub workflows, Python automation, or Oz integrationbugSomething isn't workingready-to-implementIndicates that an issue is ready for a code implementation coupled with the associated plan.repro:highThe report looks highly reproducible from the available informationtriagedInitial Oz triage has been completed for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions