Skip to content

feat(crews): seats ask their Captain instead of the person - #348

Merged
bryantderosier merged 2 commits into
j5/mainfrom
j5/crews-seats-ask-captain
Sep 29, 2026
Merged

bryantderosier merged 2 commits into
j5/mainfrom
j5/crews-seats-ask-captain

Conversation

@bryantderosier

Copy link
Copy Markdown
Collaborator

Problem

A Crew seat that raised a native question (Claude's AskUserQuestion, Codex's request_user_input) blocked in its own thread, which nobody watches. Jackson's decision on #325 is that seats don't get native question tools: a seat asks its Captain, and the Captain answers or asks the person inline. #308/#309 were slimmed to seat approvals on the same assumption, so without this a seat question stalls the Crew.

What I changed

  • apps/server/src/j5/a2a/crewSeatRuntime.ts → makeCrewSeatLookup / withCrewSeatQuestions, J5-owned and wired in through agentPersonaRuntime.ts (already behind upstream RuntimePolicy.ts):
    • A thread created as an agent or MCP thread that sits in a live Crew gets crewSeat: true.
    • It also gets a seat rule appended to agentPersonaInstructions: "questions go to your Captain" with send_message and expect_reply=true.
    • A store that can't be read logs a warning and treats the thread as no seat.
  • Claude: ClaudeAdapterV2.ts → openQuery passes disallowedTools: ["AskUserQuestion"] for seats only.
  • Codex: CodexAdapterV2.ts → codexThreadRuntimeParams adds J5_CODEX_CREW_SEAT_CONFIG to the thread config next to mcp_servers: "features.default_mode_request_user_input": false and "tools.experimental_request_user_input.enabled": false. They're dotted keys, so the user's own [features]/[tools] tables stay intact.
  • ProviderAdapter.ts: an optional crewSeat flag on the runtime policy.
  • spawnIds.ts → spawnFirstTurnText: the seat brief's <crew_collaboration> says to ask the Captain, never the person or a native question tool.
  • Other harnesses (Cursor, Grok, OpenCode, Pi, ACP registry agents, Antigravity): not supported on seats yet. Only the brief's instruction applies, and crews.md records that per harness.
  • FORK.md case 47 covers the three upstream adapter appends and the policy field, with file-table rows.
  • Docs: crews.md (Definition, AC9, History) and the Crews section of docs/user/personas.md.

Why this shape

  • Seat detection lives in the runtime-policy resolver. That resolver already hands J5 persona instructions to both adapters, so each adapter needs only one line. The rule text is appended after Codex's Default-mode "ask the user directly" text, so the upstream developer instructions stay untouched.
  • Codex keys: I found them in the Codex binary and confirmed them against a live app-server; see Verification.

Invariants

  • Only live-Crew seat threads lose native question tools. Captains and every other thread keep them.
  • The seat rule and the Codex config come from one J5 helper, so a key change is one edit (J5_CODEX_CREW_SEAT_CONFIG).

Surfaces

Surface Decision
Entry points (chat, Settings, command palette, keybinding) Unaffected; this is how seats run.
Clients (web, desktop, mobile) Unaffected.
Providers Claude and Codex seats lose native question tools. Others are not supported on seats yet; the brief instruction applies.
Contracts (packages/contracts) Unaffected.
Reverse states A seat's Crew retiring makes it an ordinary thread again, with its question tools back.
Connection modes (local, remote, tunnel) Unaffected.
Upstream files / FORK.md ClaudeAdapterV2.ts, CodexAdapterV2.ts, ProviderAdapter.ts (plus the Claude adapter test), recorded as case 47.
Docs Changed: crews.md, personas.md.

Out of scope

  • Claude seats can still use ExitPlanMode, which isn't a question tool. Its plan approval would still be asked in the seat's own thread.
  • Merge note: spawnBriefWithoutCrewContext (touched here to ignore <crew_collaboration> in brief comparisons) is deleted by fix(crews): a proposal launches once and reports every seat #313. Whichever of the two stacks lands second drops this hunk.

Upgrade and data

None. Existing seats pick up the rule on their next session start.

Verification

  • apps/server, apps/web, and packages/contracts typecheck (exit 0). vp test run apps/server/src/j5 apps/web/src/j5 apps/server/src/orchestration-v2/Adapters: 1,564 passed, 1 skipped. Lint is clean.
  • New tests:
    • A seat is flagged and gets the rule; a Captain, a person's thread, and a seat in an archived Crew are not.
    • A seat's Codex config carries both keys and a Captain's doesn't.
    • The Claude adapter withholds AskUserQuestion only from a seat. This test fails with the adapter line removed.
    • The seat brief wording.
  • Live Codex check: Codex CLI 0.155.1, codex app-server driven over stdio the way the adapter does, a Default-mode collaboration setting, and a throwaway CODEX_HOME. The prompt asked the model to ask one question.
Thread config Question request (item/tool/requestUserInput)
Question feature forced on 1
Feature forced on + tools.experimental_request_user_input.enabled=false 0
The seat fragment 0
The seat fragment in Plan mode 0

The model also lists a request_user_input_async tool, but it never raised a request in any run, so the fragment covers what actually blocks.

Review focus

  • The seat lookup in crewSeatRuntime.ts: whether "agent/MCP-created thread in a live Crew" is the right test, and that it fails open (no seat) when the store can't be read.

Closes #325

Claude Opus 5.5 via Claude Code in J5 Code

🤖 Generated with Claude Code

@bryantderosier bryantderosier added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. jackson-direct Taken by Jackson + Astra outside the fleet methodology; lanes never staff these labels Sep 28, 2026
@bryantderosier bryantderosier self-assigned this Sep 28, 2026
@bryantderosier
bryantderosier added this pull request to stack #310 September 28, 2026 15:41
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration

Configuration used: Repository: Jacksondr5/j5code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 9f6ed157-d3ba-403c-b45e-9713efb7217b


Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size:L 100-499 effective changed lines (test files excluded in mixed PRs). label Sep 28, 2026
Base automatically changed from j5/crew-requests-web to j5/main September 28, 2026 17:18
A Crew seat runs out of the person's view, so a native question it raises
waits unseen in its own thread. Per Jackson's decision on #325, a seat that
needs a decision asks its Captain with send_message; the Captain answers or
asks the person inline in the Captain thread.

The J5 runtime-policy resolver marks a live seat's policy with crewSeat and
appends the ask-your-Captain rule to its standing instructions. Claude seats
run with disallowedTools AskUserQuestion; Codex seats get
features.default_mode_request_user_input = false and
tools.experimental_request_user_input.enabled = false in their thread config.
The seat brief says the same for every harness. Recorded as FORK.md case 47.

Closes #325

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@bryantderosier
bryantderosier force-pushed the j5/crews-seats-ask-captain branch from fae11c4 to 353125e Compare September 28, 2026 17:18
Conflict: #313 removed spawnBriefWithoutCrewContext along with the retry comparison that used it, so this branch's edits to it and its tests are dropped.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@bryantderosier
bryantderosier merged commit 8a3432f into j5/main Sep 29, 2026
29 checks passed
@bryantderosier
bryantderosier deleted the j5/crews-seats-ask-captain branch September 29, 2026 14:31
bryantderosier added a commit that referenced this pull request Sep 29, 2026
Conflicts: FORK.md takes main's proposal-flow paragraph with this branch's Full-access default for custom seats; crews.md keeps this branch's Definition sentence and adds #348's rule that seats ask their Captain, and keeps both 2026-09-26 History lines.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jackson-direct Taken by Jackson + Astra outside the fleet methodology; lanes never staff these size:L 100-499 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.

Crew seats ask their Captain, not the person: no native question tools on seats

1 participant