Skip to content
Merged
41 changes: 41 additions & 0 deletions docs/interactive-chatgpt-response-evidence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ChatGPT-authored response evidence for FlowKit Interactive

**Evidence tier: M-level recorded model response. This is not native S13.**

## What the experiment does

1. FlowKit compiles the Interactive workflow and durably creates a public Agent Pending in SQLite.
2. The test emits the exact `runId`, `requestId`, `taskDigest`, Program artifact hash and allowlisted task input.
3. A ChatGPT model reads that Pending evidence in the conversation and authors a structured response.
4. The response is returned through an authenticated GitHub tool action and stored as a fixture.
5. A later test run deterministically reconstructs the same Pending and rejects the fixture unless all identity fields match exactly.
6. The trusted Host validates the result, signs its own Host receipt, commits through CAS, verifies duplicate Ack and resumes the Run.

## What it proves

- A ChatGPT-authored response was produced after inspection of a real FlowKit Pending.
- The response is bound to the exact deterministic Pending by `runId/requestId/taskDigest`.
- FlowKit's actual Program, SQLite Store and Trusted Host process that recorded response.
- Host signature/CAS, duplicate receipt and same-phase SQLite close/reopen behavior.

## What it does not prove

- The ChatGPT model invoked a FlowKit-native JavaScript tool. The response is returned through a GitHub tool action, not a native FlowKit JS-tool call.
- Independent cryptographic attestation of the ChatGPT provider/session identity.
- Grok Build or Codex native tool-call provenance.
- Cross-UID / OS-level model-process isolation.
- One physical SQLite database surviving across the separate Pending-preparation and response-acceptance Actions runs. The second run reconstructs the deterministic Pending and uses its own database.

Therefore this evidence is useful for M-level real-model participation and response-binding tests, but **must not be counted as native Host S13 / C12 PASS**.

## Test execution modes

Normal CI must consume the complete committed response fixture and reach Terminal. If the fixture is absent, the test fails.

Only an explicit preparation invocation may stop at Pending:

```bash
FLOWKIT_S13_PREPARE=1 node --test tests/interactive/s13-chatgpt-tool-bridge.test.mjs
```

The preparation mode is not used by the normal CI workflow.
51 changes: 51 additions & 0 deletions docs/interactive-complex-acceptance-c01-c12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# FlowKit Interactive P0-A — 复杂验收矩阵 C01–C12(冻结版)

**范围与判断标准**:此矩阵只测试 P0-A 的 `Condition / Agent / Terminal` 和可信 Host 的 CAS、回执、恢复、安全。不得把 Standard 的 Human/Action/Verification/Loop/Parallel 实现或脚本 Worker 的结果当作 Interactive 已支持或真实模型验证。不得把 GitHub CI 的测试数量当成真实模型会话次数。

**证据必须分层**:
- **Protocol / Scripted(自动化)**:实际 FlowKit Compiler → JavaScript Program → SQLite Store / Trusted Host 执行,但 Agent 结果由脚本提供。证实协议,不证实模型遵循指令。
- **Live Model(真实模型)**:真实 ChatGPT/Grok 逐次读取已生成的 Pending 后生成答案;每次的 requestId、taskDigest、输出、工具操作必须有独立证据。ChatGPT → GitHub Actions 桥接只能证明真实参与和受控处理,不代表原生宿主/会话来源认证。
- **Native Host(S13)**:单个受控 Grok Build / Codex 原生会话模型→JS 工具→Host→回执,原生工具日志及 Host 独立验证的会话/来源证据;不能用脚本模拟、GitHub 上传身份替代。

## 场景、可观测预期和证据

| ID | 场景 | 冻结验收要求 | 自动化证据范围 | 真实模型门禁 |
|---|---|---|---|---|
| C01 | 4 个串行 Agent + 2 个 Condition | 原生 Program 顺序、后续节点只接收合法上游状态,未跳过/重复执行;最终 State 包含各节点输出 | 新增复杂链+Host 签名测试 | **待实测**:至少四次真实模型回合 |
| C02 | 动态路线与异常条件 | ready=true/false、审查通过/拒绝、缺失 when 输入分别进入正确路径;未选 Agent 不调度 | 新增多路径正反测试 | **待实测**:至少两条真实分支 |
| C03 | Schema 拒绝与修复 | 第一次输出无效不污染 State;下一 Pending requestId/attempt 更新,合法结果可以成功 | 新增接纳/重试负例 | **待实测**:真实模型两次输出 |
| C04 | 失败/重试耗尽 | retries+1 限制,最后 `FK_R004`,State 不含未认可结果 | 新增失败序列 | 至少一个可信 Host 失败路径(真实模型待实测) |
| C05 | Host 崩溃恢复 | Pending 发布、接纳前、校验及提交各切点 SIGKILL;请求 identity/State/Journal 一致 | 已有 `tests/interactive/crash.test.mjs` 三项真子进程测试;当前 main 的 tests/integration/m6-e2e.test.mjs 另有 Host+脚本 Worker(原 PR #7 的相关工作由 PR #13 纳入) | 与真实模型耦合的 kill/resume **待实测** |
| C06 | 双进程竞争、丢响应、重复回执 | CAS 只接纳一次;后续始终返回原始 `acceptedRevision`;不声明外部 Provider 恰好执行一次 | 已有 `crash.test.mjs` + `coordinator.test.mjs` | 原生模型多会话竞争待实测 |
| C07 | Program / Skill / Policy 漂移 | 变更后未发生额外调度/CAS;旧依赖恢复不误放行 | main M5 policy 测试;当前 main 的 tests/integration/m6-e2e.test.mjs S06 覆盖脚本 Host 的 source/Skill/Program drift(由 PR #13 纳入) | 原生 Host/模型待实测 |
| C08 | 权限、签名与泄漏 | 错租户/伪签/敏感字段/UID 隔离 fail closed;模型不能直接操作私有 Store | main M5 `trusted-host` + Linux 2 项 OS 用户隔离任务 | 原生 Grok Build 私钥/SQLite 不可达待实测 |
| C09 | 容量与超限 | 2MiB hard,1.75MiB active 预留;有界结果可成功;错误原子退出;未认证超大回执不能杀 Run | main S07 `s07-capacity` + `host-oversize` | 真实模型大输出路径待实测 |
| C10 | 长链与账本 | 至少 30 个串行 Agent,Checkpoint 近期摘要 ≤16,SQLite 全量历史回执可查;Journal 连续,恢复历史 Ack | 新增长链与 SQLite 回执索引测试(现有 21 节点基础) | 不要求 30 次模型计费;脚本覆盖为准 |
| C11 | 阶段预算一致性 | `maxStagesPerCall=1` 与 128 在相同 Program/结果序列下最终 State **字节相等**,Journal 合法;不要求 revision 一致 | 新增复杂链跨预算用例,当前 main 的 tests/integration/m6-e2e.test.mjs 还有脚本 Worker 验收 | 模型侧不同调度路径待实测 |
| C12 | 原生真实模型宿主 | Grok Build 等原生 JS 工具调用原始日志、真实会话身份、Host 独立来源认证、隔离、终态 | **不能用脚本或 GitHub ChatGPT 桥接替代** | **BLOCKED**:需 Dot/Grok Build 实际宿主权限与真实日志 |

## 每个可执行测试的最小证据格式

```json
{
"scenarioId": "C01",
"execution": "SCRIPTED_HOST",
"programHash": "sha256:...",
"runId": "...",
"nodeTrace": ["requirements", "design", "plan", "review"],
"checkpointStatus": "succeeded",
"journalRevisions": 0,
"assertions": ["..."],
"result": "PASS"
}
```

测试完成后补充**精确提交/CI URL、各环境完成状态、实际模型回合次数、失败/未覆盖限制**。即使自动化 7/7 通过,C01–C05 只应在「协议层」标记 PASS;真实模型层未取得证据必须为 PARTIAL/BLOCKED。

## 阶段门禁

1. 只开发测试与验证报告,发现真实缺陷才另外起小范围修复 PR;不擅自重构 FlowKit Core。
2. PR #7 已关闭且未合并,其适用 M6 测试工作由 PR #13 纳入 main;不得把历史 PR #7 当作仍可合并的分支,也不得因绿灯宣称 Grok/Codex 原生模型来源验收通过。
3. 在复杂矩阵中允许使用脚本结果注入来做 30 Agent、并发、容量、安全负例,但必须标明执行类型和模型调用次数(脚本为零)。
4. M6 所需的冻结需求 V0.3 / 技术 V0.6-R5 合规审查仍独立存在,不能被此矩阵替代。
5. 本轮不引入 P0-B、P1、P2、Context、通用业务产物存储或 GC。
58 changes: 58 additions & 0 deletions docs/interactive-complex-acceptance-c13-c24-results-2026-11-11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# FlowKit Interactive — C13–C24 补充复杂验收结果(2026-11-11)

## 结论

**P0-A 复杂协议补充用例 C13–C20:8/8 PASS(脚本可信 Host);原 C01–C12 测试继续通过。原生模型宿主 C12/S13 仍 BLOCKED,不能据此合并 M6 / 发布。**

- 仓库:devcodex-labs/flowkit(private)
- PR:[Draft #12](https://github.com/devcodex-labs/flowkit/pull/12),基于 main,不修改生产 Core
- 验证测试提交:**09e14e82b72277ef58b656bf129c9c4bc0b4b779**
- 完成的 CI:[42968295106 — 7/7 SUCCESS](https://github.com/devcodex-labs/flowkit/actions/runs/42968295106)
- 关联矩阵:[C01–C12 原矩阵](./interactive-complex-acceptance-c01-c12.md)、[C13–C24 增量矩阵](./interactive-complex-acceptance-extension-c13-c24.md)
- 执行类型:**SCRIPTED_TRUSTED_HOST**,本次新增用例模型调用次数 **0**;不能计入真实模型调用次数

### 精确跨平台测试清单

| GitHub Actions Job | Test | Pass | Fail | Skip | Job |
|---|---:|---:|---:|---:|---|
| Ubuntu 24.04 / Node 22.13.0 | 372 | 372 | 0 | 0 | SUCCESS |
| Ubuntu 24.04 / Node 24.22.1 | 372 | 372 | 0 | 0 | SUCCESS |
| Windows 2025 / Node 22.13.0 | 372 | 372 | 0 | 0 | SUCCESS |
| Windows 2025 / Node 24.22.1 | 372 | 372 | 0 | 0 | SUCCESS |
| Host OS-user isolation / Node 22.13.0 | — | — | — | — | SUCCESS |
| Host OS-user isolation / Node 24.22.1 | — | — | — | — | SUCCESS |
| Website/docs | — | — | — | — | SUCCESS |

以上从 GitHub Actions 的实际 job 日志/结论核验,非 PR 描述中的主观声称。372 是每一个环境内的全部测试数量,包含现有回归;新增复杂测试函数为 8 个,不能解释成 372 个真实 Agent 回合。

## C13–C24 逐项裁决

| ID | 协议层 P | 真实模型 M / 原生宿主 N | 可观测证据 / 缺口 |
|---|---|---|---|
| C13 分支×阶段预算 | **PASS** | M 未单独测 | 预算 1/128 下四个分支结果相同,已核对两个终态 State Hash |
| C14 链中伪造/超限回执 | **PASS** | N 模型对抗攻击待测 | 5 个不同类型的未认证/错误回执被拒且 Checkpoint 和 Journal 字节保持一致 |
| C15 Host 重建后旧 Ack | **PASS** | N 未测 | 下游等待态及 Terminal 后重放历史 receipt,不额外提交 State,Ack 原 acceptedRevision |
| C16 Provider 可信失败回执 | **PASS** | N 真 Provider 失败待测 | signed agent-call-failed 使末端 Agent 重试一次,旧回执重复 Ack,合法第二回合成功 |
| C17 链中 Host policy drift | **PASS** | N 实际宿主升级待测 | 3 条不同入口拒绝政策漂移并证明无 CAS 写入,旧 Host 继续成功 |
| C18 多 Run 交错、重复启动 | **PASS** | N 多模型 Session 未测 | 两 Run 状态隔离;重复 startKey 幂等,同 key 不同 State 冲突 |
| C19 36 Agent 中段失败 | **PASS** | 不要求 36 次模型计费 | 第 18 个脚本结果无效,终态 FK_R004,余下 18 个未分发,State 无非法字段 |
| C20 双有效签名并发竞争 | **PASS(同进程 Host 对象)** | N 真进程/多模型竞争待测 | 两个不同签名内容仅一个 CAS 成功、另一个 FK_I_RECEIPT_CONFLICT;真正双进程测试已在 C06/M4 另验 |
| C21 崩溃/跨版本恢复 | **PARTIAL** | N 未测 | M4 有真 SIGKILL 与同环境恢复;同一物理 DB 跨 OS/Node 迁移未执行,是增强项不是原 P0-A 硬门禁 |
| C22 Prompt 注入/宿主权限 | **PASS(既有 M5 + OS UID)** | **N BLOCKED** | 白名单、拒签、跨 UID 隔离已有证据;Grok Build 原生模型权限分离无证据 |
| C23 真实模型异常组合 | 不可用脚本替代 | **M/N BLOCKED** | 真实 false 分支、持续错误、与 SIGKILL 耦合恢复及多模型竞争未完成 |
| C24 兼容/发行/原生来源门禁 | **PASS(CI 部分)** | **N BLOCKED** | 7 job 全绿不意味着 C12/S13 原生认证已通过 |

## 首轮失败与复审记录

新增 C13–C20 首次提交 5be1abb(CI 42967554504)曾 370 PASS / 2 FAIL,失败集中在 **C16 和 C20 的测试断言**:在状态为 waiting 时,测试错误地读取了公开 Frame 中被隐藏的 State。FlowKit 此时不公开私有 State 是预期安全设计。第二次提交 ac49e3e(CI 42968021802)修复了 C20,留下 C16 一处相同的测试问题(371 PASS / 1 FAIL)。最终测试提交 09e14e8 将 C16 内部断言改为从受信 SQLite Store 读取,四环境 372/372 PASS。

这两轮失败**不是 FlowKit Core 缺陷的证据**;本轮修复未修改生产源码、签名器、Coordinator、SQLite Schema 或 Program ABI。PR #12 changed-files 范围仅 docs、tests、fixtures、示例工作流。

## 仍不得放行的明确缺口

1. **C12/S13:原生 Grok Build/Codex 工具调用、原生 Session/Provider 来源认证、Host 独立可信证明和模型进程权限隔离**。GitHub Actions + ChatGPT 五回合桥接不满足该条件。
2. **真实模型负例**:C02 的 false 分支、C04 持续错误、C05 实际模型执行中 SIGKILL/恢复、C06 多原生会话竞争、C08/C09 原生输出与权限攻击。
3. **C07 综合漂移**:原 Draft PR #7 已关闭且未合并;其适用的 source/Program/Skill drift 测试已由 PR #13 纳入当前 main 的 tests/integration/m6-e2e.test.mjs S06。该证据仍是脚本 Host 协议层,不是实时模型或原生 Host 漂移验收。
4. 未证明的 Provider exactly-once、模型遵循任意 Skill 指令、同 UID 混合进程隔离不能假定成立;这些必须通过宿主信任设计而非脚本测试补足。

**裁决:C13–C20 协议 PASS,C01–C12 原先已验证结果继续有效;整体 M6 最终验收仍 BLOCKED。PR #12 保持 Draft 待更新/复审;PR #7 已关闭且未合并。当前阶段不修改 main、不发布新版本。**
Loading