Skip to content

feat(git): add a short-lived Gitoxide admission helper - #3561

Draft
zhiiw wants to merge 2 commits into
apache:mainfrom
zhiiw:codex/gitoxide-short-lived-helper
Draft

feat(git): add a short-lived Gitoxide admission helper#3561
zhiiw wants to merge 2 commits into
apache:mainfrom
zhiiw:codex/gitoxide-short-lived-helper

Conversation

@zhiiw

@zhiiw zhiiw commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Introduce a one-request/one-response Gitoxide helper for repository admission without restoring the retired bundled-Git or system-Git execution seams.

The helper:

  • opens repositories through gix::open::Options::isolated() with strict configuration;
  • returns exact SHA-1 HEAD commit/tree identity;
  • rejects SHA-256 and unknown object formats before issuing an observation;
  • accepts one bounded strict-JSON request on stdin, emits one JSON response, and exits;
  • never listens on a socket, retains a repository handle, or owns durable state.

Primary invariant

Before any managed-workspace durable mode or T1 selection, the Git backend can fail closed on unsupported repository object formats without invoking or falling back to system Git.

Owner: the single helper process invocation.
Atomicity boundary: one read-only observation from one isolated repository handle.
Failure states: exit 2 for policy rejection; exit 1 for stable operational errors.
Rollback: none, because this slice is read-only.

Scope

This is intentionally a Draft validation slice. It has no Desktop, CLI, Runtime Host, or M2 production consumer and does not implement source import, projection, candidate CAS, Write/Edit, or resume. A later slice must verify the helper artifact identity and convert an observation into an owner-issued opaque admission capability.

Verification

  • Rust protocol tests: 2 passed.
  • The helper tests run with an empty PATH and hostile Git config environment.
  • ASF source-header audit passes.
  • Cargo metadata: 138 locked packages, with no missing/GPL/AGPL license expression.
  • Dedicated Linux/macOS/Windows workflow added.
  • Ordinary npm tests and product runtime do not require a Rust toolchain.
中文说明

摘要

本 PR 引入一个“一次请求、一次响应、随后退出”的 Gitoxide helper,用于 repository admission;不会恢复已经废弃的 bundled Git 或 system Git 执行入口。

Helper 使用隔离且 strict 的 Gitoxide repository handle,返回 SHA-1 仓库的 exact HEAD commit/tree;SHA-256 与未知格式在 observation 发行前稳定拒绝。它不监听 socket、不复用 handle,也不持有 durable state,因此不是常驻 broker。

主要不变量

在选择 managed-workspace durable mode 或写入 T1 以前,Git backend 可以对不支持的 object format fail closed,并且不得调用或回退系统 Git。

Owner 是单次 helper 进程;原子性边界是一个隔离 repository handle 的一次只读观察;policy rejection 使用 exit 2,operational failure 使用 exit 1;因为只读,所以没有 rollback。

范围

该 PR 有意保持 Draft。当前没有 Desktop、CLI、Runtime Host 或 M2 生产消费者,也不实现 source import、projection、candidate CAS、Write/Edit 或 resume。后续切片必须验证 helper artifact identity,并把 observation 转换成 owner-issued opaque admission capability。

验证

  • Rust 协议测试 2 项通过。
  • 测试启动 helper 时清空 PATH 并注入恶意 Git config。
  • ASF source-header audit 通过。
  • 138 个锁定 Cargo package 未发现缺失/GPL/AGPL license expression。
  • 增加 Linux、macOS、Windows 独立 workflow。
  • 普通 npm 测试与最终用户运行不需要安装 Rust。

@zhiiw

zhiiw commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the unsupported-format admission gap at the open-error boundary.

gix 0.86.0 rejects an unknown extensions.objectFormat while constructing the repository handle, before repository.object_hash() is reachable. The helper now classifies that specific typed configuration error as repository_rejected / unsupported_object_format with exit 2, while unrelated repository-open failures remain operational errors with exit 1.

I also tested the adjacent replacement-ref identity hypothesis. With refs/replace/<HEAD> present, the isolated helper returns the raw HEAD commit and raw tree identity, not the replacement commit's tree. A regression now pins that behavior.

Verification: 4/4 Rust protocol tests pass; ASF header audit and diff check pass.

中文说明

已在 repository open-error 边界修复未知 object format 的分类缺口。

gix 0.86.0 会在构造 repository handle 时拒绝未知的 extensions.objectFormat,因此旧代码确实无法进入 repository.object_hash() 的 unknown 分支。现在 helper 会把该特定 typed-config error 转换为 exit 2 的 repository_rejected / unsupported_object_format;其他 open 失败仍保持 exit 1 的 operational error。

同时验证了相邻的 replacement-ref 身份假设:存在 refs/replace/<HEAD> 时,isolated helper 返回 raw HEAD commit 与 raw tree,不会把 replacement commit 的 tree 混入 observation。对应回归测试已经加入。

验证结果:Rust 协议测试 4/4 通过,ASF header audit 与 diff check 通过。

@zhiiw

zhiiw commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

The follow-up Gitoxide validation stack is now complete as three narrowly scoped stacked Drafts:

  1. artifact identity → opaque invocation capability
  2. bounded short-lived invocation owner
  3. exact repository observation → opaque admission capability

The combined real-helper contract now covers, on the same Runtime Host path:

  • forged release claims and wrong-owner capabilities fail closed;
  • symlink/junction helper paths and post-admission byte changes fail closed;
  • the helper runs with fixed argv, minimal environment, bounded I/O, timeout/cancellation, and no shell;
  • exit 0/1/2 map strictly to SHA-1 observation / stable operational failure / unsupported-format policy rejection;
  • raw repository paths and OIDs cannot self-authorize an admission capability;
  • SHA-256 repositories remain explicitly unsupported and receive no capability.

The three-platform workflow builds the real Rust helper and runs the artifact, invocation, and admission contracts. These PRs intentionally remain Draft: they do not claim a signed packaged-release trust root, a protected installation root, Desktop/CLI consumption, T1 persistence, source import, projection, candidate, or ref CAS. Those are production integration gates, not hidden assumptions in the helper validation stack.

中文说明

Gitoxide 后续验证链已经按三个窄边界完成:

  1. helper artifact identity → opaque invocation capability;
  2. bounded short-lived invocation owner;
  3. exact repository observation → opaque admission capability。

联合真实 helper 合同已经证明:伪造 claim、错误 owner、symlink/junction、admission 后字节变化全部 fail closed;helper 使用固定 argv、最小环境、I/O 上限、超时/取消且不经过 shell;exit 0/1/2 严格对应 SHA-1 observation、稳定 operational failure、unsupported-format policy rejection;裸 path/OID 不能自证 admission;SHA-256 默认拒绝且不签发 capability。

三平台 workflow 会构建真实 Rust helper,并运行 artifact、invocation、admission 合同。这些 PR 仍保持 Draft,因为正式发布签名信任根、受保护安装路径、Desktop/CLI、T1、source import、projection/candidate/ref CAS 尚未接入;这些是后续生产接线门槛,不是当前验证栈里的隐藏假设。

@zhiiw
zhiiw force-pushed the codex/gitoxide-short-lived-helper branch 2 times, most recently from b48b53d to 98d5106 Compare August 23, 2026 16:32
@zhiiw
zhiiw force-pushed the codex/gitoxide-short-lived-helper branch from 98d5106 to 3453011 Compare August 24, 2026 04:04
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