Skip to content

fix(desktop): stop misreporting shared Session joins - #4601

Draft
M4n5ter wants to merge 1 commit into
mainfrom
fix/shared-session-join-finalization
Draft

fix(desktop): stop misreporting shared Session joins#4601
M4n5ter wants to merge 1 commit into
mainfrom
fix/shared-session-join-finalization

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Sep 3, 2026

Copy link
Copy Markdown
Member
English

Summary

Fix shared-Session joins that had already persisted valid Guest credentials but were reported as failures while Desktop waited for the replacement authenticated Runtime Host connection.

The join now has one durable success boundary: credential activation. If the active connection still uses the previous identity, Desktop closes that connection, lets the existing reconnect lifecycle authenticate in the background, closes the join dialog, and reports that the shared Session is reconnecting. An interrupted finalization is also reconciled from the retained mount instead of presenting a false terminal error.

This keeps connection recovery in the existing lifecycle; it does not add another retry loop or weaken authentication.

Root cause

Credential activation and authenticated stream replacement were treated as one blocking operation. The first step could succeed durably while the second was delayed, so the UI reported a failure even though the shared Session was already present and opened successfully from the Session list.

Verification

  • npm run typecheck --workspace @maka/desktop
  • npm run lint
  • npm run format:check
  • npm run build
  • npx knip --workspace apps/desktop
  • npx knip --workspace packages/ui
  • 62 focused compiled tests covering Runtime Host finalization, retained-mount reconciliation, and the join dialog

Stack

  1. This PR: correct the join/finalization success boundary.
  2. Follow-up stacked PR: improve shared-Session request UX and dialog action spacing.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex investigated the failure boundary, implemented the change, and added focused regression tests. The commit contains a Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No
中文

概要

修复共享会话已经成功写入 Guest 凭据,却因为 Desktop 仍在等待新的已认证 Runtime Host 连接而被误报为加入失败的问题。

现在以“凭据已激活”作为唯一且持久的成功边界。如果当前连接仍使用旧身份,Desktop 会关闭旧连接,交给既有重连生命周期在后台完成新身份认证,同时关闭加入弹窗并提示共享会话正在重连。若最终确认过程被中断,也会根据已经保留的挂载记录继续恢复,不再把它当成终局失败。

这个改动复用现有连接恢复机制,没有新增第二套重试循环,也没有放宽身份校验。

根因

此前把“激活凭据”和“替换为新的已认证连接”当成一个同步操作。前一步已经持久成功时,后一步仍可能因网络或重连延迟而超时,于是界面显示失败,但共享会话实际上已经出现在会话列表里,并且可以正常打开。

验证

  • npm run typecheck --workspace @maka/desktop
  • npm run lint
  • npm run format:check
  • npm run build
  • npx knip --workspace apps/desktop
  • npx knip --workspace packages/ui
  • 62 个聚焦测试,覆盖 Runtime Host 最终确认、保留挂载的恢复,以及加入弹窗行为

Stack

  1. **本 PR:**修正加入流程的成功边界。
  2. 后续 stacked PR:改进共享会话请求体验和弹窗操作按钮间距。

AI 使用

  • 没有生成式工具作出实质贡献
  • 生成式工具作出了实质贡献

工具及范围:OpenAI Codex 用于定位失败边界、实现修复并补充聚焦回归测试。提交中包含 Generated-by: Codex trailer。

检查清单

  • 测试覆盖该改动,且在修复前会失败
  • 本地 lint、format、typecheck 和受影响测试均通过

本 PR 是否改变行为?

  • 是——已在概要中说明

Complete Guest imports at the durable credential-activation boundary instead of waiting for the replacement authenticated stream. Keep the reconnect lifecycle running in the background and present uncertain finalization as retained recovery rather than a failed join.

Tests: npm run typecheck --workspace @maka/desktop; npm run lint; npm run format:check; targeted Desktop manager, Guest mount, and join dialog tests

Generated-by: Codex
@github-actions github-actions Bot added the effort/M Under 500 readable lines label Sep 3, 2026
@M4n5ter
M4n5ter marked this pull request as draft September 3, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant