Repository navigation
feat(cli): initialize model connections and default target from stdin - #6805
Conversation
Extend maka host init --settings-stdin with model connections, API keys, request headers, enabled models, model overrides, request body overlays, and default target selection for a fresh State Root. Validate the complete input before detaching the worker or creating the Root. Reuse canonical header validation, provider authentication, and credential enrollment. Share local-only authentication transport between settings and CLI code, and authenticate against the claimed connection basis. Keep initialization tests focused on distinct behaviors. Refs apache#6667 Generated-by: Antigravity Generated-by: OpenAI Codex
de3056f to
d8868e3
Compare
There was a problem hiding this comment.
Finding
- [P2][normal headless bootstrap path] Preflight the configured default model before creating the Root.
Settings::preparecurrently checks only thatdefaultTargetnames an enabled connection and model (products/maka/cli/src/initialize.rs:472). It never asks the provider to resolve that model and its overrides. On exact headd8868e37fa59e4b93c19bf342c5b52231b9e677b, I supplied an enabled default model withthinkingLevels: ["off"]anddefaultThinkingLevel: "medium";maka host init --settings-stdinexited successfully and persisted the Root. The first Agent or ACP model selection then followsSource::select -> Definition::prepare, where the same configuration is rejected asUnsupportedThinkingLeveland surfaces asagent_model_unavailable. Because this initializer also rejects an existing Root, a generic headless caller cannot correct the invalid bootstrap through the same interface. Please resolve the selected provider/model/overrides beforeRootOwner::create, and add a subprocess regression proving that an invalid default exits nonzero and leaves no Root.
Conclusion
I found no P0 or P1 issue. The implementation reuses the existing configuration, credential, and provider authorities, but the broken-default case above is a real, recoverable P2 and should be fixed.
I reviewed exact head d8868e37fa59e4b93c19bf342c5b52231b9e677b against current rust-preview 51e24532283f30e71bbafb9f008dd64dd6dfbbaf; the clean merge tree is 2b907d5c9c9aa7667fae83858a9b056c42e35aa8, and the relevant initialization/provider/model files are unchanged by the new base. Formatting and diff checks passed. Three initialization integration tests passed locally. The unchanged unfinished-stdin deadline test timed out twice on macOS, so I am not treating the local suite as fully green. GitHub's exact-head run is also not green: its remaining failures are in compaction, steering-fixture, and Desktop UI paths outside this PR's changed files.
Follow-up on final head 63a4b2d5 / landed e84c0742
The original finding above is fixed on the final head. The initializer now runs the selected default model through Definition::prepare before RootOwner::create, and the added public subprocess regression covers the contradictory thinking-level case, generic diagnostics, and absence of a Root. The landed tree exactly matches the final base-plus-head merge, and both Generated-by trailers were preserved.
Remaining finding
- [P2][normal headless bootstrap path] Reject a required-auth default when this bootstrap supplied no credential. The new preflight calls
Definition::prepare, which validates model policy but does not callDefinition::authorize. For example, an enabledprovider: "openai"connection can be selected as the default withoutapiKey; OpenAI's descriptor is non-anonymous, and its provider rejectsauthorize(..., None, ...). The bootstrap nevertheless passes its checks, creates the Root and stores that default. The first Agent or ACP request then fails asagent_authentication_unavailable. ProtectedAuthorizationandx-api-keyrequest-header names cannot supply the missing provider credential, whilehost initrefuses an existing Root. Please reject a selected non-anonymous provider unless this input prepared a supported credential, and add a public subprocess regression proving the failure leaves no Root.
I found no P0 or P1 on final head 63a4b2d5e04d6ac6e3d5219efb5942286479b8f5; the required-credential case above is the remaining P2. The 18-file final patch passed formatting and diff checks. I independently ran the provider configuration-admission test and the provider policy test that proves required-auth providers reject a missing credential. I did not independently rerun the full CLI or HTTP ACP/restart scenarios. Exact-head CI 43172019593 is not green because its root build stopped on the already-reported live_workspace compile failure inherited from #6816; current Rust contains the source fix, but its replacement run was still active at this review cut.
Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.
Keep endpoint constraints in providers and explicit token limits in shared configuration validation. Preflight the selected default model before creating a Root, extend public CLI regression coverage, and document the stdin payload. Generated-by: OpenAI Codex
…6909) Extend `maka host init --settings-stdin` to accept optional `chatDefaults` and `projectDirectoryRoots` so headless ACP clients and `maka-eval` containers can seed the default sandbox policy and register explicit workspace roots outside `$HOME` before starting a Host. - Accept `chatDefaults` and non-empty `projectDirectoryRoots` in `Settings` / `PreparedSettings`, normalizing directory roots before `RootOwner::create` with redacted failure diagnostics. - Reject workspace roots overlapping the resolved target State Root (including non-existent parent `..` traversals), Host control directory, or ownership lease directory without creating `.maka-storage-root.json`. - Thread `policy_revision` from `update_network_proxy` into `set_chat_defaults` and persist workspace locations via `configure_workspace_locations` after shutting down `ConfigurationStore`. - Update CLI README examples (`README.md` / `README.zh-CN.md`) and integration tests (`maka acp --root` `session/new` plus redacted rejection cases). Refs #6667 and #6805. Generated-by: Google Antigravity
English
Summary
maka host init --settings-stdincan bootstrap model connections, credentials and a default model on a fresh State Root, so ACP clients and evaluation harnesses can configure Maka without the desktop UI.Refs #6667 and the public connection bootstrap request.
connectionsanddefaultTargetalongside the existing proxy settings, with provider defaults, API keys, request headers, enabled models, model overrides and request body overlays.Verification
Validated at
63a4b2d5e04d6ac6e3d5219efb5942286479b8f5, includingrust-previewthrough08bcd01a03e48cd56764790002c26efd11094402:cargo test -p maka-cli --test integration initialize: 4 passed. Covers persistence, disabled connections, proxy settings, reconfiguration rejection, invalid-input redaction, default-model preflight and unfinished-stdin timeout.cargo test -p maka-providers -p maka-config --test integration: 32 passed (7 provider tests and 25 configuration-store tests).d8868e37and failed because initialization incorrectly succeeded.git diff --check. Clippy with--no-depsand-D warningspassed for CLI, providers, configuration store, agent facts and agent ports.The dependency-inclusive Clippy attempt stopped on the existing
clippy::needless_updateinplugins/agent/provider-protocol/src/chat_completions/response.rs:87, outside this PR's diff. Fulljust checkand live upstream model requests were not run. Remote CI is still running; it is not recorded as passed here.AI use
Antigravity authored the initial implementation. OpenAI Codex reviewed and refined provider-owned validation, added regression coverage and documentation, and performed the verification above. Preserve both tools'
Generated-bytrailers when squashing.Checklist
Does this PR entail a change in behavior?
中文
概述
maka host init --settings-stdin支持为新的 State Root 初始化模型连接、凭据和默认模型,让 ACP 客户端及评测框架无需桌面界面即可配置 Maka。关联 #6667,具体对应公开连接初始化入口的需求。
connections和defaultTarget,支持 provider 默认配置、API key、自定义请求头、启用模型、模型参数与请求体覆盖。验证
验证提交:
63a4b2d5e04d6ac6e3d5219efb5942286479b8f5,已同步rust-preview至08bcd01a03e48cd56764790002c26efd11094402。d8868e37上运行,确认因 init 错误返回成功而失败。--no-deps、-D warnings的 Clippy。包含依赖的 Clippy 被当前基线中
plugins/agent/provider-protocol/src/chat_completions/response.rs:87的clippy::needless_update阻断,该文件不在本 PR 的 diff 中。未运行完整just check或真实上游模型请求。远端 CI 仍在执行,未宣称通过。AI 使用
Antigravity 编写初始实现。OpenAI Codex 完成审查、校验职责收口、回归测试与文档,并执行上述验证。Squash 时保留两个工具的
Generated-bytrailers。