Found while working #211, pre-existing and unrelated to it. Not fixed there
because it changes orphan-release behaviour on the dispatch critical path.
In #githubOrphanRecoveryContext (src/orchestrator/factory.ts):
const dispatchCallActive = this.#dispatchInFlight.has(issueKey(lifecycle.issue))
#dispatchInFlight is not keyed by a bare issue key. dispatch() composes its
entries as:
const key = `${...(decision.issue)}:${dryRun ? 'dry-run' : 'live'}:${phase}`
so the lookup above compares a bare key against strings that always carry the
:dry-run|live: and :dispatch|escalation suffixes. It can never match.
dispatchCallActive is therefore always false, and the guard it feeds — meant
to stop the orphan reaper releasing a lifecycle while a dispatch call for that
issue is still in flight — is inert.
The caller does verify provider status, open-PR absence, a second roster read and
the lifecycle lease before releasing an orphan-shaped row, so this is a missing
layer rather than an open hole. But it is a safety check that reads as active and
is not, which is worth either fixing or deleting.
Whichever way it goes, the fix should compose the same key dispatch() does
rather than reconstructing it by hand, so the two cannot drift apart again.
Found while working #211, pre-existing and unrelated to it. Not fixed there
because it changes orphan-release behaviour on the dispatch critical path.
In
#githubOrphanRecoveryContext(src/orchestrator/factory.ts):#dispatchInFlightis not keyed by a bare issue key.dispatch()composes itsentries as:
so the lookup above compares a bare key against strings that always carry the
:dry-run|live:and:dispatch|escalationsuffixes. It can never match.dispatchCallActiveis therefore alwaysfalse, and the guard it feeds — meantto stop the orphan reaper releasing a lifecycle while a dispatch call for that
issue is still in flight — is inert.
The caller does verify provider status, open-PR absence, a second roster read and
the lifecycle lease before releasing an orphan-shaped row, so this is a missing
layer rather than an open hole. But it is a safety check that reads as active and
is not, which is worth either fixing or deleting.
Whichever way it goes, the fix should compose the same key
dispatch()doesrather than reconstructing it by hand, so the two cannot drift apart again.