Repository navigation
Add a session/retry host route so a failed turn can be retried without duplicating the user's message
#9813
danieledwards2030-hue
started this conversation in
Ideas
Replies: 2 comments
|
I second this. |
0 replies
|
One case this route does not cover: a turn that fails before request admission has no "Retry the last turn" has nothing to re-run there, and an ordinary |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Ask. Expose a first-class way to retry the last turn of a session. Concretely: a
session/retry {request:{sessionId}}Remote route on the host wire that re-runs the most recentturn in place β the failed assistant attempt is replaced, and the user's message is not
appended again β answering something like
{accepted:true, turn:N}(withsession/not-foundforan unknown id and a
session/nothing-to-retryerror when the last turn already completed),mirroring the
session/cancel/session/promptenvelope family ({request:{β¦}}β{ok:true, value:{β¦}}) so clients can treat it uniformly. A companion durable event (e.g.turn/retriedcarrying the retriedturnnumber) would let a client render the retry after areload without guessing.
Why β the only re-send that exists today duplicates the user's message. When a turn ends in an
error, the only documented way to try again is to POST the same text through
session/prompt. Thatappends a new
user/messageto the durable transcript, so the user's message appears twice. Aclient can tag its retry request (for example via rpcId) and hide its own duplicate, but that is a
private convention: every other client, including the web UI, still shows the message twice, and the
failed attempt stays in the transcript.
Raw evidence (pinned
dsh 0.2.0-rc.2, two identicalsession/promptcalls in one session).Both calls answered
{"ok":true,"value":{"accepted":true}}, andsession/pagethen carried twoappendrecords with the same text and differentrpcIds:{"type":"user/message","seq":8,"data":{"content":[{"type":"text","text":"<the user's message>"}],"source":{"kind":"user","rpcId":"β¦-1"},"role":"user","id":"β¦"},"surfaceOp":"append"} {"type":"user/message","seq":20,"data":{"content":[{"type":"text","text":"<the user's message>"}],"source":{"kind":"user","rpcId":"β¦-2"},"role":"user","id":"β¦"},"surfaceOp":"append"}Why this belongs in the host. Every client would have to reinvent the same hiding rule, and none
of them can remove the failed attempt from the durable transcript. Searching the recorded route
corpus finds no
retry/regenerate route today: the
session/*family isattachment, cancel, create, follow, fork, list, modelCatalog, page, projections, prompt, rename, search, selectModel, updateQueueβsession/updateQueueedits the queue andsession/forkbranchesa session, neither of which re-runs a failed turn.
Why it matters for transient faults. A turn can end in
TRANSPORTorMALFORMED_RESPONSEafterthe engine's own internal retry policy is exhausted (observed raw:
llm/retrywith["normal",5,["EMPTY_RESPONSE","RATE_LIMIT","SERVER","TIMEOUT","TRANSPORT"],500,10000,0.1], then aturn/endwithreason.kind:"error"). The engine'sturn/enderror payload is{"kind":"error","error":{"message":β¦,"code":β¦}}; a retry route turns that terminal error into arecoverable one for every client, without each client re-implementing a duplicate-hiding rule.
Proposed shape (for discussion).
session/retry, args{"request":{"sessionId":"β¦"}}; value{"accepted":true,"turn":N}.(not appended), and the existing
user/messageis reused β so a freshsession/pagestill showsexactly one user bubble for that turn.
turn/retriedevent (turn number, and the retry's cause when known), deliveredon
session/followand present insession/page, so reloads and other clients render it.session/not-found;session/nothing-to-retrywhen the last turn already completed.Related.
session/deletehost route(same "add the missing host route" shape; also the style this draft follows).
(the transient-fault evidence behind "retry must be cheap and exact").
All reactions