Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .agents/skills/context-relationship-graph/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ Do not persist PR, issue, timeline-event, review, comment, or Linear description

If a typed selector or direct permalink has no exact root, return no match; do not fall back to unrelated fuzzy results. If a query reaches the node limit, disclose the bound instead of silently widening the graph.

## Current bounded record

For AR-11 provider command library review on 2026-08-20, the exact root `pr:278` was queried at depth `2` with a maximum of `30` nodes. The canonical index returned no matching root, verified timeline, or candidates because the newly opened PR was not yet in published index coverage. The result is recorded in the proposal manifest and process card; no generated index file was edited, and no relationship was inferred.

## Closeout standard

Summarize the chosen root, verified timeline, relevant candidate links, evidence locations, index/history bounds, and any required follow-up. If no relationship is found, say so precisely rather than inferring one from naming similarity.
105 changes: 105 additions & 0 deletions .github/agentic/provider-command-library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"schema_version": 1,
"defaults": {
"requested_by": "OPERATOR",
"execution_order": ["provider_control", "documented_command"],
"require_current_head_sha": true
},
"providers": {
"coderabbit": {
"authors": ["coderabbitai[bot]", "coderabbitai"],
"commands": {
"review_incremental": {
"effect": "review_request",
"requires_confirm_branch_write": false,
"documented_command": "@coderabbitai review",
"control": {
"comment_kind": "issue_comment",
"labels": ["🔍 Trigger review", "Trigger review"]
}
},
"review_full": {
"effect": "review_request",
"requires_confirm_branch_write": false,
"documented_command": "@coderabbitai full review",
"control": {
"comment_kind": "issue_comment",
"labels": ["🔍 Trigger review", "Trigger review"]
Comment on lines +25 to +27

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Review modes share control 🐞 Bug ≡ Correctness

review_full and review_incremental declare identical checkbox labels, while the dispatcher
chooses controls using only that label. A full-review request can therefore patch the generic
incremental/default control instead of posting @coderabbitai full review, recording the requested
action even though a different review mode was activated.
Agent Prompt
## Issue description
CodeRabbit incremental and full review actions share the same generic control labels, so the dispatcher cannot determine which review mode the checkbox represents.

## Issue Context
The documented commands distinguish incremental and full review, but control selection compares only visible label text.

## Fix Focus Areas
- .github/agentic/provider-command-library.json[12-28]
- .github/workflows/provider-command-dispatch.yml[162-176]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

}
},
"autofix_current": {
"effect": "branch_write",
"requires_confirm_branch_write": true,
"documented_command": "@coderabbitai autofix",
"control": {
"comment_kind": "issue_comment",
"labels": ["Push a commit to this branch"]
}
},
"autofix_stacked": {
"effect": "stacked_pull_request",
"requires_confirm_branch_write": true,
"documented_command": "@coderabbitai autofix stacked pr",
"control": {
"comment_kind": "issue_comment",
"labels": ["Create a new PR with the fixes", "Create stacked PR"]
}
},
"fix_ci_current": {
"effect": "branch_write",
"requires_confirm_branch_write": true,
"documented_command": "@coderabbitai fix-ci commit",
"control": {
"comment_kind": "issue_comment",
"labels": ["Commit on current branch"]
}
},
"fix_ci_stacked": {
"effect": "stacked_pull_request",
"requires_confirm_branch_write": true,
"documented_command": "@coderabbitai fix-ci",
"control": {
"comment_kind": "issue_comment",
"labels": ["Create stacked PR"]
}
},
"resolve_merge_conflict": {
"effect": "branch_write",
"requires_confirm_branch_write": true,
"documented_command": "@coderabbitai resolve merge conflict",
"control": {
"comment_kind": "issue_comment",
"labels": ["Resolve merge conflicts", "Resolve Merge Conflicts"]
}
}
}
},
"qodo": {
"authors": ["qodo-code-review[bot]", "qodo-code-review", "qodo"],
"commands": {
"review": {
"effect": "review_request",
"requires_confirm_branch_write": false,
"documented_command": "/agentic_review"
}
}
},
"devin": {
"authors": ["devin-ai-integration[bot]", "devin-ai-integration", "devin"],
"commands": {
"review": {
"effect": "review_request",
"requires_confirm_branch_write": false,
"documented_command": "/devin review"
},
"autofix_enablement": {
"effect": "provider_configuration",
"dispatchable": false,
"requires_confirm_branch_write": false,
"documented_command": null,
"requires_provider_setting": "Devin Review Auto-Fix and trusted-bot response policy"
}
}
}
}
}
223 changes: 223 additions & 0 deletions .github/workflows/provider-command-dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
name: Provider command dispatch

# Executes only explicit, allowlisted provider operations. The library is read
# from the trusted default branch, never from a pull-request head.
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Resolved
Comment on lines +1 to +4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Missing sentinel/pr0b3 ci jobs 📘 Rule violation ▣ Testability

This PR adds a new GitHub Actions workflow but the repository CI configuration does not include
required Sentinel and Pr0b3 scanning jobs. This violates the requirement that automated security
scanners must pass before merging deployment/integration configuration changes.
Agent Prompt
## Issue description
The repo’s CI/CD configuration does not run Sentinel and Pr0b3 as required, yet this PR introduces a new GitHub Actions workflow (a pipeline/configuration change).

## Issue Context
Compliance requires Sentinel and Pr0b3 to be present and blocking (non-optional) for relevant changes.

## Fix Focus Areas
- .github/workflows/provider-command-dispatch.yml[1-48]
- .github/workflows/repo-gate.yml[1-50]
- .github/workflows/termux-smoke.yml[1-42]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


on:
workflow_dispatch:
inputs:
pr_number:
description: Open pull-request number
required: true
type: string
provider:
description: Provider key from .github/agentic/provider-command-library.json
required: true
type: choice
options: [coderabbit, qodo, devin]
action:
description: Allowlisted provider action
required: true
type: string
head_sha:
description: Required current pull-request head SHA
required: true
type: string
confirm_branch_write:
description: Required for actions that can commit or create a stacked PR
required: false
default: false
type: boolean
repository_dispatch:
types: [provider-command]

concurrency:
group: provider-command-${{ github.event.inputs.pr_number || github.event.client_payload.pr_number || github.run_id }}-${{ github.event.inputs.provider || github.event.client_payload.provider || 'unknown' }}-${{ github.event.inputs.action || github.event.client_payload.action || 'unknown' }}
cancel-in-progress: false

permissions: {}

jobs:
dispatch:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: Execute allowlisted provider command
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
env:
OPERATOR_EXECUTOR_LOGINS: ${{ vars.OPERATOR_EXECUTOR_LOGINS || github.repository_owner }}
OPERATOR_COMMAND_ACTIONS: ${{ vars.OPERATOR_COMMAND_ACTIONS || 'coderabbit:review_incremental,coderabbit:review_full,coderabbit:autofix_current,coderabbit:autofix_stacked,coderabbit:fix_ci_current,coderabbit:fix_ci_stacked,coderabbit:resolve_merge_conflict,qodo:review,devin:review' }}
INPUT_PR_NUMBER: ${{ github.event.inputs.pr_number || github.event.client_payload.pr_number }}
INPUT_PROVIDER: ${{ github.event.inputs.provider || github.event.client_payload.provider }}
INPUT_ACTION: ${{ github.event.inputs.action || github.event.client_payload.action }}
INPUT_HEAD_SHA: ${{ github.event.inputs.head_sha || github.event.client_payload.head_sha }}
INPUT_CONFIRM_BRANCH_WRITE: ${{ github.event.inputs.confirm_branch_write || github.event.client_payload.confirm_branch_write || 'false' }}
with:
github-token: ${{ secrets.ARCHWIZ_GITHUB_TOKEN || secrets.OPERATOR_GITHUB_TOKEN || secrets.OPERATOR_TOKEN || github.token }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

4. Devin fallback cannot trigger 🐞 Bug ☼ Reliability

The token chain allows github.token to post /devin review without verifying that the commenting
identity is linked to Devin, although the recorded provider contract requires a linked account with
repository write access. The workflow can therefore create a successful dispatch receipt while Devin
ignores the command.
Agent Prompt
## Issue description
The Devin command path can use an identity that does not satisfy Devin's linked-account prerequisite and still record the command as dispatched.

## Issue Context
The repository-token fallback comments as the Actions bot, while Devin requires the commenter identity to be linked and authorized.

## Fix Focus Areas
- .github/workflows/provider-command-dispatch.yml[60-60]
- .github/workflows/provider-command-dispatch.yml[197-219]
- docs/ops/PROVIDER_COMMAND_LIBRARY.md[38-42]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

script: |
const prNumberRaw = (process.env.INPUT_PR_NUMBER || '').trim();
const provider = (process.env.INPUT_PROVIDER || '').trim().toLowerCase();
const action = (process.env.INPUT_ACTION || '').trim().toLowerCase();
const requestedSha = (process.env.INPUT_HEAD_SHA || '').trim();
const confirmBranchWrite = String(process.env.INPUT_CONFIRM_BRANCH_WRITE).toLowerCase() === 'true';
const marker = '<!-- operator-provider-command:v1 -->';
const operatorLogins = new Set((process.env.OPERATOR_EXECUTOR_LOGINS || "")
.split(",").map(value => value.trim().toLowerCase()).filter(Boolean));
const receiptAuthors = new Set([...operatorLogins, "github-actions[bot]"]);
const actorLogin = (context.actor || "").trim().toLowerCase();
const allowedActions = new Set((process.env.OPERATOR_COMMAND_ACTIONS || '')
.split(',').map(value => value.trim().toLowerCase()).filter(Boolean));
if (!prNumberRaw || !provider || !action || !requestedSha) {
core.setFailed('pr_number, provider, action, and head_sha are required.');
return;
}
if (!operatorLogins.has(actorLogin)) {
core.setFailed(`Dispatch actor ${context.actor || "unknown"} is not in OPERATOR_EXECUTOR_LOGINS.`);
return;
}
if (!/^\d+$/.test(prNumberRaw)) {
core.setFailed('pr_number must be a positive decimal integer.');
return;
}
const prNumber = Number(prNumberRaw);
if (!Number.isSafeInteger(prNumber) || prNumber <= 0) {
core.setFailed('pr_number must be a positive safe integer.');
return;
}
if (!allowedActions.has(`${provider}:${action}`)) {
core.setFailed(`${provider}:${action} is not in OPERATOR_COMMAND_ACTIONS.`);
return;
}

const defaultBranch = context.payload.repository.default_branch;
const { data: libraryContent } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: '.github/agentic/provider-command-library.json',
ref: defaultBranch,
});
if (Array.isArray(libraryContent) || !libraryContent.content) {
core.setFailed('Trusted provider command library is unavailable.');
return;
}
const library = JSON.parse(Buffer.from(libraryContent.content, 'base64').toString('utf8'));
const providerEntry = library.providers?.[provider];
const command = providerEntry?.commands?.[action];
if (!providerEntry || !command) {
core.setFailed(`No library entry exists for ${provider}:${action}.`);
return;
}
if (command.dispatchable === false) {
core.setFailed(`${provider}:${action} requires provider-side configuration and is not dispatchable.`);
return;
}
if (command.requires_confirm_branch_write && !confirmBranchWrite) {
core.setFailed(`${provider}:${action} can modify a branch; confirm_branch_write=true is required.`);
return;
}

const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
if (pr.state !== 'open') {
core.setFailed(`PR #${prNumber} is not open.`);
return;
}
if (pr.head.sha !== requestedSha) {
core.setFailed(`Stale head SHA: expected ${requestedSha}, current ${pr.head.sha}.`);
return;
}
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
per_page: 100,
});
const alreadyRecorded = comments.some(comment => {
const author = (comment.user?.login || '').toLowerCase();
return comment.body?.includes(marker) &&
comment.body.includes('dispatch_receipt: true') &&
comment.body.includes(`head_sha: ${requestedSha}`) &&
comment.body.includes(`provider: ${provider}`) &&
comment.body.includes(`action: ${action}`) &&
(receiptAuthors.has(author) || providerEntry.authors.includes(author));
});
if (alreadyRecorded) {
core.info(`Already dispatched ${provider}:${action} for ${requestedSha}.`);
return;
}

const result = { mode: 'documented_command', control_id: null, source_comment_id: null };
const labels = command.control?.labels || [];
if (command.control?.comment_kind === 'issue_comment' && labels.length) {
for (const comment of comments) {
const author = (comment.user?.login || '').toLowerCase();
if (!providerEntry.authors.includes(author) || !comment.body) continue;
const checkboxes = [...comment.body.matchAll(/^- \[ \] (<!--\s*\{"checkboxId":"([^"]+)"\}\s*-->)\s*(.+)$/gm)];
const checkbox = checkboxes.find(candidate => labels.includes(candidate[3].trim()));
Comment on lines +162 to +163

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

3. Stale controls get activated 🐞 Bug ☼ Reliability

The dispatcher searches every historical provider comment and selects a matching unchecked checkbox
without checking the comment's SHA, timestamp, or active review cycle. A stale control can be
patched successfully and suppress the documented-command fallback even when the provider no longer
treats that control as actionable.
Agent Prompt
## Issue description
Provider checkbox selection is not bound to the current review cycle or current-SHA provider response, allowing historical controls to be patched.

## Issue Context
A successful GitHub comment PATCH is treated as successful dispatch, so selecting an obsolete control prevents the documented command fallback.

## Fix Focus Areas
- .github/workflows/provider-command-dispatch.yml[123-164]
- .github/workflows/provider-command-dispatch.yml[179-195]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +162 to +163

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

5. Control parser rejects valid checkboxes 🐞 Bug ≡ Correctness

The checkbox regex requires "checkboxId":"..." with no whitespace after the colon, but existing
CodeRabbit controls use "checkboxId": "..."; consequently no declared CodeRabbit control matches
and every such dispatch falls back to posting the documented command. This defeats the workflow’s
configured provider-control route and records a documented-command execution instead of activating
the existing control.
Agent Prompt
## Issue description
The provider-control regex only matches a compact JSON `checkboxId` field, whereas stored CodeRabbit controls include whitespace around the colon. Make the checkbox parser accept normal JSON whitespace while retaining the unchecked-state, provider-author, and exact-label restrictions.

## Issue Context
The existing peer-review orchestrator already uses a whitespace-tolerant checkbox matcher, and captured CodeRabbit comments demonstrate the format the dispatcher must handle.

## Fix Focus Areas
- .github/workflows/provider-command-dispatch.yml[162-163]
- .github/workflows/peer-review-orchestrator.yml[204-220]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

if (!checkbox) continue;
const updatedBody = [
comment.body.replace(checkbox[0], `- [x] ${checkbox[1]} ${checkbox[3]}`),
'',
marker,
'dispatch_receipt: true',
`head_sha: ${requestedSha}`,
`provider: ${provider}`,
`action: ${action}`,
`effect: ${command.effect}`,
'request_actor: OPERATOR',
'execution: provider_control_patch',
`control_id: ${checkbox[2]}`,
`source_comment_id: ${comment.id}`,
].join('\n');
try {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
body: updatedBody,
});
result.mode = 'provider_control_patch';
result.control_id = checkbox[2];
result.source_comment_id = comment.id;
core.info(`Activated ${provider}:${action} control ${checkbox[2]}.`);
break;
} catch (error) {
core.warning(`Control patch for ${provider}:${action} failed: ${error.message}; using documented command.`);
}
}
}

if (result.mode === 'documented_command' && command.documented_command) {
const { data: receipt } = await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: [
command.documented_command,
'',
marker,
'dispatch_receipt: true',
`head_sha: ${requestedSha}`,
`provider: ${provider}`,
`action: ${action}`,
`effect: ${command.effect}`,
'request_actor: OPERATOR',
'execution: documented_command',
'control_id: none',
Comment on lines +210 to +213

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Receipt lacks actor attribution 🐞 Bug ◔ Observability

Receipts hard-code request_actor: OPERATOR instead of recording context.actor, so audits cannot
attribute which allowed operator initiated a dispatch even though the docs claim an "attributable
receipt".
Agent Prompt
### Issue description
The receipt metadata written to PR comments uses `request_actor: OPERATOR` (constant) rather than the actual initiating GitHub actor (`context.actor`). This makes receipts non-attributable across multiple allowed operators.

### Issue Context
The workflow already computes `actorLogin` and uses it for authorization, but does not persist it in receipts.

### Fix Focus Areas
- .github/workflows/provider-command-dispatch.yml[71-80]
- .github/workflows/provider-command-dispatch.yml[170-176]
- .github/workflows/provider-command-dispatch.yml[206-214]

### Suggested fix approach
- Replace `request_actor: OPERATOR` with something like:
  - `request_actor: ${context.actor}` (or `dispatch_actor: ...`) in both the provider-control patch receipt block and the documented-command receipt block.
- If you need the constant lane marker, keep it separately (e.g., `request_lane: OPERATOR`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

'source_comment_id: none',
'',
'Autonomous allowlisted provider-command request and receipt. Provider completion remains independently verifiable.',
].join('\n'),
});
result.source_comment_id = receipt.id;
} else if (result.mode === 'documented_command') {
core.setFailed(`${provider}:${action} requires provider configuration and has no GitHub command fallback.`);
return;
}
6 changes: 6 additions & 0 deletions docs/icm/processes/context-relationship-reconnaissance.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Broad repository crawling produces noisy, stale, and potentially sensitive conte
5. Cite relevant evidence URLs/source locations in the work plan or closeout. Review candidate links manually before expanding scope; do not perform autonomous comment, label, merge, or configuration writes from graph results.
6. If the canonical index is stale or unavailable, use the trusted publisher or an explicitly authorized bounded operator build. For archive coverage, use manual history-page backfill and record the reported `next_start_page`; do not claim full history until it is null. Use the optional Linear freshness comparison only read-only and only for explicit GitHub mappings; its `stale`, `missing`, and `ambiguous` states require review, not an automatic Linear write. Do not hand-edit generated JSONL, matrix, manifest, reports, or checkpoint files.

## Bounded no-match record

| Work item | Root | Bounds | Result | Follow-up |
|---|---|---|---|---|
| AR-11 provider command library, 2026-08-20 | `pr:278` | Depth `2`; max nodes `30` | No matching root, verified timeline, or candidates. The newly opened PR is outside the canonical index’s published coverage. | Do not infer relationships or edit generated index files. The AR-11 manifest review-log entry carries the bounded result; the trusted publisher may add the PR on its normal cadence. |

## If you change this

- **Hits:** agent planning behavior, query/closeout expectations, index freshness handling, and the line between verified context and investigation candidates.
Expand Down
Loading
Loading