Repository navigation
fix(web): chain MRTR rounds when the server rotates requestState - #2610
Merged
Merged
Conversation
The Protocol panel keyed each round on one requestState, preferring the token a round's result issued over the one its params echoed. A server that mints a fresh token per round (mrtr_two_step) split the conversation in two and left the original call shown as Awaiting input. Link rounds by hand-off instead: a retry joins the conversation when it echoes the token the round before it was issued, checked in both directions so a newest-first list chains too. Closes #2608 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: cliffhall <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Bidirectional matching remains sort-dependent when opaque request-state values are reused cyclically.
Review effort: Balanced
Findings: 1
What changed in this PR
Fixes #2608 by chaining MRTR rounds through request-state hand-offs rather than a shared token.
Changes:
- Adds issued/echoed token correlation in both sort orders.
- Adds regression coverage for rotating tokens and retries.
| File | Description |
|---|---|
protocolUtils.ts |
Implements MRTR round chaining. |
protocolUtils.test.ts |
Tests rotating-token conversations and retries. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Checking both directions let a reused opaque token (A -> B, then B -> A) match the wrong way round, so a newest-first list named the conversation differently from an oldest-first one. Pass the panel's sort direction and test only the chronological hand-off. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: cliffhall <[email protected]>
Member
Author
|
Copilot round 1: one finding, fixed.
There was nothing in the suppressed block. Requesting round 2. |
Member
Author
|
Copilot review loop closed. Round 2 was clean ("Approval recommended", no findings, no inline or suppressed comments) and it marked round 1's finding resolved. Stopping on the first clean round. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #2608
What changed
The Protocol panel grouped MRTR rounds (spec §7.3) by one shared key:
extractRequestStatepreferred the token a round's result issued over the one its params echoed.mrtr_two_stepmints a fresh token every round (it is opaque, so servers are free to do that). Retry 1 was therefore keyed on the token it received (done) rather than the one it echoed (step2). The conversation split in two, and the original call was left showing Awaiting input even though it completed.groupProtocolEntries(clients/web/src/components/groups/protocolUtils.ts) now links rounds by hand-off:requestStatethat the neighbouring round's result issued. Two retries that echo the same token are also linked, so a round whose result was an error and was then retried stays in the conversation, as it did before.extractRequestStatekeeps its signature and behaviour.Tests
protocolUtils.test.tsadds four cases:The first three fail on
origin/v2/main(3 failed / 25 passed) and pass with the fix. The fourth is a regression guard for behaviour the old single-key grouping already had.Screenshots
mrtr_two_stepagainstmrtr-showcase-http.json(Protocol Era: modern), both prompts answered, Protocol panel in its default Newest First order. Web client at 1280×900, full page.Gate
npm run local:gateis green, run withTMPDIR=/tmp. Under macOS's defaultTMPDIRit fails at one TUI test,useCopyKeys› "W saves the value to a file and shows its path". That failure is unrelated to this diff, which touches onlyclients/web, and it reproduces onv2/main. The long temp path wraps in Ink's 80-column frame. It is filed as #2609.🤖 Generated with Claude Code