Add GitHub PR to Launchpad MP comment mirroring tool#1
Draft
Conversation
- Add database model and Alembic migration for mirrored_comments table - Implement Temporal workflow with activities for comment fetching, deduplication, and posting - Add GitHub API integration to fetch issue and review comments - Add Launchpad integration to post comments to MP - Create API endpoint POST /tools/mirror-pr-comments - Register workflow and activities in worker - Update documentation with usage instructions Co-authored-by: r00ta <18282531+r00ta@users.noreply.github.com>
- Add proper dataclass parameters for all activities - Update workflow to use FetchCommentsParams, FilterDeduplicateParams, PostCommentsParams, RecordSyncParams - Update activities to accept parameter dataclasses instead of multiple arguments - Ensures compatibility with Temporal activity invocation patterns Co-authored-by: r00ta <18282531+r00ta@users.noreply.github.com>
- Replace str | None with Optional[str] - Replace int | None with Optional[int] - Replace Client | None with Optional[Client] - Ensures consistency with existing codebase patterns Co-authored-by: r00ta <18282531+r00ta@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add productivity tool to mirror GitHub PR comments to Launchpad MP
Add GitHub PR to Launchpad MP comment mirroring tool
Nov 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a Temporal workflow that mirrors GitHub PR comments (issue + review comments) to Launchpad Merge Proposals with fingerprint-based deduplication for idempotency.
Architecture
Database Layer
MirroredCommentmodel with SHA256 fingerprint for deduplicationd4f9a1b2c3e5addsmirrored_commenttable with unique constraint on fingerprintMirroredCommentsRepositoryfor persistence and duplicate detectionWorkflow
MirrorPullRequestCommentsWorkfloworchestrates 5 activities:parse_input- validates URLs, extracts identifiersfetch_github_comments- retrieves issue/review comments via GitHub APIfilter_deduplicate- queries DB for existing fingerprintspost_launchpad_comments- posts to MP via launchpadlibrecord_sync- persists metadata and statusAPI
POST /v1/tools/mirror-pr-commentsendpoint (authenticated)include_outdated(review comments),include_review_states(approval summaries)GitHub Integration
UnifiedCommentdataclassLaunchpad Integration
[File: path/to/file.py | Line: 123]Usage
Fingerprinting ensures re-running the workflow skips already-mirrored comments. Requires
GITHUB_TOKENenvironment variable.Original prompt
Overview
Add a new productivity tool that mirrors all open comments from a GitHub Pull Request (issue comments + review comments) onto a specified Launchpad Merge Proposal (MP). This should follow the existing architectural patterns used for the current Temporal-based tool that converts a Launchpad Merge Proposal into a GitHub Pull Request.
Objectives
github_pr_urllaunchpad_mp_urlinclude_outdated(bool),include_review_states(bool)MirrorPullRequestCommentsWorkflow) that:launchpadlib.Technical Requirements
Workflow & Activities
Create
MirrorPullRequestCommentsWorkflowwith activities:parse_input– validate and extract owner, repo, PR number, and MP identifier.fetch_github_comments– uses GitHub REST API to collect issue and review comments.filter_deduplicate– checks stored fingerprints in DB and returns only new comments.post_launchpad_comments– posts comments to Launchpad MP usinglaunchpadlib.record_sync– stores summary and mirrored comment records (status posted/skipped/error).Retry policies: Use Temporal default with exponential backoff for network-bound activities. Ensure activities have reasonable
start_to_close_timeoutvalues.Data Model
Add SQLAlchemy model
MirroredCommentwith columns:id(PK)fingerprint(unique; sha256 of"{source}:{comment_id}:{body}")github_comment_idgithub_source(issue|review)mp_identifier(string, e.g.,project:merge_number)created_atposted_atstatus(pending|posted|skipped|error)error_message(nullable)Create Alembic migration to add the
mirrored_commentstable and index/unique constraint onfingerprint.GitHub Integration
Use environment variable
GITHUB_TOKEN. Endpoints:GET /repos/{owner}/{repo}/issues/{number}/commentsGET /repos/{owner}/{repo}/pulls/{number}/commentsNormalize into unified dataclass
UnifiedComment(fields: source, id, author_login, body, created_at, path, line, fingerprint).Optionally (if
include_review_states), also capture review events (GET /repos/{owner}/{repo}/pulls/{number}/reviews) and post a summary comment (e.g., "Review by X: APPROVED" or "CHANGES_REQUESTED") to Launchpad. This can be done by treating review state summaries as pseudo-comments with distinct fingerprint formatreview_state:{review_id}:{state}.Launchpad Integration
Reuse existing Launchpad authentication pattern from the current tool. Implement a helper service (e.g.,
services/launchpad_comments.py) with function to post a textual comment to the Merge Proposal. Prefix review comments with file/line context if available, e.g.:[File: path/to/file.py | Line: 123]\nOriginal review comment body...API Endpoint
Add FastAPI route:
POST /tools/mirror-pr-commentsBody JSON schema:
{ "github_pr_url": "https://github.com/owner/repo/pull/123", "launchpad_mp_url": "https://code.launchpad.net/~owner/project/+merge/456", "include_outdated": false, "include_review_states": false }Response:
{ "workflow_id": "mirror-pr-comments-<hash>", "status": "started" }Idempotency & Deduplication
Fingerprints ensure no duplicate posting. Before posting, query DB for existing fingerprints for the same
mp_identifier. Skip those already present. Record skipped counts.Observability
Log structured entries per activity including
workflow_id, counts, and partial (truncated) comment bodies (first 80 chars). Provide final summary metrics via logs. (Optional future enhancement: integrate with metrics system if one exists.)Error Handling
error; continue with others.Configuration
Add any new env vars to documentation (
DEVELOPMENT.md):GITHUB_TOKEN. Confirm Launchpad credentials already documented; extend if needed.Testing
Add unit tests:
This pull request was created as a result of the following prompt from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.