Skip to content

feat(workspacedeps): core — bridge CloseSend, dependency catalog with runtime overlays, runner and discovery - #1135

Draft
sheepbox8646 wants to merge 6 commits into
workspace-deps/00-docsfrom
workspace-deps/01-core
Draft

feat(workspacedeps): core — bridge CloseSend, dependency catalog with runtime overlays, runner and discovery#1135
sheepbox8646 wants to merge 6 commits into
workspace-deps/00-docsfrom
workspace-deps/01-core

Conversation

@sheepbox8646

@sheepbox8646 sheepbox8646 commented Sep 2, 2026

Copy link
Copy Markdown
Member

变更内容

workspace-deps 第 1 层:纯后端基础设施,尚无调用方与行为变化。

  • internal/workspace/bridgeExecStream.CloseSend() 半关闭 stdin 而不 cancel 流;测试跑在真实进程内 bridgesvc 上。
  • internal/workspace:7 处 grpcPool.Remove 收敛为 Manager.resetBridge,新增 OnBridgeReset 回调,作为容器相关缓存的唯一失效点。
  • internal/workspacedeps/catalog//go:embed 的依赖 catalog。五个条目同等对待:Codex、Claude Code 为 managed;Node.js、Python、uv 以镜像副本为底座、可安装 managed 覆盖层。每个条目带 install/update/remove/check-update 脚本(POSIX sh;npm、nodejs.org LTS、uv 安装 CPython、uv releases),安装先落 staging 再原子切换 current,同版本重装不悬空;不钉版,version.pin 对任何依赖只是可选的锁定;描述为中性文案,icon 为 icon 库标识。严格 yaml 解码与校验。
  • internal/workspacedeps:stdin 脚本 runner(prelude 消除 stdin 竞争、per-dep 锁、结果经临时文件回传)、平台探测、一次 exec 探完全部依赖的 discovery(state.json → toolkit → PATH,--version 或可选 version 脚本)、per-(bot,target) 缓存。
  • npm 11 下显式 --allow-scripts=<pkg>,保持全局安装包 install 脚本照常执行。
  • 测试:deps_docker_test.go-tags dockertest)对真实 memohai/workspace:debian 镜像跑通五个依赖的 install → check-update → 同版本 update → remove;CI 对 catalog 脚本跑 shellcheck -s sh

验证

  • go test ./internal/workspace/... ./internal/workspacedeps/... 通过(runner/discovery 测试经真实 bridgesvc 执行本机 sh)。
  • Docker 脚本测试:node 24.20.0、python 3.14.7、uv 0.12.9、codex 0.153.0、claude-code 2.1.259 全部通过。
  • golangci-lint 0 issues;20 个脚本 shellcheck 零告警。

⚠️ 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/01 core feat(workspacedeps): core — bridge CloseSend, dependency catalog, runner and discovery Sep 2, 2026
@sheepbox8646
sheepbox8646 force-pushed the workspace-deps/01-core branch 2 times, most recently from 9191043 to 9010b53 Compare September 3, 2026 09:32
sheepbox8646 and others added 4 commits September 3, 2026 17:37
CloseSend half-closes the exec stream so a process fed over stdin sees EOF
while its output keeps streaming; Close still cancels. The bridge pool's
seven eviction sites now go through Manager.resetBridge, which notifies
OnBridgeReset subscribers so per-container caches can invalidate in one
place. Tests run against the real in-process bridgesvc.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sihinqYWYNmZ9K842WqDJ
Adds internal/workspacedeps/catalog: an embedded catalog of workspace
dependencies (node, python, uv from the image; codex and claude-code as
managed agent CLIs) with strict manifest decoding, validation, script
lookup and a manifest digest. Agent entries are pinned and a test in
cmd/internal/core asserts the pins equal the runtime protocol snapshots.

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

The runner feeds catalog scripts to `exec sh -s` over the bridge exec
stream with a prelude that neutralises stdin, takes a per-dependency lock
and switches `current` atomically; results come back through a temp file
so stdout/stderr stay pure log streams. Discovery probes every dependency
in one exec (state.json, toolkit fallback, PATH copy, --version or the
optional version script) and the cache holds per-(bot,target) snapshots
that invalidate on bridge reset. Tests run scripts through the real
in-process bridgesvc.

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/01-core branch from 9010b53 to 2a0ac1c Compare September 3, 2026 09:44
… to the catalog

Agent CLIs are no longer pinned to the server's protocol snapshot: the
codex and claude-code manifests drop version.pin, install resolves the
latest upstream release by default (or MEMOH_DEP_VERSION when set), and
every dependency gains a check-update script. node, python and uv keep the
image copy as their baseline but now ship install/update/remove scripts
(LTS Node from nodejs.org, CPython via uv, uv from its releases) so a
managed overlay can be installed over the image copy; the manifest model
gains HasImageBaseline/Installable and lets an image-sourced dependency
carry scripts. The catalog-vs-protocol pin test goes away with the pin.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sihinqYWYNmZ9K842WqDJ
@sheepbox8646 sheepbox8646 changed the title feat(workspacedeps): core — bridge CloseSend, dependency catalog, runner and discovery feat(workspacedeps): core — bridge CloseSend, dependency catalog with runtime overlays, runner and discovery Sep 3, 2026
…npm 11

npm 11 skips a global package's install scripts unless they are allowed
explicitly, so Claude Code's postinstall was silently skipped and the log
filled with allowScripts warnings. Pass --allow-scripts for the package
when npm is 11 or newer; npm 10 keeps its default behaviour.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sihinqYWYNmZ9K842WqDJ
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