Repository navigation
Studio: stop a recovered chat crashing on a duplicate tool call key - #12442
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Reopening a chat whose tool turn was being recovered could crash the thread view with:
Recovery mints a tool card id as
<backend id>:<run id>:<seq>when it replays atool_startabove the stored cursor. It only looked for an existing card among cards still waiting on a result. If the saved message already held that very card, finished, past its stored cursor, recovery minted it again with the same id, and assistant-ui refuses to render two parts with one key. The same gap also let a card the live stream saved (stampedgenerationToolCallId = <run id>:<seq>) be recovered as a second, duplicate card.A single recovery cannot mint one
run:seqtwice (applydrops any seq it already applied), so the crash needs the card to be in the saved content already. The fix reuses that card: before minting, recovery now looks for a carried tool card with the same minted id or the samegenerationToolCallId. Matching on the exactrun:seqkeeps reused backend ids in later rounds on separate cards.Reported in #12435 (and earlier in #10288).
Changes
studio/frontend/src/features/chat/utils/generation-tool-recovery.ts: reuse a carried card for a replayedtool_startinstead of minting a duplicate.studio/frontend/tests/generation-tool-recovery.test.ts: two regression tests, one for a finished recovered card saved past the cursor, one for a finished live card saved past the cursor.Testing
main: both fail. The first produces['call_0:run:4897', 'call_0:run:4897'], the exact key shape in the report; the second produces['call_0:live-uuid', 'call_0:run:4897'].node --experimental-strip-types --test tests/generation-*.test.ts tests/chat-generation-*.test.ts tests/stuck-generation-run.test.tsgives 156 passed, 0 failed.tsc -p tsconfig.app.json --noEmitclean; no new biome diagnostics on the changed lines.Before / after
A real Studio build of each side, Chromium, with a thread seeded directly in
studio.db(no model needed): a completed durable run whose events are text,read_filestart,read_fileend, text, and an assistant message saved with the finished recovered card one event past its stored cursor. Opening the thread starts recovery.16c112906): the thread crashes to "Something went wrong!" withDuplicate key toolCallId-call_0:<run id>:3 in tapResourcesin the page error.38ee7d9ec): oneread_filecard and the full reply.