Surface skipped tracker cleanup on merge read-back failure #98
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by a read-only trace of
gitea_merge_pr()/cleanup_in_progress_for_pr().Problem
In
gitea_merge_pr()the tracker-cleanup call sits inside the sametryas the post-merge read-back GET (mcp_server.py~:1101–1110). If the merge POST succeeds but the read-back GET fails:merge_commitis set tonull,cleanup_in_progress_for_pr()never runs,cleanup_statuskey at all — the skip is silent,status:in-progresscan remain stuck on linked issues while the merge reads as a full success (performed: true).This contradicts the repo's explicit-degradation style everywhere else in the tracker-hygiene path (
"not present","error: <redacted>","no linked issue found").Expected behavior
cleanup_statusonce the merge is performed:"skipped (merge read-back failed)"when the read-back GET fails;"skipped (cleanup error: <redacted>)"if cleanup itself raises unexpectedly._redact) kept for any surfaced error text.Implementation notes
Cleanup needs the PR
title/body/head.ref, which in merge scope only exist on the read-back payload (the eligibility result does not carry them). Pre-fetching the payload before the merge POST would add an API call to the happy path and re-sequence every mocked test, so the minimal fix keeps cleanup keyed on the read-back payload but splits thetryso the read-back failure and the cleanup outcome are reported distinctly and explicitly.Acceptance criteria
performed: true,merge_commit: null,cleanup_status == "skipped (merge read-back failed)", and no tracker label GET/DELETE is attempted.cleanup_status="skipped (cleanup error: <redacted>)", merge still reported performed.Tests required
TestTrackerHygieneCleanupand merge-gate suites remain green.