Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

fix(baseline): Keep an agent from weakening the gate and give the PR a valid title - #288

Merged
mpaulosky merged 3 commits into
mainfrom
chore/sandcastle-review-fixes
Oct 25, 2026
Merged

mpaulosky merged 3 commits into
mainfrom
chore/sandcastle-review-fixes

Conversation

@mpaulosky

Copy link
Copy Markdown
Owner

Claude's reviews of TicketManager#242 and IssueTracker#279 found five things in the Template's Owned Sandcastle files and workflow rules:

  • Gate script. GATE_COMMAND runs from the agent-written worktree, so the gate-fixer could edit it to make the exit code 0. runGate now fails, without running the gate, when a commit of the branch's own (main's merged-in history left out) changes the gate script, and says how to restore it.
  • Retry that can't work. A new branch refused only for main's workflow change was left in the queue with a promise that the next round's push would go through. It can't: the next round reuses the unpushed local branch on the old main. The issue now moves to Sandcastle:local, as the created-at-base case does.
  • PR title. The PR was opened with the issue's title, which fails the PR title check when it isn't conventional. prTitle() keeps a conforming title, else adds feat: (fix: for a bug) and fixes the capital and final period.
  • Changed check files. The PR body now lists files the branch's commits change under .sandcastle/, scripts/ and .github/ci/ (CHECK_PATHS), for the reviewer.
  • Copilot-note rule. Not changed: counting Claude's review only where Copilot's quota note is on the commit is deliberate (ADR 0004, pinned by pr-automerge.test.mjs). references/automerge.md now records its cost: a head GitHub drops Copilot's request for waits for a person to merge.

scripts/gate.sh passes.

🤖 Generated with Claude Code

…alid title and list changed check files, and stop promising a retry that can't work

The gate fails when the branch's own commits change the gate script. The PR title is made
to pass the PR title check. The PR body names the files the branch changes under
.sandcastle/, scripts/ and .github/ci/. A new branch refused only for main's workflow
change moves to Sandcastle:local, since the next round can't push it either. The
Copilot-note rule for Claude's backup reviews is recorded as deliberate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
mpaulosky added a commit to mpaulosky/TicketManager that referenced this pull request Oct 25, 2026
… valid title and list changed check files

Copies the Template's build.mts, checkpoint.mts, config.mts and their tests (mpaulosky/dotfiles#288).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
mpaulosky added a commit to mpaulosky/IssueTracker that referenced this pull request Oct 25, 2026
… valid title and list changed check files

Copies the Template's build.mts, checkpoint.mts, config.mts and their tests (mpaulosky/dotfiles#288).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mpaulosky mpaulosky added the review:claude Review with Claude label Oct 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Review

PR #288 changes three things in Sandcastle, in both the Template's Owned files and dotfiles' copies:

  • Gate guard: runGate now refuses to run the gate when the branch's own commits change the gate script.
  • PR title and body: the PR title is turned into a <type>(<scope>): <Summary> subject, and the PR body lists the branch's changes under CHECK_PATHS.
  • Workflow refusal: when a new branch's push is refused only for main's workflow change, the issue now moves to Sandcastle:local instead of staying in the queue.

I read both diff pieces in full, so every changed file was reviewed.

Verdict: the intent is sound, but the gate guard has two real defects:

  1. The guard can't be cleared. It checks commit history, not the file's current content. Once any commit has touched the script, the branch can't get past the guard, and the fix its message suggests doesn't work.
  2. The guard misses merge commits. Because of --no-merges, a merge commit that changes the script gets through unchecked.

Further problems:

  • The guard silently does nothing when GATE_COMMAND starts with a wrapper or interpreter.
  • In the PR body, a file name containing a backtick can break out of its code span and inject a closing keyword or an @mention.
  • CHECK_PATHS leaves out the files that dotfiles' own gate runs (test.sh and package.json).
  • One prTitle edge case can produce a title the PR title check is likely to reject.

Each finding names the Template's file; dotfiles' copy under .sandcastle/lib/ has the same code on the same line and needs the same fix.

… the PR body and make the guarded paths per-repo settings

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Review

This PR changes four things in Sandcastle's build. Each change is made in the Template's Owned files and copied to dotfiles' .sandcastle/:

  • Gate guard. runGate now refuses to run when the branch's copy of GATE_SCRIPT differs from base and, at checkpoint 2, from the mergedMain it merged in. The check is by content, through changedFiles.
  • PR title. prTitle turns the issue title into a conventional-commit title, so check-pr-title.sh accepts it.
  • PR body note. The PR body lists the files the branch changed under the new CHECK_PATHS.
  • Refused push. A new branch whose push GitHub refuses only for main's workflow change now moves to Sandcastle:local instead of staying in the queue.

The docs and the Seed repo-config.mts gain GATE_SCRIPT and CHECK_PATHS. The resolved thread's history-vs-content problem is fixed: the guard compares content, and a real-repo test covers restoring the script.

Verdict: the change is sound in its main path, but there are gaps worth fixing or knowingly accepting before merge:

  • Branch on an older main. The guard wrongly refuses an earlier round's branch built on an older main whenever main has since changed the gate script. The code comment says this case is left out.
  • Unchecked mergedMain. At checkpoint 2 the guard uses mergedMain before it is checked against GitHub's main.
  • Uncaught throw. A throw from the PR body note's git call loses a reviewed, gated publish.
  • Workflows not listed. CHECK_PATHS leaves out .github/workflows/, which is exactly what Sandcastle:local builds change.
  • Replace refs. The guard's git calls honour replace refs in the shared .git, which agents can write.
  • Follow-up pass. It still gates without the guard. I'm inferring this from comments, because lib/follow-up-pass.mts wasn't in the context.

I read all three diff pieces, all eight context pieces and CLAUDE.md; there is no AGENTS.md.

@mpaulosky mpaulosky removed the review:claude Review with Claude label Oct 25, 2026
…ollow-up pass's gate

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mpaulosky
mpaulosky merged commit 2a5bd33 into main Oct 25, 2026
17 checks passed
@mpaulosky
mpaulosky deleted the chore/sandcastle-review-fixes branch October 25, 2026 23:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant