feat(cli): set up managed remote Runtime Hosts - #3230
Conversation
Provide one idempotent Host-side setup transaction for future Desktop and terminal onboarding. The command installs the exact invoking release into a Maka-owned deployment, composes the existing systemd lifecycle with stable Client credential replacement, and verifies the authenticated loopback Host before returning connection facts. Service uninstall removes the managed package while retaining the State Root, and interrupted setup remains safe to retry. Generated-by: Codex
|
Warning Review limit reached
Next review available in: 11 minutes Limit details: You’ve used all 3 included reviews currently available. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughProblem solvedThis PR adds an idempotent Linux CLI setup transaction for managed remote Runtime Hosts. It:
The setup contract supports the future Desktop Add Computer flow. It does not add Desktop UI, automatic updates, version switching, macOS or Windows service support, Node.js installation, sudo usage, or SSH configuration changes. Source of truth and solution scopeThe PR extends the existing CLI, Runtime Host access-authority, service-management, and protocol paths. It does not create a parallel authentication or service-management system. The new setup command composes existing service and access-authority operations. The managed deployment path preserves the exact package identity, supports safe rollback, and removes only managed files during uninstall. Canonical WebSocket-path validation is shared across setup, service management, serving, SSH tunneling, and listener code. The solution is the smallest coherent implementation supported by the provided change summary. Each added orchestration, deployment validation, framing, credential replacement, and test seam supports a required transaction or failure boundary. Simplification and deletion assessmentNo safe deletion is evident. The tests cover convergence, credential replacement, deployment cleanup, output redaction, malformed frames, path validation, service-install failure, and State Root retention. Removing these tests or their supporting seams would weaken regression coverage. Shared option parsing and canonical WebSocket-path validation reduce duplicated logic. Further dependency-injection simplification can be considered after broader usage. This is optional follow-up work. Validation and risksThe change summary reports tests for:
The final status of required checks is unverified. The requested repository diff produced no output, so it provides no additional validation evidence. Complexity deltaThe PR adds:
It removes or consolidates:
The PR increases local implementation complexity. The added states, validation, and public surface are necessary for an idempotent, retry-safe, machine-readable transaction. The available evidence supports that total maintenance complexity stays justified, but not that it decreases. Review-relevant risks
The person performing the merge reviews the final diff. A maintainer makes the final determination. WalkthroughThe PR adds an idempotent Linux Runtime Host setup command. It manages persistent package deployment, service installation, credential replacement, authenticated verification, structured output, canonical WebSocket paths, cleanup, tests, and documentation. ChangesRuntime Host setup
Estimated code review effort: 4 (Complex) | ~60 minutes Merge Risk: 🟠 High · up to The setup flow can revoke an existing client credential when verification fails, leaving the host inaccessible, and a later service-install path can lose the deployment cleanup reference so uninstall leaves managed files behind. Merge should be blocked until both rollback and cleanup failures are fixed and covered by regression tests. Sequence Diagram(s)sequenceDiagram
participant MakaCli
participant ManagedDeployment
participant RuntimeHostService
participant RuntimeHostAccessAuthority
participant RuntimeHostWebSocket
MakaCli->>ManagedDeployment: prepare service-owned package deployment
MakaCli->>RuntimeHostService: install and verify managed service
MakaCli->>RuntimeHostAccessAuthority: replace principal credential
MakaCli->>RuntimeHostWebSocket: verify authenticated connection
MakaCli-->>MakaCli: emit completion or error frame
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
PR Summary by QodoAdd managed remote Runtime Host setup transaction
AI Description
Diagram
High-Level Assessment
Files changed (21)
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 690905ed-1433-4a9c-bc5d-0b888dd22bc2
📒 Files selected for processing (21)
docs/runtime-host-remote-access.mddocs/runtime-host-remote-access.zh-CN.mdpackages/cli/README.mdpackages/cli/README.zh-CN.mdpackages/cli/src/__tests__/runtime-host-operator-command.test.tspackages/cli/src/__tests__/runtime-host-service-manager.test.tspackages/cli/src/__tests__/runtime-host-setup.test.tspackages/cli/src/cli-core.tspackages/cli/src/runtime-host-access-command.tspackages/cli/src/runtime-host-cli.tspackages/cli/src/runtime-host-managed-deployment.tspackages/cli/src/runtime-host-service-management-command.tspackages/cli/src/runtime-host-setup-command.tspackages/runtime-host/src/__tests__/authenticated-websocket.test.tspackages/runtime-host/src/__tests__/websocket-listener.test.tspackages/runtime-host/src/client/index.tspackages/runtime-host/src/client/setup-frame.tspackages/runtime-host/src/protocol/access-authority.tspackages/runtime-host/src/server/access-authority.tspackages/runtime-host/src/server/host-kernel.tspackages/runtime-host/src/server/operation-dispatcher.ts
Included review availability: Your plan provides up to 3 included reviews per hour; 2 remain after this review.
Code Review by Qodo
1.
|
Base service persistence on the final launch path, preserve the exact managed deployment identity, and apply one validation contract to setup frames and WebSocket paths. This keeps the documented npx setup and later uninstall reliable across environment changes. Generated-by: Codex
091af68 to
ba5a60b
Compare
|
/agentic_review |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/cli/src/runtime-host-setup-command.ts (1)
143-181: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftKeep the prior pairing state until verification succeeds.
deployment.rollback()runs only whenmanageService()throws. A failed readiness check, pairing operation, or credential verification exits without compensating the changed state.For an existing
principalId,replaceCredential()revokes the prior credential beforeverifyCredential()runs. If verification fails, setup emits only an error frame. The prior Client credential is revoked, and the new credential is not returned. The existing Client can no longer reconnect.Disposition: fix-now.
Deletion or reuse of the current rollback is insufficient. The current replacement operation commits immediately. Add a pending credential or equivalent commit-and-rollback protocol. Finalize replacement only after authenticated verification succeeds. Coordinate service and deployment rollback in the same transaction scope. This adds temporary credential state, a commit surface, and failure-path tests.
Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 12fe5c97-edd4-4461-8f60-a391d8dbc7a6
📒 Files selected for processing (19)
apps/desktop/src/renderer/settings/runtime-host-profiles-section.tsxdocs/runtime-host-remote-access.mddocs/runtime-host-remote-access.zh-CN.mdpackages/cli/README.mdpackages/cli/README.zh-CN.mdpackages/cli/src/__tests__/runtime-host-service-manager.test.tspackages/cli/src/__tests__/runtime-host-setup.test.tspackages/cli/src/runtime-host-cli.tspackages/cli/src/runtime-host-managed-deployment.tspackages/cli/src/runtime-host-service-management-command.tspackages/cli/src/runtime-host-service-manager.tspackages/cli/src/runtime-host-setup-command.tspackages/runtime-host/src/client/host-profile.tspackages/runtime-host/src/client/index.tspackages/runtime-host/src/client/setup-frame.tspackages/runtime-host/src/client/ssh-tunnel.tspackages/runtime-host/src/protocol/index.tspackages/runtime-host/src/protocol/websocket-path.tspackages/runtime-host/src/server/websocket-listener.ts
Included review availability: Your plan provides up to 3 included reviews per hour; 0 remain after this review.
|
Code review by qodo was updated up to the latest commit ba5a60b |
Reject launch transitions that would discard ownership of a setup-managed package. Validate the persisted canonical deployment target before recursive uninstall so redirected paths cannot escape the managed tree.\n\nGenerated-by: Codex
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 05ddec0 |
|
Given that there are currently almost no users on the remote host and the associated risk is relatively low, it is hereby decided to proceed with the merge first. |
English
Summary
Add one idempotent Host-side setup flow for managed remote Runtime Hosts. A released CLI can now:
This is the CLI contract that the later Desktop Add Computer wizard will invoke through interactive system SSH. Desktop UI, version switching, automatic updates, and macOS service support remain outside this PR.
Fixes #3229
Verification
npm run build:testnpm run typechecknpm --workspace @maka/runtime-host test— 979 passednpm --workspace maka-agent test— 285 passedgit diff --checkAI use
Select exactly one:
Tool(s) and scope: OpenAI Codex assisted with implementation, tests, documentation, and validation under the maintainer's direction
Checklist
Does this PR entail a change in behavior?
简体中文
摘要
为托管的远程 Runtime Host 增加一个幂等的 Host 侧 setup 流程。发布版 CLI 现在可以:
这是后续 Desktop 添加电脑 向导通过交互式 system SSH 调用的 CLI 契约。Desktop UI、版本切换、自动更新和 macOS service 支持不属于本 PR。
修复 #3229
验证
npm run build:testnpm run typechecknpm --workspace @maka/runtime-host test— 979 项通过npm --workspace maka-agent test— 285 项通过git diff --checkAI 使用
OpenAI Codex 在维护者指导下协助实现、测试、文档与验证;权威选择见英文部分
检查清单