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
Think: TurnResult.message is the session leaf, not the message this turn produced #2264
TurnResult.message is documented as part of the wait-mode result, but _enrichTurnResult fills it from session.getLatestLeaf() after the turn queue has released. That is the newest message in the conversation, not the assistant message this turn produced.
After submitMessages + inspectSubmission, there is no message at all: ThinkSubmissionInspection has submissionId, status, error, timestamps — no message. A workflow that admitted the turn by submission id cannot tell which assistant message that turn wrote.
Environment
@cloudflare/think@0.17.0
runTurn({ mode: "wait" }) and submitMessages / inspectSubmission
The first result can be { status: "completed", message: undefined } because the leaf is already the second turn's user message. #2243 has the _enrichTurnResult / TurnQueue trace.
Reproduction (submit)
const{ submissionId }=awaitagent.submitMessages([userMessage],{idempotencyKey: "import:instance:capture:homes",});constinspection=awaitagent.inspectSubmission(submissionId);// inspection.status === "completed"// inspection.message is not a field
The caller has to walk getMessages() and guess which assistant row belongs to this submission.
Workaround
Record the user message id at admit time and take the first assistant after it in getMessages(). That is stable for both wait and submit. For wait, do not trust result.message.
Suggested fix
Attach the assistant message produced by this turn to the result, captured while the queue slot is still held (or looked up by requestId). For submissions, put that message (or its id) on ThinkSubmissionInspection once status === "completed".
Activity
fix(think): structured output on wait TurnResult; submission messageId (