Skip to content

feat(runner): 独立管理交付工作区并统一运行数据路径 - #2

Merged
GRD-Chang merged 12 commits into
mainfrom
codex/publish-20260919
Sep 19, 2026
Merged

GRD-Chang merged 12 commits into
mainfrom
codex/publish-20260919

Conversation

@GRD-Chang

Copy link
Copy Markdown
Owner

Runner 之前在用户启动命令的本地仓库中创建分支、运行数据和 worktree,交付收尾也可能改变本地 Git 引用。本 PR 将交付操作移到 Runner 独立管理的远端克隆,用户的文件、索引、分支和 Git 元数据保持不变,交付完成后由用户自行拉取代码。

变更

  • 集中定义运行路径:长期数据默认位于 ~/.local/share/agent-run/,支持 XDG_DATA_HOME;配置与临时运行文件按生命周期分别保存。
  • 支持从任意目录通过 --repo OWNER/REPO 启动和管理任务;也可从当前仓库只读识别远端。同一用户、仓库和 Parent 复用唯一未完成任务,不因启动目录或本地 clone 不同而重复执行。
  • 为远端仓库创建独立克隆并校验物理路径、所有权和规范状态目录;Worker 仅访问本轮所需的受管 checkout,其他任务、控制状态和安装数据继续隔离。
  • 安装与卸载保留仓库和任务数据;完成或显式放弃后安全清理 worktree,失败、暂停和等待人工处理时保留现场。
  • 从待检查提交读取 CI 失败分类策略,避免持久克隆的旧 checkout 干扰判断;减少无效的进程发现开销,保留进程组终止和子进程回收。
  • 更新中英文操作、安装文档和 ADR,补齐独立工作区、生命周期、恢复、并发、卸载及沙箱边界测试。

兼容性

新任务使用 Runner 管理的规范状态目录。旧 checkout 内或自定义目录中的任务不迁移、不恢复、不清理;变更命令不再接受任意 --state-dir,status 与 history 保留显式状态目录的只读排障能力。独立克隆仅使用远端已推送内容,不会自动带入用户本地未推送的修改。

验证

  • 同一产品文件树已通过完整回归:make test-full,2943 passed;命令墙钟 266.17 秒。
  • make typecheck 通过,已完成工作区写入边界、并发控制和清理行为的独立审查。
  • 发布文件树一致性、提交历史及 git diff --check 核验通过。
  • 本 PR 将运行公开仓库的完整 CI;以上结果不替代该检查状态。

请使用普通 merge 合并此 PR,保留提交历史。

Centralize Runner data, configuration and runtime roots. Create independent remote clones with private context and commit identity while keeping source checkouts untouched.

Keep repository data and records outside installer cleanup, and reject redirected or unowned workspace paths.
Reopen the current checkout and read-only Git metadata beneath the masked Runner data root. Keep sibling tasks, control state and installation snapshots hidden, including from descendant processes.
Route repository inference and explicit --repo selection through one managed clone. Share task control across user checkouts, use canonical state paths, and remove custom-state mutation routing.

BREAKING CHANGE: New runs use the Runner data directory. Existing tasks in checkout-local or custom state directories are not resumed or migrated.
Prepare CLI runs in independent clones while preserving direct engine injection. Keep executor fencing, recovery, control actions and read-only observation assertions under the new ownership boundary.
Document managed repository selection, unified paths, task uniqueness and cleanup boundaries. Keep private context in committed remote files and leave user checkouts and historical tasks under user control.
Bind repairability to expected_head_sha so fetched community changes and concurrent tasks do not use stale configuration from the persistent clone checkout. Missing objects or policy never fall back to local files.
Resolve data-home aliases consistently and reject both user working trees and Git metadata directories. Revalidate existing clones so relocating Runner data cannot bypass repository ownership checks.
Avoid scanning descendants after the child has exited and skip discarded adoption scans when no baseline was supplied. Preserve process-group termination and child reaping. Reuse the already validated clone during test preparation.
Point real executor contention probes at managed state and Git roots. Verify uninstall preserves a populated managed repository instead of comparing empty legacy directories.
@GRD-Chang
GRD-Chang merged commit 1347dcd into main Sep 19, 2026
1 check passed
@GRD-Chang
GRD-Chang deleted the codex/publish-20260919 branch September 19, 2026 11:09
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