Repository navigation
fix: compare GitHub repository slugs case-insensitively - #1058
Conversation
…ests for github repo slugs
…github repo case insensitively
|
Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 5:06 PM ET / 21:06 UTC. ClawSweeper reviewWhat this changesThe PR adds a shared case-insensitive GitHub repository-slug comparator, applies it across repair and automerge guards, and adds focused tests plus a Crabbox proof package. Merge readiness✅ Ready for maintainer review Keep this PR open for normal maintainer review: current main still performs byte-exact parsed-slug guards, while the PR consistently uses the non-empty case-insensitive comparator. The prior P1 does not remain on the reviewed head; the previously named source-PR and automerge-status guards now use the shared helper. Priority: P2 Review scores
Verification
How this fits togetherThe repair lane receives model-authored GitHub URLs, parses their repository and PR identity, and validates that identity before repair or automerge actions proceed. These guards feed source-PR checkout, replacement handling, and automerge outcome reporting. flowchart LR
A[Model-authored GitHub URL] --> B[GitHub URL parser]
B --> C[Repository slug comparator]
C --> D{Same target repository?}
D -->|Yes| E[Repair or automerge handling]
D -->|No| F[Fail-closed rejection]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the shared comparator with its bounded cross-repository regression guard, preserving exact repository identity apart from GitHub’s case-insensitive slug semantics. Do we have a high-confidence way to reproduce the issue? Yes. A case-variant model-authored canonical PR URL reaches the byte-exact current-main guard, and the checked-in pre-fix build proof records the resulting missing reviewed SHA. Is this the best way to solve the issue? Yes. A single non-empty case-insensitive comparator preserves the existing fail-closed boundary while matching GitHub repository-slug semantics at every parsed-PR guard. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f6f6bfca7d65. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
|
Maintainer review done before merge: read the full source diff — the sameRepoSlug substitution is uniform across all six guard sites, the comparator's non-empty guard makes the both-missing edge stricter than the old ===, and the case-differing canonical_pr regression is covered in test/repair/automerge-outcome.test.ts. CI green on head. Thanks @dwin-gharibi! 🦞 |
Closes #1057.
What Problem This Solves
Fixes an issue where a repair result naming the target repository with different
casing —
https://github.com/OpenClaw/OpenClaw/pull/83707instead ofopenclaw/openclaw— failed every repository guard in the repair lane, eventhough github.com serves both URLs and they address the same PR.
The clearest symptom is in automerge: the reviewed head SHA is dropped, and
automergePlanningHeadBlockthen reports "automerge planning result is missing avalid reviewed head SHA" — a diagnostic that blames the model's output rather
than the comparison. The failure is fail-closed, so it stalls the lane rather than
merging anything wrong.
This is reachable, not theoretical.
canonical_pris model-authored:prompts/repair/autonomous.md:93tells Codex to emit it "with full URL whenknown", and
schema/repair/codex-result.schema.json:180types it as anunconstrained
["string", "null"]— no pattern, no normalization. A model echoinga repository's display casing produces exactly this input.
Why This Change Was Made
parsePullRequestUrl/parseIssueOrPullRefmatch with theiflag and returnthe slug verbatim; every consumer compared it byte-exactly. A sibling helper in
the same file already got this right —
issueNumberFromReflowercases both sides.This adds one shared comparator,
sameRepoSlug, and routes all sixteencomparison sites through it:
automerge-outcome.tsexecute-fix-github.tsexecute-fix-artifact.tspost-flight.tssource-pr-checkout.tstarget-validation.tsFixing only the reported site would have left the identical defect in five other
modules, so they move together.
On the risk of touching
execute-fix-artifact.ts(≈13% covered): the change isone-directional. It can only turn a "different repository" verdict into "same
repository" when the two slugs differ solely by case; it can never make a
previously-matching slug stop matching. That bounds what a mechanical edit in a
low-coverage module can do.
sameRepoSlugalso treats an empty or absent slug as no match, so thecomparator cannot degrade into "empty matches everything" — a real hazard when
swapping
===for a helper.Non-goals: no change to URL parsing, the allowed host, item-number matching, or any
other guard.
User Impact
Automerge and repair lanes resolve a canonical or source PR whose slug differs only
by case, instead of stalling with a misleading "missing reviewed head SHA". No
configuration change, no migration, no data-contract change.
OpenClaw Bay: not affected. No status, lifecycle, or telemetry shape Bay renders
changes. No Bay update or Bay proof is needed.
Release note:
fix: compare GitHub repository slugs case-insensitively.No
CHANGELOG.mdedit is included — happy to add one if this repo's release policywants it.
Evidence
Diff
Plus a new proof package under
docs/proof/automerge-repo-case-sensitivity/.Focused tests
node --test test/repair/automerge-outcome.test.ts test/repair/execute-fix-github.test.ts test/repair/post-flight.test.ts test/repair/source-pr-checkout.test.ts→ 18/18 pass.Three new cases:
a mixed-case
GitHub.comhost);passes both before and after, proving the fix did not widen into cross-repository
head borrowing;
sameRepoSlugcompares case-insensitively and never matches an empty/absent slug.Red/green
Reverted only
src/repair/, rebuilt, and re-ran:The cross-repository rejection test passes in both directions, which is the point:
it is a guard, not a symptom.
Real Behavior Proof
Claim. A parsed repository slug is matched case-insensitively, so a
case-differing
canonical_prresolves normally — while a genuinely differentrepository is still rejected.
Exercised surface.
automergeOutcomeReviewedShaFromResult()indist/repair/automerge-outcome.js(the reported site, measured before/after), plusa scan of the built output of all six consumer modules.
Scenario / fixture. Three claims:
exact-case control.
openclaw/openclaw-state; an absent slug never satisfies a guard.compared with
===/!==instead of the comparator. Any match fails the proof, soa site added later without it is caught.
The contrast compiles the pre-fix
automerge-outcome.ts+github-ref.tsfromthe base commit inside the lease. If that build is unavailable the proof reports
SKIPPED and fails, rather than quietly asserting an unmeasured contrast.
Command and environment. Node 24 in a Docker-backed Crabbox
local-containerlease:
crabbox run \ --provider local-container \ --local-container-image node:24 \ --no-hydrate \ --timing-json \ --artifact-glob '.artifacts/automerge-repo-case-proof/**' \ --script docs/proof/automerge-repo-case-sensitivity/run-proof.shlocal-container(Docker/OrbStack)0.15.0node:24@sha256:934240a162082fd8b8a2f90cd5114446443f1eba1c5378f6687167ca405e6584v24.19.0(satisfiesengines.node >= 24)cbx_fe1bec2bb1b0(amber-barnacle)run_194358f6840f.crabbox/runs/run_194358f6840f/run_194358f6840f-artifacts.tgz0Observed result. In-container: 17/17 proof checks PASS, focused suites
18/18, exit 0. The lease verified the comparator counts on both sides
(
post-fix: 2 sameRepoSlug,pre-fix: 0) before running the claims.A gap this proof caught in itself. The first lease run failed:
post-flight.test.tscould not load, because the script ranbuild:repairwhiletest/helpers.tsimportsdist/clawsweeper.jsanddist/review-activity-cursor.jsfrom the main build. That was an environment gap in my proof script, not a code
defect — it passed on my host only because
dist/was already fully built there.The script now runs
build:nodeand asserts both artifacts exist. Recording itbecause a proof that only works on a pre-warmed host is not a proof.
Artifact / trace.
docs/proof/automerge-repo-case-sensitivity/holdsrun-proof.sh,run-proof.mjs, and the contract README. The lease artifact tarballholds
proof-output.txt,focused-tests.txt,install.log,build.log, andprefix-build.log.Limits. Covers the slug comparison only. Claim 3 scans built output for the
specific
parsed.repo === …shape — a site comparing a parsed slug through adifferently-named local variable would not be caught by that regex; the six modules
were enumerated by hand from the parser call graph. The proof exercises no live
GitHub redirect: that github.com serves case-differing slugs is GitHub's documented
behavior, relied on here rather than demonstrated.
Repository test suite status
The proof and focused suites run on Node 24 inside the Crabbox lease recorded above
(
18/18in-container). The note below concerns only the full suite on the macOS host.Host full suite on this branch: 22 distinct failures. Three did not appear in the
clean-tree baseline —
comment webhook settles duplicate fast ack comments after dispatch,webhook signature verification uses sha256 body hmac, andexact-review queue durably coalesces concurrent unchanged pull request edits. All three areknown flakes from earlier branches in this series, and I verified rather than assumed:
comment-webhook.test.tspasses 25/25, three runs in a row in isolation on thisbranch;
dist/repair/comment-webhook.jsshows none of the sevenfiles this PR touches is reachable from it.
Green on this branch:
local-containerproofpnpm run build:allpnpm run format:checkpnpm run lint