Skip to content

feat(agent-docs-audit): diff-scoped sticky PR comments for L1 findings#3299

Merged
caio-pizzol merged 1 commit into
mainfrom
caio/agent-docs-pr-comments
May 14, 2026
Merged

feat(agent-docs-audit): diff-scoped sticky PR comments for L1 findings#3299
caio-pizzol merged 1 commit into
mainfrom
caio/agent-docs-pr-comments

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Surfaces deterministic agent-doc findings on the PR that introduced them, instead of burying them in workflow artifacts. Reviewers see findings only for files the PR touched.

  • PR runs stay L1-only (no AI, no Bash, no secrets).
  • Sticky comment via <!-- agent-docs-audit -->; updated in place.
  • When findings clear, the comment edits to a "resolved as of " state rather than vanishing or leaving a stale warning.
  • Includes both file-level findings (computeFlags) and pair-level findings (linked-inverted, unexpected-duplicate). Skips single-side pairs since fresh packages with one side are normal.
  • Fork PRs degrade silently on 403.
  • pull-requests: write is sufficient; same pattern as visual-test.yml posting sticky comments via the Issues comments API.

Warning-only. The detector is heuristic; blocking CI would create false-positive friction. Surface first, then decide whether delta-only hard gates are justified after observing noise on real PRs.

@caio-pizzol caio-pizzol requested a review from a team as a code owner May 14, 2026 15:04
@caio-pizzol caio-pizzol merged commit a4449ba into main May 14, 2026
14 checks passed
@caio-pizzol caio-pizzol deleted the caio/agent-docs-pr-comments branch May 14, 2026 15:05
Copy link
Copy Markdown

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

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: fd6317e056

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 πŸ‘.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +176 to +179
execFileSync('gh', ['api', '-X', 'PATCH', `/repos/${REPO}/issues/comments/${String(existing)}`, '--input', tmpFile], { stdio: 'inherit' });
console.log(`Updated comment ${existing}`);
} else {
execFileSync('gh', ['api', '-X', 'POST', `/repos/${REPO}/issues/${PR}/comments`, '--input', tmpFile], { stdio: 'inherit' });
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 Capture gh stderr before matching 403s

For fork PRs (where the GITHUB_TOKEN is read-only despite requested write permissions), a comment write returns 403, but these execFileSync calls inherit stderr so the API error text is printed, not captured in err.message; the catch below usually sees only Command failed: gh api ... and rethrows instead of taking the intended graceful path. This makes the warning-only audit fail on fork PRs that have L1 findings.

Useful? React with πŸ‘Β / πŸ‘Ž.

Comment on lines +159 to +160
const out = execFileSync('gh', ['api', `/repos/${REPO}/issues/${PR}/comments`, '--paginate'], { encoding: 'utf-8' });
const comments = JSON.parse(out);
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 Slurp paginated comments before JSON parsing

On PRs with more than one page of issue comments, gh api --paginate emits separate JSON documents per page; the GitHub CLI docs call out --slurp as the option that returns one array of all pages. Parsing this output as a single JSON value throws, so getExistingCommentId() returns null and the sticky comment can be duplicated or left stale instead of updated.

Useful? React with πŸ‘Β / πŸ‘Ž.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant