You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
propose_crew and request_crew_member silently replay the first proposal when a client_request_id is reused #316
propose_crew and request_crew_member return the first proposal when a client_request_id is reused with different arguments. This is the same silent-replay flaw #181 fixes for spawn_agent.
Where it breaks
propose_crew:AgentCrewProposalService.create does INSERT OR IGNORE and returns { status: "existing" } (apps/server/src/j5/a2a/AgentCrewProposalService.ts ~202, ~248). CrewProposalService.propose then returns the first proposal whatever the new brief, name, or seats are.
request_crew_member: looks up the proposal by key and returns it without comparing the requested seat (CrewProposalService.ts, "A replayed request finds its proposal before anything is checked").
The caller gets a success response naming a proposal that doesn't match what it asked for.
stop_agent, stop_crew, archive_crew: reusing a key on a different thread raises OrchestratorCommandIdConflictError through canReplayCommandReceipt (Orchestrator.ts ~178, used ~7852). The handler reports it as a state error.
join_squadron: placement commands store a request_fingerprint and fail with PlacementCommandConflictError (PlacementService.ts ~490).
What should change
On replay, compare the stored proposal's brief, display name, and seats (for request_crew_member, the requested seat) with the new request. On a mismatch, refuse with a state error that names the original proposal and tells the caller to use a fresh client_request_id.
A deeper check found a second, related case in stop_agent and stop_crew. Line numbers are on j5/main at 2cf4ad7a83.
Same key, same target, newer run: silent.stop_agent derives the run.interrupt command id from the key (handlers.ts ~915). If the key is reused after the target starts a new run, the command id on the same thread replays the old receipt through canReplayCommandReceipt (Orchestrator.ts ~7852). The call reports interrupt_requested, and the new run keeps going. stop_crew does the same per seat (handlers.ts ~946).
Different target: loud. Reusing the key on a different target raises OrchestratorCommandIdConflictError.
archive_crew and join_squadron: safe. Details are in the issue body.
This is a different mechanism from the proposal replay above: it's a stale receipt on the same thread, not an ignored payload. It could be fixed here or split into its own issue.
The main bug here is fixed. #660 (50e5f28463) and #661 make propose_crew and request_crew_member refuse a reused client_request_id with different arguments, and an identical retry still replays. That's what this issue asked for, so closing.
One leftover from the 2026-09-25 comment: j5_stop_crew still derives each seat's interrupt command id from the reused key (handlers.ts around line 1094). So reusing a key after a seat starts a new run replays the old receipt and reports "interrupted" while the new run keeps going. (j5_stop_agent was retired in #982.) It needs an agent to reuse a request key across runs, which is rare, so I'm not tracking it unless we actually see it happen.
Activity
Jacksondr5 commentedon Sep 25, 2026
A deeper check found a second, related case in
stop_agentandstop_crew. Line numbers are onj5/mainat2cf4ad7a83.stop_agentderives therun.interruptcommand id from the key (handlers.ts~915). If the key is reused after the target starts a new run, the command id on the same thread replays the old receipt throughcanReplayCommandReceipt(Orchestrator.ts~7852). The call reportsinterrupt_requested, and the new run keeps going.stop_crewdoes the same per seat (handlers.ts~946).OrchestratorCommandIdConflictError.archive_crewandjoin_squadron: safe. Details are in the issue body.This is a different mechanism from the proposal replay above: it's a stale receipt on the same thread, not an ignored payload. It could be fixed here or split into its own issue.
bryantderosier commentedon Dec 1, 2026
The main bug here is fixed. #660 (
50e5f28463) and #661 makepropose_crewandrequest_crew_memberrefuse a reusedclient_request_idwith different arguments, and an identical retry still replays. That's what this issue asked for, so closing.One leftover from the 2026-09-25 comment:
j5_stop_crewstill derives each seat's interrupt command id from the reused key (handlers.tsaround line 1094). So reusing a key after a seat starts a new run replays the old receipt and reports "interrupted" while the new run keeps going. (j5_stop_agentwas retired in #982.) It needs an agent to reuse a request key across runs, which is rare, so I'm not tracking it unless we actually see it happen.