Skip to content

Router should provide context-specific guidance when /fs-code is used on a PR #854

Description

@guyoron1

What happened

On PR #44, the human reviewer (fgiudici) commented /fs-code at 16:42 UTC to request the code agent fix the review findings. The routing logic in workflow run 30026246718 matched the /fs-code case block, but the ISSUE_IS_PR=true gate prevented dispatch: /fs-code is gated on ISSUE_IS_PR == "false" because it is designed for issues, not PRs. The route job logged 'No stage matched -- skipping dispatch' with no user-visible feedback. The user received no indication that the command was invalid in this context or that /fs-fix was the appropriate alternative. fgiudici ended up making the fix manually.

What could go better

When a recognized /fs-* command is used in a context where it cannot apply, the router should provide actionable feedback rather than failing silently. This is distinct from #5403 (generic feedback for unrecognized commands): /fs-code IS recognized — it matched a specific case block — but the context check (ISSUE_IS_PR) prevented dispatch. The feedback should be context-specific: 'Did you mean /fs-fix? The /fs-code command only works on issues.' This would have saved fgiudici from discovering the limitation through silence and doing the work manually. Confidence is high — the routing logic and log output are unambiguous.

Proposed change

In the Route step of reusable-dispatch.yml (and dispatch.yml), within the /fs-code case block, add an else-branch when ISSUE_IS_PR == "true" that posts a brief reply comment on the triggering comment explaining that /fs-code only works on issues and suggesting /fs-fix for PRs. Implementation sketch:

/fs-code)
  if [[ "${ISSUE_IS_PR}" == "false" ]]; then
    if [[ "${COMMENT_USER_TYPE}" != "Bot" ]] && is_authorized; then
      STAGE="code"
    fi
  else
    # Context-specific feedback: /fs-code on a PR
    gh api "repos/${GITHUB_REPOSITORY}/issues/comments/${COMMENT_ID}/reactions" \
      -f content=confused 2>/dev/null || true
    gh pr comment "${PR_NUMBER}" --repo "${GITHUB_REPOSITORY}" \
      --body "The \`/fs-code\` command only works on issues. To request fixes on a PR, use \`/fs-fix\`." \
      2>/dev/null || true
  fi
  ;;

The same pattern should be applied to /fs-fix when used on an issue (if applicable), and any other commands with context restrictions. This complements fullsend-ai#5403's generic catch-all with targeted guidance for known command/context mismatches.

Validation criteria

After the fix: (1) Comment /fs-code on a PR — within 60 seconds, the triggering comment receives a 'confused' reaction and a reply comment appears suggesting /fs-fix. (2) Comment /fs-code on an issue — behavior is unchanged (code agent dispatches normally). (3) The workflow run completes cleanly with exit code 0. Verify on 2-3 repos to confirm cross-repo consistency.


Generated by retro agent from release-engineering/fbc-update-planner#44

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions