Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
56cbfce
fix(tests): 以真实契约重整回归并修复凭据与上下文边界
xiaoland Nov 27, 2026
d2eb3e7
fix(platform): 将最终对象状态与命令回执原子提交
xiaoland Nov 27, 2026
7705a04
chore(audit): 临时运行保留性破坏控制与平台基线对照
xiaoland Nov 27, 2026
1c4ef61
fix(audit): 修正测试提取方式并明确平台恢复边界
xiaoland Nov 27, 2026
d8f7d9f
fix(tests): 修正配置夹具并补齐 schema 与调度门槛证明
xiaoland Nov 27, 2026
f5d315c
fix(tests): 对正确的拒绝结果传入借用
xiaoland Nov 27, 2026
204e6de
chore(audit): 完成破坏控制并移除临时验证入口
xiaoland Nov 27, 2026
f9cf8a5
fix(tests): 用真实未回收进程组验证 Tunnel 关闭边界
xiaoland Nov 28, 2026
d06d6d2
fix(tunnel): 等待退出中的进程组完成回收
xiaoland Nov 28, 2026
eb1d54a
chore(integration): 同步 PR 149 最新调度与平台契约
xiaoland Nov 28, 2026
e029438
feat(acceptance): 在真实浏览器、原生安装和发行归档上验证交付
xiaoland Nov 28, 2026
bbc82f6
fix(github): 仅从本次可比的限额响应计算用量变化
xiaoland Nov 28, 2026
7f2e7da
fix(platform): 传播终态回执持久化错误
xiaoland Nov 28, 2026
50d1832
ref(operations): 从真实 CLI、注册表与 Git 工作树验证操作契约
xiaoland Nov 28, 2026
613037b
fix(group): 撤销活动职责时等待原代原生执行与写入资格收口
xiaoland Nov 28, 2026
16d383e
ref(publication): 通过真实分页、发布意图及观察读取验证恢复
xiaoland Nov 28, 2026
acf71e7
chore(ci): 在打包变更的 PR 验证双平台归档并核对旧配置状态
xiaoland Nov 28, 2026
51e9376
fix(platform): 绑定合并回执的原请求并兼容已导入的 Local 命令
xiaoland Nov 28, 2026
fe82de3
ref(provider): 通过原生协议帧、进程和 OTLP 分信号证明终态
xiaoland Nov 28, 2026
84ac362
fix(pi): 关闭构造失败的执行并保留后台清理未确认状态
xiaoland Nov 28, 2026
0e6aec9
chore(audit): 临时验证独立复审恢复的契约会因目标缺陷失败
xiaoland Nov 28, 2026
9d9f0c2
fix(group): 退休前保存停机期间观察到的原生终态
xiaoland Nov 28, 2026
d8e0d90
ref(pi): 保留统一启动清理路径的原生状态采样
xiaoland Nov 28, 2026
8b48ac3
chore(audit): 对运行中撤销的旧实现和终态丢失做定点对照
xiaoland Nov 28, 2026
d827c81
ref(acceptance): 拒绝夹带现成库的归档并核对清理未确认的构造错误
xiaoland Nov 28, 2026
ee6e3a3
fix(lifecycle): 保留撤销证据并停止调度退休代的历史重置
xiaoland Nov 28, 2026
73a9d3f
chore(audit): 复验退休代隔离与未知终态的破坏控制
xiaoland Nov 28, 2026
91b4c05
ref(tests): 用持久游标继续读取事件并核对显式恢复资格
xiaoland Nov 28, 2026
0927d88
chore(ci): 收回本次审计的临时破坏验证入口
xiaoland Nov 28, 2026
05fb1e5
fix(lifecycle): 重启时先结算已有停机证明的撤销
xiaoland Nov 28, 2026
1111857
chore(audit): 在真实重启断点复验撤销与终态证据
xiaoland Nov 28, 2026
605aa1d
chore(ci): 完成恢复对照后保留常规验收路由
xiaoland Nov 28, 2026
29bf1d4
chore(tests): 让未知终态回归指明持久状态差异
xiaoland Nov 28, 2026
d64644f
chore(audit): 单独验证撤销的状态与冷启动断点
xiaoland Nov 28, 2026
5e28b42
chore(audit): 校准三项独立运维回归与还原检查
xiaoland Nov 28, 2026
2de3f3b
chore(ci): 将临时变异对照留在审计记录
xiaoland Nov 28, 2026
352c90b
ref(tests): 复用两种撤销场景的事件夹具
xiaoland Nov 28, 2026
27c31ac
fix(github): 识别注释闭合后同一行的可见提及
xiaoland Nov 28, 2026
38ff5f4
ref(tests): 删除重复验证和测试专用生产分支
xiaoland Nov 28, 2026
dcd2269
ref(tests): 用一个状态表达远端 PR 是否存在
xiaoland Nov 28, 2026
5d38483
fix(tests): 接受终态前已落盘的输入诊断
xiaoland Nov 28, 2026
5ebea82
fix(tests): 按追加语义核对原生终态原因
xiaoland Nov 28, 2026
b463cfc
ref(tests): 复核各层证明并收敛重复验收
xiaoland Nov 28, 2026
7fba3bd
fix(tests): 读取后核对首个客户端的写权限
xiaoland Nov 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,40 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: rustup toolchain install 1.93.0 --profile minimal --component clippy,rustfmt --target ${{ matrix.target }}
- uses: actions/setup-node@v4
with:
node-version: 24.15.0
- run: node --test native/pi/tests/tool-environment.test.mjs
- run: node --test native/pi/tests/*.test.mjs
- run: cargo fmt --check
- run: cargo check --locked --all-targets
- run: cargo clippy --locked --all-targets -- -D warnings
- run: cargo test --locked --all-targets
- name: Verify the installed Pi runtime and factory cleanup
if: matrix.name == 'linux'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
BRAID_TEST_PI_INSTALL: ${{ runner.temp }}/pi-background
PI_OFFLINE: '1'
run: |
if git cat-file -e "$BASE_SHA^{commit}" 2>/dev/null &&
git diff --quiet "$BASE_SHA" HEAD -- native/pi src/config.rs src/provider src/profile_materials.rs src/profile_materials src/agent_session.rs Cargo.toml Cargo.lock .github/workflows/ci.yml; then
echo 'Installed Pi inputs unchanged'
exit 0
fi
node native/pi/install.mjs "$BRAID_TEST_PI_INSTALL" --plugins background
"$BRAID_TEST_PI_INSTALL/bin/node" --test native/pi/acceptance/installed-runtime.test.mjs
cargo test --locked --bin braid profile_materials::tests::failed_home_binding_stops_the_installed_execution_before_returning -- --ignored --exact
- name: Verify conflicting Console edits in two browser pages
if: matrix.name == 'linux'
env:
CHROME_BIN: /usr/bin/google-chrome
run: |
npm ci --prefix tests/browser --ignore-scripts
node --test tests/browser/draft.test.mjs
- name: Verify OTLP internal diagnostics stay out of ordinary logs
if: matrix.name == 'linux'
run: >-
cargo test --locked --bin braid --features opentelemetry-otlp/internal-logs
telemetry::tests::telemetry_isolates_collector_rejection_bodies_from_ordinary_diagnostics -- --exact
28 changes: 25 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
name: release

on:
pull_request:
paths:
- '.github/workflows/release.yml'
- 'scripts/package.sh'
- 'scripts/verify-package.sh'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'config.example.toml'
- 'deploy/otel-collector.example.yaml'
- 'LICENSE'
- 'README.md'
- 'CHANGELOG.md'
push:
tags:
- "v*"
Expand All @@ -11,7 +24,7 @@ on:
required: true

permissions:
contents: write
contents: read

jobs:
build:
Expand All @@ -32,9 +45,15 @@ jobs:
shell: bash
env:
BRAID_BUILD_TARGET: ${{ matrix.target }}
BRAID_RELEASE_TAG: ${{ github.event.inputs.version || github.ref_name }}
run: scripts/package.sh
BRAID_RELEASE_TAG: ${{ github.event.inputs.version || (github.event_name == 'push' && github.ref_name) || '' }}
run: |
if [[ -z "$BRAID_RELEASE_TAG" ]]; then
BRAID_RELEASE_TAG=$(python3 -c 'import tomllib; print("v" + tomllib.load(open("Cargo.toml", "rb"))["package"]["version"])')
fi
scripts/package.sh
scripts/verify-package.sh dist "$BRAID_RELEASE_TAG" "$BRAID_BUILD_TARGET"
- uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request'
with:
name: release-${{ matrix.target }}
path: |
Expand All @@ -43,6 +62,9 @@ jobs:
if-no-files-found: error

release:
if: github.event_name != 'pull_request'
permissions:
contents: write
needs: build
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
svc.local.json
AGENTS.local.md
# svc:end local-config

/tests/browser/node_modules/
7 changes: 7 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ this repository; do not modify user-scope Agent instructions.
- Product acceptance is real black-box GitHub-to-Agent behavior. Compile,
formatting, lint, protocol probes, and diagnostic scripts support delivery
but do not substitute for `docs/10-prd/acceptance.md`.
- Route regressions through the owner of the decision. Use the built binary for
CLI, process and browser contracts, and the existing binary unit target for
private Rust modules. Importing source files into integration tests registers
their unit tests again under a different executable.
- A restart claim needs a durable write and a fresh reader. Assert the reason for
rejection with otherwise valid prerequisites. When retiring a fixture, check
its callers outside tests and remove any accessors needed solely by that fixture.
- The Agent may make coherent verified commits in this repository without
per-commit approval. Pushes, releases, external GitHub mutations, and changes
outside this repository retain their own authority gates.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,4 @@ repository workflow, see the [documentation index](docs/index.md) and


Braid 使用编译、回归测试、实际操作及获授权实验取得反馈。测试验证局部行为和故障边界;真实 GitHub、provider 和 OTel 原始证据及人工判断构成产品验收依据。
开发验证命令、测试归属及不能由本地回归证明的范围见[验证分层](docs/10-prd/acceptance.md#开发回归与产品验收的分层)。
81 changes: 81 additions & 0 deletions docs/10-prd/acceptance.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,68 @@ events are never pass oracles.
验收按本页描述操作真实产品并保留原始证据。自动测试、模拟和包 smoke 可验证
局部实现,但不能替代本页的真实产品验收。GitHub 对象和人工判断仍是产品验收依据。

## 开发回归与产品验收的分层

修改代码时,先运行所属边界的回归,再由 CI 验证 macOS arm64 和 Linux x86_64。
每个测试须能指出具体可信回归;不同层保护不同风险时分别保留。不要为了减少
测试数量删除协议、数据库兼容、授权或停止证明,也不要把测试自建的配置、状态机
或回执当作生产实现的证明。

| 契约 | 主要自动证明归属 | 仍需真实验收的部分 |
| --- | --- | --- |
| 配置、凭据导入、headless setup、公开回执 | `tests/` 中实际 binary 子进程;配置与 doctor 的局部不变式 | GitHub App 转换、登录、provider 认证与安装后的工具环境 |
| GitHub 准入、完整读取、发布及 uncertain 写入 | `producer`、`context`、`github`、`writer` 的生产 owner,外部 HTTP 固定夹具 | 实际 webhook、GitHub 权限、native 关联及跨仓库行为 |
| durable intent、租约、迁移和重放 | `store` 的真实 SQLite actor;旧 schema 建库、备份还原、关闭重开 | 已发布旧 binary 升级及现场恢复,不能以直接造库代替 |
| Context 替换和 provider 事件 | `group`、`provider` 的真实编排;受控外部会话通知和停止回执 | 真实模型消费新 Context、适配器后台执行停止、长轮次中撤销职责 |
| 内建对象与观测存储 | `platform`、`console` 的 HTTP→SQLite/Git 回归、真实 Console 二进制和两页并发编辑;独立 OTLP 编码器输入 | 完整操作旅程、实际 Harness 与跨宿主运行 |
| 原生执行与材料 | Node 真实进程树、已安装的 Pi background 插件与 RPC;Profile snapshot 和 auth 文件重新读取 | 其余插件组合、真实模型工具调用及跨宿主进程行为 |
| 采样与完整敏感证据 | `telemetry` 中真实 SDK→HTTP→protobuf;每次独立子进程初始化 SDK | 生产 Collector 的权限、保留、查询及完整长旅程关联 |

默认入口与 `.github/workflows/ci.yml` 一致:

```shell
cargo fmt --check
agent-build cargo clippy --locked --all-targets -- -D warnings
agent-build cargo test --locked --all-targets
node --test native/pi/tests/*.test.mjs
```

`agent-build` 是本机编译串行入口;CI 直接运行相同 Cargo 命令。局部迭代可加
`--bin braid <模块名>::` 或 `--test <文件名>` 筛选。Linux CI 另启用
`opentelemetry-otlp/internal-logs`,单独复跑
`telemetry::tests::telemetry_isolates_collector_rejection_bodies_from_ordinary_diagnostics`,
验证 SDK 开启内部诊断时,Collector 返回的敏感正文仍不会进入普通日志。
这不改变发行 binary 的 feature。标为 ignored 的 `telemetry_child` 只供父测试
用独立子进程调用,父测试负责检查退出状态与所有输出;不能单独计作通过。

Linux CI 在同一次 Cargo 构建后启动一个独立平台,从两个 Chromium 页面编辑同一
Issue。先提交的一页保存成功,过期页面显示该对象的修订冲突并保留正文;取消刷新
保留草稿,确认放弃后重新打开才读到已提交正文。复跑时使用本次构建的二进制:

```shell
npm ci --prefix tests/browser --ignore-scripts
BRAID_BINARY=/absolute/path/to/braid CHROME_BIN=/absolute/path/to/chromium \
node --test tests/browser/draft.test.mjs
```

Pi 安装或 Rust 适配器变更时,Linux CI 复用本轮编译并按 lock 安装 background
插件。安装包自带的 Node 验证真实 RPC、工具执行和 EOF 退出。Rust 工厂用例使材料绑定
在原生启动后失败,并读取工厂返回前留在该执行目录的停止回执。安装步骤需要访问发行
站点和 npm。其它插件组合和含模型会话各自单独记录。修改打包入口、编译锁或包内材料的 PR,以及实际发行均在两个目标平台运行
`scripts/verify-package.sh DIST RELEASE_TAG RUST_TARGET`;它从校验和指定的
归档中运行 binary,核对版本、示例配置及迁移后重开的数据库。

负向用例应断言错误阶段、类型或关键诊断,并有能够到达该守卫的合法前置条件。
恢复用例应先让真实 owner 写入,关闭并重新打开,再从消费者取回结果。新缺陷
修复保留同一输入下修复前红、修复后绿的证据。两份 checkout 做对照时,各设独立
`CARGO_TARGET_DIR`:Cargo 集成测试按固定路径启动 binary,共享 target 曾使另一份
checkout 的同名产物被当成最新。核对运行的测试名和失败诊断;缺少对照时说明原因。删除或
迁移测试前,核对原断言在保留测试中的归属;仅重复编译同一模块不算额外证明。

全绿支持上述局部合同,不授予产品发布资格。真实 campaign 仍按下列场景记录
`pass`、`fail` 或 `unavailable`,尤其不得把 Provider terminal、HTTP 请求受理或
命令 `prepared` 回执当作任务完成、持久采用或停止确认。

## Campaign Setup

Create a real Issue whose description contains a distinguishable design fact,
Expand All @@ -46,6 +108,25 @@ installation exposes native Agent App assignment or uses the Trusted Braid
Mention fallback; the campaign must not claim one mode while exercising the
other.

### 固定真实 Context 夹具

在专用 campaign 配置上记录 Issue、PR、直接关联的已关闭 Issue、可见评论、
折叠/删除评论 ID、一个仅出现在第二页的评论标记,以及各自的预期正文片段。
独立预期来自操作者预先创建的工作项和 GitHub 页面。固定夹具后,在权限受限的
证据目录执行以下公开命令。命令会在 campaign 的本地账本中记录读取到的修订。

```shell
"$BRAID_BIN" context issue "$ISSUE" --config "$CONFIG" --page-size 1 > "$EVIDENCE/issue.md"
"$BRAID_BIN" context pr "$PR" --config "$CONFIG" --page-size 1 > "$EVIDENCE/pr.md"
```

逐项用真实 GitHub 页面和预先记录的预期核对输出。完整可见正文和后页标记必须
出现,折叠/删除评论只含各自的元数据,隐藏标记不出现;PR 的关联 Issue 身份与
数量符合 GitHub,已关闭 Issue 的旧正文不出现。记录每项输入、对象身份和
pass/fail/unavailable。对超过 hard limit 的独立配置,分别保留 stdout、stderr
和退出码:必须因 Context 超限失败且 stdout 没有部分正文。缺少对应夹具时
该项为 unavailable。关于 Agent 实际收到、采用哪版 Context,按旅程 1、3、4 取证。

## Required Journeys

### 1. Activation and Initial Context
Expand Down
10 changes: 8 additions & 2 deletions docs/20-product-tdd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,14 @@ Console 的 OTLP Collector 保存原始传输批次与完整解码记录,使

平台通过有类型的应用命令修改对象。命令 request ID、内容摘要、预期 revision
与回执持久保存在平台库;普通对象变更与事件、回执一起提交,
并发正文修改不会覆盖新 revision。发布和合并保留 Git/SQLite 意图边界,不能用
外层数据库事务假装跨系统原子化。浏览器只能选择固定 source 或由 Harness 验证的候选,不能提供任意路径。
并发正文修改不会覆盖新 revision。发布候选的对象更新、事件与成功回执也在同一
SQLite 事务提交;Git 保留引用不代替数据库中的候选事实。合并在 Git CAS 前将
请求 ID、精确合并 commit 与原 writer 来源绑定到持久意图;CAS 仍验证当前授权和
revision。最终合并状态、对象关闭、撤权、事件与成功回执一起提交。相同请求的恢复
只在当前目标引用等于绑定 commit 时确认已发生的效果,不重放 Git CAS,也不恢复
writer 权限;原 writer 来源仅用于保持事件归属。旧无绑定回执或目标引用已经前移时
保留未完成状态,交由操作者核实,不以 revision 推断结果归属。这一边界不提供跨
Git/SQLite 的原子事务。浏览器只能选择固定 source 或由 Harness 验证的候选,不能提供任意路径。

`console::runtime` 持有实际 runtime task、停止通道与启动 generation。Collector
、平台和控制端点持续存活,Harness 可单独停止。GitHub 与内建上游通过统一 runtime 接口托管。请求接受不等于任务已就绪或已停止;
Expand Down
6 changes: 4 additions & 2 deletions docs/20-product-tdd/app-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ manifest 的文件。旧材料可由 operator 显式配置 `GH_CONFIG_DIR` 作
| `SessionFactory::start/resume` | 创建或恢复会话并返回中立句柄。Codex 内部共享 app-server,Pi 每个会话持有独立进程;上层接口相同。 |
| `send_user_msg(msg, steering)` | Idle 时申请启动 turn;已知拒收返回 Deferred,queue 保留输入。Acknowledged 只代表原生执行明确接纳,结果不明返回具体 Unknown。 |
| `steer_user_msg(msg, expected_turn_id)` | 只向已观察且仍匹配的 active turn 投递,不偷换为新 turn;明确拒收返回 Deferred,结果不明保留具体 Unknown。 |
| `interrupt()` | 尝试停止已观察到的 active turn;terminal 仍通过事件流返回。 |
| `events()` | 将 provider 的响应与通知去重为 TurnStarted / TurnTerminal;dispatch 前订阅,同一 receiver 随 RunningAgentTurn 交给 driver。失效的 active handle 合成 Unknown,不能伪造失败。 |
| `is_unavailable()` | 句柄失效后永久返回 true;idle 或晚订阅也可观察。恢复创建新句柄,不复活旧句柄。 |
| `close()` | 确认所属执行停止后释放资源;失败保留句柄与具体原因,阻断替代执行,不能影响其它会话。 |
| `close()` | adapter 先请求中断所属活动 turn,再确认执行停止并释放资源。关闭失败时保留句柄与原因,阻止替代执行。 |

具体 `AgentProvider` 接口只在 adapter 内使用。共享 Codex 进程退出会使其所有
句柄失效;独立 Pi 进程退出只影响所属句柄。释放旧句柄会取消旧监听任务,
Expand Down Expand Up @@ -178,6 +177,9 @@ execution 静止,长期服务 busy 也不统一阻断普通输入。
锁定材料关闭先请求 owned stop,再释放 stdin 发送 EOF、等待父进程,最后用固定 Node
执行同一材料的离线清理并核对 exact execution 回执。Mac 与 Linux 都核对 OS 出生身份、
登记进程组和继承 execution 标记;身份或停止范围不明时返回 unknown。
工厂创建或恢复 Pi 会话时,物理执行在句柄交给 Group 前归工厂所有。握手、会话绑定或初始
Context 持久化失败后,工厂等待同一执行的关闭结果;清理未确认时,返回构造与清理两者的原因。
原生 background Bash 工具各自记录命令退出码与进程树收口证据;清理不明时向调用者报告错误。
这不构成安全沙箱,也不追踪主动擦除标记、脱离登记范围的进程或撤销已发出的外部请求。
外部基础 Pi 仍使用 abort 与父退出依据,不声称具备插件后代清理合同。

Expand Down
4 changes: 3 additions & 1 deletion docs/20-product-tdd/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ changes to them produce Event References when subscribed.
Braid preserves original Markdown bytes except for actual HTML comment nodes.
The Context projector parses GitHub Flavored Markdown, obtains source ranges for
HTML inline/block comments beginning with `<!--`, and splices those ranges from
the original UTF-8 body. Text that resembles `<!-- -->` inside fenced or inline
the original UTF-8 body. A block's closing line can also contain visible text;
only its actual comment delimiters and contents are removed, preserving that
suffix and any HTML attribute values. Text that resembles `<!-- -->` inside fenced or inline
code remains. Malformed HTML that the parser does not recognize as a comment is
ordinary visible text.

Expand Down
Loading
Loading