Skip to content
Open
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
6 changes: 5 additions & 1 deletion .github/workflows/copilot_bugbot_status_card.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Copilot - Bugbot Status Card
run-name: Bugbot status · PR ${{ inputs.pull_number }}
run-name: Bugbot status · PR ${{ inputs.pull_number }} · ${{ inputs.operation }}

on:
workflow_dispatch:
Expand All @@ -8,6 +8,10 @@ on:
description: Pull request number
required: true
type: number
operation:
description: SHA-256 correlation of the versioned handoff; not publication authority
required: true
type: string
work:
description: Versioned publication handoff
required: true
Expand Down
158 changes: 141 additions & 17 deletions build/github_action/index.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions docs/bugbot/failure-scenarios.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,24 @@ confirmation. Correct the named provider/response cause and recheck from the
current source; preserve identity and reconciliation checks. Completed writes
remain in place and must not be repeated blindly. See the
[structured error reference](/security-operations/operations/error-reference#conflict-eligibility-and-review-freshness).

## Shared writer acknowledgment

An accepted status-writer dispatch can omit its run ID. The caller recovers only
one native run that matches the exact handoff operation, repository, workflow,
default ref and producer attempt. A recent run on the same PR is insufficient.
The matching source workflow must be installed on trusted default; preparing a
PR or merging develop does not establish installation.

If acknowledgment remains unavailable, inspect the native writer run and retry
acknowledgment. The previous verified card and Review check remain authoritative;
no completed publication receipt or unqueued card fallback is issued. A retry in
the same producer adapter reads the accepted operation instead of repeating its
POST. A native rerun creates a new producer attempt and retains the existing
source/head/policy fences. This is not a durable exactly-once guarantee across
arbitrary process restarts.

Missing permission, foreign or ambiguous runs and incomplete listings fail
closed. The bounded lookup applies to this short publication acknowledgment;
it imposes no model investigation deadline or token/turn/read limit. Operation
correlation establishes data/run identity, not independent code attestation.
35 changes: 35 additions & 0 deletions quality/bugbot/evidence/issue-976/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Accepted dispatch acknowledgment — #976

The five focused dispatch, worker, handoff, publication-workflow and policy
suites pass **62 tests** with fake providers. The dispatch matrix includes the
direct ID, unique accepted 204, absent/ambiguous match, foreign workflow/ref/
repository/operation, denied lookup permission, transient workflow/origin/list
reads, acknowledgment replay, a foreign direct ID, later/incomplete pages,
lost POST response, concurrent retries, replaced origin and progress sequences.
The actual worker rejects a missing/forged correlation before provider reads.

The caller hashes the actual encoded handoff. Progress includes its native
observation sequence in the correlation so subsequent progress still wakes the
writer. A replay shares the accepted operation rather than blindly sending
another POST. The worker independently recomputes the hash before applying its
existing source, actor, head, policy, attempt and serialized-publication checks.
Run/data correlation is not independent attestation of executable producer code.

The first three control attempts could not compile: two TypeScript inference
errors, followed by a stale numeric run-ID use after introducing a typed effect.
They executed zero tests. Their logs are preserved. Subsequent controls passed
17, 47, 59 and 60 tests as receipt binding, worker validation and progress cases
were completed; `final-controls.log.gz` records all 62. These are implementation
controls, not model qualification campaigns or live installation evidence.

Run the five Jest files named in the final log. Source workflow validation,
typecheck, lint, generated-bundle and specification/docs checks accompany the
PR's delivery SHA. The owning SDD and catalog register this adapter and its
fixed acknowledgment bounds. There is no model investigation deadline or
new user configuration. Consumer installation templates are unchanged.

No model or real GitHub call occurs in these controls. A completed handoff
receipt is unavailable on failure; existing publication controls preserve the
last verified card and Check fallback. Production verification stays disabled.
The corresponding workflow still needs explicit reviewed installation on the
trusted default branch under #977. A develop PR cannot establish installation.
Binary file added quality/bugbot/evidence/issue-976/controls-2.log.gz
Binary file not shown.
Binary file added quality/bugbot/evidence/issue-976/controls-3.log.gz
Binary file not shown.
Binary file added quality/bugbot/evidence/issue-976/controls-4.log.gz
Binary file not shown.
Binary file added quality/bugbot/evidence/issue-976/controls-5.log.gz
Binary file not shown.
Binary file added quality/bugbot/evidence/issue-976/controls-6.log.gz
Binary file not shown.
Binary file added quality/bugbot/evidence/issue-976/controls-7.log.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions specs/CATALOG.md

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions specs/bugbot-review-state-reconciliation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2502,3 +2502,89 @@ path forms and one generated-card ownership case. Reuse actual workflow,
adapter, Git and packaged entrypoints; no model calls or evaluated-PR writes.
Update the operator documentation and catalog evidence, run specification,
architecture and focused checks, and report final-head CI separately.

## Accepted status-writer dispatch acknowledgment (#976)

This bounded correction is submitted for review with #976. It does not prove
installation on the trusted default branch; #977 owns that separate, explicitly
authorized operation. The existing worker still authenticates the producer,
comparison, policy and current native evidence before serialized publication.

An accepted dispatch can omit `workflow_run_id`. The caller MUST correlate that
operation without blindly repeating its POST or adopting a merely recent run.
The infrastructure acknowledgment adapter derives `operation` as SHA-256 of the
exact encoded version-1 handoff, including producer run/attempt, kind, comparison,
policy and any verified body. The source-only workflow accepts this internal
string input and includes it in its native run title. Progress wakes prefix
the digest with their native observation sequence, so later progress still
dispatches while a duplicate observation shares its acknowledgment. The worker recomputes the
digest from its actual handoff before any provider read; a missing or forged
correlation is skipped and the Action publishing step fails. It grants no publication
authority and is not an independent attestation of executable producer code.
No public Action option, consumer template or model-investigation bound changes.

```mermaid
flowchart LR
H[Validated handoff] --> P[One dispatch POST]
P --> D{Run ID returned?}
D -->|yes| V[Validate exact worker and publishing step]
D -->|no| L[Read complete correlated run listings]
L -->|one exact match| V
L -->|none, foreign, ambiguous or unavailable| K[Keep verified card and Check fallback]
V -->|successful publication| R[Existing receipt may proceed]
```

In words, the direct ID remains the ordinary path. Missing-ID recovery reads the
workflow identity and the authenticated producer's creation time/attempt, then
searches that workflow on the same repository/default ref. A match requires the
full operation title, repository, workflow ID/path, event, branch, first worker
attempt and a creation time no earlier than the origin. Enumerate up to ten pages
of 100 unique runs and require a consistent complete count before adopting one
match. A truncated, repeated, inconsistent or ambiguous listing is unresolved.
Six lookup passes with 500 ms between passes cover eventual visibility and
transient reads; 401/403 or invalid identity fails closed. These fixed bounds
apply only to short acknowledgment reads. They impose no verifier research
cutoff, token budget, turn count or read quota.

The adapter remembers a submitted operation within its producing attempt and
shares an in-flight acknowledgment between duplicate callers. A lost POST
response or a subsequent lookup failure never permits another POST for that
operation in that adapter. Retrying acknowledgment repeats reads. This is not a
durable exactly-once protocol across arbitrary process restarts. A native rerun
has a different producer attempt and therefore a different handoff identity;
ordinary worker source/attempt fences continue to apply.

Even a directly returned ID MUST match the expected native title, repository,
workflow path/ref/event and first worker attempt before its one successful
publishing job/step can acknowledge completion. Failure leaves the last verified
comment and existing Check/Job Summary authoritative, performs no unqueued card
fallback and issues no completed publication receipt. Operator guidance is:
“Publication acknowledgment unavailable. Inspect the native writer run and retry
acknowledgment; the previous verified review remains available.” This adds no
locale-specific status-card text; diagnostics remain technical detail.

Rollout requires reviewing the matching adapter and source workflow together and
then installing that exact workflow on trusted default under #977. An old writer
that lacks operation correlation cannot satisfy this recovery contract. A
prepared PR, develop merge or fake-provider control does not demonstrate an
installed writer. Keep production verification disabled throughout.

The test budget is **13 new dispatch declarations / 18 controlled-provider
rows**, plus one worker declaration covering missing/forged correlation (two rows), plus the seven existing dispatch controls and existing publication/policy
integration suites. Distribution: unique accepted 204, absent match, ambiguity,
four foreign-identity dimensions, missing permission, transient workflow/origin/run-list read failures,
read-only retry after acceptance, foreign direct ID, later-page match, incomplete
listing, lost-response/concurrent retry, replaced origin attempt and distinct/replayed
progress sequences. Assert POST
counts, selected run, absent acknowledgment on failures, and the existing
preserved-card/no-receipt behavior through the actual publication workflow.
All endpoints are fake; no real secrets or GitHub writes occur.

Acceptance requires that matrix, targeted publication integration, workflow,
typecheck, build/bundle, architecture, coverage, documentation and specification
checks at the delivered SHA. Register the adapter in the existing capability
catalog, regenerate its view, and update failure/retry guidance. Keep historical
pilot artifacts and all qualification gates unchanged. Primary API behavior is
specified by [GitHub workflow dispatch](https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event),
[workflow runs](https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow)
and [native run names](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#run-name).
4 changes: 3 additions & 1 deletion specs/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,9 @@
"src/application/policies/bugbot_status_card_publication_policy.ts",
"src/infrastructure/github/github_bugbot_status_card_workflow.ts",
"src/infrastructure/github/github_bugbot_status_card_dispatch.ts",
"src/infrastructure/github/native_list_pagination.ts"
"src/infrastructure/github/native_list_pagination.ts",
"src/infrastructure/github/github_bugbot_status_card_acknowledgment.ts",
"src/infrastructure/github/github_bugbot_status_card_handoff.ts"
],
"tests": [
"src/domain/bugbot/__tests__/review_state.test.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/github_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export async function runGitHubAction(verificationAuthority?: BugbotVerification
event: eventName, ref, actor, server: serverUrl, workflowRef: process.env.GITHUB_WORKFLOW_REF ?? '',
locale: readGithubActionLocaleInputs(getGithubActionInput).pullRequest,
policy: verificationAuthority?.policyDigest ?? 'default',
inputs: { pullNumber: payload.inputs?.pull_number, work: payload.inputs?.work },
inputs: { pullNumber: payload.inputs?.pull_number, work: payload.inputs?.work, operation: payload.inputs?.operation },
});
if (effect === 'skipped') core.setFailed('No current Bugbot status card publication was authorized.');
else logInfo('Bugbot status card publication ' + effect + '.');
Expand Down
Loading