You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A failed proposal-to-Crew attach write no longer strands the recorded Crew #221
A roster launch records its Crew before any seat spawns so that a failure leaves nothing a Crew record does not know about. The link from the proposal back to that record is written with Effect.ignore (apps/server/src/j5/a2a/CrewProposalService.ts:295-296, the onRecorded callback into proposals.attachInstance). If that one write fails and the spawn then fails too, the gate reopens with crewInstanceId null. A decline on that reopened gate skips Crew cleanup (CrewProposalService.ts:562), leaving a live Crew record and any seat threads the failed launch created with no gate that can retire them.
What should change:
Stop ignoring the attach failure. The instance id is deterministic from the proposal, so a later read can recover the link: when a roster proposal is resolved or declined with crewInstanceId null, look up the Crew by its deterministic id before deciding there is nothing to clean up.
If the record exists but the link is missing and cannot be restored, refuse to launch further seats and reopen the gate with an error naming the Crew, rather than proceeding with an untraceable partial launch.
The boot sweep that settles lost claims (CrewProposalService.ts:691 onward) applies the same recovery.
Tests to ship (CrewProposalService.test.ts):
the attach write fails after the Crew record is durable and the spawn then fails: decline retires the recorded Crew and archives its seat threads
the same state at boot: the sweep recovers the link or retires the Crew
a genuine database error on attach remains retryable and does not lose the link permanently
Done when no sequence of a failed attach write and a failed spawn can leave a Crew record or seat thread that a decline or the boot sweep cannot find.
Related criteria: crews.md AC7.
Independent of #220, but both touch the launch recovery path in CrewProposalService and CrewLaunchService; land whichever is ready first and rebase the other. Soft: land before #223, so a refused launch always has a proposal linked to its recorded Crew.
Activity