Skip to content

fix(deps): route promotion PR source context - #2857

Merged
stranske merged 3 commits into
mainfrom
codex/dependency-promotion-source-context
Jul 31, 2026
Merged

fix(deps): route promotion PR source context#2857
stranske merged 3 commits into
mainfrom
codex/dependency-promotion-source-context

Conversation

@stranske

@stranske stranske commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • classify structurally valid dependency-repair promotion markers as explicit dependency automation source context
  • provide a stable dependency PR source reference so issue-less promotion PRs can enter keepalive
  • reject malformed or incomplete markers instead of granting source context
  • document that PR 46 remains the merge-time provenance gate

Review follow-up

Addresses the P1 source-context gap identified after #2853 merged. Without this fix, a marked agent/deps-repair-* PR could still stop at missing-source-context unless someone manually added workflow:source-dependabot.

Validation

  • node --test .github/scripts/__tests__/source-context.test.js .github/scripts/__tests__/agents-pr-meta-keepalive.test.js (56 passed)
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Dependency-repair promotion markers now automatically identify the originating Dependabot pull request.
    • Valid promotion metadata provides explicit source context, enabling automated coding-agent dispatch without a linked issue or manually applied source label.
  • Bug Fixes

    • Invalid or malformed promotion metadata is safely ignored to prevent incorrect source attribution.
  • Documentation

    • Updated operational guidance for dependency-repair promotions and source validation.

@cursor

cursor Bot commented Jul 31, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@stranske
stranske temporarily deployed to agent-standard July 31, 2026 16:08 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 5 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 542e2e43-c1d9-4f91-a11b-4bd1e954316c

📥 Commits

Reviewing files that changed from the base of the PR and between ab58b69 and 02ca89f.

📒 Files selected for processing (3)
  • .github/scripts/__tests__/source-context.test.js
  • .github/scripts/source_context.js
  • templates/consumer-repo/.github/scripts/source_context.js
📝 Walkthrough

Walkthrough

The change adds dependency-repair promotion marker parsing to both source-context implementations. Valid markers produce explicit Dependabot context with a dependency-pr:#<source_pr> reference. Tests cover valid and malformed metadata, and operations documentation describes the behavior.

Changes

Dependency repair source context

Layer / File(s) Summary
Promotion metadata parsing
.github/scripts/source_context.js, templates/consumer-repo/.github/scripts/source_context.js
Both implementations detect promotion markers, validate JSON, PR numbers, and SHA values, normalize valid metadata, and export the parser.
Source context resolution
.github/scripts/source_context.js, templates/consumer-repo/.github/scripts/source_context.js
Valid promotion metadata takes precedence over other source detection, sets the Dependabot source, assigns a dependency-pr:#<source_pr> reference, and marks the context explicit.
Promotion context validation
.github/scripts/__tests__/source-context.test.js, docs/ops/DEPENDENCY_REPAIR_PROMOTION.md
Tests cover valid and malformed markers. Documentation describes source context and later PR validation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest as Pull request body
  participant Parser as parseDependencyRepairPromotionSource
  participant Resolver as resolvePrSourceContext
  PullRequest->>Parser: Read promotion marker
  Parser-->>Resolver: Return validated source_pr metadata
  Resolver-->>PullRequest: Set explicit Dependabot source context
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the dependency promotion source-context change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/dependency-promotion-source-context

Comment @coderabbitai help to get the list of available commands.

@stranske
stranske enabled auto-merge (squash) July 31, 2026 16:08
@stranske-keepalive

stranske-keepalive Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Automated Status Summary

Head SHA: 20a7a89
Latest Runs: ⏳ pending — Gate
Required contexts: Gate / gate, Health 45 Agents Guard / guard
Required: core tests (3.12): ⏳ pending, core tests (3.13): ⏳ pending, docker smoke: ⏳ pending, gate: ⏳ pending

Workflow / Job Result Logs
(no jobs reported) ⏳ pending

Coverage Overview

  • Coverage history entries: 0

Updated automatically; will refresh on subsequent CI/Docker completions.


Keepalive checklist

Scope

No scope information available

Tasks

  • No tasks defined

Acceptance criteria

  • No acceptance criteria defined

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/scripts/source_context.js (1)

392-405: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Do not authorize Dependabot context from an unverified PR-body marker.

A PR author controls the marker body. The parser only validates field format. It does not verify that source_pr is bot-owned or that the recorded SHAs match the referenced PR. This code then sets explicit Dependabot context, and the documentation states that this permits keepalive dispatch before PR 46 validates merge provenance. PR 46 therefore does not protect the dispatch path.

  • .github/scripts/source_context.js#L392-L405: Verify the referenced PR and SHA relationships through trusted GitHub API data before assigning SOURCE_TYPES.DEPENDABOT or an explicit source context.
  • templates/consumer-repo/.github/scripts/source_context.js#L392-L405: Apply the same trusted-provenance check in the consumer template.
  • .github/scripts/__tests__/source-context.test.js#L172-L195: Add coverage that a correctly formatted but unverified marker does not authorize dependency automation context.
  • docs/ops/DEPENDENCY_REPAIR_PROMOTION.md#L68-L71: State that keepalive dispatch requires verified provenance, not marker structure alone.

As per path instructions, “These scripts run with an elevated GITHUB_TOKEN across the fleet. Flag … missing validation of GitHub API / event payloads … and spoofable bot-actor checks.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/source_context.js around lines 392 - 405, In
.github/scripts/source_context.js:392-405 and
templates/consumer-repo/.github/scripts/source_context.js:392-405, update the
source-context resolution around detectedSourceType/sourceType to verify the
referenced PR’s trusted GitHub API provenance, bot ownership, and SHA
relationships before assigning SOURCE_TYPES.DEPENDABOT or any explicit source
context. Add regression coverage in
.github/scripts/__tests__/source-context.test.js:172-195 proving a correctly
formatted but unverified marker cannot authorize dependency automation. Update
docs/ops/DEPENDENCY_REPAIR_PROMOTION.md:68-71 to require verified provenance,
not marker structure alone, for keepalive dispatch.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/scripts/source_context.js:
- Around line 392-405: In .github/scripts/source_context.js:392-405 and
templates/consumer-repo/.github/scripts/source_context.js:392-405, update the
source-context resolution around detectedSourceType/sourceType to verify the
referenced PR’s trusted GitHub API provenance, bot ownership, and SHA
relationships before assigning SOURCE_TYPES.DEPENDABOT or any explicit source
context. Add regression coverage in
.github/scripts/__tests__/source-context.test.js:172-195 proving a correctly
formatted but unverified marker cannot authorize dependency automation. Update
docs/ops/DEPENDENCY_REPAIR_PROMOTION.md:68-71 to require verified provenance,
not marker structure alone, for keepalive dispatch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3c1d90e4-cce2-40df-a5e3-eecbf2a9f2e1

📥 Commits

Reviewing files that changed from the base of the PR and between 090a222 and ab58b69.

📒 Files selected for processing (4)
  • .github/scripts/__tests__/source-context.test.js
  • .github/scripts/source_context.js
  • docs/ops/DEPENDENCY_REPAIR_PROMOTION.md
  • templates/consumer-repo/.github/scripts/source_context.js

@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: 87abc15851

ℹ️ 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".

Comment thread .github/scripts/source_context.js Outdated
Comment thread .github/scripts/source_context.js Outdated
@agents-workflows-bot

Copy link
Copy Markdown
Contributor

Workflow source needed

PR #2857 needs either a linked GitHub issue or one valid non-issue Workflow Source before PR metadata automation can manage it safely.

Please do one of:

  • Add <!-- meta:issue:123 --> or a normal Closes #123 / Related to #123 line.
  • Check one Workflow Source option in the PR body.
  • Add a hidden marker such as <!-- workflow-source:local_request -->, <!-- workflow-source:manual_remote -->, <!-- workflow-source:review_followup -->, <!-- workflow-source:sync_campaign -->, or <!-- workflow-source:dependabot -->.
  • Add a workflow source label such as workflow:source-direct-pr, workflow:source-local-request, workflow:source-review-followup, workflow:source-sync, or workflow:no-automation.

Once a valid source is present, this warning will not be reposted.

@stranske
stranske temporarily deployed to agent-standard July 31, 2026 16:27 — with GitHub Actions Inactive
@stranske

Copy link
Copy Markdown
Owner Author

Closer review pass on current head 02ca89f4: both actionable threads are fixed and resolved. Validation: node --test .github/scripts/__tests__/source-context.test.js .github/scripts/__tests__/agents-pr-meta-keepalive.test.js = 57 passed; python scripts/validate_template_sync.py and python scripts/validate_template_completeness.py both pass; git diff --check origin/main...HEAD is clean. Gate still has async jobs in progress, so no merge is attempted this round.

@stranske
stranske merged commit 8497346 into main Jul 31, 2026
40 checks passed
@stranske
stranske deleted the codex/dependency-promotion-source-context branch July 31, 2026 16:29
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