Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ jobs:
cache-dependency-path: web/package-lock.json
- name: Install frozen frontend dependencies
run: npm ci
- name: Audit production and development dependencies
run: npm audit --audit-level=high
- name: Run frontend tests
run: npm run test:run
- name: Build frontend
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ data.

```bash
cd web
npm audit --audit-level=high
npm run test:run
npm run build
```
Expand Down Expand Up @@ -136,6 +137,5 @@ Before requesting review, confirm:
## Reporting Security Issues

Do not publish exploitable details, credentials, or sensitive data in a public
issue. Contact the repository owner privately with a minimal reproduction,
affected versions, and impact. A dedicated security policy and private
reporting channel are planned but are not yet configured.
issue. Follow [SECURITY.md](SECURITY.md) to report a vulnerability without
disclosing sensitive details.
7 changes: 4 additions & 3 deletions CONTRIBUTING.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ uv run python scripts/verify_repository_safety.py

```bash
cd web
npm audit --audit-level=high
npm run test:run
npm run build
```
Expand Down Expand Up @@ -124,6 +125,6 @@ Pull Request 应包含:

## 报告安全问题

不要在公开 Issue 中发布可利用细节、凭据或敏感数据。请私下联系仓库所有者,
提供最小复现、受影响版本和影响范围。项目计划增加独立安全策略和私密报告渠道,
但当前尚未配置。
不要在公开 Issue 中发布可利用细节、凭据或敏感数据。请按
[SECURITY.md](SECURITY.md) 的流程提交漏洞,在没有私密入口时只公开提出建立私密联系,
不要附带复现细节。
23 changes: 14 additions & 9 deletions DOCUMENT_INDEX.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \

COPY src ./src
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --offline
uv sync --frozen --no-dev

COPY migrations ./migrations
COPY data ./data
Expand Down
23 changes: 13 additions & 10 deletions IMPLEMENTATION_HANDOFF.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# OperCerta 实施交接

> 更新时间:2026-07-31。先读 `DOCUMENT_INDEX.md` 的核心阅读表,再读本文件和 `docs/development-log/current-state.md`。
> 更新时间:2026-08-10。先读 `DOCUMENT_INDEX.md` 的核心阅读表,再读本文件和 `docs/development-log/current-state.md`。

## 当前交接结论

OperCerta 的代码与自动化主线已经完成。双门禁与本人掌握收口经 PR #23 合入 main `7bb9ecda8170ed8752049331f5597ea2368d77b1`;main Actions run `30629194460` 五项全绿,包含后端 `671 passed`、前端 19 文件/60 条、三业务固定契约 42/42、Agent 安全恢复 9/9,以及干净构建 uv `0.11.28` 镜像后的真实 Compose 三业务数据库副作用与 API/MCP 重启恢复。
OperCerta 的三业务、Agent 主线、真实模型固定评测和本地运行能力已经合入 main `c4257ac10dec470bbb9ca1076c4cfacfb21a80de`(PR #25)。该 main run `30744845403` 中仓库安全、Python 质量、后端 682 条及两套评测、前端 19 文件/62 条均通过;`compose-smoke` 因 Dockerfile 在全新 runner 上离线安装项目时缺少 PEP 517 `hatchling` 缓存而失败。修复分支已推送并创建 Draft PR #26;初始 PR run `31479724666` 四项全部通过,Compose 按 PR 事件规则跳过。本地 clean Docker build、三业务副作用和 API/MCP 重启恢复也已通过;仍需合并后的 main-only Compose run 才能称为总门禁重新全绿。

本版本发布定义已经正式修订为:

Expand All @@ -27,17 +27,19 @@ OperCerta 的代码与自动化主线已经完成。双门禁与本人掌握收

## 本轮收口修改

- 新增 Apache-2.0 `LICENSE`。
- Dockerfile 的 uv 固定为本地/CI 同版 `0.11.28`。
- 仓库安全扫描覆盖双语 README、双语 CONTRIBUTING、handoff 和文档索引。
- 新增双门禁修订规格、实施计划和本人掌握验收表。
- 当前状态不再堆叠历史快照;历史仍保存在 daily 与 release evidence。
- 修复 clean-runner Docker build:保持运行依赖 `--frozen`,但不再假设构建后端已经存在于 uv cache。
- 升级前端锁文件中的受影响传递依赖,并在 CI/贡献指南加入 `npm audit --audit-level=high`。
- 新增 `SECURITY.md`,明确安全报告入口和非生产边界。
- 统一当前实现为“有界 ReAct 风格 Tool Loop”,不再误报为严格 Plan-and-Execute。
- 同步 682 条后端、当前收口分支 63 条前端、42/42、9/9 Agent、9/9 Kimi 真实模型固定路径等已验证数字及其样本边界。
- 补充完整 Agent Harness 技术说明和 2026-08-10 规格/发布审计。

## 下一执行顺序

1. 由项目所有者亲自执行 `docs/learning/opercerta-ownership-acceptance.md`;必须记录 `operation_id`、`work_order_id`、Trace、审计序列和数据库事实,**不得由 Codex 自动代签**。
2. 完成 3–5 分钟录屏与口述复盘。
3. 人工证据通过后,把 Showcase 门禁改为 `PASSED`,创建最终 tag 并记录回滚提交。
1. 项目所有者复核 Draft PR #26 后批准转为 Ready 并合并;取得新的 main 五项全绿证据。
2. 由项目所有者亲自执行 `docs/learning/opercerta-ownership-acceptance.md`;必须记录 `operation_id`、`work_order_id`、Trace、审计序列和数据库事实,**不得由 Codex 自动代签**。
3. 完成 3–5 分钟录屏与口述复盘。
4. 人工证据通过后,把 Showcase 门禁改为 `PASSED`,创建最终 tag 并记录回滚提交。

## 本地运行入口

Expand Down Expand Up @@ -66,6 +68,7 @@ uv run python scripts/run_agent_evaluation.py

cd web
npm ci
npm audit --audit-level=high
npm run test:run
npm run build
```
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ flowchart LR
UI["React console"] --> API["FastAPI boundary"]
API --> SIGNAL["Deterministic signal scan"]
SIGNAL --> GOAL["Typed goal encoding"]
GOAL --> GRAPH["LangGraph plan-and-execute loop"]
GOAL --> GRAPH["LangGraph bounded ReAct-style tool loop"]
GRAPH --> LLM["LLM reasoning"]
LLM --> POLICY["Tool policy and harness"]
POLICY --> MCP["FastMCP read tools"]
Expand Down Expand Up @@ -180,11 +180,11 @@ provider; it is not a production-accuracy, traffic, cost, or SLA claim.
| Gate | Current verified result |
| --- | ---: |
| Backend suite | 682 tests passed |
| Frontend suite | 19 test files, 60 tests passed |
| Frontend suite | 19 test files, 63 tests passed |
| Three-business fixed contracts | 42/42 passed |
| Frozen Agent safety and recovery evaluation | 9/9 passed |
| Kimi K2.6 real-model quality evaluation | 9/9 passed; injection 3/3; zero unauthorized calls, approval bypasses, or duplicate work orders |
| Main Compose smoke | Build, business database effects, API/MCP restart, recovery, and cleanup passed |
| Closeout-branch local Compose smoke | Clean build, business database effects, API/MCP restart, recovery, and cleanup passed; new main CI pending |

Run the local gates:

Expand All @@ -200,6 +200,7 @@ bash scripts/run_real_model_quality_evaluation.sh

cd web
npm ci
npm audit --audit-level=high
npm run test:run
npm run build
```
Expand Down Expand Up @@ -253,12 +254,14 @@ Completed locally:
- three bounded business workflows and the shared Agent loop;
- approval binding, revalidation, idempotent writes, and restart recovery;
- real PostgreSQL/pgvector, Redis, FastMCP, FastEmbed retrieval, and React console;
- fixed contract/evaluation suites and main-branch Compose recovery evidence;
- fixed contract/evaluation suites and closeout-branch local Compose recovery evidence;
- read-only public project page and a reproducible pre-release.

Current gate state:

- engineering and local automated gate: `PASSED`;
- remote CI gate: `PR_CHECKS_PASSED_MAIN_PENDING`; PR #26 passed all four PR
jobs, while the main-only Compose smoke still requires a post-merge run;
- Showcase Release gate: `AWAITING_OWNER_VALIDATION` until the owner completes
the manual walkthrough, source explanation, recovery/idempotency experiment,
and 3–5 minute recording;
Expand Down
10 changes: 6 additions & 4 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ flowchart LR
UI["React 控制台"] --> API["FastAPI 边界"]
API --> SIGNAL["确定性异常扫描"]
SIGNAL --> GOAL["类型化目标编码"]
GOAL --> GRAPH["LangGraph 规划与执行循环"]
GOAL --> GRAPH["LangGraph 有界 ReAct 风格工具循环"]
GRAPH --> LLM["LLM 推理"]
LLM --> POLICY["工具策略与 Harness"]
POLICY --> MCP["FastMCP 只读工具"]
Expand Down Expand Up @@ -167,11 +167,11 @@ Goal、工具、证据、审批和数据库副作用契约,不代表生产准
| 门禁 | 当前已验证结果 |
| --- | ---: |
| 后端测试 | 682 条通过 |
| 前端测试 | 19 个测试文件、60 条用例通过 |
| 前端测试 | 19 个测试文件、63 条用例通过 |
| 三业务固定契约 | 42/42 通过 |
| 冻结 Agent 安全与恢复评测 | 9/9 通过 |
| Kimi K2.6 真实模型质量评测 | 9/9 通过;提示注入 3/3;未授权调用、审批绕过、重复工单均为 0 |
| main Compose smoke | 构建、业务数据库副作用、API/MCP 重启、恢复和清理通过 |
| 收口分支本地 Compose smoke | 干净构建、业务数据库副作用、API/MCP 重启、恢复和清理通过;等待新 main CI |

运行本地门禁:

Expand All @@ -187,6 +187,7 @@ bash scripts/run_real_model_quality_evaluation.sh

cd web
npm ci
npm audit --audit-level=high
npm run test:run
npm run build
```
Expand Down Expand Up @@ -239,12 +240,13 @@ docs/ 技术指南、开发记录和发布证据
- 三条受控业务流程和共享 Agent Loop;
- 审批绑定、重新取证、幂等写入和重启恢复;
- 真实 PostgreSQL/pgvector、Redis、FastMCP、FastEmbed 检索和 React 控制台;
- 固定契约/评测以及 main 分支 Compose 恢复证据;
- 固定契约/评测以及收口分支本地 Compose 恢复证据;
- 只读公开项目页面和可复现预发布版本。

当前门禁状态:

- 工程与本地自动化门禁:`PASSED`;
- 远程 CI 门禁:`PR_CHECKS_PASSED_MAIN_PENDING`;PR #26 四项 PR job 已通过,main-only Compose smoke 仍需合并后运行;
- Showcase Release gate:`AWAITING_OWNER_VALIDATION`,必须由项目所有者亲自完成
业务实演、源码讲解、恢复/幂等实验和 3–5 分钟录屏;
- Product Release gate:`CLOSED`。
Expand Down
33 changes: 33 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Security Policy

## Supported Versions

OperCerta is a pre-1.0 project. Security fixes are applied to the latest `main`
branch only. Historical tags and preview deployments are not maintained as
supported production releases.

## Reporting a Vulnerability

Do not disclose credentials, exploitable details, private endpoints, customer
data, or a working exploit in a public issue or pull request.

1. Prefer GitHub's **Security → Report a vulnerability** flow when it is
available for this repository.
2. Include the affected revision, impact, prerequisites, and the smallest safe
reproduction. Redact secrets and personal or business data.
3. If private vulnerability reporting is not available, open a public issue
that contains only the title `Security contact requested`. Do not include
technical details; wait for the maintainer to establish a private channel.

The maintainer will acknowledge a valid private report, assess severity, and
coordinate a fix and disclosure. No response-time SLA is promised for this
non-production project.

## Security Boundary

The public Netlify site is a read-only static showcase. The complete Agent MVP
runs locally and uses demo JWT identities and synthetic data. It must not be
treated as a production identity, public API, or repository for confidential
information. Production deployment requires a separate security review for
identity, secrets, ingress, rate limiting, backups, monitoring, and incident
response.
54 changes: 54 additions & 0 deletions docs/development-log/audits/2026-08-10-final-closeout-audit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# OperCerta 最终收口审计(2026-08-10)

## 审计范围与优先级

本次审计覆盖四份 `docs/specs/` 基线设计、后续已批准的 `docs/superpowers/specs/` 修订、对应实施计划、当前源码、测试、评测、Compose、公开静态专题和发布证据。发生冲突时按“后批准、范围更具体的修订规格优先”解释;历史设计原文不回写,以保留决策演进。

当前版本仍定义为:

> **公开静态展示 + 本地可复现完整 Agent MVP + 3–5 分钟录屏。**

## 规格—实现—证据矩阵

| 规格目标 | 当前实现 | 自动化或文档证据 | 结论 |
| --- | --- | --- | --- |
| 只实施 OperCerta,不复用旧公司材料 | 仓库只包含 OperCerta 源码与合成业务数据 | `verify_repository_safety.py`、四份基础设计 | 符合 |
| 库存、设备、任务三业务闭环 | signal → case → Agent 调查 → 审批 → 复核 → 幂等工单 | 42/42 三业务契约、Compose 数据库断言 | 符合 |
| 异常先被合理发现,再启动 Agent | 确定性 signal scanner 读取事实与规则,创建/对账 signal;用户从 case 启动调查 | signal inbox、reconciliation 和 successor 测试/证据 | 符合 |
| 有限业务输入,不开放无边界聊天 | React 表单与 FastAPI/Pydantic 形成可信 `IntentEnvelope` | API、前端与非法输入测试 | 符合 |
| LLM 是认知层但不是写入权威 | Goal 编码、有界 ReAct 风格 Tool Loop、FinalAnalysis、批准后 Verifier | Agent Trace、9 条冻结轨迹、9 条 Kimi 固定路径 | 符合;已纠正旧“严格 Plan-and-Execute”表述 |
| LangGraph 承担 Agent 编排 | 单一 `ControlledAgentRootGraph` 负责循环、interrupt、checkpoint、resume 和 recovery | checkpoint/重启恢复测试与 Compose recovery-only | 符合 |
| MCP/Skill/Function Calling | 模型经 LangChain 原生 tool calling 选择 5 个只读 MCP 工具;写工具只由代码节点调用 | ToolPolicy、ToolExecutor、FastMCP 集成测试 | 符合 |
| RAG 与长期知识 | FastEmbed + pgvector 检索按场景、版本和有效状态过滤的合成 SOP,并返回 citation | RAG 隔离测试、真实模型 citation 指标 | 符合;SOP 不覆盖业务事实和审批规则 |
| 记忆与状态 | Graph State、PostgreSQL checkpoint、pgvector SOP、Trace/Audit 四类记忆 | 核心技术手册、数据库和恢复测试 | 符合;无用户画像或跨任务聊天记忆 |
| 高风险写入受控 | JWT/RBAC、审批绑定、批准后绕过 Redis 重取事实、Verifier、确定性 Binding | 审批、事实漂移、缓存绕过与权限测试 | 符合 |
| 审批竞态与幂等副作用 | PostgreSQL 行锁、审批周期唯一语义、operation 派生幂等键、唯一约束、写后读 | 并发审批、重复写入、数据库断言 | 符合 |
| 可恢复、可审计、可观测 | 业务表主导恢复 + checkpoint;Trace、Audit、SSE、低基数指标 | 9/9 安全恢复评测、Compose restart | 符合 |
| 前端可展示技术链路 | Case 隔离、角色切换、业务事实、审批、Agent Trace、架构与 Eval 专题 | 收口分支 19 个前端测试文件/63 条用例、Vite build | 符合 |
| 评测不虚构 | 682 条后端、63 条前端、42/42、9/9 Agent、9/9 Kimi 固定本地小样本 | JSON 报告与 release evidence | 符合;不等于生产准确率或 SLA |
| 静态公开展示与本地 MVP 分离 | Netlify 只读页面;可写 API、数据库和 demo JWT 仅在本地 | Showcase 门禁修订、README、Netlify 证据 | 符合 |

## 本次发现并处理的偏差

1. **主线 CI 状态漂移:** main `c4257ac` 的 Actions run `30744845403` 并非五项全绿。四项通过,`compose-smoke` 在 clean runner 构建镜像时因 `uv sync --offline` 缺少 `hatchling` 缓存而失败。收口分支已用 RED/GREEN 测试移除错误的离线假设;必须以新远程 main run 关闭此项。
2. **Agent 模式术语漂移:** README 和讲解文档沿用 Plan-and-Execute,但当前实现是模型根据 Observation 逐轮选择工具的有界 ReAct 风格循环。已统一表述,避免面试或开源审查时与代码不符。
3. **前端数字漂移:** 已合并 main 实际为 62 条前端用例,部分 README、专题和状态文档仍显示 60。同步后又增加源码入口回归测试,因此收口分支最终为 63 条。
4. **前端传递依赖告警:** `npm ci` 后发现 nanoid、postcss、undici 的传递依赖漏洞。锁文件已升级到修复版本,CI 新增 high 级依赖审计。
5. **开源安全报告缺口:** CONTRIBUTING 曾写“计划增加安全策略”。已新增 `SECURITY.md` 并改为可执行的私密报告优先流程。
6. **Harness 学习材料分散:** Prompt、上下文、工具、编排、记忆、Eval、约束与恢复已集中补入核心技术手册,并明确 Mock/Real、token budget 和通用并行调度边界。

## 仍需项目所有者完成的关键节点

- 复核 Draft PR #26,批准转为 Ready 并合并;以新的 main CI 五项全绿作为远程工程门禁证据。
- 独立完成 `opercerta-ownership-acceptance.md` 的业务实演、源码讲解、重启/幂等实验和记录;Codex 不得代签。
- 录制 3–5 分钟演示并核对静态专题内容。
- 验收通过后创建最终 Showcase tag;不得提前把 Product Release gate 打开。

## 发布判定

- 工程与本地自动化门禁:`PASSED`,本分支完整本地结果已通过。
- 远程 CI 门禁:`PR_CHECKS_PASSED_MAIN_PENDING`;PR 四项通过,等待合并后的 main Compose。
- Showcase Release gate:`AWAITING_OWNER_VALIDATION`。
- Product Release gate:`CLOSED`。

公网 FastAPI、生产 IAM、限流、防滥用、托管密钥、备份恢复、高可用和线上告警不属于当前 Showcase 版本,不应为了“看起来完整”而伪装为已实现。
Loading