Skip to content

feat(runtime): resolve Codex and Claude Code CLIs through the dependency manager - #1138

Draft
sheepbox8646 wants to merge 4 commits into
workspace-deps/02-service-apifrom
workspace-deps/03-runtime
Draft

feat(runtime): resolve Codex and Claude Code CLIs through the dependency manager#1138
sheepbox8646 wants to merge 4 commits into
workspace-deps/02-service-apifrom
workspace-deps/03-runtime

Conversation

@sheepbox8646

@sheepbox8646 sheepbox8646 commented Sep 2, 2026

Copy link
Copy Markdown
Member

变更内容

workspace-deps 第 3 层:direct runtime 通过依赖管理器解析 CLI,不再硬编码 /opt/memoh/toolkit/bin/{codex,claude}

  • 端口internal/agent/runtime/external):DependencyRequirer(driver 声明依赖 id)、LauncherResolverLauncher(按 managed → toolkit → PATH 的来源优先级解析可执行文件,不做版本判断)、VersionObserver(握手版本回写缓存)、DependencyMissingError;反馈码 agent_dependency_missing(409,args dep_id/install_task_id)。
  • resolverinternal/workspacedeps):Service 实现上述端口;无副本时通过 background.SpawnManaged 投递后台安装并返回 task id。
  • codex/claudecode driver:启动前解析 launcher;握手上报的版本回写;缺失时 feedback 沿既有路径到达用户。
  • PATH 优先级:bridge 对每次 exec 前置 /data/.memoh/deps/bin(存在时),direct runtime 与通用 ACP 的 containerPath 同步——这是覆盖层对 agent 命令生效的前提。
  • 装配:driver 注入 resolver;启动期校验声明的依赖存在于 catalog 且 launcher 命令匹配,失败阻止启动。
  • API:bot agents 响应带 dependency {dependency_id}CreateRequest.enabled 可选;ListModels 透传 feedback 错误;runtime_notice 的 metadata 投影为 UI message args
  • 收敛:toolkit wrapper 删除 PATH fallback。

验证

  • go test ./... 全绿;golangci-lint 0 issues;FX 图校验通过。
  • 第二套 dev 环境:Codex agent 在 managed 副本下正常解析并启动;缺失路径返回 agent_dependency_missing 并触发后台安装。

⚠️ No human QA — this PR has not been verified by a human yet. Remove this line once a human confirms the happy path.

🤖 Generated with Claude Code

https://claude.ai/code/session_017sihinqYWYNmZ9K842WqDJ

@sheepbox8646 sheepbox8646 changed the title workspace deps/03 runtime feat(runtime): resolve Codex and Claude Code CLIs through the dependency manager Sep 2, 2026
@sheepbox8646
sheepbox8646 force-pushed the workspace-deps/03-runtime branch from a4d9751 to 9f7dc4a Compare September 3, 2026 08:00
@sheepbox8646
sheepbox8646 force-pushed the workspace-deps/03-runtime branch 2 times, most recently from a503e79 to c574342 Compare September 3, 2026 09:44
@sheepbox8646
sheepbox8646 force-pushed the workspace-deps/03-runtime branch from c574342 to b6d61cc Compare September 3, 2026 12:19
sheepbox8646 and others added 4 commits September 3, 2026 22:12
Adds the neutral port between direct runtimes and the workspace dependency
manager: drivers declare the catalog dependency and pinned version that
provides their CLI, and resolve the executable through LauncherResolver at
launch time. Also adds the two stable feedback codes for a missing
dependency and a version mismatch.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sihinqYWYNmZ9K842WqDJ
…ager

Codex and Claude Code drivers declare their workspace dependency and pinned
CLI version, resolve the executable through the LauncherResolver before
launching (managed at pin → toolkit at pin → any managed → any toolkit →
PATH) and surface a one-time runtime_notice per thread when the running
copy differs from the pin. A missing copy returns the stable
agent_dependency_missing feedback and starts a background install through
the new background.SpawnManaged task kind. Bot agents API responses now
carry the runtime's dependency requirement, direct agents can be created
disabled, and the toolkit launcher wrappers lose their PATH fallback.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sihinqYWYNmZ9K842WqDJ
…rivers

Injects the workspace dependency service into the Codex and Claude Code
drivers, validates at startup that every driver's declared dependency
exists in the catalog at the declared pin with the expected launcher
command, projects runtime_notice metadata into UI message args so the web
client can render alignment actions, and makes the panel's alignment
verdict follow the same launcher candidate order the resolver and
preflight use.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sihinqYWYNmZ9K842WqDJ
… shim dir to PATH

With the pins gone the runtime ports carry no version: DependencyRequirer
names only the dependency, Launcher no longer reports a mismatch and the
resolver ranks discovered copies by source (managed → toolkit → PATH)
regardless of version, so selectLauncherCandidate moves from the service
into resolver.go where the ports live. The version-mismatch feedback,
runtime notice and start-up pin validation are dropped; the drivers still
report the handshake version to the copy they launched. The bridge
prepends the dependency shim directory to PATH for every exec and the
Codex, Claude Code and ACP launchers do the same, so a managed overlay wins
over the image copy in terminals and runtimes alike. Bot agent dependencies
shrink to {dependency_id}; Swagger and the SDK are regenerated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sihinqYWYNmZ9K842WqDJ
@sheepbox8646
sheepbox8646 force-pushed the workspace-deps/03-runtime branch from b6d61cc to 6f3557d Compare September 3, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant