Skip to content

fix(j5): archiving a Crew is gated on the Owner's scope in the client - #912

Merged
bryantderosier merged 2 commits into
j5/mainfrom
fix/stack-771-followups
Nov 3, 2026
Merged

bryantderosier merged 2 commits into
j5/mainfrom
fix/stack-771-followups

Conversation

@bryantderosier

@bryantderosier bryantderosier commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The server only lets an Owner archive a Crew, but the client guarded Archive crew with the Operate scope. A Collaborator with Operate saw an enabled Archive crew button on Fleet and was refused when they clicked it. I said I'd fix this together with #762's cleanup item, and #762 only got the cleanup answer. This moves archiveCrew to the same scope (settings:write, which only an Owner's device holds) in the contract and in the server's own scope table, and the Fleet button now reads Archive crew's own permission instead of borrowing Stop crew's.

I also went back through every review comment on the #750–#762 and #770 stack (stack pingdotgg#771) for anything dropped. Everything else was either fixed in the later commits or deliberately declined with a reason in the thread. The one other miss was agent-tools.md, which still said "An accepted proposal is not checked again". The panel pointed out that's only true of a retry; preview and approval do check it. #762 said it would be fixed with the models PR and it wasn't. It now says "A retry of a proposal already accepted is not checked again."

Evidence

  • The scope assertions cover the change. clientRpcPermissions.test.ts now asserts archiveCrew and answerCrewWorktreeCleanup both need settings:write, and actions.test.ts moves archiveCrew into the Owner-only group, where an Operate-only session gets it as unavailable.
    cd packages/contracts && vp test run src/j5/clientRpcPermissions.test.ts (4 passed)
    cd packages/client-runtime && vp test run src/j5/actions.test.ts (7 passed)
  • wsRpc.test.ts keeps the server's table and the contract in step and now calls archive through an Owner client.
    cd apps/server && vp test run src/j5/wsRpc.test.ts src/j5/a2a/ClientActionsService.test.ts (12 passed)
  • Fleet tests still pass: cd apps/web && vp test run src/j5/fleet (44 passed).
  • vp run typecheck is clean (0 errors) in packages/contracts, packages/client-runtime and apps/web.

Not verified: I didn't open Fleet in a browser as a Collaborator, so the disabled button is covered by the permission tests only. vp run check:changed passes format and lint here, but typecheck, knip and test fail in files this change doesn't touch (the server's CrewWorktrees.test.ts, knip's config loading, and other agents' copies under .claude/worktrees), so I ran the affected packages directly. No full suite.

Merge Danger

Door: two-way. A scope constant, a button's gating and one doc line, with no data or migration, so a revert undoes it.

Blast Radius: the Archive crew button on Fleet, for people whose device holds Operate but not Owner. Owners see no change. The server already refused everyone else.

After merge: nothing.

Checklist

  • One concern: the description has no "also" (the doc line is the same stack-review cleanup, one sentence)
  • Tests cover the changed behavior (backend changes ship with focused tests)
  • UI changes: before/after screenshots above, and a video for motion or interaction (a button's enabled state for a non-Owner only; no screenshots)
  • Live testing: the section above says what ran live and what did not (nothing ran live)
  • Upstream-owned files: each one is recorded in FORK.md (none edited; all paths are J5-owned)
  • Upstream product: any change to what upstream's product does has a human decision linked above and a register entry in docs/j5/product/upstream.md (none)
  • Surfaces: entry points, clients, providers, contracts, reverse states, connection modes (Fleet is the only Archive crew button; mobile has none, and the sidebar's Captain archive goes through upstream's own admission check)
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them

🤖 Generated with Claude Code

…, and one docs line is accurate

The server lets only an Owner archive a Crew, but the client guarded it with the
Operate scope, so a Collaborator saw an enabled Archive crew button and was then
refused. It now takes the same scope as answering a worktree cleanup, and the
Fleet button reads its own command's permission instead of Stop crew's.

agent-tools.md also said an accepted proposal is never checked again, which is
only true of a retry; preview and approval check it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Nov 3, 2026 2:12am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Nov 3, 2026
@github-actions github-actions Bot added the size:S 10-29 effective changed lines (test files excluded in mixed PRs). label Nov 3, 2026
@Jacksondr5

Copy link
Copy Markdown
Owner

Review by Claude Opus 5.5 (single reviewer). The change is right, but it's only half of the scope move, and Test Server 1 fails 4 tests in apps/server/src/j5/wsRpc.test.ts.

clientRpcPermissions.ts now guards archiveCrew with settings:write, but the server's own list still has it as Operate (apps/server/src/j5/a2a/clientActionRpc.ts:47). The first failure is the test that keeps the two in step:

j5.crews.archive: expected 'settings:write' to equal 'orchestration:operate'

The other three are the read-only refusal test and two handler tests that call archive as an operator.

The fix is the same shape as a2c758518c, which moved answerCrewWorktreeCleanup:

  • Change clientActionRpc.ts:47 to AuthSettingsWriteScope.
  • In wsRpc.test.ts, add archiveCrew to the settings-scoped cases and call it through the Owner client (the handler tests at about lines 479 and 574).

The server tests weren't in the packages run for this PR, so cd apps/server && vp test run src/j5/wsRpc.test.ts is the one to add.

…Owner's scope

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@bryantderosier

Copy link
Copy Markdown
Collaborator Author

Good catch, I only ran the contract and client packages. Moved archiveCrew to settings:write in clientActionRpc.ts too, and wsRpc.test.ts now lists it with the settings-scoped cases and calls it through the Owner client. vp test run src/j5/wsRpc.test.ts passes (12 with the neighbouring service test).

@bryantderosier
bryantderosier merged commit 2487e42 into j5/main Nov 3, 2026
33 checks passed
@bryantderosier
bryantderosier deleted the fix/stack-771-followups branch November 3, 2026 12:17

This branch was successfully deployed

1 active deployment
Preview — 7a5c1c42 Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants