Skip to content

fix(chat): a resume that answers after the user moved leaves them where they are - #23321

Merged
bolichen97 merged 2 commits into
kirodotdev:mainfrom
Pearcekieser:fix/resume-respects-switch-away
Oct 25, 2026
Merged

bolichen97 merged 2 commits into
kirodotdev:mainfrom
Pearcekieser:fix/resume-respects-switch-away

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A resume from Older sessions, History, the palette or a short-name link that is still loading no longer pulls the user off a session they opened in the meantime, and two quick resumes end on the one clicked last.

Resume a closed session from Older sessions and, before it loads, open another session. When the resume answers, the dashboard switches to the resumed session. On a pod with the resume POST held for 2000 ms, the user opened S1 100 ms in and ended on the resumed session in 10 of 10 runs. Clicking S1 and then back to S0 ended on the resumed session in 10 of 10 runs. Clicking a slow row and then a fast row 100 ms later ended on the slow one in 10 of 10 runs, after briefly showing the fast one.

Why it matters

A resume rebuilds the session from its transcript and can take seconds. A user who opens another session while it loads has made a choice, and the late answer overrides it. In the two-row case the user's last click loses to whichever request answers last.

Not a goal

  • Renaming captureForkOrigin and forkMayOpen now that resumes use them as well as creates and forks.
  • Changing what the resume itself does on the gateway. The resumed session is still listed as an open tab and leaves Older sessions either way.
  • A deadline on the resume POST itself. A hung request keeps running; only the client's guard on it expires.

What changed (motivation → approach → change)

resumeFromHistory.fulfilled in website/src/store/chat/lifecycle.ts called enterActiveSlot for every successful resume, at line 520 on origin/main. It had no switched-away check, no check that it was the latest resume, and no guard against a repeat. Creates and forks already have the first two through captureForkOrigin and forkMayOpen, from #22818 and #22989.

Resumes now use the same rule. The pending reducer records each resume in pendingResumes, keyed by requestId, with its history key, its start time and the origin from captureForkOrigin. The fulfilled reducer still lists the session and consumes the Older sessions row. It takes the view only when the action's requestId equals lastResumeRequestId and forkMayOpen allows it against that origin. lastResumeRequestId already ordered the "can't be opened" notice, so the latest click wins by the same token.

Across kinds, a create, fork or resume opening its session moved the view, and forkMayOpen read that as the user moving away, so a resume clicked after New lost to the create. Such a move now counts in activeSlotRequestMoves, apart from user moves. Each create, fork and resume start bumps requestSeq, the origin records it, and forkMayOpen refuses only when a request started later has already opened its session, recorded in activatedRequestSeq. A request's own switch names its number: both fork paths, in hooks/useSessionActions.ts and pages/useChatPageSlotSwitches.ts, the foreground-tab create in pages/chat-sidebar/create.ts, and pages/chat/memoryModeSwitch.ts. Creates clicked back to back are one request made several times, so the first to open keeps the view, as on origin/main. The mobile drawer in pages/chat/page/sessionsDrawer.ts counts request moves as the user's picks.

The thunk's condition drops a second resume of a key that has an entry younger than PENDING_OPEN_LEASE_MS, whatever rows were resumed in between. That is the 10 s bound the chat page already uses for a pending create or fork, moved from the page controller to store/chat/state.ts so the store can read it. A hung POST stops blocking its row after 10 s, and the next pending action prunes entries past that age. The dropped repeat is dispatched as a rejection with meta.condition. Its reducer makes the resume it repeats the latest again and re-takes the origin at that click, so after H1, H2, H1 the first H1 opens when it answers.

useChatPageSessionController.ts counts a resume still within its lease in openPending, beside a pending create or fork, so the page does not auto-open another session while a resume that will open one is on its way. Three callers used to treat a successful resume as one that took the view. Each now reads the live active slot. handleResumeSession closes a tab only when lastResumeActivation shows its own resume replaced the tab the click started on. The short-name ?sid= callback returns at once if ChatPage has unmounted, and releases its URL-sync hold when the resume did not open, and replaces ?sid= with the session on screen. focusComposerForResumedSession in pages/chat/composerFocus.ts now takes the store, which both palette providers in website/src/components/commandPalette/providers/ pass, and moves no caret when the view did not move.

Backwards compatibility

Compatible. A resume with no session change while it loads opens the session exactly as before. pendingResumes, the request counters, the new meta fields and the rejected repeat action are internal to the chat slice. Dropping a repeat of a row within the 10 s lease is new: origin/main has no condition on resumeFromHistory and sends the second resume. A caller that awaits unwrap() on such a repeat now gets a rejection with meta.condition set. Every in-tree caller either does not await it or catches it.

Tests

  • website/src/test/resumeRespectsSwitchAway.test.ts runs the real resumeFromHistory thunk against deferred api.resumeChatSlot answers. It covers a move to another session, a move away and back, two resumes where the earlier one answers last, a repeated click, a failed resume clearing its entry, staying on the origin, and the page auto-selecting another session after it dropped the origin. It adds H1, H2, H1 with the first H1 still pending, which sends one H1 and opens it, and a move after that repeat, which leaves the view alone. A second block fakes Date only and pins the clock. A repeat at 9999 ms sends nothing, one at 10000 ms sends a fresh POST, and the hung one answering late does not take the view. On origin/main 5 of the first 7 cases fail. On the first commit of this branch the H1/H2/H1 and lease cases fail, and the repeated-click case fails because it reads the renamed field. With both commits all 11 pass.
  • website/src/test/ChatPage.sid.test.tsx adds a ?sid=chat-7 link whose resume is held while the user switches to another session. After the resume answers, the URL must name that session, the "Opened" notice must clear, a later switch must update the URL, and Back must return to the session the user was on. It fails on the first commit, where the URL keeps naming chat-7-50, and passes with the fix. A second case switches session and then routes to /developer while the resume is held. The URL must stay /developer after the resume answers. It failed on 4ae7ac1, where the URL returned to the chat route.
  • website/src/test/composerFocus.test.ts adds a resume that answered but did not take the view, which must focus nothing. It fails on the first commit and passes with the fix.
  • website/src/test/ChatPage.resumeSurfaceGate.test.tsx adds a resume that answers after the user moved. The origin tab and its draft must survive. It fails on origin/main and passes with the fix. A second case switches to chat-2 and clicks the same row again before the resume answers. chat-9 opens, and chat-1 and its draft must survive. It failed on 4ae7ac1, where chat-1 was deleted.
  • website/src/test/latestClickAcrossKinds.test.ts runs the real createSlot and resumeFromHistory thunks against deferred answers. New then an Older sessions row, with the create answering first, must end on the row. A resume then New, with the resume answering first, must end on the new chat. A sidebar Fork then New, with the fork answering first, must end on the new chat. Three controls, where the later click answers first or the user moves while both are pending, keep their outcome. The three cross-kind cases fail on 9c99331c3a and pass with the fix. ChatPage.resumeSurfaceGate.test.tsx adds New, then Continue a previous chat, with the create opening first: chat-1 and its draft must survive, since the resume replaced the new chat.
  • website/src/test/ChatPage.waitsForPendingOpen.test.tsx adds a hung resume. Within its lease it holds the pick. Past the lease its entry is still there, yet a later loss of the chat picks at once. The second case fails on 9c99331c3a.
  • website/src/test/forkRespectsSwitchAway.test.tsx adds a resume clicked before a transcript Fork that answers after the fork opened: the child must keep the view. It fails on 9cda2a8, where the fork carried the resume's number. latestClickAcrossKinds.test.ts adds two creates in a row, which keep the first, and a foreground-tab switch carrying the create's number, after which a later resume still opens.
  • website/src/hooks/useSessionActions.cov80.test.tsx, the four sidebar tab tests and the memory-chip test's switch recorder now expect a request's switch to carry its number.
  • Six test files dispatched a bare resumeFromHistory/fulfilled to seed a resumed session, chatSlice.sidePanelAlwaysOpen.test.ts from main among them. A real resume always dispatches pending first, so website/src/test/resumeLanded.ts dispatches both, with the origin taken from the current state.

Proof: PROVEN latestClickAcrossKinds.test.ts (3 cross-kind cases) and ChatPage.waitsForPendingOpen.test.tsx "a resume past its lease does not hold a later pick" fail on 9c99331c3a, and the forkRespectsSwitchAway transcript-Fork case fails on 9cda2a8, the create, resume, create case fails on e0bdbc2, and the same clicks answering create, create, resume fail on d90289a; the three-creates case fails on 4a9fcd9; all pass on this head (head 6f51588)

Manual verification

On a pod, Playwright held the resume POST and clicked sessions during the hold, 10 runs per case. Before is origin/main 0be5bcd for the Older sessions cases and the first commit, deb2dea, for the short-name cases. After is the head of this branch.

Case Before This branch
Resume H1 held 2000 ms, open S1 100 ms in took the view 10/10 kept the user's choice 10/10
Resume H1 held 2000 ms and H2 held 300 ms, clicked 100 ms apart slower answer won 10/10 last click won 10/10
Resume H1 held 2000 ms, open S1, then back to S0 took the view 10/10 kept the user's choice 10/10
Resume H1 held 2000 ms, no other click (control) opened H1 10/10 opened H1 10/10
/chat?sid=<H1 short name>, resume held 2000 ms, open S1 during the hold URL kept naming H1 after a later switch 10/10 URL named S1, then followed the next switch, 10/10
/chat?sid=<H1 short name>, no other click (control) opened H1, URL named it 10/10 opened H1, URL named it 10/10
Header New with its create held 400 ms, H1 clicked 100 ms in and held 2000 ms not run on the pod; the unit test above fails on 9c99331c3a last click won, H1 open, 10/10

The six F20 cases and the New-then-resume case were rerun 10 times each on a build of 9cda2a8, the head of this branch, with the results above.

The fork and create cases from #22818 and #22989 ran on the same build to check that the shared rule did not move. Sidebar Fork and message Fork with a click on S1 during an 800 ms hold kept the user's choice 10/10 each. Sidebar Fork with no click opened the child 10/10. Header New and folder "+" with S1 then S0 during a 1500 ms hold kept the user's choice 10/10 each. Header New with no click opened the new chat 10/10. No pod case drives a repeated click or a hung resume. The unit tests above cover those.

Screenshots / video

Why no screenshot: No pixel changes. The fix only skips a session switch and corrects the URL, and the table above records the behaviour.

Related Issues

Closes #23320

Sibling sweep

Siblings: none -- createSlot and every fork path already gate their switch on forkMayOpen (#22818, #22989), and this PR moves resumeFromHistory, the last slot-entry thunk that skipped it, onto the same rule.

Pattern harvest

Rule candidate: review-prompt
Pattern: every async action that switches the active session when it settles must capture the origin at its start and ask forkMayOpen, and a repeatable one must also check it is the latest request. A caller that acts on the result must read the live active slot rather than infer the switch from a fulfilled action.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@Pearcekieser
Pearcekieser requested review from a team and KiroCrewCaptain as code owners October 23, 2026 03:57
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 6f515889187f13410411e206e697cebac745cb08 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

The fix removes a reproduced defect (10/10 runs, base-failing tests). The one premise left unchecked is the repeat-click drop, which is easy to reverse.

Notes

  • Item 4 — inherited, oversized: the only support is "It had … no guard against a repeat", and every failure cited for it is on branch commit 4ae7ac1, not on base. Without the drop, lastResumeRequestId already makes the newest click's request the one that opens. Subtraction: delete the condition/dispatchConditionRejection pair, the meta.condition branch in resumeFromHistory.rejected, newestResumeOf and getPendingMeta.startedAt pruning, and keep latest-click ordering alone.
  • Item 3 — rides along: "A sidebar Fork then New, with the fork answering first, must end on the new chat" changes what creates and forks do, which is outside the Goal's resume scope. It is mostly forced by item 1, so this is a note only.

What this change ships

Inventory (10 items) — 8 justified

Intent: A slow resume no longer drags the user off a session they opened while it loaded, and the last click wins. FIX.

  1. A late resume no longer switches away from a session the user opened meanwhile — justified
  2. Of two quick resumes, the one clicked last opens — justified
  3. Across create/fork/resume, the later click keeps the view (Fork then New ends on New) — rides along
  4. A second click on a row still resuming (within 10 s) sends nothing — undeclared in Goal, oversized
  5. The page waits for a pending resume before auto-picking another session — justified
  6. A resume closes the original tab only when that resume actually replaced it — justified
  7. A ?sid= link that lost the race rewrites the URL to the session on screen — justified
  8. The palette resume moves the caret only when the view moved — justified
  9. The 10 s lease constant moved from the page into the store — justified
  10. The mobile drawer counts request-opened sessions as the user's picks — justified

[FIRST-PRINCIPLES-REVIEWED] 6f51588

Description read

[DESCRIPTION-READ] d70eb75902b3175624494a0d10f1ba47dbd511abe1d1e02c6601ea3c9a437add

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 6f515889187f13410411e206e697cebac745cb08 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the fix is in the reducer, where both the resume race and the cross-kind race start, and nothing outside the patch reads the new rejection of a repeated resume and breaks.

Notes

  • The click-ordering state now spans seven fields: activeSlotMoves, AutoMoves, RequestMoves, requestSeq, requestBurst, activatedRequestSeq and lastResumeActivation. A single "latest user intent" token would make the rule shorter to state and test. Each create, fork, resume or switch would bump it, and a request would open only if its token is still the newest. Worth a follow-up before a fourth request kind adds more counters.
  • The create-burst exception (opened.burst === origin.burst) keeps the old "first create wins" rule as a special case inside the new "latest click wins" model. Dropping it would remove one field and one branch.
  • Take-away check: dropping a repeat of the same row within 10 s rejects with meta.condition. I checked every resumeFromHistory dispatch site outside the patch: HistoryPane.tsx:239, sessionsDrawer.ts:267, NotificationDetailPanel.tsx:197 and useChatPageSessionController.ts:885. None of them awaits unwrap() without a catch, so all still work.

[DESIGN-REVIEWED] 6f51588

Description read

[DESCRIPTION-READ] 7247e5508603dd89083995193649e5a6bce29fb3a950392369dde69688c946ea

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 6f515889187f13410411e206e697cebac745cb08 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing to check. The diff adds and changes no controls, labels, strings or element states. It only changes which session a late resume, fork or create may open. Without a blind read, this lane cannot confirm how users perceive that difference.

[UX-REVIEWED] 6f51588

Description read

[DESCRIPTION-READ] af2fec0486b6cf3e66ecda5a6a6a1ffae69c888486d010cdd776e65bf27105a6

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 6f515889187f13410411e206e697cebac745cb08 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6f51588

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 6f515889187f13410411e206e697cebac745cb08 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 6f51588

@Pearcekieser
Pearcekieser force-pushed the fix/resume-respects-switch-away branch from c016211 to 4ae7ac1 Compare October 23, 2026 04:15
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • A late resume navigates back after ChatPage unmounts

fixed in 4ae7ac1. The resume completion callback in openShortNameMatch now returns at once when unmountedRef.current is true, before it touches URL-sync state or calls navigate. The lookup step above it already had the same check.
Regression test in ChatPage.sid.test.tsx follows the trigger: short-name link to a closed session, switch to chat-2-200 while the resume is held, navigate to /developer, then answer the resume. On c016211 the URL went back to /chat/fix-login-bug?sid=chat-2-200; with the fix it stays /developer. 5 repeats and a shuffled run of the file, 92 tests, pass.
self-added: yes
mechanism: navigate in the resume completion callback, added by this PR

issue (blocking): upheld and fixed as described above.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 23, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Resume completion navigates with a stale route after unmount

fixed in 4ae7ac1. The resume completion callback now returns first when unmountedRef.current is true, so the navigate that names the viewed session never runs after ChatPage is gone.
The new ChatPage.sid.test.tsx case unmounts ChatPage by routing to /developer while the resume is held. It failed on c016211, where the URL came back to the chat route, and passes on the fix in 5 repeats and a shuffled file run.
self-added: yes
mechanism: navigate in the resume completion callback, added by this PR

issue (blocking): upheld and fixed as described above.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 23, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/resume-respects-switch-away branch from 4ae7ac1 to 5aef44e Compare October 23, 2026 04:56
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 23, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • A repeated resume deletes the tab the user already left

fixed in 5aef44e. handleResumeSession now reads chat.activeSlotMoves when the click starts and runs the swap cleanup only when the count has risen by exactly 1, the resume taking the view itself. A switch to S1 followed by a repeated H1 click adds a move before the resume opens, so the first click no longer deletes S0 or its drafts.
New case in ChatPage.resumeSurfaceGate.test.tsx: on chat-1 with a draft, resume chat-9, switch to chat-2, click chat-9 again (no second POST), then answer. On 4ae7ac1 deleteChatSlot was called for chat-1; with the fix it is not, the draft stays, and chat-9 is active. The existing swap case still deletes the origin. 5 shuffled runs of the file pass.
self-added: yes
mechanism: swap cleanup in handleResumeSession, gated on activation ownership

issue (blocking, security): upheld and fixed as described above.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 23, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/resume-respects-switch-away branch from 5aef44e to 3aab6c2 Compare October 23, 2026 05:42
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: rebased on main 4643565, head 3aab6c2, no behaviour change.

Frontend Tests (3) on 5aef44e failed in chatSlice.sidePanelAlwaysOpen.test.ts, added on main by #21007 after this branch was cut. Its resumed helper dispatched a bare resumeFromHistory.fulfilled with no pending action and no origin, which this PR no longer treats as a resume that took the view. The helper now uses reduceResume from website/src/test/resumeLanded.ts, the same fixture the other five seeded-resume files use here. The test assertions are unchanged. Frontend Coverage Merge was red only because that shard was.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 23, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at d90289a4c64e54d17f832f256322d3c3e708ac68: one current-head AI finding has no reply, and the description carries a claim the author agreed is wrong.

  1. The GPT lane's downgraded finding on lifecycle.ts#L502 has no disposition. The case is New, then an Older sessions row, then New again, with the replies arriving create, create, resume. Create 1 opens and sets activatedRequestSeq to 1. Create 2 is suppressed because lastCreatedActivation.seq still equals activatedRequestSeq. The resume then passes forkMayOpen and opens. The user ends on the resume, not on their last click. Main behaves the same way here, so this is not a regression. Please post a disposition (fix it, or rebut or defer it with reasons) so it is not left silent.
  2. ## Backwards compatibility still says a repeat's unwrap() "already rejected on origin/main". Your comment agrees that this is new behaviour. Please correct the body.

The rest looks sound: resumes now use the same forkMayOpen gate as creates and forks, the tests cover the reported races, and CI is green at this head.

— crew-pr-reviewer (r124)

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • An intervening resume defeats the latest New click

upheld. New, an Older sessions row, then New again, answering create, create, resume: the first-create guard suppressed the second create because the first was still the newest request to have opened, so the resume then opened and the user ended on it, not on their last click. Main ends there too, but the guard is this PR's mechanism.
fixed in 071030d: the guard now holds only for two creates clicked back to back (the second create's requestSeq is the first's plus one). With a resume or fork clicked between them, the second create opens, and the resume then finds a later request already opened and stays in the background. Two quick New presses still keep the first.
New latestClickAcrossKinds.test.ts case for exactly this order fails on d90289a and passes on 071030d; 72 create and resume test files pass, 1781 tests. The head pushes in the next CI slot.
self-added: yes
mechanism: first-create guard in createSlot.fulfilled

issue (non-blocking): upheld and fixed as described above.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

@iamwhatever thanks, both items are handled on 071030d, which pushes in the next CI slot.

  1. The create, create, resume order is fixed rather than deferred: the first-create guard now applies only to two creates clicked back to back, so the second New opens and the late resume stays in the background. Disposition with the test is above.
  2. The Backwards compatibility section is corrected: dropping a repeat within the 10 s lease is new, since main has no condition on resumeFromHistory. The body edit goes out just before that push.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 24, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/resume-respects-switch-away branch from d90289a to 071030d Compare October 24, 2026 22:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 24, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: Bundle Size Gate on 071030d fails with ModelEffortDropdown at 505.0 KB against its 500.0 KB default budget. That failure is not from this PR. Four other PRs failed the same gate on the same chunk in the 23:02-23:15Z window: feat/redaction-tiers-22552-combined, feat/customize-control-deeplink, feat/dev-fleet-release-channel-pin and feat/stale-config-turn-boundary-reload, all at 504.9-505.0 KB. This PR changes store and controller logic for session switching and adds no import to that chunk. The chunk moved over the line on main, so it needs a CHUNK_BUDGETS entry or a split there. No push from this PR for it.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 25, 2026
…re they are

resumeFromHistory now records the origin with captureForkOrigin and its fulfilled reducer opens the session only for the latest resume and only when forkMayOpen allows it, the rule creates and forks follow. A repeat of the resume on its way is dropped by the thunk's condition, and the chat page treats a pending resume like a pending create or fork. handleResumeSession retires the origin tab only when the resume took the view.
@Pearcekieser
Pearcekieser force-pushed the fix/resume-respects-switch-away branch from 071030d to 4a9fcd9 Compare October 25, 2026 05:26
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: rebased on main 9e9c87c, head 4a9fcd9, no behaviour change. The Bundle Size Gate red on 071030d was the ModelEffortDropdown chunk at 505.0 KB against its 500 KB budget, failing on other PRs in the same window; main re-measured that budget in #23867, and this rebase picks it up. Both commits rebased cleanly. On the rebased head tsc -p tsconfig.app.json and eslint on the changed files are clean, and the PR's tests plus the test files main changed since the last base pass.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 25, 2026
…ume did not open

The repeat guard keeps one entry per pending resume, keyed by requestId, so H1, H2, H1 sends one H1. An entry stops blocking its row after PENDING_OPEN_LEASE_MS, the bound the chat page's wait already uses, so a hung POST does not leave the row dead. A dropped repeat hands the latest-click token back to the resume it repeats, with the origin re-taken at that click. The ?sid short-name callback and the palette focus check the live active slot, so a resume the reducer declined releases URL sync, rewrites ?sid to the session on screen, and moves no caret.
@Pearcekieser

Pearcekieser commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author
  • A third pending create bypasses the repeat guard

fixed in 6f51588. The first-create guard compared request numbers, so only the create directly after the first was held back. Three quick New presses let the third open over the first and hide the draft typed into it.
The guard now works on bursts. A resume or fork start bumps requestBurst, creates do not, and a create stays in the background when it shares a burst with the create that opened and that create is still the newest request to have opened. Any number of back-to-back creates keep the first; a resume or fork clicked between them still lets the later create open.
New latestClickAcrossKinds.test.ts case, three creates answering in order, ended on the third chat on 4a9fcd9 and stays on the first with the fix. 72 create and resume test files pass, 1782 tests. The head pushes in the next quarter-hour band.
self-added: yes
mechanism: first-create guard in createSlot.fulfilled

issue (blocking): upheld and fixed as described above.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 25, 2026
@Pearcekieser
Pearcekieser force-pushed the fix/resume-respects-switch-away branch from 4a9fcd9 to 6f51588 Compare October 25, 2026 05:57
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 25, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

note: readiness passed on 6f51588. green_age.py reports it stale: main gained 60 commits since 9e9c87c, two of them in files this PR also edits, store/chatSlice.ts and pages/chat/page/sessionsDrawer.ts. The PR merges cleanly onto main 813e25c. On that merged tree, with its own npm ci since main changed package.json, tsc -p tsconfig.app.json is clean and 55 test files pass, 1813 tests: the 46 test files main changed since 9e9c87c plus this PR's resume, fork, create and drawer tests. No push, so readiness stands.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[operator: bolichen97] Approved at 6f51588: readiness passed, PR Readiness success, mergeable, no open blocking requests.

@bolichen97
bolichen97 enabled auto-merge (squash) October 25, 2026 09:24
@bolichen97
bolichen97 merged commit cec54fa into kirodotdev:main Oct 25, 2026
103 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A resume that answers after the user opened another session takes the view back

3 participants