Skip to content

skills(review-reviewers): pilot gist-backed evidence storage - #291

Merged
max-sixty merged 3 commits into
mainfrom
gist
Apr 16, 2026
Merged

max-sixty merged 3 commits into
mainfrom
gist

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Pilots per-month, per-target secret gists as the evidence store for review-reviewers. The tracking issue becomes a directory — one bot comment per new gist — so maintainers still get a notification when new monthly evidence appears, without the old per-run comment churn.

review-runs keeps the issue-comment mechanism (inlined from the shared file it used to import) with a TODO to migrate once the pilot validates. shared/review-gates.md now holds just the gates + finding format, not the storage mechanism.

Why gists

  • Single growing file instead of fighting the 65 KB comment-body limit
  • Gist revision history gives a per-run diff for free
  • Per-target separation (worktrunk, tend, prql) — the matrix already fans out, now the evidence does too

PAT scope change

Classic PATs need gist scope; fine-grained PATs need gists:write. Existing adopters' bots will need their PAT regenerated before the pilot expands beyond tend, but this PR only activates gist storage in review-reviewers (tend-internal), so downstream repos are unaffected today.

Notes

  • First run of a new month in the 3-target matrix can briefly create duplicate tracking issues (all three concurrent entries see no existing one); later runs pick the lowest-numbered match deterministically and maintainers close duplicates.
  • BSD/GNU date fallback for "last month" handles end-of-month quirks.
  • Went through two review passes with the code-reviewer agent — caught invalid gh issue create --json flag, missing --raw on gh gist view, $(cat) newline-stripping, undefined per-run findings filename, and date -d 'last month' EOM quirk.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits April 16, 2026 08:20
Pilots per-month, per-target secret gists for below-threshold findings in
`review-reviewers` only. The monthly tracking issue becomes a directory —
one comment per gist on first creation — avoiding the 65 KB comment-body
limit and the append-to-issue complexity.

`review-runs` keeps the issue-comment mechanism (now inlined from the
shared file) until the pilot validates; a TODO marks the intended
migration. Classic PATs now need `gist` scope (fine-grained:
`gists:write`).

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	plugins/tend-ci-runner/skills/review-reviewers/SKILL.md

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One bug: the seed writes to /tmp/gist-seed.md, so the created gist contains a file named gist-seed.md. All subsequent reads and PATCHes target findings.md, which doesn't exist on the first run — the first gh gist view -f findings.md silently produces an empty file, and the first PATCH then creates findings.md (leaving gist-seed.md as a permanent orphan containing the intended header/purpose doc).

Fix: name the seed file findings.md so its basename matches what later code reads. Inline suggestion below. The -f/--filename flag on gh gist create only applies to stdin input, so the cleanest fix is to put the seed in a dedicated directory. After this change, reads/PATCHes all operate on the same findings.md from day one and the gist has a single file.

gh gist create takes the gist file's name from the local file's basename.
Seeding from /tmp/gist-seed.md created gists with a file named
gist-seed.md, and later reads/PATCHes targeting findings.md would have
silently created a second file on the first run, leaving the seed as an
orphan.

Seed from /tmp/gist-seed/findings.md so the basename matches from day one.

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 491a760 into main Apr 16, 2026
4 of 6 checks passed
@max-sixty
max-sixty deleted the gist branch April 16, 2026 15:35
max-sixty added a commit that referenced this pull request Apr 16, 2026
The "Reading historical evidence" and "Recording below-threshold
findings" sections in the `review-reviewers` skill both fetched the same
gist file. Reuse the file written during the read step
(`/tmp/current.md`) instead of re-fetching it before the PATCH.

Follow-up to #291.

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Apr 16, 2026
Catches the case where a required classic OAuth scope is added upstream
(most recently `gist` in #291) but adopter repos still have older PATs
that will silently fail the first time an affected skill runs.

**New:** `plugins/tend-ci-runner/scripts/pat-scope-audit.sh` parses the
bot PAT's `X-OAuth-Scopes` response header, compares granted vs
required, and prints `STATUS=ok|missing|fine-grained` plus CSV lists on
stdout. No GitHub writes — detection only.

**Wired into nightly:** Step 1 of the `nightly` skill runs the script
and acts on `STATUS` — closes a prior tracking issue when scopes are now
complete, opens/updates one (deduped via marker `<!--
tend-pat-scope-audit -->`) when scopes are missing, skips fine-grained
PATs with a log line. Remediation in the issue body points at step 8 of
the `install-tend` skill.

**CLAUDE.md:** added a short section capturing the split we settled on
while designing this — agent drives diagnostics/remediation inside the
action; Actions gate whether the agent runs at all. The reason this
landed as an agent-driven skill step rather than deterministic YAML.

Fine-grained PAT self-introspection is not supported by GitHub (no
documented endpoint exposes a fine-grained token's permissions), so
those are reported and skipped rather than probed. The three prose
locations documenting required scopes (`docs/tend.example.toml`,
`DESIGN.md`, `plugins/install-tend/skills/install-tend/SKILL.md`) remain
the reader-facing source; this script is the one executable reference —
a comment in the script names them so future scope additions are easy to
keep in sync.

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Apr 18, 2026
Bumps generator version to 0.0.16 and syncs lockfile.

7 commits since 0.0.15: nightly bot PAT scope audit (#294), review-reviewers gist-backed evidence storage with single-fetch optimization (#291, #292), nightly closes bot-opened tracking issues when resolved (#290), drops GITHUB_STEP_SUMMARY writes that fail under Claude sandbox (#289), release docs clarification (#288), and notifications dedup of bot-authored PRs (#279).

Co-Authored-By: Claude <[email protected]>
@max-sixty max-sixty mentioned this pull request Apr 18, 2026
max-sixty added a commit that referenced this pull request Apr 18, 2026
Bumps generator to 0.0.16.

## Changes since 0.0.15

- #294 — nightly: audit bot PAT scopes via script
- #292 — review-reviewers: fetch current-month gist once per run
- #291 — review-reviewers: pilot gist-backed evidence storage
- #290 — nightly: close bot-opened tracking issues when resolved
- #289 — skills: drop `GITHUB_STEP_SUMMARY` writes that fail under
Claude sandbox
- #288 — docs(release): commit on the current branch, don't create a new
one
- #279 — notifications: dedup bot-authored PRs cross-referencing the
issue

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants