Skip to content

feat(core): extract feedback handlers (reply, comment, ack, close)#166

Open
galligan wants to merge 1 commit into
fire-5/read-handlersfrom
fire-6/feedback-handlers
Open

feat(core): extract feedback handlers (reply, comment, ack, close)#166
galligan wants to merge 1 commit into
fire-5/read-handlersfrom
fire-6/feedback-handlers

Conversation

@galligan

@galligan galligan commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extract replyHandler, commentHandler, ackHandler, closeHandler to core
  • Consolidate identifyUnaddressedFeedback from both CLI and MCP into shared handler
  • Short ID resolution pattern (@abc123) shared across all feedback handlers (FIRE-6)

Test plan

  • bun run check passes
  • bun test passes (288 tests)

🤘🏻 In-collaboration-with: Claude Code

Greptile Summary

Extracts feedback handlers (replyHandler, commentHandler, ackHandler, closeHandler) from CLI to packages/core/src/handlers/, following the same architectural pattern established in recent commits for statusHandler and read handlers. The extraction consolidates short ID resolution (@abc123) and batch operations into shared handler implementations, enabling code reuse across CLI and MCP interfaces.

  • Handlers follow the standard Handler<TInput, TOutput> contract with HandlerContext
  • All handlers use the Result type for consistent error handling
  • Short ID resolution pattern (@abc123) is implemented consistently across all feedback handlers
  • Batch operations (resolveBatchIds, batchAddReactions, deduplicateByCommentId) are properly utilized
  • Polymorphic behavior preserved (e.g., closeHandler handles both PR closure and thread resolution)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Refactoring extracts existing CLI logic to core handlers without changing behavior. The handlers follow established patterns (Result types, HandlerContext, batch utilities), maintain backward compatibility, and all tests pass (288 tests). Code is well-structured with proper TypeScript types, error handling, and documentation.
  • No files require special attention

Important Files Changed

Filename Overview
packages/core/src/handlers/ack.ts Extracts ack handler to core, consolidates batch ID resolution and reaction logic with proper error handling
packages/core/src/handlers/reply.ts Extracts reply handler to core, implements short ID resolution pattern with thread reply and optional resolve
packages/core/src/handlers/comment.ts Extracts comment handler to core, simple PR-level comment implementation with auth checks
packages/core/src/handlers/close.ts Extracts close handler to core, polymorphic implementation handling both PR closure and thread resolution
packages/core/src/handlers/index.ts Exports all new feedback handlers and types for CLI/MCP consumption

Last reviewed commit: c806561

@linear

linear Bot commented Feb 22, 2026

Copy link
Copy Markdown

Add four transport-agnostic feedback handlers:
- replyHandler: resolve comment ID, find thread, post reply, optionally resolve
- commentHandler: resolve PR node ID, post issue comment
- ackHandler: batch-resolve IDs, store acks locally, optionally add reactions
- closeHandler: polymorphic — resolve thread or close PR

All use detectAuth → lazy GitHubClient import, return Result<T, Error>.
No console.*, process.exit, or transport-specific code.

🤘🏻 In-collaboration-with: [Claude Code](https://claude.com/claude-code)
@galligan galligan force-pushed the fire-5/read-handlers branch from 289ae13 to e353d4e Compare February 22, 2026 03:51
@galligan galligan force-pushed the fire-6/feedback-handlers branch from 07f873a to c806561 Compare February 22, 2026 03:51
@galligan galligan changed the title feat(core): extract feedback handlers to core feat(core): extract feedback handlers (reply, comment, ack, close) Feb 22, 2026
@galligan galligan marked this pull request as ready for review February 22, 2026 04:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c806561355

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return Result.ok({
id: shortId,
...(reply.url && { url: reply.url }),
...(input.resolve && { resolved: true }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Set resolved only after thread resolution succeeds

When input.resolve is true, the handler logs and ignores resolveReviewThread failures but still returns resolved: true, which can mislead CLI/MCP callers into treating unresolved threads as closed. This occurs whenever GitHub rejects resolution (permissions, transient API failure, invalid thread state), so downstream automation may skip retries even though the thread is still open.

Useful? React with 👍 / 👎.

Comment on lines +135 to +138
if (reactionResult.isErr()) {
ctx.logger.debug("Reaction already exists or failed", { commentId });
}
return Result.ok({ type: "thread", ok: true });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not return success when issue-comment ack fails

In the issue-comment branch, addReaction errors are swallowed and the function always returns { ok: true }, but there is no local ack fallback in this handler. If the reaction call fails for reasons other than “already reacted” (e.g., auth/network/API errors), the operation performs no acknowledgement while reporting success, causing callers to believe the feedback was handled when it was not.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant