fix(mock_concurrent_mma): route sprints on prompt content not session_id
The prior session_id-based routing (added in 635ca552) had two bugs:
1. call_n literal matching (== 2, == 3) is fragile to test ordering:
the file-based counter persists across tests in the same session,
so call_n != 2 for the 1st sprint if a prior test ran.
2. session_id='mock-sprint-A' means 'this is a follow-up call after
the 1st sprint returned mock-sprint-A', so the response should be
sprint-B (2nd track tickets), not sprint-A. The prior code routed
this to sprint-A, which means track-b's worker has stream id
'ticket-A-1' (not 'ticket-B-1') and the test's 'ticket-B-1' poll
never finds it.
Fix: route on prompt content. The production's conductor_tech_lead
passes the track_brief (containing 'Track A Goal' or 'Track B Goal')
in the user_message. The prompt is NOT empty in --resume mode (the
gemini_cli_adapter passes the prompt as the first turn of the resumed
session).
The prompt-based routing is the original pre-635ca552 design and
works correctly for any number of tracks (A, B, C) without depending
on call ordering.
Verified: 3 consecutive test runs PASS (7.81s, 8.90s, 7.95s) after
the fix. The 'Worker from Track B never appeared' flakiness is gone.
This commit is contained in:
@@ -67,23 +67,19 @@ def main() -> None:
|
||||
return
|
||||
|
||||
# 2. Sprint Planning (different tickets for different tracks)
|
||||
# The gemini_cli_adapter reuses the session_id from the epic call
|
||||
# (mock-epic) for all subsequent calls. We use the global call counter
|
||||
# to cycle through Track A (call #2) and Track B (call #3).
|
||||
if session_id == "mock-epic" and call_n == 2:
|
||||
_emit_sprint_ticket("A")
|
||||
return
|
||||
if session_id == "mock-epic" and call_n == 3:
|
||||
_emit_sprint_ticket("B")
|
||||
return
|
||||
if "mock-sprint-A" in session_id:
|
||||
_emit_sprint_ticket("A")
|
||||
return
|
||||
if "mock-sprint-B" in session_id:
|
||||
_emit_sprint_ticket("B")
|
||||
return
|
||||
# Route on prompt content (the production passes the track_brief which
|
||||
# contains "Track A" or "Track B"). The prior session_id-based routing was
|
||||
# fragile because:
|
||||
# 1. The call_n counter is shared across tests in the same session, so
|
||||
# call_n != 2 for the 1st sprint if a prior test ran.
|
||||
# 2. session_id="mock-sprint-A" means "this is a follow-up call after
|
||||
# the 1st sprint returned mock-sprint-A", so the response should be
|
||||
# sprint-B (2nd track), not sprint-A.
|
||||
if 'generate the implementation tickets' in prompt:
|
||||
track_label = "A" if "Track A" in prompt else "B"
|
||||
if "Track A" in prompt: track_label = "A"
|
||||
elif "Track B" in prompt: track_label = "B"
|
||||
elif "Track C" in prompt: track_label = "C"
|
||||
else: track_label = "A"
|
||||
_emit_sprint_ticket(track_label)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user