Skip to content

fix(feature-ideation): add discussion→dispatch redispatch bridge — single-idea enhancement crashes on discussion events (#591-class) #963

Closed

Description

@don-petry

Problem (confirmed)

feature-ideation's discussion: created single-idea enhancement crashes with:

##[error]Action failed with error: Unsupported event type: discussion

anthropics/claude-code-action aborts on discussion event contexts, and feature-ideation has no redispatch bridge (unlike initiative-planner). So when a human opens a new Idea, the enhancement crashes before posting anything — no new idea is ever enhanced on creation. Pre-existing (the discussion-trigger enhancement added in #629/#805 never actually worked); surfaced by the #875 validation (failed run: https://github.com/petry-projects/.github-private/actions/runs/28290846519, event=discussion).

The enhance_backlog sweep and scheduled runs are fine (they run under workflow_dispatch).

Fix — mirror the initiative-planner #618 bridge

Restructure the active stub .github/workflows/feature-ideation.yml (this repo) so the discussion: created path re-dispatches to workflow_dispatch instead of calling the reusable directly:

  1. Add a target_discussion input to the stub's workflow_dispatch inputs (string, default '').
  2. Add a redispatch job that runs only on discussion events: guard category.slug == 'ideas' && user.type != 'Bot', require GH_PAT_WORKFLOWS (a dispatch fired with GITHUB_TOKEN never starts a run — same constraint as scripts/initiative-planner/redispatch.sh), then gh workflow run feature-ideation.yml -f target_discussion=${{ github.event.discussion.number }}.
  3. Make the existing ideate job (the uses: reusable call) run only on workflow_dispatch/schedule, and source target_discussion from inputs.target_discussion (so single-idea mode works under the dispatched run, where claude-code-action is supported).

Reference implementation: .github/workflows/initiative-planner.yml (the redispatch job) + scripts/initiative-planner/redispatch.sh.

Acceptance criteria

  1. Creating a new human-authored Ideas Discussion results in exactly one enhancement comment in single-idea mode, carrying the canonical <!-- feature-ideation:enhanced --> marker — with no Unsupported event type: discussion crash.
  2. Bot-authored / non-ideas discussions are not redispatched (guard holds).
  3. bats coverage asserts the redispatch job exists, is guarded, and forwards target_discussion.
  4. Re-validates [Phase 2] Validate the folded feature-ideation enhancement mode on real .github-private Discussions (next ring) #875.

Cross-repo follow-on (not this issue)

The org template petry-projects/.github : standards/workflows/feature-ideation.yml needs the same bridge so other repos inherit it — a maintainer raises that PR (dev-lead can't write the public repo). This issue fixes the next-ring (.github-private) stub, which is what #875 validates.

Blocks #876 (deprecate idea-enhancer). Refs #875, #934, #872.

Activity

  1. github-actions commented on Jun 27, 2026

    @github-actions
    Contributor

    Thanks for the thorough write-up and for tracking down the failed run — this is clearly documented and the initiative-planner parallel makes the fix path straightforward. Before we proceed: can you confirm that GH_PAT_WORKFLOWS is already provisioned as a repository secret here (as it is for initiative-planner), or will that need to be added as part of this fix?

  2. don-petry commented on Jun 27, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead Implementation Plan

    Issue: #963 — fix(feature-ideation): add discussion→dispatch redispatch bridge

    Scope

    Restructure the active thin-caller stub .github/workflows/feature-ideation.yml so the discussion: created path re-dispatches to workflow_dispatch (mirroring the initiative-planner #618 bridge) instead of calling the reusable directly — fixing the Unsupported event type: discussion crash so a new human Idea is enhanced exactly once.

    Implementation Checklist

    • Add a target_discussion workflow_dispatch input (string, default '')
    • Add a redispatch job gated on discussion events: guard category.slug == 'ideas' && user.type != 'Bot', require GH_PAT_WORKFLOWS, then gh workflow run feature-ideation.yml -f target_discussion=<num> (logic kept inline in the stub so it stays drift-free with the org template — no repo-private script the template lacks)
    • Gate the existing ideate job to workflow_dispatch/schedule only, and source target_discussion from inputs.target_discussion

    Tests to Write (tests/test_feature_ideation.bats)

    • target_discussion declared as a workflow_dispatch input
    • redispatch job exists and is gated on the discussion event
    • redispatch guard holds category.slug == 'ideas' and user.type != 'Bot'
    • redispatch requires GH_PAT_WORKFLOWS
    • redispatch forwards target_discussion via gh workflow run feature-ideation.yml
    • ideate job no longer runs on the discussion event
    • ideate sources target_discussion from inputs.target_discussion

    Test Command

    bats tests/test_feature_ideation.bats (full: scripts/run-bats.sh ...), then bash .dev-lead/scripts/dev-lead-lint.sh

  3. don-petry commented on Jun 27, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead: Implementation Complete

    Plan Execution

    • Added target_discussion workflow_dispatch input (string, default '')
    • Added a redispatch job gated on the discussion event (category.slug == 'ideas' && user.type != 'Bot') that requires GH_PAT_WORKFLOWS and re-invokes the stub via gh workflow run feature-ideation.yml -f target_discussion=<num>
    • Gated the ideate reusable call to workflow_dispatch/schedule only, sourcing target_discussion from inputs.target_discussion
    • Added bats coverage (redispatch job exists, is guarded, requires the PAT, forwards target_discussion; ideate is off the discussion path and reads the input)

    Design notes

    • The bridge logic is kept inline in the stub (not a scripts/feature-ideation/redispatch.sh) because this file is a thin caller copied into other repos via the org template — a copied stub carries no scripts/ tree, so inlining keeps it drift-free with petry-projects/.github/standards/workflows/feature-ideation.yml.
    • The redispatch job needs no GITHUB_TOKEN scopes (it dispatches with the PAT and does not checkout), so it pins permissions: {} — tighter than the initiative-planner bridge, which checks out to run its script.

    Test Results

    bats tests/test_feature_ideation.bats
    1..12
    ok 1 feature-ideation.yml exists
    ok 2 feature-ideation.yml calls the org reusable workflow
    ok 3 feature-ideation.yml pins the reusable to the configured channel tag
    ok 4 feature-ideation.yml exposes the enhance_backlog backfill-sweep input
    ok 5 feature-ideation.yml forwards enhance_backlog to the reusable workflow
    ok 6 feature-ideation.yml declares a target_discussion workflow_dispatch input
    ok 7 feature-ideation.yml has a redispatch job that runs only on the discussion event
    ok 8 feature-ideation.yml redispatch job keeps the ideas-category / non-bot guard
    ok 9 feature-ideation.yml redispatch requires GH_PAT_WORKFLOWS (GITHUB_TOKEN won't start a run)
    ok 10 feature-ideation.yml redispatch forwards target_discussion via workflow_dispatch
    ok 11 feature-ideation.yml ideate job no longer runs on the discussion event
    ok 12 feature-ideation.yml sources target_discussion from inputs.target_discussion
    
    Full CI bats list (47 files): 0 failures.
    

    Lint

    • bash .dev-lead/scripts/dev-lead-lint.sh → all checks passed (shellcheck 81 files, agent/CODEOWNERS frontmatter)
    • yamllint (CI config) on the workflow → PASS
    • actionlint 1.7.12 on the workflow → PASS

    Files Changed

    • .github/workflows/feature-ideation.yml: new target_discussion dispatch input; new discussion-gated redispatch bridge job (PAT guard + gh workflow run re-dispatch); ideate job restricted to workflow_dispatch/schedule and now reads inputs.target_discussion.
    • tests/test_feature_ideation.bats: 7 new assertions covering the input, the guarded redispatch job, the PAT requirement, target_discussion forwarding, and the ideate-job rewiring (already wired into lint.yml's bats list).

    Notes

  4. added a commit that references this issue on Jun 27, 2026
  5. added 12 commits that reference this issue on Aug 2, 2026
  6. added a commit that references this issue on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug reportsdev-leadFor dev-lead agent pickupneeds-human-reviewFlagged by automated PR review agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions