fix(desktop): connect shared sessions through Peer Mesh - #4238
Conversation
hqhq1025
left a comment
There was a problem hiding this comment.
Review result: P1 NO-GO on the current head. The new signed endpoint/mesh name fields are emitted on the existing Peer Mesh v1 wire format, but the previous v1 decoder rejects those extra keys, so rolling upgrades can partition existing meshes even though all hosted checks are green.
Validation: full npm run build:test; 43 focused Peer Mesh/operator/Desktop tests; git diff --check; direct new-encoder/old-decoder reproduction.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
jackwener
left a comment
There was a problem hiding this comment.
Approved at the author's explicit direction for exact head bd7d05912b2f5cf8cbf1a582e3644ee21b99d814.
Automated review notice: This comment was posted by an automated review agent operated by WAWQAQ. It is not an independent human review and does not replace one.
hqhq1025
left a comment
There was a problem hiding this comment.
Reviewed exact head 5ab8868728ea52a06963e9a743d367ca86366ed9. I found no P0-P3 issues in the current diff.
The follow-up correctly allows the managed-service operator launcher to append its validated --client-data-root argument to Peer Mesh commands while keeping control/deployment lookup bound to the verified managed root identity. I also re-evaluated my earlier mixed-version concern: Peer Mesh was introduced after the latest release tag (v0.1.11), so this PR is defining its first released v1 shape rather than regressing a supported rolling-upgrade contract. That earlier concern is therefore not a blocker for this head.
Validation: full npm run build:test; all CLI tests (633/633); focused Desktop operator/profile tests (33/33); focused Peer Mesh/native tests (14/14); git diff --check; all hosted checks successful. Local Rust tests were not rerun because this host has Rust 1.75 while the repository requires Rust 1.98+, but the hosted Rust quality job and all native-addon platform builds passed.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
hqhq1025
left a comment
There was a problem hiding this comment.
Review result: P1 NO-GO on exact head 9880cf48ca4cdc82b8d36bfbe4ea119ae30da766.
The new concurrent recovery path can indefinitely preserve an expired authority route whenever any reachable gossip member responds faster than the authority. This keeps application route discovery from recovering the direct authority path even though the authority remains reachable.
Validation: clean npm run build:test; focused Peer Mesh/native tests 14/14; lint and format checks; git diff --check; a deterministic three-reconcile reproduction with a reachable authority delayed by 25 ms. All hosted checks are terminal green, but the PR is currently conflicting with the latest main.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
| this.#syncPeer(meshId, target, AbortSignal.any([signal, controllers[index]!.signal])), | ||
| ); | ||
| try { | ||
| await Promise.any(attempts); |
There was a problem hiding this comment.
P1: Do not let a gossip-only success cancel route recovery from the authority
When the stored authority route is expired, this Promise.any treats any fulfilled sync as sufficient and immediately aborts every other attempt. A reachable gossip member can legitimately return a successful sync without a fresh authority route because responseRoutes only includes live routes that member currently knows. If that member is consistently faster, every reconciliation cancels the still-reachable authority before it responds, so the authority record remains stale indefinitely and resolveRoutes(authorityPeerId) cannot recover its direct route.
I reproduced this by expiring all routes, keeping the authority reachable with only a 25 ms response delay, refreshing another member, and reconciling the affected member three times: the authority entry stayed stale each time. Making the gossip peer unreachable allowed the next reconciliation to refresh the authority immediately, confirming the race. Please only consider a fallback successful for this branch if it actually installs a fresh authority route, or otherwise allow the authority attempt to complete.
hqhq1025
left a comment
There was a problem hiding this comment.
Review result: P1 NO-GO on exact head 42a056a79ec7a8c0ce4cb13abb84c47b6d81ea38. The previous authority-route starvation finding is fixed, but the new cancellation UI does not actually cancel non-reconcile Peer Mesh mutations.
Validation: clean npm run build:test; full typecheck; focused Runtime Host suites 44/44, Desktop management suites 33/33, Peer Mesh/native suites 14/14, Desktop profile/manager suites 74/74; changed-file Biome; git diff --check; and a direct IPC cancellation reproduction. The PR currently has no hosted checks and remains conflicting with current main.
Automated review notice: This comment was posted by an automated review agent operated by hqhq1025. It is not an independent human review and does not replace one.
| return response.result; | ||
| }; | ||
| if (action === 'reconcile') return reconcileManagedTarget(input.localMesh?.(), run, signal); | ||
| return run({ |
There was a problem hiding this comment.
P1: Propagate the operation signal to cancellable mutations
The controller created for operationId is dropped here (and in the managed-host branch below), because this command object omits signal; executeLocal likewise calls mesh.join(...) and mesh.leave(...) without passing its signal. The dialog exposes Cancel for these operations and closes immediately after invoking it, so a stalled join/leave can keep running and later commit a membership change after the user believes it was cancelled. I reproduced both Desktop leave and local-host leave through the IPC handlers: the callee observed signalPassed: false, and both promises were still pending after runtime-host-peer-mesh:cancel. Please pass the signal through every networked mutation and add cancellation regressions for Desktop and managed targets.
Join managed Runtime Hosts through explicit Client and Host Mesh targets, recover stale authority routes over management channels, and expose managed Host Mesh actions directly. Persist signed endpoint and Mesh names, keep stable identifiers copyable, and make Mesh rosters collapsible without exposing internal revisions. Generated-by: Codex
Activate Relay v2 reservations when transit policy is added to an existing peer connection, and preserve native path failures as stable errors. Keep managed endpoint metadata and signed routes atomic while tightening the Desktop management boundary. Generated-by: OpenAI Codex
Allow the generic managed-service operator launcher to pass its validated client data root through Peer Mesh commands, so Desktop can reconcile managed Hosts instead of failing during argument parsing. Generated-by: OpenAI Codex
Generated-by: OpenAI Codex
42a056a to
1b4aba0
Compare
* fix(desktop): connect shared sessions through Peer Mesh Join managed Runtime Hosts through explicit Client and Host Mesh targets, recover stale authority routes over management channels, and expose managed Host Mesh actions directly. Persist signed endpoint and Mesh names, keep stable identifiers copyable, and make Mesh rosters collapsible without exposing internal revisions. Generated-by: Codex * fix(peer): connect Mesh members to managed Hosts Activate Relay v2 reservations when transit policy is added to an existing peer connection, and preserve native path failures as stable errors. Keep managed endpoint metadata and signed routes atomic while tightening the Desktop management boundary. Generated-by: OpenAI Codex * fix(cli): accept managed Mesh operator context Allow the generic managed-service operator launcher to pass its validated client data root through Peer Mesh commands, so Desktop can reconcile managed Hosts instead of failing during argument parsing. Generated-by: OpenAI Codex * fix(peer): recover Mesh routes through reachable members Generated-by: OpenAI Codex * fix(desktop): make peer collaboration recoverable * fix(peer): preserve active Mesh transport paths * fix(desktop): recover interrupted managed Host setup * fix(desktop): activate managed Host Peer Mesh * fix(cli): replace incompatible development Hosts * refactor(desktop): isolate Runtime Host management UI * test(runtime-host): finalize owner pairings explicitly * fix(desktop): make Peer Mesh refresh local and bounded * style(cli): format Runtime Host setup changes * docs(astryx): refresh surface inventory
English
Summary
Refs #3843
Verification
npm run typechecknode --test packages/runtime-host/dist/__tests__/peer-mesh.test.js— 10 passednode --test packages/cli/dist/__tests__/runtime-host-operator-command.test.js— 6 passednpm --workspace @maka/desktop run build:renderernpm run check:asf-headersnpm run astryx:surface-inventorynpm run dev:peer, including aliases, collapsed/expanded Mesh cards, identifier copying, and managed-Host reconciliationAI use
Tool(s) and scope: OpenAI Codex assisted with implementation, tests, and UI verification under M4n5ter's direction
Checklist
Does this PR entail a change in behavior?
简体中文
概要
关联 #3843
验证
npm run typechecknode --test packages/runtime-host/dist/__tests__/peer-mesh.test.js— 10 项通过node --test packages/cli/dist/__tests__/runtime-host-operator-command.test.js— 6 项通过npm --workspace @maka/desktop run build:renderernpm run check:asf-headersnpm run astryx:surface-inventorynpm run dev:peer验证 Desktop Client 与本机 Runtime Host,包括别名、Mesh 折叠/展开、ID 复制及受管 Host 同步恢复AI 使用
工具及范围:OpenAI Codex 在 M4n5ter 指导下协助实现、测试和 UI 验证
检查清单
本 PR 是否改变行为?