review/start can disagree with turn/started turn.id during review lifecycle
What issue are you seeing?
The review lifecycle can report two different turn IDs for what appears to be the same review turn.
In particular, during review/start:
review/startreturnsresponse.turn.id = Aturn/startedfor the review can arrive withturn.id = B- but later lifecycle events such as
item/completedforexitedReviewModeandturn/completedare still associated withA
That means clients cannot safely treat turn/started.turn.id as the sole authoritative review turn ID.
This also appears to affect persisted/history views of the review turn. If the review runs a command or tool call, the execution item can end up associated with the child review turn instead of the parent review turn that review/start returned.
The issue matters for both inline review and detached review:
- inline review: the
review/startturn ID andturn/startedturn ID can diverge - detached review: the review thread is detached correctly, but clients still need a single authoritative turn ID within that detached thread
What steps can reproduce the bug?
Using app-server v2 APIs / notifications:
- Start a thread.
- Call
review/startwithdelivery: inline. - Record
review/start.response.turn.id. - Observe the subsequent
turn/startednotification for that review. - In some cases,
turn/started.turn.iddiffers fromreview/start.response.turn.id. - Observe later review lifecycle notifications such as:
item/completedcontainingexitedReviewModeturn/completed
- Those later events are still associated with the
review/startturn ID, not theturn/startedone.
A stronger repro is a review that performs a command/tool call:
- Start a thread with persisted extended history enabled.
- Call
review/startwith a custom review prompt that triggers a shell/tool call. - Wait for the review to finish.
- Call
thread/read(includeTurns=true). - The command/tool execution item may not be attached to the same review turn returned by
review/start.
What is the expected behavior?
A review should have one authoritative turn ID for its entire lifecycle.
For both inline and detached review, the following should all agree on the same turn ID:
review/start.response.turn.idturn/started.turn.id- review
item/*notifications such asenteredReviewMode/exitedReviewMode turn/completed- persisted/history views such as
thread/read(includeTurns=true)
Additional information
I searched for an existing public issue but did not find a clear duplicate.
From tracing the flow locally, the underlying problem seems to be that review has a parent review turn and a child review session, and child events can leak the child session turn ID even though the review lifecycle is completed on the parent turn.
I have a local analysis/fix branch based on current main (yuhuan417:fix/review-turn-id-consistency) if a maintainer wants a concrete patch reference, but I am intentionally opening the issue first because the contribution guide asks for discussion/invitation before opening an external PR.