fix(desktop): branch tiled slash commands from their own session - #73251
fix(desktop): branch tiled slash commands from their own session#73251frizikk wants to merge 6 commits into
Conversation
Related to #73236 for #73207: both correct tile |
|
Thanks for the targeted runtime-aware fix. The reported defect is confirmed on current main: No blocking defect was identified in static review. The linked #73207 discussion also distinguishes this implementation from #73236 because this patch retains runtime-scoped live state and fails closed for a missing explicit target. Automated hermes-sweeper review. |
69509c4 to
d018654
Compare
d018654 to
ee812d8
Compare
|
Rebased and repaired at |
ee812d8 to
057a817
Compare
|
Refreshed onto current |
Forward the slash invocation runtime into the branch action and resolve offscreen transcript, busy state, stored identity, profile, and workspace from that runtime cache. Pin live runtime branches to their invocation gateway across async profile lookup, persist delayed children in the invocation profile namespace, and suppress stale focus effects after profile or route intent changes. Child runtime metadata remains isolated from foreground stores, while missing explicit targets fail closed.
057a817 to
fa153cc
Compare
What does this PR do?
Fixes #73207.
Desktop session tiles already pass their runtime ID into the shared slash dispatcher. The native
/branchaction dropped that target and called the foreground-only branch helper with no arguments, so a command entered in a tile created a child from whichever primary chat was in front.This PR forwards the invocation runtime through the existing branch action and resolves offscreen branch state from that runtime's isolated cache. The target transcript, busy state, stored parent identity, owning profile, and workspace now stay together, including an explicitly detached/empty workspace rather than borrowing the foreground cwd. Live runtime branches synchronously lease the invocation socket before asynchronous profile lookup; production pruning preserves that lease, disconnected requests reconnect once and retry on the exact same transport, concurrent reconnects coalesce by owner generation, and every completion path releases the lease. Domain errors are never replayed. A delayed branch runtime response reconciles profile-scoped approval metadata only into the source profile, even after the foreground switches. Delayed children are persisted in the invocation profile/layout namespace and no longer steal focus or consume the foreground route-resume edge after profile or route intent changes. Their runtime metadata remains isolated from foreground stores. The existing foreground message-action path remains unchanged, and an explicit target that disappears during dispatch fails closed instead of falling through to an unrelated conversation.
This is adjacent to, but not duplicated by:
/branchcommand or tile session-menu branching.Related Issue
Fixes #73207
Type of Change
Changes Made
apps/desktop/src/app/session/hooks/use-prompt-actions/slash.tsapps/desktop/src/app/contrib/wiring.tsxapps/desktop/src/app/gateway/hooks/use-gateway-request.tsapps/desktop/src/app/session/hooks/use-session-actions/index.tssession.branchthrough its recovery-aware requester;apps/desktop/src/app/session/hooks/use-session-actions/utils.tsapps/desktop/src/store/gateway.tsapps/desktop/src/store/gateway.test.tsapps/desktop/src/store/session-states.tsHow to Test
/branchin session B.Commands run locally:
The earlier parent candidate's complete Desktop UI run reported
2771 passed, 5 failed, while its exact detachedorigin/mainbaseline reported2766 passed, 6 failed; every candidate failure reproduced there with the same assertion (locale-sensitive number/date formatting and unrelated billing tests), and the baseline had one additional floating-pane order flake. The remediation commit was then validated through the expanded 292-test affected lane, renderer/electron/e2e typechecks, changed-file lint and formatting checks, a clean production build, andgit diff --check.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass — N/A: Desktop renderer-only change; the relevant Vitest/typecheck/build gates are documented above, and the full UI baseline is disclosedDocumentation & Housekeeping
docs/, docstrings) — N/A: no user-facing command semantics changedcli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
No visual styling changes. The fail-before behavior was captured by two deterministic hook regressions:
Both now pass, along with all 292 tests in the affected hook/helper/store files. The cross-profile regressions also verify that asynchronous profile lookup cannot reroute
session.branch, a profile switch during the pending RPC cannot mutate/reveal the newer profile's tiles or approval cache, foreground stores remain unchanged, and the child persists under the invocation layout with the target profile/workspace/runtime metadata. Additional exact-seam regressions cover explicit detached cwd, offscreen route-resume ownership, primary generation invalidation, reconnect coalescing, domain-error no-replay, activation/prewarm pruning, and deferred pruning after the final lease release.Disposable mutation probes demonstrated that both original findings are test-sensitive:
expected work off, received smart);sourceGateway.request.bind(sourceGateway)failed the source-requester regression because the production lease was never invoked.Refreshed candidate identity:
057a817d6379aaad9a92051dad989ae34ecb91217072b73f912f0e2a71fdcf1450ad82e87f12be522d5dd972325b83f34a2e24e298a8afd4e7ea1f4f936dd7346fd7fd8107af1ce7fc019c07c001c1bd