Skip to content

fix(assistant): allocate a Host workspace when remote project resolution fails - #6176

Open
me2seeks wants to merge 2 commits into
mainfrom
fix/assistant-host-project
Open

me2seeks wants to merge 2 commits into
mainfrom
fix/assistant-host-project

Conversation

@me2seeks

@me2seeks me2seeks commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

First-time Personal Assistant opening fails on a default WSL/remote Host when no Project can be resolved. Preserve the existing default/current Project precedence and local task-directory fallback. Only after remote assistant Project resolution is exhausted, ask the connected Host to allocate a task directory in its own home and register its Project identity for the existing Session creation/binding flow. The Host preflights the same default model and execution policy used by Session creation before making that directory, so a missing model leaves no empty task behind.

The fallback uses ~/Maka/tasks/task-*, or ~/Maka Dev/tasks/task-* for standard Host development profiles. It never selects an arbitrary existing Project or accepts a Client path. Existing assistant bindings, directories, models and history remain unchanged; ordinary task creation and explicit remote workspace validation retain their existing behavior.

Fixes #6175.

Verification

Rebased onto main dc4515cd6e7637e8267d59cd4f71ad53f403f9e7; head 467e16e6f80c6a2759831df41837fedd8365d3a2. Both conflicts were additive dependencies from #6181: preserve prepareBotWake/Bot model synchronization alongside the new allocateWorkspace callback in production composition and its test fixture. Range-diff confirms the preflight commit is unchanged and no feature behavior was dropped.

  • 96 focused checks passed: 74 Desktop workspace/IPC/candidate/navigation cases, 18 Host assistant/allocation cases, 2 production composition cases, and both Kimi K3 prompt-suggestion cases. The production allocation case verifies missing-model failure leaves no task directory, then configures a model, allocates a real Host Project, creates and binds a normal Session, and restarts to verify that same binding/session. The other composition case checks Bot publication/disable fencing retained from main.
  • fix(runtime): honor Kimi K3 none effort #6183 is included by the rebase. Both pinned Kimi metadata shapes (with and without none) now pass locally; no unrelated Kimi fix is added to this PR.
  • Full root build/typecheck/lint/format, Desktop/UI Knip, renderer architecture (168 checks plus strict-base check), ASF headers, Windows test inventory, protocol epoch guard and git diff --check passed.
  • Existing coverage includes Project precedence, stale defaults, local fallback, WSL/remote Host allocation, ordinary task rejection, explicit Client-path rejection, disabled assistants, redirected directories, allocation/registration failure and preflight failure.

The original defect was reproduced on a real Windows development Desktop + default WSL Host at b0ed5707ff. The revised allocation was verified in isolated production compositions on Linux; it has not been installed into the user's running Windows/WSL deployment. The full repository test suite, Electron UI and installer packaging were not run. Fresh hosted CI and independent human review remain required.

Compatibility

Client and Host must both support epoch 226 for assistant.allocate-workspace. Immediately before pushing, main remained at 225 and #6091/#6163 were still open, so 226 remains valid. If another protocol PR lands first, rebase and advance to the next unused epoch before merging. No existing workspace is migrated.

A preflight cannot make the later separate Session creation atomic: removing the default model after preflight or an unrelated Session-create failure can still leave an allocation. An ambiguous creation response must not trigger unconditional deletion of a potentially bound workspace.

AI use

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

Tool(s) and scope: OpenAI Codex investigated, implemented and reviewed the scoped fallback, wrote tests/docs, resolved rebase conflicts, and prepared this PR. Independent human review remains required. Retain the Generated-by: OpenAI Codex commit trailers when squashing.

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

中文说明

只在 WSL/远程 Host 无法解析助手项目时,由目标 Host 分配自己的任务目录并注册项目;保留默认/当前项目优先级、本机兜底和已有助手绑定。缺少默认模型时,预检失败不会留下空目录。已 rebase 到最新 main,保留 #6181 的 Bot 模型同步并纳入 #6183 的 Kimi 修复。96 项相关测试及完整构建、类型和仓库检查通过;协议号仍为 226,合并前需留意其他协议 PR 的先后顺序。

@github-actions github-actions Bot added the effort/M Under 500 readable lines label Oct 19, 2026
@me2seeks
me2seeks force-pushed the fix/assistant-host-project branch from 7388f72 to d1045c7 Compare October 19, 2026 16:33
@me2seeks
me2seeks requested a review from xxhZs October 19, 2026 16:35

@Astro-Han Astro-Han 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.

Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

I reviewed all seven changed files at d1045c778f64655f86b50440cb2095331ebca44b. The assistant now resolves a usable project from the captured Host's catalog, honors default/current project identities and aliases, excludes unavailable or archived projects, and supplies that Host explicitly when creating the session (apps/desktop/src/renderer/platform/desktop/personal-assistant.ts:31, apps/desktop/src/preload/preload.ts:2336). Navigation carries the same Host through creation and binding. Local projectless creation still allocates a dedicated task directory, and remote creation still requires a Host-owned project.

No new P0–P2 findings. I reproduced the original environment/remote failure by replacing only the adapter with its parent version: both regression cases again fail with the remote-project-required error. With the current implementation, 77 Desktop tests passed, covering assistant project choice, navigation and binding reuse, chat, workspace resolution, bundled preload routing and session IPC. Another 16 Host tests passed, including assistant persistence and a real two-client Unix-socket project catalog.

Four additional controlled integration cases composed the actual adapter, bundled preload, main-process creation handler and workspace resolver. Environment and remote Hosts selected the usable project and reused the bound conversation; local creation used its dedicated directory. When the default Host changed during catalog loading, creation still reached the captured Host and navigation refused to bind after the switch. Restoring only the previous preload creation route made that switch case target the wrong Host. The integration's IPC transport, session client and binding storage were controlled fixtures.

The normal clean root test build, all workspace type checks (including Desktop main/preload/renderer/Storybook/assistant-web), production renderer build, lint, formatting, ASF headers, 168 architecture tests and the architecture check against main, surface inventory, locale hygiene, Windows skip inventory, E2E budget and protocol epoch guard passed. Exact-head CI run 39286366585 is successful. The guard reports no protocol changes at epoch 225, and a trial merge with main b0ed5707ff3dc645c66253ed93e50936e3f9d45d has no conflicts; that merged tree was not tested.

I did not repeat the author's live Windows/WSL probe, test an authenticated remote deployment, run installer packaging or post-restart Windows checks, or make paid model calls. Within the verified scope, I found no remaining correctness blocker; the merge decision remains with the maintainers.

@me2seeks me2seeks changed the title fix(desktop): resolve assistant projects on Host-owned workspaces fix(assistant): provision a dedicated workspace on the owning Host Oct 20, 2026
@me2seeks
me2seeks force-pushed the fix/assistant-host-project branch from 242f3f5 to 2ce9634 Compare October 20, 2026 02:37
@me2seeks me2seeks changed the title fix(assistant): provision a dedicated workspace on the owning Host fix(assistant): allocate a Host workspace when remote project resolution fails Oct 20, 2026

@Astro-Han Astro-Han 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.

Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

I reviewed all 17 changed files at 2ce96344fb0db4f4f22ab70dd3b59e06f096ac7e and compared the rewritten implementation with d1045c778f64655f86b50440cb2095331ebca44b. The earlier renderer-side project selection and explicit creation Host parameter have been replaced. For implicit assistant creation on an environment or remote Host, Desktop now asks that Host to allocate a fresh workspace when its normal default/current project resolution produces none. Explicit project/path validation and existing project preferences retain precedence. The Host creates a directory under its own home, validates ownership and real paths, and registers it through the project membership gate (apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts:160, packages/runtime-host/src/server/personal-assistant-workspace.ts).

No new P0–P2 findings. One P3 cleanup issue remains: workspace allocation commits before session creation validates its prerequisites. With no default model configured, three attempts through the actual Desktop creation handler/resolver and production Host handlers all failed, leaving three registered projects and three empty task directories, with zero sessions and no assistant binding. The inline comment at runtime-host-session-catalog-ipc-main.ts:166 describes this reproducible residue. Preflight validation or recovery of allocations known to be unused would avoid accumulating them; an ambiguous session-create response must not trigger unconditional deletion.

Validation included 77 Desktop tests, 17 Host tests and two production composition tests. Removing only the new Main-process fallback callback made the assistant creation regression test fail again with the required-project error. Two additional integration cases used the actual navigation, Main-process creation handler, workspace resolver, production Host composition and SQLite binding store, with an in-process transport and a controlled model backend. Two simultaneous opens allocated two distinct workspaces/sessions but converged on the same durable assistant binding; reopening allocated nothing further. The other case reproduced the failed-creation residue above. These cases did not exercise an authenticated remote connection or the full preload transport.

Four real-filesystem cases exercised the actual allocator, catalog and membership gate: 24 concurrent allocations beneath a home directory that was itself a Git repository produced distinct project identities and the exact nested task paths, with registration serialized; registration failure propagated and a subsequent allocation succeeded; replacing a newly allocated directory with an outside-pointing symlink was rejected by catalog containment checks; redirecting the tasks parent outside the intended root was rejected without creating outside contents.

The normal clean root test build, all workspace type checks, production renderer build, lint, formatting, ASF headers, 168 architecture tests plus the check against main, surface inventory, Windows skip inventory, E2E budget and protocol guard passed. The previously reported Kimi lowest-effort prompt-suggestion test also passed individually on this head. The protocol epoch changes from 225 to 226 for assistant.allocate-workspace, so Desktop and Host must use compatible protocol versions. P3 (coordination): #6091 and #6163 have been asked to move to 226 as well; whichever merges first takes 226 and the others must bump again. At the final status check, exact-head CI run 39359909044 was queued, not successful. A trial merge with main b0ed5707ff3dc645c66253ed93e50936e3f9d45d had no conflicts; that merged tree was not built or tested.

I did not run the full repository test suite, live Windows/WSL or authenticated remote deployment tests, installer packaging, or paid model calls. The checks above support the Host-owned fallback and binding behavior within those limits; CI completion and the merge decision remain with the maintainers.

Comment thread apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts

@Astro-Han Astro-Han 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.

Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

Incremental review of 2ce96344..cc1978e2 (one commit, +34/-2, no rebase). No P0–P2 findings.

  • Prior P3 (failed creation leaves registered empty projects): fixed for the reported case. HostPersonalAssistantWorkspace.allocate() now runs preflightSessionCreation() before resolving home, creating the task directory or registering a project, and the composition wires it to sessionCatalog.resolveDefaultCreateTarget() (execution-composition.ts:2617). With no default model configured, allocation now fails with the same error before any durable state is written.
  • Tests: the composition test now calls assistant.allocate-workspace before configuring a default target and asserts the failure, zero sessions and no ~/Maka directory, then configures the target and continues the original path. A new unit test checks that a throwing preflight leaves no task directory and no registered project.
  • Residual note (not a finding): the preflight is check-then-act, so a default model removed between allocation and session creation, or a session-create failure for an unrelated reason, can still leave one empty registered workspace. That window is narrow and does not need to block.

Prior conclusions on the Host-owned fallback and binding behavior stand. The protocol epoch remains 226 (see the earlier note about #6091 and #6163).

@github-actions github-actions Bot added effort/L Under 1000 readable lines and removed effort/M Under 500 readable lines labels Oct 20, 2026
…on fails

Preserve configured default/current projects, local managed task directories and existing assistant binding behavior. Add a Host-owned allocation fallback only for implicit WSL/remote assistant creation without a resolvable project.

Generated-by: OpenAI Codex
Validate the default model and Host execution policy before creating a remote assistant task directory. Repeated opens with no configured model now fail without leaving empty task folders.

Generated-by: OpenAI Codex
@me2seeks
me2seeks force-pushed the fix/assistant-host-project branch from cc1978e to 467e16e Compare October 20, 2026 10:31
@me2seeks

Copy link
Copy Markdown
Contributor Author

Codex follow-up: rebased #6176 onto current main dc4515cd6e and pushed head 467e16e6f8 with an exact-head lease. Resolved both conflicts by retaining main's prepareBotWake / Bot model synchronization alongside the workspace allocator in production composition and the assistant test fixture. The range-diff preserves both original feature commits.

#6183 is now included, and both Kimi K3 prompt-suggestion metadata scenarios pass. All 96 focused checks, root build/typecheck/lint/format, Desktop/UI Knip, strict renderer architecture, headers, Windows inventory and protocol guard pass locally.

Main still declares epoch 225; #6091 and #6163 remain open. This PR keeps 226 and must recheck the epoch before merging. No additional verified actionable P3 was found: the reported missing-model residue is fixed, while the acknowledged check-then-act window is documented rather than adding unsafe cleanup after an ambiguous Session-create response.

The PR description/checklist now reflects this rebased head and current validation. This automated response is not independent human approval.

@Astro-Han Astro-Han 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.

Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

Incremental check of cc1978e2..467e16e6. This is a rebase onto current main (which now includes #6139, #6183, #6182, #6181 and #6177). git range-diff shows the preflight commit unchanged and the workspace-allocation commit differing only in surrounding context: the PersonalAssistantService dependencies in execution-composition.ts and the test fixture now sit next to #6181's prepareBotWake / Bot model synchronization, with allocateWorkspace added alongside them. There are no changes to the author's own logic.

Prior conclusions stand: no P0–P2. The rebase resolves the earlier conflict, and CI test now passes; the earlier failure was the Kimi K3 prompt-suggestion test fixed on main by #6183. The protocol epoch is still 226 while main is at 225; if #6091 or #6163 lands first with 226, this PR will need the next unused value.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/L Under 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(desktop): open Personal Assistant on Host-owned workspaces without a current project

2 participants