You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "ggbdpq (via GitHub)" <gi...@apache.org> on 2026/10/01 16:27:04 UTC

Re: [PR] fix(cli): stage a rewound turn's quotes into the replacement submit [maka]

ggbdpq commented on code in PR #5265:
URL: https://github.com/apache/maka/pull/5265#discussion_r4157855377


##########
packages/cli/src/pi-tui-runner.ts:
##########
@@ -1361,16 +1491,61 @@ export async function runMakaPiTui(input: MakaPiTuiInput): Promise<void> {
     const messageId = randomUUID();
     appendUserPrompt(state, text, messageId, true);
     requestRender();
+    // Quotes staged by a rewind (#5109) ride this message and only this one:
+    // the staging clears as the message dispatches, and a refusal or failure
+    // restages them for the retry.
+    const staged = effectiveStagedQuotes();
+    const originSessionId = input.driver.getSessionId();
+    if (staged.length > 0) clearStagedQuotes();
+    else supersedePendingRestage();
+    // The generation is read after the dispatch's own clear: the restore
+    // guard compares against the staging state this submit actually left
+    // behind, so an ordinary failure still passes while a Session switch, a
+    // newer rewind, or an explicit clear landing while the admission was in
+    // flight has since bumped it and must not inherit context meant for the
+    // original conversation (#5109 review).
+    const originGeneration = stagedGeneration;
+    const originFollowDraft = stagedQuotesFollowDraft;

Review Comment:
   Fixed at `eb0f8e4ed`: the draft-following lane is now captured **before** the dispatch's own `clearStagedQuotes()` in `pi-tui-runner.ts` (the read moved above the clear, where it still sees the staged lane), so `restageForRetry()` restores the quotes as draft-following instead of ordinary turn-staged — and the retry context then rides the recovered draft through `/session` and side-view switches rather than being dropped by the next `applySwitchResult()`. The combined failed-submit-then-switch window this P2 flagged as untested is now pinned by a dedicated runner regression (`keeps a failed retraction-restored quote restage across a later session switch`).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org