Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/10b1c211-c043-4ebb-aac9-369179433ff9 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
add_comment to PR review thread replies on pull_request_review_comment triggers
| }); | ||
| comment = data; | ||
| const shouldReplyToTriggeringPRReviewComment = context.eventName === "pull_request_review_comment" && explicitItemNumber === undefined; | ||
| const triggeringReviewCommentId = Number(context.payload?.comment?.id); |
There was a problem hiding this comment.
@copilot handle context that may be coming from workflow_dispatch or workflow_call
There was a problem hiding this comment.
Pull request overview
Updates add_comment so that when invoked from a pull_request_review_comment trigger (and no explicit item_number is supplied), it replies inline in the originating review thread instead of posting a detached top-level PR comment.
Changes:
- Route
add_commenttopulls.createReplyForReviewComment(...)forpull_request_review_commentevents whenitem_numberisn’t explicitly provided. - Preserve existing top-level comment behavior when
item_numberis explicitly provided. - Add targeted tests to verify inline-reply routing vs explicit top-level routing.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/add_comment.cjs | Adds thread-aware routing logic for pull_request_review_comment triggers with fallback to top-level comments. |
| actions/setup/js/add_comment.test.cjs | Adds tests validating inline reply behavior and explicit override behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 1
| const shouldReplyToTriggeringPRReviewComment = context.eventName === "pull_request_review_comment" && explicitItemNumber === undefined; | ||
| const triggeringReviewCommentId = Number(context.payload?.comment?.id); | ||
|
|
||
| if (shouldReplyToTriggeringPRReviewComment && Number.isInteger(triggeringReviewCommentId) && triggeringReviewCommentId > 0) { | ||
| core.info(`Replying inline to triggering PR review comment ID: ${triggeringReviewCommentId}`); | ||
| const { data } = await githubClient.rest.pulls.createReplyForReviewComment({ | ||
| owner: repoParts.owner, | ||
| repo: repoParts.repo, | ||
| pull_number: itemNumber, | ||
| comment_id: triggeringReviewCommentId, | ||
| body: processedBody, |
🧪 Test Quality Sentinel ReportTest Quality Score: 75/100
Test Classification DetailsView Per-Test Classification
Flagged Tests — Requires Review
|
| Component | Points Earned | Max | Notes |
|---|---|---|---|
| Behavioral Coverage | 40 | 40 | 2/2 design tests |
| Error/Edge Case Coverage | 15 | 30 | 1/2 tests has explicit edge case (explicit item_number override); fallback branch uncovered |
| Low Duplication | 20 | 20 | No duplicate clusters |
| Proportional Growth | 0 | 10 | 4.38:1 inflation ratio exceeds 2:1 threshold |
| Total | 75 | 100 |
Verdict
✅ Check passed. 0% of new tests are implementation tests (threshold: 30%). The two new tests verify genuine behavioral contracts — routing to inline reply vs. top-level comment — and are high value. Suggestions above (fallback branch coverage, assertion messages) would improve confidence further but do not block merging.
📖 Understanding Test Classifications
Design Tests (High Value) verify what the system does:
- Assert on observable outputs, return values, or state changes
- Cover error paths and boundary conditions
- Would catch a behavioral regression if deleted
- Remain valid even after internal refactoring
Implementation Tests (Low Value) verify how the system does it:
- Assert on internal function calls (mocking internals)
- Only test the happy path with typical inputs
- Break during legitimate refactoring even when behavior is correct
- Give false assurance: they pass even when the system is wrong
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.
References: §24782289324
🧪 Test quality analysis by Test Quality Sentinel · ● 518.9K · ◷
There was a problem hiding this comment.
✅ Test Quality Sentinel: 75/100. Test quality is acceptable — 0% of new tests are implementation tests (threshold: 30%). Both new tests verify behavioral contracts (routing to inline reply vs. top-level comment). See the comment above for suggestions on improving edge case coverage (missing comment ID fallback path).
|
@copilot review all comments |
…ll workflows Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7015dc8a-013a-49ca-8161-44ce6a14e2ff Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7015dc8a-013a-49ca-8161-44ce6a14e2ff Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
add_comment to PR review thread replies on pull_request_review_comment triggersadd_comment to PR review thread replies on pull_request_review_comment triggers (including relayed workflow contexts)
add_commentwas posting top-level PR comments even when invoked from an inline review comment trigger, which detached agent responses from the review thread. This change makes defaultadd_commentbehavior thread-aware forpull_request_review_commentevents.Handler behavior update
actions/setup/js/add_comment.cjs,add_commentnow detects:pull_request_review_commentcontextitem_numberin the messagepulls.createReplyForReviewComment(...)instead ofissues.createComment(...).Relayed context support added
add_commentnow resolves effective event context for forwarded invocations, including:workflow_dispatchrelays usinginputs.event_name+inputs.event_payloadworkflow_call/relay cases usinginputs.aw_contextfallbackExplicit target override preserved
item_numberis explicitly provided, behavior remains unchanged:add_commentposts a top-level issue/PR comment usingissues.createComment(...).Coverage added for routing and relayed contexts
actions/setup/js/add_comment.test.cjs, added focused tests for:pull_request_review_commentwithout explicititem_numberitem_numberis providedpull_request_review_commentcontext is forwarded viaworkflow_dispatchinputsworkflow_callaw_context