Repository navigation
fix(mantis): prove the PR merge commit instead of the raw head - #127961
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 22, 2026, 11:34 AM ET / 15:34 UTC. ClawSweeper reviewWhat this changesThis PR makes Mantis build and prove a deterministic local merge of an open pull request head onto the live main tip, then labels the evidence accordingly. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessThe previous P1 blocker is addressed: the workflow now requires a main-targeting PR and constructs a two-parent candidate from the live main tip and reviewed head. No new concrete correctness defect was found, but this protected maintainer workflow needs exact-head CI and a maintainer merge decision. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherMantis is OpenClaw’s PR-proof workflow: it resolves a pull request, prepares baseline and candidate worktrees, runs isolated Telegram proof lanes, and publishes evidence on the PR. This change replaces the raw-head candidate with a synthesized merge candidate so the proof includes current main behavior. flowchart LR
A[PR dispatch] --> B[Resolve main tip and PR head]
B --> C[Find merge base]
C --> D[Build deterministic merge candidate]
D --> E[Run isolated proof lanes]
E --> F[Publish PR evidence]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +61, Docs 0, Config +24, Other 0. Total +85 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one canonical candidate recipe: resolve the dispatch-time main tip, merge it with the exact reviewed head, prove that immutable result, and publish its SHA as the candidate evidence. Do we have a high-confidence way to reproduce the issue? Yes, by source: current main makes the candidate worktree directly from the raw PR-head SHA, while the changed workflow constructs a merge candidate from live main and that head. The focused workflow test names and protects that distinction. Is this the best way to solve the issue? Yes. Building the merge candidate locally from immutable main, head, and merge-base revisions avoids reliance on GitHub’s stale test-merge cache while retaining the reviewed head as a parent. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 963fafbb1652. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
… head The Telegram Desktop proof previously built the candidate from the raw PR head, so a head behind main failed for reasons main already fixed (observed on #127770: 59 commits behind, hitting the Unknown-model defect fixed by #127952). GitHub's cached PR test merge cannot be the candidate either: it was observed 50 commits / 12 hours stale and never refreshed. The workflow now resolves the live refs/heads/main tip and merge base at dispatch, requires a main-targeting PR, and builds a deterministic local merge (merge-tree --merge-base + commit-tree with pinned identity/date) as the candidate; conflicts fail with a direct rebase message and there is no fallback to the raw head. Lane labels and docs now say the candidate is the PR merged onto main.
1446a61 to
ed843bd
Compare
… head (openclaw#127961) The Telegram Desktop proof previously built the candidate from the raw PR head, so a head behind main failed for reasons main already fixed (observed on openclaw#127770: 59 commits behind, hitting the Unknown-model defect fixed by openclaw#127952). GitHub's cached PR test merge cannot be the candidate either: it was observed 50 commits / 12 hours stale and never refreshed. The workflow now resolves the live refs/heads/main tip and merge base at dispatch, requires a main-targeting PR, and builds a deterministic local merge (merge-tree --merge-base + commit-tree with pinned identity/date) as the candidate; conflicts fail with a direct rebase message and there is no fallback to the raw head. Lane labels and docs now say the candidate is the PR merged onto main.
What Problem This Solves
Mantis Telegram Desktop Proofproved the raw PR head (pr.head.sha) against its merge base. A PR whose head is behindmainwas therefore proved on a tree that lacks fixes already landed onmain, and failed for reasons unrelated to the PR. Observed today on #127770 (head6544389d, 59 commits behindmain): its pdf-tool lane dies on the static-runtimeUnknown modeldefect that #127952 already fixed onmain— the proof could not say anything about the PR itself.A first iteration used GitHub's PR test merge (
pr.merge_commit_sha), but live evidence killed it: GitHub's test merge is lazily cached and does not refresh whenmainadvances. #127770's cached merge base was0978e27f— 50 commits / 12 hours behindmain, still missing the pdf fix — and repeatedpulls.getcalls never refreshed it (verified over ~15 minutes; live run 32581065979 exercised exactly that stale candidate: run 32581065979 came backOverall: blockedwith both lanes pinned to the stale pair — baseline0978e27f, candidate525b4ac2— and the pdf tool dying onUnknown modelin both, i.e. the proof said nothing about the PR).Why This Change Was Made
Mantis must prove what would actually land, on today's
main. The workflow now builds the candidate itself, deterministically:refs/heads/maintip; merge base via the compare API; PR must targetmain(a PR based on a stale topic branch can no longer be labeled "merged onto main" — this also removes the vacuous ancestor check). Fork approval still pins the exact untrusted head (approved_head_sha === pr.head.sha); the local merge only adds the trustedmainparent on top of those reviewed bytes.git merge-tree --write-tree --merge-base=<mergeBase> <mainTip> <head>+git commit-treewith fixed identity and the baseline committer date, so the candidate SHA is reproducible for the same (main, head) pair. Content conflicts (exit 1) fail with a direct "needs a rebase or merge" message; other git failures propagate as themselves.mergeablepolling loop and both stale-cache failure paths, the test-merge two-parents proof, and the baseline-ancestor-of-main compare. No fallback to the raw head — proving a stale tree is the bug.docs/concepts/mantis.mdsay the candidate is the PR merged ontomain— now literally true at dispatch time.User Impact
Maintainers dispatching Mantis on any open PR get a proof of the PR merged onto the
maintip resolved at dispatch, with a direct "rebase needed" message when the PR conflicts. Fork dispatch inputs are unchanged.Evidence
node scripts/run-vitest.mjs test/scripts/mantis-telegram-desktop-proof-workflow.test.ts test/scripts/mantis-build-telegram-desktop-proof-evidence.test.ts test/scripts/mantis-publish-pr-evidence.test.ts).node scripts/check-changed.mjsover the touched files (format, oxlint, tsgo, workflow guards) green; fresh structured review clean.963fafbb+ feat(pdf): add explicit OpenAI native document opt-in #127770 head6544389dproduced identical candidate SHA8698bf2b2456ab7049912d289f29c5d582406dabboth times.963fafbb; candidate was built in CI as8698bf2b— byte-identical to the SHA predicted by the local determinism check. Neither lane hitUnknown model; the verdict now differentiates on the PR itself (baselinepassvia extraction fallback, candidatefailon a malformed-JSON pdf tool response in its nativeinput_filepath — a real finding posted on feat(pdf): add explicit OpenAI native document opt-in #127770).