[Bug]: gt doctor --fix for lifecycle-hygiene can never succeed (gt mail delete lacks the --force it tells you to use)
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
gt doctor --fix's lifecycle-hygiene check reports the identical warning before and after --fix, with no error shown even under -v.
Root cause chain — internal/doctor/lifecycle_check.go, LifecycleHygieneCheck.Fix():
for _, msg := range c.staleMessages {
cmd := exec.Command("gt", "mail", "delete", msg.ID)
...
}- Stale lifecycle messages live in deacon's inbox by definition (that's what
checkDeaconInboxscans).gt mail delete <id>refuses when the caller isn't the message's assignee:Since$ gt mail delete hq-wisp-q34 Error: hq-wisp-q34: cannot close hq-wisp-q34: assignee is "deacon/", actor is "mayor"; reclaim or use --force to overridegt doctor --fixis normally run by an operator/mayor, not deacon itself, this is the common case, not an edge case. - The suggested override doesn't exist:
$ gt mail delete hq-wisp-q34 --force Error: unknown flag: --forcegt mail delete --helpconfirms only-h/--help— no--force, no--identity. There's currently no CLI way to delete another identity's mail. Fix()'s error is swallowed somewhere before the CLI output — the check just re-reports the same warning, with no error surfaced even with-v. A silently-failed fix looks identical to a fix that was never attempted.
Expected Behavior
gt doctor --fix should actually clear stale lifecycle messages in deacon's inbox when run by any operator identity, and should surface an error if the fix genuinely fails.
SDK Version I encountered this issue in
gt version: dev (built from current main at time of report)
Steps To Reproduce
- Have a stale
LIFECYCLE:-subject message in deacon's inbox. - Run
gt doctoras any identity other than deacon (e.g. mayor) — reportslifecycle-hygiene: Found N stale lifecycle message(s) in deacon inbox. - Run
gt doctor --fix— identical warning reported again, nothing changes. - Run
gt mail delete <id>directly — reproduces the assignee/actor mismatch error, confirming the root cause.
Filled out the Steps to Reproduce section?
- I have entered valid steps to reproduce my issue or have attached a minimally reproducible case in code that shows my issue happening; and understand that without this my issue will be flagged as invalid and closed after 30 days.
Anything else?
Workaround found: bd close <id> --force on the underlying bead works and clears the check.
Suggested fix: either give gt mail delete the --force override its own error message already promises (and have Fix() use it), or have Fix() act with the deacon identity explicitly. Separately, Fix() errors should be surfaced in gt doctor --fix output rather than silently re-showing the original warning.
Tracked internally as gt-nkf.
Source: gastownhall/gastown