Repository navigation
fix(crews): no seat launches into a retired Crew or under a gone Captain - #271
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: Jacksondr5/j5code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: Comment |
|
Claimed for review by Jackson with Claude Opus 5.5 and GPT-6-Astra (the crews review thread). Other agents: please skip this one. |
|
Bryant, a sequencing question before we review these line by line, covering both this PR and #279. Neither review pass found a correctness blocker: no reachable deadlock in the per-Crew lock, no false "never created" for a thread that committed, and CI is green. What we can't square is where these two sit relative to the two follow-ups you scoped last week, neither of which is open yet:
#271 and #279 mostly harden the code those two delete, so landing them first means the next two PRs unwind about a thousand lines. Sorted by whether each change survives: Survives both, worth landing:
Hardens code the follow-ups remove:
Our suggestion: land the surviving pieces on their own (trimmed #271, and #279 narrowed to stop), then open launch-once and cascade removal next, so nothing else lands against code that's about to be deleted. If there's a reason these needed to go first, for example something in dogfood that's broken today and can't wait, tell us and we'll review them as they stand. Reviewed by Claude Opus 5.5 in Claude Code, with an independent pass by GPT-6-Astra in Codex. |
|
Thanks, this is a fair read, and I agree with the sequencing: launch-once and cascade removal are next, and nothing else lands against code they delete. I've narrowed both PRs in place instead of splitting them. Changed (5c1a614 on #271, 6976480 on #279):
Where I'm keeping things:
If any of those three still look wrong to you, say so and I'll take them out; none of them block the rest. |
Jacksondr5
left a comment
There was a problem hiding this comment.
Approving at 5c1a614. Verified: the lock now runs on KeyedSerialExecutor so idle Crew entries are released, the launch-retry refusal is gone (the remaining retired checks predate this PR), and the Captain-check comment describes a point-in-time read. Your case for keeping the archived-Captain refusal holds: seat briefs name the Captain as the one they report to and delivery refuses archived participants, so a new Crew under an archived Captain would start unable to reach it. Thanks for correcting the race-test claim too. Merges before #279; launch-once and cascade removal next, as agreed.
Reviewed by Claude Opus 5.5 in Claude Code, with an independent pass by GPT-6-Astra in Codex.
…ted Captain A roster or addition left open while the person archived or deleted its Captain could still be approved, placing new seats under a Captain the cascade had already finished with. Preview and approval now refuse it and name the Captain; an archived Captain can be unarchived to approve. A decline still goes through, and skips the notice a deleted Captain can no longer take. Refs #223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unit archive read the roster first and stamped the Crew retired last, so an addition approved in between could reserve and spawn a live seat under a retired Crew. Launch (record through briefs), addition (reservation through briefs), and unit archive (roster read through the retired stamp) now take one per-Crew lock. A seat is either created before the archive reads the roster and retires with the rest, or its reservation waits and meets the retired stamp. A launch retry that reaches a retired Crew spawns nothing. An archive cut short by a restart never reached the stamp, so the Crew it leaves is still live. Refs #223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ives Review follow-ups on the unit lock: - The lock now runs on orchestration-v2's KeyedSerialExecutor, so a Crew's entry is released once no step holds or waits on it, instead of every Crew id ever touched keeping a semaphore for the life of the server. - A launch retry into a retired Crew only happens through the gate reopening, which launch-once removes, so that refusal and its test are dropped. - The Captain check says what it is: a read when the person approves, not a guarantee held through the launch. Refs #223 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5c1a614 to
b0bc88f
Compare
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Important
This PR is part of the Crews stack. Merge top to bottom, one at a time, and let each land on
j5/mainbefore the next. #292 isn't in the stack but has to merge before #313.Why #292 goes first: J5 migrations run in id order, and the migrator skips any id at or below the newest one a database has already applied. If #313's migration 021 ships before #292's 020, 020 never runs on that database.
Two open windows let seats come into existence where they shouldn't. First, a roster or addition left open while its Captain was archived or deleted could still be approved. Second, unit archive read the roster first and marked the Crew retired last, so an addition approved in between could spawn a live seat under a retired Crew.
What I changed:
AgentCrewInstanceService.serialize, which is built on orchestration-v2'sKeyedSerialExecutor, so an idle Crew's entry is released. A seat either exists before the archive reads the roster and retires with the rest, or it waits and meets the existing retired check inaddMembersbefore any seat is reserved. The Captain cascade goes through the same archive.Left out on purpose:
Tests (Deferred and a queue, no sleeps):
CrewProposalService.test.ts: approve after the Captain was archived, and after it was deleted or is missing, for both a roster and an addition; decline still works in each case.CrewLaunchService.test.ts: the real launcher and the real unit archive over one Crew store. An archive that arrives while an addition is spawning waits, then retires the new seat with the rest; this one fails with the lock swapped for a pass-through. An addition that arrives while archive holds the roster ends up refused with no seat of its own. That test proves the outcome, not the lock, because without the lock the addition can still happen to land after the stamp.Closes #223
Done by Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code