Skip to content

create-ticket mis-associates a backlog ticket created from an unrelated branch #847

Description

@williamthorsen

Problem

create-ticket assumes the ticket being created belongs to the current branch. When a backlog or follow-up ticket is created while on a branch that already owns a different ticket, two coupled defects fire:

  1. Manifest clobber — step 5's derive-session-context.mjs --set-ticket-url "$url" writes the new issue URL into the current branch's manifest, mislinking the unrelated ticket to the branch and misleading later ticket-source resolution.
  2. Frontmatter mismatch — step 6 (and the step-7 plan artifact) resolve ticket_id/ticket_ref from the branch manifest, so the saved artifact's frontmatter carries the branch's id while its directory and heading use the new issue number.

Context

create-ticket is the only skill that runs gh issue create; wrap-up, save-plan, and respond-to-review delegate to it via {skill:create-ticket}, so a fix there propagates to all of them. wrap-up benefits most — its tickets are deferred/follow-up items that are structurally branch-unrelated.

Both fix mechanisms already exist: resolve-frontmatter.sh supports --override ticket_id=/--override ticket_ref=, and step 5's --set-ticket-url is a plain call the skill can gate. No helper-script changes are required.

Observed in KB events 01KVN3EYSVNN951VEJMSTASQFS and 01KVMVJHK1AECC6RYE51PK3B2F (same root cause, captured hours apart).

Proposed solution

Instruction-only changes in create-ticket/SKILL.md:

  • Capture the branch-derived ticket_id (for the guard only; the authoritative new id still comes from the platform).
  • Gate --set-ticket-url: persist to the branch manifest only when the branch has no ticket yet or its ticket equals the new one; otherwise skip and note the skip.
  • Pass --override ticket_id=/--override ticket_ref= (new id) when resolving frontmatter for both the ticket and plan artifacts; keep branch as authoring provenance.

The frontmatter override is unconditional (the artifact always describes the new ticket), not gated on the backlog case. No other skill changes.

Acceptance criteria

Must have

  • A ticket created while on a branch whose ticket differs from the new one leaves the branch's manifest ticket link untouched.
  • A ticket created for the current branch (branch has no ticket, or its ticket equals the new one) still persists the manifest link — the common case does not regress.
  • Saved ticket and plan artifacts carry the newly created ticket's ticket_id/ticket_ref in frontmatter, not the branch's.
  • When the manifest association is skipped, the skill records it in its output.

Nice to have

  • KB events 01KVN3EYSVNN951VEJMSTASQFS and 01KVMVJHK1AECC6RYE51PK3B2F marked addressed-by the resulting PR.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions