fix(desktop): keep new-chat binding stable during attachment sync - #64759
fix(desktop): keep new-chat binding stable during attachment sync#64759DESXIE wants to merge 7 commits into
Conversation
0921628 to
282546c
Compare
282546c to
ab8a1d3
Compare
|
Thanks for the focused follow-up. The premise is present on current main: The explicit runtime/stored/route binding in this PR addresses that interval while retaining the existing session-identity checks. It also matches the live route-token representation in No blocking issue identified by static review. This is an automated hermes-sweeper review. |
|
Independent confirmation from a real macOS Desktop repro:
I checked out this PR at Result: 72/72 passed. The explicit |
Thanks — I checked #65890. Disabling Router transitions is a useful improvement and should reduce the window in which the created-chat route commit is delayed. However, it does not fully replace this PR's guard. The attachment path still crosses async boundaries, and correctness cannot rely on the route commit always winning that race. This PR carries the explicit runtime/stored-session/route binding through attachment staging, accepts only the created session's delayed route transition, and retains the existing protections for unrelated route changes, runtime rebinding, and created-session recovery. I'm rebasing this on the newer routed-session/queued-submit work now and will update the branch once the combined regression coverage is green. |
ab8a1d3 to
b8d46db
Compare
fb9a134 to
5bd44b1
Compare
Keep the exact runtime, stored-session, and target-route binding from new-chat creation so a delayed React Router commit during image attachment staging is accepted once without weakening genuine session-switch or ABA protections.
Reject unrelated route-only navigation after session creation, preserve resume recovery for the newly created stored session, and keep user-driven create cancellation silent.
Provide the structured created-session binding required by the shared submit hook for tile-scoped sessions.
Keep queue drains scoped to their durable target while retaining created-session binding checks.
5bd44b1 to
f19bbf7
Compare
|
Closing as superseded by upstream work that landed on Why this is no longer the right merge pathThis PR explored an explicit created-session binding: { runtimeSessionId, storedSessionId, routeToken }so the first new-chat send with attachments would not treat the app's own delayed React Router commit as a user switch. That class of false-positive drift aborts is now covered on current
I verified on current DecisionForcing another rebase of this branch would reintroduce a competing create-return contract against the newer drift helper and keep generating conflicts without a remaining independent production gap. Thanks to everyone who reviewed and reproduced the original bounce, including the earlier #63624 path and the alternate first-send attempts. Closing this as superseded rather than continuing to fight the current |
Problem
After #63624, a new text-only chat sends correctly, but the first send can still bounce back to the composer when it includes an attachment.
Session creation schedules navigation to the newly persisted chat. If React Router commits that navigation while attachment staging is awaiting, the submit guard can mistake the delayed app-initiated route update for a user session switch and abort before
prompt.submit.Fix
Return the exact runtime, stored-session, and target-route binding created by
createBackendSessionForSend:The submit pipeline now:
session.resumerecovery for the newly created stored session when the first submit times out or reportssession not found;The prompt and slash callers also reject a stale binding if the user switches context during optional post-create setup.
Verification
npm run test:ui -- src/app/session/hooks/use-prompt-actions/index.test.tsx src/app/session/hooks/use-session-actions.test.tsx— 72/72 passed (53 prompt-action + 19 session-action tests)npm run typecheck— passedreact-hooks/exhaustive-depswarning in the test harness)git diff --check— passedRegression coverage includes delayed attachment-route commit, unrelated route-only navigation, real and partial session switches, runtime ABA rebinding, created-session timeout recovery, silent create cancellation, optimistic stored-session association, and post-create async setup.
Related