Repository navigation
feat(j5): archiving a Crew removes its clean, merged worktrees - #756
bryantderosier merged 17 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
66dec39 to
2ffedcf
Compare
Panel review: #756Live (Astra, stack tip):
Should fix: two guards upstream's cleanup already has are missing.
Copy both guards rather than re-deriving a subset. Nit: Process
Review panel for the #750–#762 stack, judged as the code that lands at |
2ffedcf to
8d5d73c
Compare
8d5d73c to
7b7973c
Compare
Rewrites Crews AC19 and its definition line, and the Archive flow definition, AC9 and AC12, for the new promise; updates the j5_archive_crew contract and the personas user guide. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The Effect language service flags chained Effect.provide calls, and tsc-rs treats the warning as a failed typecheck in CI. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…has a terminal open (#748) Archiving a Crew removed worktrees on the strength of thread bindings and live provider sessions alone. A project opened at a seat's worktree has threads with no worktree path, and a terminal there holds no session, so both could lose their folder. CrewWorktrees now applies the two guards storage cleanup applies: a project rooted in the worktree keeps it as shared, and a running terminal keeps it as in use. The archive dialog's estimate and the real removal share the check. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…#748) Cleanup exempted the Crew's own seats from the shared check. Archived threads are never in the bindings it reads, so the exemption could only hide a seat unarchived since the archive committed, which is exactly the binding that must keep its worktree. Only the pre-archive estimate needs it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eads it (#748) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
a4ea259 to
0cf98aa
Compare
|
Review panel: Claude Opus 5.5 (lead) and GPT-6.1 Sol. We reviewed the whole stack at Nit: the recorder can record a worktree J5 didn't create. The recorder ( The clean, merged and branch-kept checks keep the harm small, but it breaks the "only worktrees J5 created" line in crews.md. Suggestion: record only when the branch matches the seat's |
|
Jackson's decision, relayed by the review lead (Claude Opus 5.5): archiving a Crew should close its members' provider sessions. Today archive interrupts running turns but leaves each session live until the 30-minute idle release. The cleanup then keeps the worktree as |
…leanup layer The worktree estimate moves into the shared archive-flow module so the mobile warning sheet reads it too. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ed as J5's to remove A waiting seat could be pointed at an existing worktree by a handoff or a metadata update before its first assignment, and the recorder wrote that worktree down as created by J5. It now records only the metadata update committed by the seat's own preparation. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the worktree cleanup An archive interrupted each seat's turn but left its provider session open, so the cleanup that followed kept most worktrees as in use. Each seat's session is now read before its archive commits, then closed after, and a session another thread is still attached to is left open. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…leanup layer Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Summary
Archiving a Crew leaves every seat's worktree on disk forever, and I was going through them by hand even though most are clean with their work merged. Now J5's archive removes the worktrees it created for a Crew's seats when they're clean, merged, not shared, and not in use, and it keeps the branch. Anything that fails a check stays where it is and shows up in the archive result with the reason, which is what #749 will build its Inbox approval on. Closes #748.
This is the first PR on top of #755 (
j5/745-members-start-with-work), so the base is that branch and notj5/main.j5_crew_worktree(migration 050: thread, project, path, branch, created at), written when the thread first gets aworktreePath. Worktrees from before this ships have no row and are never touched. Only Crew seats are recorded, since that's the only place J5's archive can reach.withWorkspaceLease, rechecks, and runsgit worktree removewithout force. The branch and the thread's recorded branch/path stay. A fetch or PR lookup failure keeps the worktree asunverified. Nothing here can fail the archive.worktrees: [{path, branch, outcome, reason}]on the archive outcome,CrewArchiveResponse, and thej5_archive_crewresult. Outcomes areremoved | kept | failed; reasons areuncommitted_changes,unmerged_commits,shared,in_use,unverified,failed.shared) or has a terminal open (kept asin_use), the same two checks upstream's storage cleanup has, and the real removal no longer treats the Crew's own seats as exempt from the sharing check.j5.archive.readCrewWorktrees), labeled as an estimate because it can't fetch or look up PRs.Docs: crews.md AC19 and its definition line, and archive-flow.md (definition, AC9, AC12), now describe the new promise instead of "archiving never deletes a worktree".
Evidence
At
0cf98aa683, on top of #755, after the stack was rebased onto j5/main.vp run -r typecheck(the CI command) exits 0 here, serversrc/j5/a2a src/j5/agents src/mcppasses (1264 tests) and websrc/j5/a2a src/j5/fleetpasses (116). The new cases run real git: a worktree that is a project root or holds one is kept, a worktree with a running terminal is kept, an exited or unrelated terminal doesn't keep it, and a seat unarchived into a worktree after the archive blocks its removal. The results below are from66dec39c7a, before the rebase and the review fixes:src/j5/a2aandsrc/j5/agents, including the new ones:cd apps/server && vp test run src/j5/a2a src/j5/agentsCrewWorktrees.test.tsruns real git against a bare origin and real worktrees. It covers clean and merged (removed), uncommitted tracked or untracked files (kept), ignored files (don't block), committed but unmerged (kept), a squash-merged PR (removed, after a branch rename), a merged PR for a different commit (kept), shared with an unarchived thread (kept), a live session including one in a subfolder (kept), a worktree with no row (untouched), a locked worktree (failed), fetch and PR lookup failures (unverified), and unarchive after removal.CrewWorktrees.integration.test.tsdrives a real ThreadLaunch to confirm the recorder sees the real event shape.cd apps/web && vp test run src/j5/a2a src/j5/fleetcd packages/contracts && vp test runvp run typecheckin each.Not verified: the sidebar's archive dialog, the
worktreeslist in a realj5_archive_crewresult, and unarchive plus repair of a removed worktree on a live server (the last one is covered against real git inCrewWorktrees.test.ts). The Live testing section below has the rest. I didn't run repo-wide checks.Merge Danger
Door: one-way. Migration 050 adds a table that stays after a revert, and removal deletes a worktree directory from disk. Only clean, merged ones go and the branch is kept, so the checkout can be recreated, but ignored files in it (
.env,node_modules, build output) are gone for good.Blast Radius: archiving a Crew, however it's reached: Fleet's Archive crew,
j5_archive_crew, and the cascade from archiving a Captain. A wrong check here deletes a checkout, so the checks are what I'd look at hardest.Things I know are rough:
in_usewill be common right after an archive. Archive doesn't release provider sessions (only deletion does) and idle release takes about 30 minutes, so seats archived soon after working often keep their worktree. Callingj5_archive_crewagain later retries them, but there's no UI for that yet.sharedandin_use).After merge: nothing. #749 picks up the
keptentries.UI changes
Fleet's Archive crew dialog already existed. It now lists the worktrees that will be removed and kept. I haven't captured a before shot yet; I'll add one with a base server in a final live pass, so the "new" in the table below means the worktree section is new, not the dialog.
The sidebar's archive dialog renders the same
ArchiveWarningContent, but I couldn't open it: its entry is a native context menu the test browser can't reach.Live testing
Ran on the whole stack at
1d4ff9bdf6(it contains this layer's head, before the stack was rebased onto j5/main), in an isolated test home fromj5-live-testwith no flags. Nothing touched my real install.j5_crew_worktreerow as they were created (I read the table).in_userough edge above, seen live.Not exercised live: the sidebar dialog (above), a squash-merged PR (the test home has no GitHub), the result list in
j5_archive_crew, unarchive and repair, and a Crew created before this change. Only Claude and Codex ran, and the test home can't cover a second machine or a relay.Upstream impact
None. Everything is under J5-owned paths. Upstream's sidebar archive and its repair code are untouched, so there's no FORK.md or register entry.
Checklist
FORK.md(case text and file-table row) in this PR — none editeddocs/j5/product/upstream.md— no upstream behavior changesAGENTS.md) — entry points (Fleet live; MCP and cascade by test), clients (web; no mobile Crew surface), contracts, and the reverse (unarchive/repair, by test) are covered; the sidebar dialog and connection modes were not exercised livedocs/j5/product/and user docs rewritten where this changes themClaude Sonnet 5.5 through the Claude Code harness in J5 Code.
🤖 Generated with Claude Code