Repository navigation
fix(crews): unit stop and archive finish over a seat that was never created - #279
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. |
|
Covered together with #271 in one comment, since the question is the same for both: #271 (comment) The short version for this PR: the unit-stop handling survives option A and is worth landing on its own. The unit-archive and Captain-cascade skipping hardens code your cascade-removal PR takes out, and the main case (a row left by a failed create) goes away when launch-once drops that row. Two smaller notes if it lands as is. Nothing reads the new Reviewed by Claude Opus 5.5 in Claude Code, with an independent pass by GPT-6-Astra in Codex. |
f035381 to
6976480
Compare
|
Replied on #271 for both PRs, since the question was the same: #271. The short version for this one: I dropped |
Jacksondr5
left a comment
There was a problem hiding this comment.
Approving at 6976480. neverCreatedSeats and the cascade test are gone, and the body now names the thread-committed-but-home-missing case it doesn't cover. You're right that unit archive keeps its never-created handling: archive_crew and the Fleet's Archive crew survive option A, and a restart mid-launch still leaves rows with no thread. The runtimeLayer.test.ts touch is the smaller cost than duplicating the upstream orchestrator wiring; recording it under #232 is the right place. Merges after #271.
Reviewed by Claude Opus 5.5 in Claude Code, with an independent pass by GPT-6-Astra in Codex.
…reated A launch records every seat's row before any seat thread exists, so a launch or addition that failed partway leaves rows with no thread. Unit archive, the Captain cascade, and unit stop all read every row as a live seat and failed on the first missing one: the Crew could not be retired, and a stop gave up before interrupting later running seats. A seat now counts as never created only when two absences agree: no home is registered for its deterministic thread id, and the projection store answers not-found for it. Both reads run under the Crew's unit lock, so no launch or addition is creating the seat meanwhile. Unit archive and stop pass such a seat by, report it as never_created, and finish on the seats that exist; the row stays on the retired roster. A store that cannot answer, or a home with no thread behind it, still fails loudly. The HTTP responses the apps decode carry these seats in a new optional neverCreatedSeats list rather than a new per-seat value, so older mobile builds still decode them. The agent-facing MCP results say never_created per seat. Refs #224 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ade tests Review follow-ups: - Nothing in the apps reads a never-created list, so the optional neverCreatedSeats field is dropped. The HTTP routes leave those seats out of members, which every client already decodes; the MCP results still say never_created per seat. - The Captain-cascade case is dropped because the cascade removal takes that code out. Unit archive keeps its never-created handling, since archive_crew and the Fleet's Archive crew survive as batch conveniences and a restart mid-launch still leaves rows with no thread. Refs #224 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6976480 to
bffa90e
Compare
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The sync replaced NodeSqliteClient.layerMemory() with NodeSqliteClient.layer({ filename: ":memory:" }); the Crew stop tests this branch adds still called the old one.
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.
A launch records every seat's row before any seat thread exists, so a launch or addition that failed partway leaves rows with no thread behind them. Unit stop and unit archive read each row as a live seat and failed on the first missing one: a stop gave up before it reached later seats that were still running, and the Crew couldn't be archived as a unit.
What I changed:
never_created, and still interrupts every running seat after it.archive_crewand the Fleet's Archive crew) skips such seats, reports them asnever_created, finishes on the seats that exist, and stamps the Crew retired. The row stays on the retired roster. Under the product(j5): decide what archive, unarchive, and settle mean for agents, Crews, and their children #254 ruling these doors stay as batch conveniences, and even with launch-once dropping failed-create rows, a restart mid-launch still leaves rows with no thread.members, so every client decodes what it gets. The agent-facing MCP results saynever_createdper seat.What this doesn't cover: a crash after a seat's thread commits but before its home registers still stops unit archive with a mismatch error. That's the loud failure I want there, since the seat exists, but it means not every partial Crew archives cleanly.
Tests:
ArchiveAgentService.test.ts:readFactsreturns null only when both the home and the thread are absent; an unreadable store and a home with no thread both fail.ArchiveCrewService.test.ts: the unit retires past a never-created seat and replays as already archived; a seat whose facts can't be read fails the unit and retires nothing.CrewStopService.test.ts: a missing seat ahead of a running one still lets the stop interrupt it; an unreadable seat or a homed seat with no thread fails the stop.CrewLaunchService.test.ts: with the real launcher, an addition reserves its seat, the spawn fails, and the unit archive still finishes.CrewArchiveHttp.test.ts,CrewStopHttp.test.ts: never-created seats are left out ofmembers.One upstream-file touch: the existing J5 Crew-stop block in
orchestration-v2/runtimeLayer.test.tsgains two mock lines (the lock and the home read). #232 already tracks recording that block in FORK.md.Stacked on #271.
Closes #224
Done by Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code