Skip to content

[WIP] Fix repository drift report issues - #1375

Merged
groupthinking merged 4 commits into
mainfrom
claude/automation-repository-drift-report
Aug 29, 2026
Merged

[WIP] Fix repository drift report issues#1375
groupthinking merged 4 commits into
mainfrom
claude/automation-repository-drift-report

Conversation

@Claude

@Claude Claude AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[automation] Repository drift report</issue_title>
<issue_description>## Canonical delivery-state reconciliation

Generated: 2026-08-04T14:01:48.187Z

  • Open PRs: 59
  • Total remote branches: 334
  • Ready PRs without exactly one canonical issue: 2
  • Issues with competing implementation PRs: 4
  • Unattached branches older than 14 days: 181

PRs requiring canonical issue

Competing PRs

Stale unattached branches

  • bolt/fix-batch-query-n1-bottleneck-16664381751066617032065475a, last commit 2026-07-12T17:57:46Z
  • bolt-fix-database-optimizer-n1-queries-14843617805558882255265ab89, last commit 2026-07-14T14:41:06Z
  • bolt-memoize-segment-row-140767167233558652043755b95, last commit 2026-07-12T00:10:21Z
  • bolt-optimize-interactive-transcript-filtering-125656783817544419028f841ca, last commit 2026-07-21T07:59:08Z
  • claude/dazzling-edison-95u1m4f6f083a, last commit 2026-07-17T09:47:19Z
  • claude/dazzling-edison-ymkr67f024fd7, last commit 2026-07-17T09:13:23Z
  • claude/determined-maxwell-1y1im55d491a0, last commit 2026-07-18T02:48:59Z
  • claude/determined-maxwell-3vgs179d52047, last commit 2026-07-09T05:59:01Z
  • claude/determined-maxwell-3z56dm13ce226, last commit 2026-07-07T03:27:39Z
  • claude/determined-maxwell-4dxv0ea395c9c, last commit 2026-07-07T03:21:31Z
  • claude/determined-maxwell-4ky0tzc42776d, last commit 2026-07-14T14:25:40Z
  • claude/determined-maxwell-4l1ghl1d5ace8, last commit 2026-07-17T02:22:03Z
  • claude/determined-maxwell-4nb64adddb4db, last commit 2026-07-02T07:02:52Z
  • claude/determined-maxwell-4thx4d1d5aa56, last commit 2026-07-10T18:46:42Z
  • claude/determined-maxwell-5c11cx1e32f53, last commit 2026-07-07T04:48:27Z
  • claude/determined-maxwell-5k80n4da0291d, last commit 2026-07-21T04:35:31Z
  • claude/determined-maxwell-06popt70f6db6, last commit 2026-06-29T22:25:32Z
  • claude/determined-maxwell-6rg53d78331cd, last commit 2026-07-09T06:45:21Z
  • claude/determined-maxwell-7vrh8v850a796, last commit 2026-06-28T23:07:41Z
  • claude/determined-maxwell-7wu0ngcfe7cd8, last commit 2026-07-17T01:40:51Z
  • claude/determined-maxwell-8p5n7ud9d12cd, last commit 2026-07-17T02:36:20Z
  • claude/determined-maxwell-9erquce3c0238, last commit 2026-07-18T03:37:17Z
  • claude/determined-maxwell-9ld7rcd39c63d, last commit 2026-07-15T03:45:23Z
  • claude/determined-maxwell-9qcq2rbb98a67, last commit 2026-07-06T23:43:16Z
  • claude/determined-maxwell-9qx6ue4f5e59f, last commit 2026-07-07T03:22:01Z
  • claude/determined-maxwell-9wecpk16be441, last commit 2026-07-12T02:10:48Z
  • claude/determined-maxwell-11jydn471a705, last commit 2026-07-12T02:19:35Z
  • claude/determined-maxwell-13gas772751ee, last commit 2026-07-21T00:02:55Z
  • claude/determined-maxwell-14jgh5b3bad4c, last commit 2026-07-14T13:49:01Z
  • claude/determined-maxwell-61nzcv5e90d0a, last commit 2026-07-12T04:09:08Z
  • claude/determined-maxwell-81rne117958ac, last commit 2026-07-07T03:07:30Z
  • claude/determined-maxwell-5593h9baf93b2, last commit 2026-07-02T21:38:19Z
  • claude/determined-maxwell-92049he6ad8b6, last commit 2026-07-07T00:20:43Z
  • claude/determined-maxwell-a6apnm18cb319, last commit 2026-07-03T20:50:31Z
  • claude/determined-maxwell-aacju9c4cd028, last commit 2026-07-04T05:08:30Z
  • claude/determined-maxwell-ayuxew365f94b, last commit 2026-07-14T17:18:08Z
  • claude/determined-maxwell-bfoiqr58b1284, last commit 2026-07-12T02:47:55Z
  • claude/determined-maxwell-bloicmaee31b4, last commit 2026-07-17T04:03:52Z
  • claude/determined-maxwell-bmfsgm32d7ef1, last commit 2026-07-02T07:02:48Z
  • claude/determined-maxwell-bowgqi98d16fb, last commit 2026-07-15T02:43:52Z
  • claude/determined-maxwell-brk70zc9adf78, last commit 2026-07-12T02:48:28Z
  • claude/determined-maxwell-cmkdxqddf6ac0, last commit 2026-07-12T04:07:30Z
  • claude/determined-maxwell-dczolv42e9ff9, last commit 2026-07-17T03:59:38Z
  • claude/determined-maxwell-e0iuifdf2daa2, last commit 2026-07-07T00:16:44Z
  • claude/determined-maxwell-e1ur8wb9bb83a, last commit 2026-07-12T04:05:59Z
  • claude/determined-maxwell-e8uv5v01d1e4f, last commit 2026-07-07T00:41:03Z
  • claude/determined-maxwell-e9hha12d027d8, last commit 2026-07-17T04:08:45Z
  • claude/determined-maxwell-en9kru62cdc86, last commit 2026-07-06T23:38:34Z
  • claude/determined-maxwell-ey01vyc290856, last commit 2026-07-07T03:23:10Z
  • claude/determined-maxwell-f02xls0d8d387, last commit 2026-07-12T04:07:11Z
  • claude/determined-maxwell-fuumwie18d1e4, last commit 2026-07-06T23:38:56Z
  • claude/determined-maxwell-g31z0uf3226e7, last commit 2026-07-18T04:30:07Z
  • claude/determined-maxwell-gfxhok25315d9, last commit 2026-07-07T03:21:53Z
  • claude/determined-maxwell-gvupbtcb56b19, last commit 2026-07-12T04:02:43Z
  • claude/determined-maxwell-h7gz7ldc3b09f, last commit 2026-07-07T04:56:41Z
  • claude/determined-maxwell-h904ct660d3dc, last commit 2026-07-07T03:26:13Z
  • claude/determined-maxwell-hli561afa02ac, last commit 2026-07-03T23:31:06Z
  • claude/determined-maxwell-hu0rea0e22d42, last commit 2026-07-12T02:25:36Z
  • claude/determined-maxwell-iox2ok08c15da, last commit 2026-07-17T02:43:42Z
  • claude/determined-maxwell-ip1f59cbe919a, last commit 2026-07-06T23:46:27Z
  • claude/determined-maxwell-jm8plv2caf995, last commit 2026-07-07T03:22:43Z
  • claude/determined-maxwell-kaypemcc4df87, last commit 2026-07-08T22:25:02Z
  • claude/determined-maxwell-kdbbzsbd1c5eb, last commit 2026-07-03T20:48:49Z
  • claude/determined-maxwell-klo4xce2c5b21, last commit 2026-07-21T00:06:20Z
  • claude/determined-maxwell-kpfd1cde73686, last commit 2026-07-12T02:15:32Z
  • claude/determined-maxwell-l4kzow318a59d, last commit 2026-07-12T05:17:22Z
  • claude/determined-maxwell-ldvlx68b39f2a, last commit 2026-07-03T01:49:28Z
  • claude/determined-maxwell-ldye728fbee60, last commit 2026-07-15T03:03:22Z
  • claude/determined-maxwell-lxth4b06fa2ad, last commit 2026-07-17T04:14:03Z
  • claude/determined-maxwell-mij7u989e4a6d, last commit 2026-07-07T08:15:24Z
  • claude/determined-maxwell-msnh154855637, last commit 2026-07-04T04:31:11Z
  • claude/determined-maxwell-n1dpmxb48b6ce, last commit 2026-07-15T02:32:01Z
  • claude/determined-maxwell-nb1zz3609985b, last commit 2026-06-29T14:43:08Z
  • claude/determined-maxwell-nbnstz410c9be, last commit 2026-07-07T04:42:39Z
  • claude/determined-maxwell-ostftdb41cff0, last commit 2026-07-17T02:07:00Z
  • claude/determined-maxwell-p4s1gj7503c72, last commit 2026-07-11T02:38:40Z
  • claude/determined-maxwell-p6cak639d0dfa, last commit 2026-07-11T02:58:36Z
  • claude/determined-maxwell-p9v5qd8569484, last commit 2026-07-17T09:24:19Z
  • claude/determined-maxwell-pcaelid0a6ac6, last commit 2026-07-06T23:38:16Z
  • claude/determined-maxwell-pduakff6da8ac, last commit 2026-07-15T04:06:16Z
  • claude/determined-maxwell-pzoqq8fb9a5ee, last commit 2026-07-07T03:24:08Z
  • claude/determined-maxwell-q4p6rk2ff61c3, last commit 2026-07-04T05:08:03Z
  • claude/determined-maxwell-r838un802d531, last commit 2026-07-06T23:37:55Z
  • claude/determined-maxwell-rn9d53b9efe61, last commit 2026-07-15T03:40:50Z
  • claude/determined-maxwell-s49460f6e0653, last commit 2026-07-15T03:11:37Z
  • claude/determined-maxwell-shjn00c86fdaa, last commit 2026-07-06T23:44:06Z
  • claude/determined-maxwell-t6hfkk826d75c, last commit 2026-07-12T03:52:11Z
  • claude/determined-maxwell-tbufwf3b3cbbe, last commit 2026-07-12T03:57:35Z
  • claude/determined-maxwell-u7kfre1dcbc16, last commit 2026-07-14T17:11:30Z
  • claude/determined-maxwell-ubh3hfa693c78, last commit 2026-07-06T23:37:23Z
  • claude/determined-maxwell-ubv6b68c47297, last commit 2026-07-07T03:37:24Z
  • claude/determined-maxwell-udy1ne53fa3fc, last commit 2026-07-17T02:44:01Z
  • claude/determined-maxwell-uybuwc53fa3fc, last commit 2026-07-17T02:44:01Z
  • claude/determined-maxwell-vkacey9f8af98, last commit 2026-07-07T01:23:47Z
  • claude/determined-maxwell-vupf5j52ea9dc, last commit 2026-07-07T03:22:17Z
  • claude/determined-maxwell-w20w27b804a94, last commit 2026-07-11T02:43:03Z
  • claude/determined-maxwell-xyhnam6ccc622, last commit 2026-07-07T05:06:59Z
  • claude/evaluate-unused-foldersc4b64f4, last commit 2026-07-03T01:37:08Z
  • claude/explore-codebase-implementation-plan8be0d91, last commit 2026-06-19T03:16:33Z
  • claude/help-github-docs-page73a637f, last commit 2026-06-19T02:45:50Z

This report is intentionally non-destructive. Branch deletion requires a merged PR or an explicit retention decision.

Canonical governance: #898</issue_description>

Comments on the Issue (you are @claude[agent] in this section)

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
v0-uvai Error Error Aug 29, 2026 1:49am

@Claude Claude AI linked an issue Aug 4, 2026 that may be closed by this pull request
- Comment on non-draft PRs missing canonical issue references
- Auto-close superseded draft PRs when the newer PR declares supersession
- Auto-close the drift report issue when all findings are resolved
- Upgrade pull-requests permission from read to write
- Add workflow to README catalog

Agent-Logs-Url: https://github.com/groupthinking/EventRelay/sessions/36224c07-1067-42d5-a6f8-0c386ec50ed6

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Comment thread .github/workflows/repository-reconciliation.yml
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Agent Completion Truth Gate: BLOCKED

Reasons: verdict_artifact_missing

Machine-readable verdict
{
  "verdict": "blocked",
  "reasons": [
    "verdict_artifact_missing"
  ],
  "details": {}
}

Workflow evidence

@github-actions

Copy link
Copy Markdown

🔍 PR Validation

⚠️ PR title should follow conventional commits format

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 4d97a9b.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@groupthinking
groupthinking marked this pull request as ready for review August 13, 2026 07:53
@github-actions github-actions Bot added ci/cd documentation Improvements or additions to documentation labels Aug 13, 2026
…ssues), so freshly-created clean drift reports are left open, causing the workflow to oscillate — spamming a new "Repository drift report" issue every clean run.

This commit fixes the issue reported at .github/workflows/repository-reconciliation.yml:191

## Bug

In `.github/workflows/repository-reconciliation.yml`, the report issue is located via a search restricted to open issues:

```js
const query = `repo: 
```

*   When an open report already exists, `report` is defined.
*   Otherwise the code **creates** a new issue but discards the return value:

```js
await github.rest.issues.create({ owner, repo, title, body }); // not captured
```

The auto-close block was then guarded by `report`:

```js
if (report && untracked.length === 0 && ...) {
  await github.rest.issues.update({ ..., state: "closed" });
}
```

### Failure mode (concrete trigger)

Consider the exact state right after a prior clean run closed the report:

1.  Run N (clean): no *open* report exists → search returns nothing → `report` is `undefined` → a **brand new** report issue is created → close block is skipped (`report` falsy) → the fresh issue is left **OPEN**.
2.  Run N+1 (still clean): the search now finds that open issue → `report` defined → close block runs → issue closed.
3.  Run N+2 (still clean): no open report again → creates a new one, leaves it open...

This oscillation spams a new open "Repository drift report" issue on every other run even when the repository is perfectly clean, defeating the auto-close feature.

## Fix

Capture the created issue's number and use a single `reportNumber` variable in the close condition. In `@actions/github-script`, `github.rest.issues.create()` is an Octokit request that resolves to a response object whose payload is under `.data`, so `created.data.number` is the correct path.

```js
let reportNumber;
if (report) {
  reportNumber = report.number;
  await github.rest.issues.update({ owner, repo, issue_number: report.number, body });
} else {
  const created = await github.rest.issues.create({ owner, repo, title, body });
  reportNumber = created.data.number;
}
...
if (reportNumber && untracked.length === 0 && duplicates.length === 0 && staleBranches.length === 0) {
  await github.rest.issues.update({ owner, repo, issue_number: reportNumber, state: "closed", state_reason: "completed" });
}
```

Now a freshly-created clean report is closed in the same run, eliminating the oscillation.


Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: groupthinking <garveyht@gmail.com>
@groupthinking
groupthinking merged commit f0ba42b into main Aug 29, 2026
22 of 28 checks passed
@groupthinking
groupthinking deleted the claude/automation-repository-drift-report branch August 29, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[automation] Repository drift report

2 participants