Skip to content

fix: address PR review findings and scope reviewer to diff only#23

Merged
adamhenson merged 4 commits into
mainfrom
fix/pr-review-findings
Jun 21, 2026
Merged

fix: address PR review findings and scope reviewer to diff only#23
adamhenson merged 4 commits into
mainfrom
fix/pr-review-findings

Conversation

@adamhenson

Copy link
Copy Markdown
Contributor

Summary

  • workflow-run.ts: retry checkConclusionJobCompleted once on API error, then proceed instead of dropping the ingest
  • comment.ts: findExistingComment now throws on paginate error so upsertComment aborts rather than falling through to create a duplicate
  • run.ts: only overwrite resolvedWorkflowName when runData.workflowName is non-empty, preserving the companion workflow name as fallback
  • workflow-run.ts: anchor issue-branch regex to full name (^agent/issue-N$) to prevent substring matches in longer branch names
  • run.ts: prefer resolvedTriggerType over resolvedTriggerEvent in buildTriggerRef so a manual trigger_number without trigger_event doesn't mislabel PRs as #N
  • README.md: make turns field conditional in printf snippet so an unset TURNS var doesn't write invalid JSON into the artifact
  • agent-review.md: remove bash tools (no full-file reads), instruct reviewer to only comment on lines present in the diff

Test plan

  • All existing tests pass

@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown

⚡ AgentMeter

# Workflow Model Status Cost Duration
1 Agent: Code Review claude-sonnet-4-5 $0.00 6m
2 Agent: Code Review (Codex) gpt-5.4-mini $0.21 1m
3 AgentMeter — Inline Test claude-sonnet-4-5 $0.01 11s
4 Agent: Code Review claude-sonnet-4-5 $0.00 7m
5 Agent: Code Review (Codex) gpt-5.4-mini $0.33 1m
Total $1.20
All 12 runs
# Workflow Model Status Cost Duration
1 Agent: Code Review claude-sonnet-4-5 $0.00 6m
2 Agent: Code Review (Codex) gpt-5.4-mini $0.21 1m
3 AgentMeter — Inline Test claude-sonnet-4-5 $0.01 11s
4 Agent: Code Review claude-sonnet-4-5 $0.00 7m
5 Agent: Code Review (Codex) gpt-5.4-mini $0.33 1m
6 Agent: Code Review claude-sonnet-4-5 🚫 $0.00 3m
7 AgentMeter — Inline Test claude-sonnet-4-5 $0.01 10s
8 Agent: Code Review (Codex) gpt-5.4-mini $0.35 1m
9 Agent: Code Review claude-sonnet-4-5 🚫 $0.00 3m
10 AgentMeter — Inline Test claude-sonnet-4-5 $0.01 11s
11 Agent: Code Review (Codex) gpt-5.4-mini $0.27 1m
12 AgentMeter — Inline Test claude-sonnet-4-5 $0.01 11s
Total $1.20

View in AgentMeter →

@github-actions

Copy link
Copy Markdown

Findings:

  1. src/workflow-run.ts
    The new retry logic fails open after the second API error and returns true. That reintroduces the duplicate-ingest problem the gate is meant to prevent: workflow_run fires multiple times per agent run, and if listJobsForWorkflowRun is unavailable or the token is under-scoped, this code will now ingest on every firing instead of skipping. The previous fail-closed behavior was safer for correctness.

  2. src/run.ts
    Falling back to ctx.workflowName when runData.workflowName is empty misattributes workflow-run ingests to the companion tracking workflow. In workflow_run_id mode the docs explicitly say the agent workflow name should be used, not the companion. If getWorkflowRun fails or returns no name, keeping the companion name silently pollutes the dashboard and comment history. Safer options are to leave it blank or skip the ingest when the agent run metadata cannot be resolved.

Overall the rest of the diff looks reasonable, but these two changes can cause incorrect production data.

@github-actions

Copy link
Copy Markdown

Findings:

  • High: src/workflow-run.ts:203-217 now fails open if listJobsForWorkflowRun errors twice. In workflow_run mode this is the gate that prevents the ~5 duplicate firings from being ingested. Returning true here can cause duplicate ingests/comments for a single agent run whenever GitHub API access is flaky or under-scoped. I would keep this fail-closed, or dedupe server-side before proceeding.
  • Medium: src/run.ts:102-105 falls back to ctx.workflowName when getWorkflowRun() returns an empty name. In companion workflow_run mode ctx.workflowName is the tracking workflow, not the agent workflow, so this records the wrong workflow name in the ingest payload and PR comment. If the agent run name is unavailable, leaving it blank is safer than misattributing it.
  • Medium: src/comment.ts:294-315 removed the local error handling around paginate(listComments). A transient 403/timeout on the comments list now aborts the whole comment update path, whereas before it would fall back to creating a new comment. That makes comment posting less resilient in production and can silently skip updates.

Otherwise the implementation looks solid, but I’d want tests for the gate failure path and the workflow-name fallback before merging.

@github-actions

Copy link
Copy Markdown

Findings

  • src/comment.ts findExistingComment() no longer catches GitHub API failures. That changes upsertComment() from “best effort” to “fail the whole comment write” on any transient listComments error, because the outer try/catch now swallows the exception before createComment()/updateComment() can run. In production this means a temporary 403/502 on comment lookup can suppress the entire review comment instead of falling back to creating a new one. I’d restore the inner catch or handle lookup failures separately and return null.

No other blocking issues stood out in the diff.

@github-actions

Copy link
Copy Markdown

No major correctness issues found in the changed code paths.

The retry-once gate in src/workflow-run.ts and the trigger-ref fallback in src/run.ts both look consistent with the existing flow, and the exact branch match in src/workflow-run.ts avoids the earlier false-positive issue.

Residual risk:

  • I couldn’t run the Vitest suite in this workspace because vitest isn’t installed here, so I couldn’t confirm the new tests execute end to end.

@github-actions github-actions 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.

Summary

Found 4 type safety/code style issues in the diff:

Type annotations missing:

  • src/comment.ts:317 - error parameter needs unknown type
  • src/workflow-run.ts:205 - firstError parameter needs unknown type
  • src/workflow-run.ts:211 - secondError parameter needs unknown type

Missing JSDoc:

  • src/workflow-run.ts:183 - attemptCheck arrow function needs JSDoc block

Logic & tests: The retry logic and test coverage look solid. The regex anchor fix and trigger type preference changes are correct improvements.

Generated by Agent: Code Review for issue #23 · ● 104.3K

Comment thread src/comment.ts
if (!existing) return null;
return { id: existing.id, body: existing.body ?? '' };
} catch {
} catch (error) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing type annotation on error parameter. In strict TypeScript, all parameters should have explicit types:

} catch (error: unknown) {

Comment thread src/workflow-run.ts
workflowRunId: number;
}): Promise<boolean> {
try {
const attemptCheck = async (): Promise<boolean> => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing JSDoc block for the attemptCheck function. Per code style requirements, every function should have a JSDoc comment describing its purpose, even internal arrow functions:

/**
 * Attempts to verify the conclusion job has completed for this workflow run.
 * `@returns` true if the conclusion job completed successfully, false otherwise
 */
const attemptCheck = async (): Promise<boolean> => {

Comment thread src/workflow-run.ts

try {
return await attemptCheck();
} catch (firstError) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing type annotation on firstError parameter. In strict TypeScript, all parameters should have explicit types:

} catch (firstError: unknown) {

Comment thread src/workflow-run.ts
);
try {
return await attemptCheck();
} catch (secondError) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing type annotation on secondError parameter. In strict TypeScript, all parameters should have explicit types:

} catch (secondError: unknown) {

@adamhenson
adamhenson merged commit 069bef4 into main Jun 21, 2026
9 checks passed
@adamhenson
adamhenson deleted the fix/pr-review-findings branch June 21, 2026 20:24
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