Skip to content

feat(agents): PRs get labels, milestone and reviewer; branches keep up with main - #482

Merged
craig-o-curtis merged 4 commits into
mainfrom
chore/pr-labels-and-main-sync
Nov 8, 2026
Merged

craig-o-curtis merged 4 commits into
mainfrom
chore/pr-labels-and-main-sync

Conversation

@craig-o-curtis

@craig-o-curtis craig-o-curtis commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Agents now keep a branch up to date with main, and every PR they open or close out gets its labels, milestone and reviewer.

Labels, milestone and reviewer

node scripts/pr-meta.mjs shows what a PR should carry. --apply sets it on the branch's open PR.

  • Labels come from the commit types (feat → enhancement, fix → bug, refactor, docs) and the changed paths:
    • packages/gmt → gmt, its skills/ → skills, and each lint plugin → its own label
    • .github/workflows → pipes
    • .agents, .claude, AGENTS.md, CLAUDE.md → ai skills
    • root tooling, .github outside workflows, .vscode and apps/dox/scripts → gmt monorepo
    • context, docs, the rest of apps/dox, the READMEs and every LICENSE → documentation
    • a test checks that every tracked file gets a label, except a changeset entry, which comes with the package change
    • a release/ branch gets only release
  • Milestone is the milestone of the issue the PR closes. Without one, it is taken from the tracker that holds the branch's story id (Dox or Domination).
  • Reviewer is every collaborator who is not the PR's author.

--apply only adds. It never removes a label, never replaces a milestone someone set, and never asks again someone who was already asked or has already reviewed. A gh failure other than gh's own "not found" answer stops the script with gh's message.

The rules live in scripts/lib/pr-meta-plan.mjs, tested in apps/dox/scripts/pr-meta/plan.test.ts with branches and paths from merged PRs.

Keeping up with main

AGENTS.md § Git gains two standing instructions:

  1. When work on a branch starts, as finalizer's first step (before it edits the READMEs or the tracker), and before any push: fetch origin/main, merge it in (never rebase), resolve conflicts so both sides survive, validate, and commit the merge. At the finalizer's first step the merge is committed without validate, because the story's figures are synced only at its step 4; its step 9 validates the merged tree.
    • If uncommitted work touches the incoming files, the agent names them and does not stash.
    • Pushing still needs the owner's word.
    • AGENTS.md, CLAUDE.md and the inline pipeline name these two as the only exceptions to the git rule.
  2. Run pr-meta.mjs --apply right after a PR opens, and when finalizer closes a story whose PR is open.

finalizer (steps 1 and 11), /pipeline, /pr-desc and /release point at these.

Validation

…p with main

- scripts/pr-meta.mjs works out a PR's labels (commit types and changed paths), milestone (the closed issue's, else the story's tracker) and reviewer (the other collaborator); `--apply` adds them to the open PR.
- AGENTS.md § Git: two standing instructions. Merge `origin/main` in at the start of work, before finalizer validates and before any push, fixing conflicts. Run pr-meta after a PR opens or a story closes.
- finalizer, pipeline, pr-desc and release point at both.
@craig-o-curtis craig-o-curtis added ai skills Adds AI skills, commands, context, enhancements enhancement New feature or request labels Nov 8, 2026

@baldurpan baldurpan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Four comments, inline. The script itself does what the description says. At d8b1d29 the 71 tests pass, and a dry run on this PR gives the labels it already carries. I read --apply, and it only adds.

I'd want the first two settled before this merges. Both are about the instructions, not the script:

  • The new standing instructions contradict the section they sit in, and CLAUDE.md.
  • The finalizer's merge will usually be refused at the point it runs.

The other two are smaller. Some root tooling and docs/ get no label. A gh failure reads as "no open PR".

Comment thread AGENTS.md Resolved
Comment thread .agents/finalizer.md Resolved
Comment thread scripts/lib/pr-meta-plan.mjs Resolved
Comment thread scripts/pr-meta.mjs Resolved
@craig-o-curtis
craig-o-curtis enabled auto-merge (squash) November 8, 2026 16:34
- AGENTS.md, CLAUDE.md and the inline pipeline name the two standing
  instructions as the only exceptions to the git rule.
- finalizer merges `origin/main` as its first step, before it edits the
  READMEs or the tracker, so git does not refuse the merge.
- Every root tooling file, all of `.github/` outside workflows and `.vscode/`
  get `gmt monorepo`; `docs/` and every LICENSE get `documentation`. A test
  checks that every tracked path gets a label, except a changeset entry.
- pr-meta treats only gh's own not-found answers as no PR or no issue; any
  other gh failure stops with gh's message.

@baldurpan baldurpan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the quick turnaround. All four threads are fixed, and I've checked each one at e232372.

Moving the merge to step 1 raises one new point, in the inline thread on AGENTS.md:69.

Comment thread AGENTS.md Resolved
@craig-o-curtis
craig-o-curtis enabled auto-merge (squash) November 8, 2026 16:57
@baldurpan

Copy link
Copy Markdown
Contributor

Checked the merge from main (9d21295): it doesn't change this PR's patch. The only file both PRs touch is scripts/lib/affected.mjs, and the two edits are independent. plan.test.ts still passes on the merged tree, so every file #478 added gets a label. My review still stands, and the thread on AGENTS.md:69 is still open.

…ate (#482)

At the finalizer's first step the story's published figures are not synced
yet (step 4), so `validate` fails on any story with new tests for a reason
the merge did not cause. The finalizer now commits the resolved merge
without it; step 9's `validate` checks the merged tree. The other merges
(work starting on a branch, before a push) still run `validate` first.

@baldurpan baldurpan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving 319f801. All five threads are fixed, and I've checked each one:

  • AGENTS.md, CLAUDE.md and inline-mode.md agree on the two standing exceptions.
  • The finalizer merges main at step 1 and runs validate only at step 9.
  • Every tracked file gets a label, with a git ls-files test that keeps it that way.
  • pr-meta.mjs reports gh's own error instead of "no open PR".

The merge from main (9d21295) doesn't change the patch, and the label test passes on the merged tree.

CI when I approved: 6 checks passed, and 31 were still running, Build & Lint and the TZ tests among them.

@craig-o-curtis
craig-o-curtis merged commit d479dca into main Nov 8, 2026
41 checks passed
@craig-o-curtis
craig-o-curtis deleted the chore/pr-labels-and-main-sync branch November 8, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai skills Adds AI skills, commands, context, enhancements enhancement New feature or request gmt monorepo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants