Skip to content

bug(runtime-host): align CLI and Desktop local recovery and fix misleading TUI startup prompts #5026

Closed

Description

@me2seeks

What happened

A source-linked local maka cannot recover from an incompatible, same-account ephemeral Runtime Host. Startup shows an operator/permission message and only Cancel/Retry, even though the Host is local and has no managed deployment owner. Desktop has additional identity-checked recovery paths for older ephemeral Hosts; CLI/TUI should expose equivalent recovery capabilities when the same authority and safety conditions are satisfied.

The startup message also misidentifies the situation and prints a stray prompt before explaining the blocker:

> 
需要在服务所在位置处理
当前客户端没有替换此服务的权限。请在 Local 上,由管理该服务的用户更新或停止服务。
Maka 会持续检查。常驻服务不会仅因等待而退出,可能需要你采取操作。
Enter: 取消 · r: 安全重试 >

Expected:

  • CLI/TUI and Desktop use consistent local Host recovery eligibility and consequences for equivalent installations, ownership evidence, and Host state.
  • A source checkout has an explicit recovery path for an existing local unmanaged Host. Unsupported npm installation identity must not silently become an OS-permission diagnosis.
  • Unknown activity requires explicit interruption consent; automatic replacement requires fresh safety evidence. Managed services retain their installed operator authority.
  • Explain the compatibility mismatch, actual lifecycle/installation blocker, and available next action. A failed natural-exit check does not establish that the Host is a persistent service.
  • Render the startup explanation before an actionable prompt; do not show an orphan > that resembles a ready chat input.

How to reproduce

  1. Run Maka from a source checkout through a linked maka command and leave its local ephemeral Host running.
  2. Update/rebuild the checkout so the CLI compatibility epoch differs from that running Host. In the observed case, the old Host reports blocked_by_residency without activity details.
  3. Run the linked maka against the same workspace root and OS account.
  4. Observe the operator-required screen above. Retrying does not add a recovery capability while installation and Host state remain unchanged.

Observed live evidence from a read-only connectExistingRuntimeHost probe:

{
  "clientEpoch": 131,
  "kind": "incompatible",
  "registration": {
    "compatibilityEpoch": 121,
    "lifecycleMode": "ephemeral",
    "state": "ready"
  },
  "handshake": {
    "kind": "incompatible",
    "compatibilityEpoch": 121,
    "replacement": "blocked_by_residency"
  }
}

Both managed deployment authority and local deployment records were absent. The command and running Host pointed into the same checkout and ran under the same OS account. Installation resolution returned:

unsupported_installation: A development checkout is not a persistent npm CLI installation

The specific resident work was not established; the report does not assume it is safe to interrupt.

The extra leading > is independently reproducible without a live Host: instantiate createCliHostHandoffSurface with a PassThrough input and writable output with isTTY = true, then publish its first attention view. The captured output, after stripping terminal control sequences, starts with "> \n需要在服务所在位置处理".

Environment

  • Source commit inspected: 93a8dd7852b268ddcce930ce6f28bf85dff4c955
  • Linux 7.0.0-30-generic
  • Node.js v26.3.0
  • Surface: CLI/TUI startup; Desktop recovery comparison is source-derived
  • Source-linked private maka-agent workspace package
  • Runtime Host epoch: 121; current CLI build epoch: 131; source epoch: 133. These are distinct running/build/source states, not release version numbers.

Logs, screenshots, or additional context

Source references pinned to the inspected commit:

  • CLI replacement eligibility: only an eligible persistent npm-global installation creates a replacement capability; installation errors are swallowed. The blocker omits the specific installation failure and compatibility diagnostic.
  • Source installation rejection.
  • Desktop older ephemeral Host recovery: when process identity evidence is available, explicit consent can invoke identity-fenced termination. This is a capability comparison, not a claim that Desktop was exercised against the affected production workspace.
  • Shared blocker projection: missing replacement becomes operator_required.
  • Copy projection: mayExitNaturally = false becomes persistent-service wording even for an ephemeral Host.
  • Premature readline redraw: readline.write(null, { ctrl: true, name: 'u' }) redraws the default > before the description and before setPrompt installs the action prompt. This screen runs before runMakaPiTui starts.

Suggested acceptance criteria:

  • Equivalent CLI/TUI and Desktop scenarios yield consistent recovery capabilities under shared ownership, identity and activity checks.
  • Cover source-linked unmanaged Hosts, npm-owned Hosts, managed Hosts, owner mismatch, unknown/active work, changed process identity, cancellation and safe retry.
  • Preserve specific incompatibility and installation/authority failure reasons in the startup presentation; show a concrete next action.
  • Do not label an ephemeral Host as a persistent service solely because natural exit is not advertised.
  • A terminal-output regression test verifies that the first explanation precedes the action prompt, while subsequent view changes still discard stale partially typed consent.

Validation performed: live read-only handshake and installation probes, isolated terminal-output reproduction, and 54 passing tests from the existing built Host handoff / CLI context / local handoff suites. The suites were run against existing build artifacts, not a fresh build of the inspected source. Existing tests explicitly expect operator_required for unsupported installations, so their success does not cover the missing user recovery path. No running Host was stopped and no workspace data was modified.

Related implementation: #4958; managed activation context: #4962. This report concerns the remaining recovery capability and startup presentation gaps.

Activity

  1. added
    bug
    on Sep 8, 2026
  2. me2seeks commented on Sep 8, 2026

    @me2seeks
    ContributorAuthor

    take

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

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions