19 Commits
Author SHA1 Message Date
weichen 7005493077 Merge pull request 'Update Gitea endpoints after server migration' (#5) from fix/gitea-endpoint-migration into main
ci / vet-and-test (push) Successful in 0s
ci / docker-checkout-hostgateway (push) Successful in 1s
governance / governance (push) Successful in 58s
2026-10-22 14:34:26 +00:00
weichen 3f4266b96a Bump the development-manager pin for the endpoint migration
ci / vet-and-test (pull_request) Successful in 1s
ci / docker-checkout-hostgateway (pull_request) Successful in 3s
governance / governance (pull_request) Successful in 25s
Why: governance checks validate candidate .gitmodules URLs against the
pinned development-manager scaffold, which now carries the new Gitea
endpoint base after its own migration.

Evidence: host-verified; see Dev PR #706

Impact: pin update only, part of the coordinated endpoint migration.

Refs: Agent-System-Dev PR #706
2026-10-22 14:26:10 +00:00
weichen 33808f5cc0 Update Gitea endpoints after server migration
ci / vet-and-test (pull_request) Successful in 3s
ci / docker-checkout-hostgateway (pull_request) Successful in 3s
governance / governance (pull_request) Failing after 41s
Why: the Gitea server moved to https://gitea.naitangbaobao.cn with SSH
on port 52222; endpoint references must follow or superproject CI
checkout refuses the old URLs.

Evidence: host-verified API reach and SSH auth (Dev task card
fix/gitea-endpoint-migration)

Impact: configuration only; no runtime behavior change.

Refs: Dev PR #706
2026-10-22 14:17:26 +00:00
weichen 1758e2c1a9 Merge pull request 'Adopt the shared governance kit (development-governance-v2)' (#4) from feature/governance-adoption into main
ci / vet-and-test (push) Successful in 1s
ci / docker-checkout-hostgateway (push) Successful in 7s
governance / governance (push) Successful in 22s
2026-10-17 09:25:33 +00:00
weichen 917f5b6cc7 Close and archive the governance adoption card
ci / vet-and-test (pull_request) Successful in 1s
ci / docker-checkout-hostgateway (pull_request) Successful in 2s
governance / governance (pull_request) Successful in 22s
Why: the adoption PR is reviewed and its candidate HEAD passed CI; the card closure is folded into the PR so no separate close PR is needed.
Evidence: CI GATE on 676a6e37dcc854673d32eebdd733e8557a1d1562; independent Review REPLAY (cursor-agent-stable --mode ask 全新只读会话(fresh_session=true,session id not-observable)闭合重审 VERDICT: APPROVE(对象 676a6e3,与 HEAD 仅 .task/ 不同)).
Impact: task card only (moved to .task/archive/).
Refs: https://git-home.u1680832.nyat.app:30319/weichen/Logging-System/pulls/4
2026-10-17 09:22:12 +00:00
weichen 676a6e37dc docs(task): record review repair run and evidence
ci / vet-and-test (pull_request) Successful in 0s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s
governance / governance (pull_request) Successful in 21s
Why: independent Review blocked the adoption; the repair unit ran through the shared executor and was integrated with agent-exec apply.
Evidence: .task/evidence/governance-adoption/ (SELF): governance check and agent-exec validate on the repaired head.
Impact: task card and evidence logs only.
Refs: .task/feature-governance-adoption.md
2026-10-17 08:58:46 +00:00
agent-exec-transport b57c1a0e0d agent-exec transport 1b906777fd42e2a559bb9a8c7fa10e93/696f1cfe2efd 2026-10-17 08:55:54 +00:00
weichen 110337ee2e docs(task): complete the card for review (sync, CI, results)
ci / vet-and-test (pull_request) Successful in 1s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s
governance / governance (pull_request) Successful in 23s
2026-10-17 08:47:51 +00:00
weichen 01b1404d83 docs(task): record review repair run and evidence
ci / vet-and-test (pull_request) Successful in 1s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s
governance / governance (pull_request) Successful in 16s
Why: independent Review blocked the adoption; the repair unit ran through the shared executor and was integrated with agent-exec apply.
Evidence: .task/evidence/governance-adoption/ (SELF): governance check and agent-exec validate on the repaired head.
Impact: task card and evidence logs only.
Refs: .task/feature-governance-adoption.md
2026-10-17 08:46:45 +00:00
agent-exec-transport 6706225544 agent-exec transport 8bc2c2e6dfb442518564682a3f3aee9b/eeb4bdaf4d3d 2026-10-17 08:43:27 +00:00
weichen f0b463c745 docs(task): record review repair run and evidence
governance / governance (pull_request) Successful in 16s
ci / vet-and-test (pull_request) Failing after 30s
ci / docker-checkout-hostgateway (pull_request) Failing after 1m0s
Why: independent Review blocked the adoption; the repair unit ran through the shared executor and was integrated with agent-exec apply.
Evidence: .task/evidence/governance-adoption/ (SELF): governance check and agent-exec validate on the repaired head.
Impact: task card and evidence logs only.
Refs: .task/feature-governance-adoption.md
2026-10-17 08:41:31 +00:00
agent-exec-transport 742ffb2c7c agent-exec transport d1dd6edec0f4a656022d69dd4e0b7b46/9c9282bcc23a 2026-10-17 08:39:54 +00:00
weichen f4351ea681 Record the adoption unit run and positive/negative evidence
governance / governance (pull_request) Successful in 38s
ci / vet-and-test (pull_request) Failing after 2m23s
ci / docker-checkout-hostgateway (pull_request) Failing after 2m54s
Why: Phase 6 requires one positive executor run and the negative cases (missing config, bad receipt, out-of-scope path, unknown side effect) before adoption becomes active.
Evidence: .task/evidence/governance-adoption/ (SELF): governance check, agent-exec validate and adoption cases; this commit passed the generated pre-commit hook (admit).
Impact: task card and evidence logs only.
Refs: .task/feature-governance-adoption.md
2026-10-17 07:38:25 +00:00
agent-exec-transport 3b355600aa agent-exec transport b513506a93e5d62111d5f0bb08647b29/e507140fa996 2026-10-17 07:21:09 +00:00
weichen 3124414922 Bootstrap AGENT-EXECUTION.md and the governance adoption card
Why: development-governance-v2 Phase 6 adopts the shared governance kit in every formal repository; the executor needs a valid AGENT-EXECUTION.md before any implementation unit can run.
Evidence: generated by dm-server governance init at Development-Manager bd3a7de57a3a9e1a4495b94c5fa5c08d71e7be8c; dm-server agent-exec validate passes.
Impact: configuration and task card only; no code or CI change yet.
Refs: Agent-System-Dev docs/superpowers/plans/2026-10-16-development-governance-v2-master.md
2026-10-17 07:18:15 +00:00
weichen da5c33eb25 Merge pull request 'Record Gitea access facts in AGENTS.md' (#2) from feature/gitea-access-facts into main
ci / vet-and-test (push) Successful in 2s
ci / docker-checkout-hostgateway (push) Successful in 2s
2026-09-30 16:08:39 +00:00
weichen 93f71c2fe1 Record Gitea access facts in AGENTS.md
ci / vet-and-test (pull_request) Successful in 2s
ci / docker-checkout-hostgateway (pull_request) Successful in 2s
Why: agents rediscovered Gitea hosts and credential locations from
scratch each session, and the retired git-panel host kept failing with
TLS broken-pipe errors before the right host was recalled.

Evidence: curl git-home...:30319/api/v1/version with token from
~/.secrets/gitea -> {"version":"1.27.3"}; ssh -p 31411 git@git-ssh...
(BatchMode) -> "Hi there, weichen!" with key ~/.ssh/home_gitea (ED25519,
SHA256:GYXaOXIMeloQ1fKSfdJ/ndgPQzs/Ix7Hk62ekfkfQ20). Same section already
merged in Agent-System-Dev (PR #73).

Impact: AGENTS.md only; records hosts and credential locations, no
secret values (baseline hard boundary 2).

Refs: Agent-System-Dev PR #73
2026-09-30 16:06:19 +00:00
weichen 49b5d8be60 Merge pull request 'Adopt the task-startup gate and commit format in AGENTS.md' (#1) from feature/entry-docs-gate into main
ci / vet-and-test (push) Successful in 2s
ci / docker-checkout-hostgateway (push) Successful in 2s
2026-09-30 03:15:26 +00:00
weichen d7dde2aa9e Adopt the task-startup gate and commit format in AGENTS.md
ci / vet-and-test (pull_request) Successful in 1s
ci / docker-checkout-hostgateway (pull_request) Successful in 3s
Why: the composition adopted the delivery gate (Dev repo ef89fc8); resident
entry rules must carry the gate so agents load them without reading the
guidelines submodule first.
Evidence: text-only entry change; gate mechanics validated in the Dev repo
scratch-repo suite (19/19) and merged as PR weichen/Agent-System-Dev#1.
Impact: entry doc only; no code, contract, or build change in this repo.
Refs: Development-Guidelines 0.1.0-draft.7; Agent-System-Dev ef89fc8
2026-09-30 03:14:40 +00:00
25 changed files with 656 additions and 46 deletions
+34 -2
View File
@@ -8,7 +8,23 @@ jobs:
vet-and-test:
runs-on: nightly
steps:
- uses: actions/checkout@v4
- name: Checkout
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
# 自包含检出(runner 无法访问 github.com 上的 actions/checkout):固定 SHA 浅取回;凭据只经 GIT_CONFIG_* 环境变量以 URL 限定的 extraheader 传给单个 git 进程(不进命令行、不持久化);强制检出并清理遗留文件,等价 actions/checkout 的 clean。
case "$GITHUB_SHA" in *[!0-9a-fA-F]*|"") echo "Checkout requires a fixed commit SHA" >&2; exit 1;; esac
url="${GITHUB_SERVER_URL%/}/${GITHUB_REPOSITORY}.git"
git init -q .
GIT_CONFIG_COUNT=3 \
GIT_CONFIG_KEY_0="http.${url}.extraheader" GIT_CONFIG_VALUE_0="AUTHORIZATION: token ${TOKEN}" \
GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1= \
GIT_CONFIG_KEY_2=core.hooksPath GIT_CONFIG_VALUE_2=/dev/null \
git fetch -q --depth=1 "$url" "$GITHUB_SHA"
git checkout -q -f --detach FETCH_HEAD
git clean -ffdxq
unset TOKEN
- run: go vet ./... && go test -count=1 ./...
docker-checkout-hostgateway:
runs-on: ubuntu-latest
@@ -16,5 +32,21 @@ jobs:
env:
GITHUB_SERVER_URL: http://gitea:3000
steps:
- uses: actions/checkout@v4
- name: Checkout
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
# 自包含检出(runner 无法访问 github.com 上的 actions/checkout):固定 SHA 浅取回;凭据只经 GIT_CONFIG_* 环境变量以 URL 限定的 extraheader 传给单个 git 进程(不进命令行、不持久化);强制检出并清理遗留文件,等价 actions/checkout 的 clean。
case "$GITHUB_SHA" in *[!0-9a-fA-F]*|"") echo "Checkout requires a fixed commit SHA" >&2; exit 1;; esac
url="${GITHUB_SERVER_URL%/}/${GITHUB_REPOSITORY}.git"
git init -q .
GIT_CONFIG_COUNT=3 \
GIT_CONFIG_KEY_0="http.${url}.extraheader" GIT_CONFIG_VALUE_0="AUTHORIZATION: token ${TOKEN}" \
GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1= \
GIT_CONFIG_KEY_2=core.hooksPath GIT_CONFIG_VALUE_2=/dev/null \
git fetch -q --depth=1 "$url" "$GITHUB_SHA"
git checkout -q -f --detach FETCH_HEAD
git clean -ffdxq
unset TOKEN
- run: test -f go.mod && echo "docker-mode checkout via host-gateway OK"
+150
View File
@@ -0,0 +1,150 @@
name: governance
on:
pull_request:
push:
branches: [main]
jobs:
governance:
runs-on: ubuntu-latest
env:
GOPROXY: https://goproxy.cn,direct
steps:
- name: Checkout
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
SUBMODULE_TOKEN: ${{ secrets.SUBMODULE_TOKEN }}
run: |
set -euo pipefail
# 只物化两个治理 gitlink(Guidelines 与 deps/development-manager),非递归;
# 其它 gitlink 不物化、不取回。凭据只以 URL 限定的 extraheader 存在于本进程树内。
python3 - <<'PY_CHECKOUT'
import os
from pathlib import Path
import re
import subprocess
import sys
from urllib.parse import urlsplit
# 服务端基址取运行器注入的 GITHUB_SERVER_URL(平台控制、候选 PR 不可影响)。
SERVER = os.environ.get("GITHUB_SERVER_URL", "").rstrip("/")
parsed_server = urlsplit(SERVER)
if parsed_server.scheme not in {"http", "https"} or not parsed_server.netloc:
sys.exit("Checkout server must be the platform-injected http(s) URL")
SSH = "ssh://git@gitea.naitangbaobao.cn:52222/weichen/"
# 审查过的白名单,独立于候选 .gitmodules:仅列出两个治理 gitlink。
REPOSITORIES = {
"deps/development-guidelines": "Development-Guidelines",
"deps/development-manager": "Development-Manager",
}
TARGET = "weichen/Logging-System"
root_token = os.environ.pop("TOKEN", "")
component_token = os.environ.pop("SUBMODULE_TOKEN", "")
if not root_token or not component_token:
sys.exit("Checkout requires TOKEN and SUBMODULE_TOKEN")
if os.environ.get("GITHUB_REPOSITORY") != TARGET:
sys.exit("Checkout repository is outside the reviewed allowlist")
sha = os.environ.get("GITHUB_SHA", "")
if not re.fullmatch(r"[0-9a-fA-F]{40}", sha):
sys.exit("Checkout requires a fixed commit SHA")
# 丢弃继承的 Git 追踪/配置/SSH 钩子;凭据只存在于单个 Git 进程树的精确 URL 头中。
clean_env = {k: v for k, v in os.environ.items() if not k.startswith("GIT_")}
clean_env.update(GIT_CONFIG_NOSYSTEM="1", GIT_CONFIG_SYSTEM="/dev/null",
GIT_CONFIG_GLOBAL="/dev/null", GIT_TERMINAL_PROMPT="0")
config = {
"core.hooksPath": "/dev/null", "core.fsmonitor": "false",
"init.templateDir": "", "credential.helper": "",
"fetch.recurseSubmodules": "false", "submodule.recurse": "false",
"http.followRedirects": "false", "protocol.allow": "never",
"protocol." + urlsplit(SERVER).scheme + ".allow": "always",
}
def git(repo, *args, extra=None):
values = config | (extra or {})
env = clean_env | {"GIT_CONFIG_COUNT": str(len(values))}
for index, (key, value) in enumerate(values.items()):
env[f"GIT_CONFIG_KEY_{index}"] = key
env[f"GIT_CONFIG_VALUE_{index}"] = value
return subprocess.run(["git", "-C", str(repo), *args], env=env,
check=True, stdout=subprocess.PIPE).stdout
def materialize_governance(root):
# -r 列出任意深度的 gitlink,但不进入 submodule 内部;其它 gitlink 只记录、从不取回。
links = {}
for entry in git(root, "ls-tree", "-rz", "HEAD").split(b"\0"):
if not entry:
continue
metadata, path = entry.split(b"\t", 1)
mode, kind, commit = metadata.decode().split()
if mode == "160000":
links[path.decode()] = commit
for name in REPOSITORIES:
if name not in links:
raise ValueError("Governance gitlink is missing from the fixed commit")
raw = git(root, "config", "--no-includes", "--blob", "HEAD:.gitmodules", "--null", "--list")
entries = {}
for item in raw.split(b"\0"):
if not item:
continue
key, value = item.decode().split("\n", 1)
match = re.fullmatch(r"submodule\.(.+)\.(path|url)", key)
if not match:
continue
name, field = match.groups()
if name not in REPOSITORIES:
continue
if field in entries.setdefault(name, {}):
raise ValueError("Duplicate candidate .gitmodules setting")
entries[name][field] = value
# 先整体校验两个治理条目,再进行任何带凭据的取回。
for name, repository in REPOSITORIES.items():
fields = entries.get(name, {})
if fields.get("path") != name:
raise ValueError("Governance submodule path is outside the reviewed allowlist")
trusted_url = f"{SERVER}/weichen/{repository}.git"
if fields.get("url") not in {SSH + repository + ".git", trusted_url}:
raise ValueError("Governance submodule URL is outside the reviewed allowlist")
for name, repository in REPOSITORIES.items():
url = f"{SERVER}/weichen/{repository}.git"
# 仅持久化审查过的公开 URL,使 Git 在进程级配置消失后仍识别该 submodule。
git(root, "config", f"submodule.{name}.url", url)
git(root, "submodule", "update", "--init", "--checkout", "--", name,
extra={f"submodule.{name}.url": url,
f"submodule.{name}.update": "checkout",
f"http.{url}.extraheader": "AUTHORIZATION: token " + component_token})
child = root / name
if git(child, "rev-parse", "HEAD").decode().strip() != links[name]:
raise ValueError("Materialized governance gitlink does not match the fixed SHA")
try:
root = Path.cwd()
# 必须是干净的临时工作区;不复用既有 Git 状态。
if (root / ".git").exists():
raise ValueError("Checkout requires a fresh workspace")
git(root, "init", "-q")
url = f"{SERVER}/{TARGET}.git"
git(root, "remote", "add", "origin", url)
git(root, "fetch", "--depth=1", "origin", sha,
extra={f"http.{url}.extraheader": "AUTHORIZATION: token " + root_token})
git(root, "checkout", "-q", "--detach", "FETCH_HEAD")
materialize_governance(root)
except (ValueError, OSError, subprocess.CalledProcessError) as error:
sys.exit(f"Checkout refused: {error}")
print("Checkout complete; credentials were not persisted in Git configuration")
PY_CHECKOUT
unset TOKEN SUBMODULE_TOKEN
- name: Install Go 1.27.1
run: |
set -euo pipefail
curl -fsSL -o "$RUNNER_TEMP/go.tgz" https://mirrors.aliyun.com/golang/go1.27.1.linux-amd64.tar.gz
tar -C /usr/local -xzf "$RUNNER_TEMP/go.tgz"
ln -sfn /usr/local/go/bin/go /usr/local/bin/go
ln -sfn /usr/local/go/bin/gofmt /usr/local/bin/gofmt
- name: Validate agent execution configuration
run: scripts/agent-exec validate --repo .
- name: Governance check
run: scripts/dm governance check --repo .
+4 -1
View File
@@ -1,3 +1,6 @@
[submodule "deps/development-guidelines"]
path = deps/development-guidelines
url = ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Development-Guidelines.git
url = ssh://git@gitea.naitangbaobao.cn:52222/weichen/Development-Guidelines.git
[submodule "deps/development-manager"]
path = deps/development-manager
url = ssh://git@gitea.naitangbaobao.cn:52222/weichen/Development-Manager.git
@@ -0,0 +1,63 @@
# Logging-System 采纳 development-governance-v2 治理套件 任务卡
任务主记录:[Logging-System PR #4](https://git-home.u1680832.nyat.app:30319/weichen/Logging-System/pulls/4)(本文件随 PR 描述维护)。
状态:已完成(闭合随本 PR 合入;合入以平台记录为准);owner:weichen。
## 基线与授权
- 权威仓:weichen/Logging-System;root_target:main;immediate_target:main
- branch_kind:initiative;initiative_id:governance-adoption-Logging-System
- R0(initial_main_sha):da5c33eb25a88b5ad5c88999d1a119f6f5b3af24;工作区:/home/weichen/projects/Logging-System-wt-feature-governance-adoption(worktree);分支:feature/governance-adoption
- 父任务信息(仅子任务填写):无
- accepting_requirements:false(单仓采纳 initiative,范围固定为下列十步,不接收新需求)
- 需求分流:verdict=NEW;selected_initiative=无;候选=无;理由=development-governance-v2 Phase 6 每个正式仓库独立 initiative;triage 收据=无(本仓采纳前尚无 triage 入口)
- 授权与交付终点:owner 已授权 development-governance-v2 全部实施(Agent-System-Dev 主记录 docs/superpowers/plans/2026-10-16-development-governance-v2-master.md);终点为本 PR 合入 main 且采纳状态 active。分支保护与 tag 由用户执行。
- 实施执行:agent-per-unit(配置:AGENT-EXECUTION.md;外部 Agent 一单元一新进程/会话/工作区)
## 目标与非目标
目标(Phase 6 十步):固定 Guidelines SHA(deps/development-guidelines @ 2688fd2be6a52c0bf110e7e6366b6f291ab5e4eb);增加 AGENT-EXECUTION.md;增加共享执行器薄入口(deps/development-manager @ bd3a7de57a3a9e1a4495b94c5fa5c08d71e7be8c + scripts/dm、scripts/agent-exec、scripts/task);四条路由(implementation/repair/test/review);任务卡模板与分支元数据;CI 中启用 schema 校验(.gitea/workflows/governance.yml:agent-exec validate + governance check);一次正例运行;负例(缺配置、坏收据、越界路径、未知副作用);独立 Review + CI;采纳状态 active。
非目标:不改业务代码与既有测试;不改分支保护(由用户执行);不发布 tag。
引导说明:AGENT-EXECUTION.md 由 host 以固定版本治理套件(dm-server governance init @ bd3a7de57a3a9e1a4495b94c5fa5c08d71e7be8c)生成并作为引导配置提交(执行器运行前必须存在有效配置;沿用 DM 采纳先例);其余文件由实施单元生成。
## Agent 实施收据
| 单元 ID | 预期范围 | 角色 | 候选顺序 | attempt | CLI/模型 | 终态 | transport | fallback | 源码外收据路径 |
|---|---|---|---|---|---|---|---|---|---|
| governance-adoption-Logging-System-r1 | 13 个允许路径(治理文件 + 两个 gitlink) | 31244149 | implementation | cursor→antigravity→pi | run b513506a(dm-server pinned,attempts=1) | cursor / not-observable | success | 3b355600aacf(apply 快进) | 否 | /tmp/gov-receipt-Logging-System-r1.json |
| governance-adoption-Logging-System-repair-r1 | PROJECT.md、policy/guidelines-adoption.md | repair | cursor→antigravity→pi | run d1dd6ede(attempts=1) | cursor / not-observable | success | 742ffb2c7c9d(apply 快进) | 否 | /tmp/gov-receipt-Logging-System-repair-r1.json |
| governance-adoption-Logging-System-repair-r2 | .gitea/workflows/ci.yml、policy/guidelines-adoption.md | repair | cursor→antigravity→pi | run 8bc2c2e6(attempts=1) | cursor / not-observable | success | 670622554482(apply 快进) | 否 | /tmp/gov-receipt-Logging-System-repair-r2.json |
| governance-adoption-Logging-System-repair-r3 | .gitea/workflows/ci.yml、policy/guidelines-adoption.md | repair | cursor→antigravity→pi | run 1b906777(attempts=1) | cursor / not-observable | success | b57c1a0e0d68(apply 快进) | 否 | /tmp/gov-receipt-Logging-System-repair-r3.json |
## 同步记录
| 节点 | sync_base_sha | tested_head_sha | checked_at | 结果 |
|---|---|---|---|---|
| 启动 | da5c33eb25a88b5ad5c88999d1a119f6f5b3af24 | da5c33eb25a88b5ad5c88999d1a119f6f5b3af24 | 2026-10-17T07:18:15Z | 一致 |
| 请求审核 | da5c33eb25a88b5ad5c88999d1a119f6f5b3af24 | 01b1404d8355 | 2026-10-17T08:47:35Z | 已含 origin/main |
## 结果与验证(完成后填写)
- 结果:治理套件已采纳——Guidelines 与 Development-Manager gitlink 固定、AGENT-EXECUTION.md 四条路由、共享执行器薄入口、pre-commit admit、governance CI;采纳状态 active 随本 PR 合入生效。
- 验证:见下表(命令输出由 /tmp/gov-neg/ev.sh 写入 .task/evidence/governance-adoption/,SELF 除非另注)。
- 复现:正负例脚本冻结副本 Agent-System-Dev `docs/superpowers/plans/evidence/governance-adopt-cases.py`(sha256 3aa1bf6ea1cd48f3f59c0a307620e4112389a93fe21a113006f54e62eb8f0d06),用法 `python3 governance-adopt-cases.py <仓库根>`;它经本仓 `scripts/agent-exec` 运行假 CLI,不访问网络。
- 影响与剩余项:不改业务代码;本地启用钩子需由人执行 `git config core.hooksPath scripts/hooks`;将 governance 检查设为分支保护必需项属用户双钥匙事项(命令见 Agent-System-Dev 治理主记录)。
| 时间(UTC) | 命令 | 被测 HEAD | exit | 来源 | 摘要/位置 |
|---|---|---|---|---|---|
| 20261017T073824Z | `scripts/dm governance check --repo .` | 3b355600aacf | 0 | SELF | ok fixtures;[输出](../evidence/governance-adoption/00-20261017T073824Z.log) sha256:caf90f14cc142ed7 |
| 20261017T073824Z | `scripts/agent-exec validate --repo .` | 3b355600aacf | 0 | SELF | validate: ok;[输出](../evidence/governance-adoption/01-20261017T073824Z.log) sha256:39d7b45b3a2af043 |
| 20261017T073824Z | `python3 /tmp/gov-neg/adopt_cases.py .` | 3b355600aacf | 0 | SELF | [verdict] ALL PASS cases=5;[输出](../evidence/governance-adoption/02-20261017T073824Z.log) sha256:84a4b7528fd2a932 |
| 20261017T084130Z | `scripts/dm governance check --repo .` | 742ffb2c7c9d | 0 | SELF | ok fixtures;[输出](../evidence/governance-adoption/03-20261017T084130Z.log) sha256:c5a1a532588e5219 |
| 20261017T084130Z | `scripts/agent-exec validate --repo .` | 742ffb2c7c9d | 0 | SELF | validate: ok;[输出](../evidence/governance-adoption/04-20261017T084130Z.log) sha256:4135b4ee9fa8ff49 |
| 20261017T084644Z | `scripts/dm governance check --repo .` | 670622554482 | 0 | SELF | ok fixtures;[输出](../evidence/governance-adoption/05-20261017T084644Z.log) sha256:9fa960ad4417bb71 |
| 20261017T084644Z | `scripts/agent-exec validate --repo .` | 670622554482 | 0 | SELF | validate: ok;[输出](../evidence/governance-adoption/06-20261017T084644Z.log) sha256:df6671799eaa44b1 |
| 2026-10-17T08:47:35Z | CI `ci / vet-and-test (pull_request)` | 01b1404d8355 | 0 | GATE | success;[运行](https://git-home.u1680832.nyat.app:30319/weichen/Logging-System/actions/runs/3600/jobs/5695) |
| 2026-10-17T08:47:35Z | CI `ci / docker-checkout-hostgateway (pull_request)` | 01b1404d8355 | 0 | GATE | success;[运行](https://git-home.u1680832.nyat.app:30319/weichen/Logging-System/actions/runs/3600/jobs/5696) |
| 2026-10-17T08:47:35Z | CI `governance / governance (pull_request)` | 01b1404d8355 | 0 | GATE | success;[运行](https://git-home.u1680832.nyat.app:30319/weichen/Logging-System/actions/runs/3602/jobs/5698) |
| 20261017T085846Z | `scripts/dm governance check --repo .` | b57c1a0e0d68 | 0 | SELF | ok fixtures;[输出](../evidence/governance-adoption/07-20261017T085846Z.log) sha256:d4952124b13adfdc |
| 20261017T085846Z | `scripts/agent-exec validate --repo .` | b57c1a0e0d68 | 0 | SELF | validate: ok;[输出](../evidence/governance-adoption/08-20261017T085846Z.log) sha256:1c11390efe49b02e |
| — | 候选 HEAD CI | 676a6e37dcc8 | 0 | GATE | success ci / vet-and-test (pull_request)=success(/weichen/Logging-System/actions/runs/3623/jobs/5724);ci / docker-checkout-hostgateway (pull_request)=success(/weichen/Logging-System/actions/runs/3623/jobs/5725);governance / governance (pull_request)=success(/weichen/Logging-System/actions/runs/3624/jobs/5726) |
| — | 独立 Review | 676a6e37dcc8 | 0 | REPLAY | cursor-agent-stable --mode ask 全新只读会话(fresh_session=true,session id not-observable)闭合重审 VERDICT: APPROVE(对象 676a6e3,与 HEAD 仅 .task/ 不同) |
@@ -0,0 +1,19 @@
command: scripts/dm governance check --repo .
cwd: /home/weichen/projects/Logging-System-wt-feature-governance-adoption
head: 3b355600aacfb7924b94ea9315c4e0c37ac2a8eb
exit: 0
utc: 20261017T073824Z
---
ok gitlink deps/development-guidelines
ok gitlink deps/development-manager
ok agent-execution
ok file AGENTS.md
ok file PROJECT.md
ok file policy/guidelines-adoption.md
ok file .task/templates/task-card.md
ok executable scripts/agent-exec
ok executable scripts/hooks/pre-commit
ok executable scripts/dm
ok executable scripts/task
ok adoption status
ok fixtures
@@ -0,0 +1,7 @@
command: scripts/agent-exec validate --repo .
cwd: /home/weichen/projects/Logging-System-wt-feature-governance-adoption
head: 3b355600aacfb7924b94ea9315c4e0c37ac2a8eb
exit: 0
utc: 20261017T073824Z
---
validate: ok
@@ -0,0 +1,13 @@
command: python3 /tmp/gov-neg/adopt_cases.py .
cwd: /home/weichen/projects/Logging-System-wt-feature-governance-adoption
head: 3b355600aacfb7924b94ea9315c4e0c37ac2a8eb
exit: 0
utc: 20261017T073824Z
---
[object] Logging-System-wt-feature-governance-adoption HEAD=3b355600aacfb7924b94ea9315c4e0c37ac2a8eb
PASS positive-run-apply: run exit=0 terminal=success apply exit=0 head=9f119e119fe2
PASS missing-config: run exit=2 terminal=invalid-config validate exit=2
PASS bad-receipt: apply exit=4 head_unchanged=True msg=apply: no local integrity record: changed paths do not match the transport diff
PASS out-of-scope-path: run exit=5 terminal=scope-expansion transport=False
PASS unknown-side-effect: run exit=4 terminal=failed-unknown transport=False
[verdict] ALL PASS cases=5
@@ -0,0 +1,19 @@
command: scripts/dm governance check --repo .
cwd: /home/weichen/projects/Logging-System-wt-feature-governance-adoption
head: 742ffb2c7c9d2194678576519cfca70408fa4d75
exit: 0
utc: 20261017T084130Z
---
ok gitlink deps/development-guidelines
ok gitlink deps/development-manager
ok agent-execution
ok file AGENTS.md
ok file PROJECT.md
ok file policy/guidelines-adoption.md
ok file .task/templates/task-card.md
ok executable scripts/agent-exec
ok executable scripts/hooks/pre-commit
ok executable scripts/dm
ok executable scripts/task
ok adoption status
ok fixtures
@@ -0,0 +1,7 @@
command: scripts/agent-exec validate --repo .
cwd: /home/weichen/projects/Logging-System-wt-feature-governance-adoption
head: 742ffb2c7c9d2194678576519cfca70408fa4d75
exit: 0
utc: 20261017T084130Z
---
validate: ok
@@ -0,0 +1,19 @@
command: scripts/dm governance check --repo .
cwd: /home/weichen/projects/Logging-System-wt-feature-governance-adoption
head: 670622554482a161de911d1e9ba79b8307426f0b
exit: 0
utc: 20261017T084644Z
---
ok gitlink deps/development-guidelines
ok gitlink deps/development-manager
ok agent-execution
ok file AGENTS.md
ok file PROJECT.md
ok file policy/guidelines-adoption.md
ok file .task/templates/task-card.md
ok executable scripts/agent-exec
ok executable scripts/hooks/pre-commit
ok executable scripts/dm
ok executable scripts/task
ok adoption status
ok fixtures
@@ -0,0 +1,7 @@
command: scripts/agent-exec validate --repo .
cwd: /home/weichen/projects/Logging-System-wt-feature-governance-adoption
head: 670622554482a161de911d1e9ba79b8307426f0b
exit: 0
utc: 20261017T084644Z
---
validate: ok
@@ -0,0 +1,19 @@
command: scripts/dm governance check --repo .
cwd: /home/weichen/projects/Logging-System-wt-feature-governance-adoption
head: b57c1a0e0d6857432bca2bfeef63b38b5fe136b6
exit: 0
utc: 20261017T085846Z
---
ok gitlink deps/development-guidelines
ok gitlink deps/development-manager
ok agent-execution
ok file AGENTS.md
ok file PROJECT.md
ok file policy/guidelines-adoption.md
ok file .task/templates/task-card.md
ok executable scripts/agent-exec
ok executable scripts/hooks/pre-commit
ok executable scripts/dm
ok executable scripts/task
ok adoption status
ok fixtures
@@ -0,0 +1,7 @@
command: scripts/agent-exec validate --repo .
cwd: /home/weichen/projects/Logging-System-wt-feature-governance-adoption
head: b57c1a0e0d6857432bca2bfeef63b38b5fe136b6
exit: 0
utc: 20261017T085846Z
---
validate: ok
+66
View File
@@ -0,0 +1,66 @@
# <任务标题> 任务卡
任务主记录:<Issue/PR 链接,或注明"本文件随 PR 描述维护">。
状态:<进行中 / 待审核 / 已合入 / 已放弃>;owner:<填写>。
## 基线与授权
- 权威仓:<仓 URL 或逻辑 ID>;root_target:main;immediate_target:<main 或 feature/initiative>
- branch_kind:<initiative | child | standalone>;initiative_id:<稳定 ID,普通任务为空>
- R0(initial_main_sha):<完整 SHA>;工作区:<路径>(worktree / clone);分支:<feature|fix|hotfix/...>
- 父任务信息(仅子任务填写):parent_branch=<父分支>;parent_head_sha=<SHA>;parent_pr=<父 PR>
- accepting_requirements:<true | false>(仅 initiative 可为 true;冻结后为 false)
- 需求分流:verdict=<JOIN | NEW>;selected_initiative=<分支或无>;候选=<分支@HEAD 列表或无>;理由=<不适配/适配依据>;triage 收据=<源码外路径与摘要>
- 授权与交付终点:<本次允许的动作与终点;未授权事项写明>
- 实施执行:agent-per-unit(配置:AGENT-EXECUTION.md;外部 Agent 一单元一新进程/会话/工作区)
## 目标与非目标
<预期结果、受影响入口/模块/契约;明确不做什么。>
## Agent 实施收据
按根目录 AGENT-EXECUTION.md 路由;外部 Agent 一单元一新进程/会话/隔离工作区。实施、修复与测试必须通过登记的候选执行;未配置或候选安全耗尽停在 unavailable/blocked,禁止 host 隐式代写。
| 单元 ID | 预期范围 | 角色 | 候选顺序 | attempt | CLI/模型 | 终态 | transport | fallback | 源码外收据路径 |
|---|---|---|---|---|---|---|---|---|---|
| 待定义 | — | NOT_RUN | NOT_RUN | NOT_RUN | NOT_RUN | NOT_RUN | NOT_RUN | NOT_RUN | — |
## 复用材料(task-start 自动检索结果摘录)
- 相关近期提交:<git log -- <paths> 命中;无则写无>。
- 相关经验条目:<检索命中;无则写无>。
## 同步记录
| 节点 | sync_base_sha | tested_head_sha | checked_at | 结果 |
|---|---|---|---|---|
| 启动 | <R0> | <HEAD> | <日期时间> | <一致/已同步> |
| 验收前 | <填写> | <填写> | <填写> | <填写> |
字段没有发生的写"无",不省略。本卡与 PR 描述同源:开 PR 时将"目标与非目标、结果与验证、影响与剩余项"复制进 PR 描述,不另写第二份。
## 交付调度(有多个就绪任务时)
- 调度记录 / entry_id / 当前 attempt_id:<平台或调度服务链接及标识;未入队写无>。
- 入队源 HEAD / owner / 依赖:<完整 SHA、身份、依赖或无>。
- 固定候选引用:<调度尝试中的 base/head、组件与配置;未固定写无>。
- 窗口、最终 CI、Review 与真实合入结果:<引用调度记录及原始证据,不复制全队列>。
定义见 [合入调度与 CI 分配](../standards/merge-queue.md)。本段在候选固定前整理;固定后先使用源码之外的记录保存运行结果,再按项目闭合流程回填。
## 结果与验证(完成后填写)
- 结果:<交付了什么;未发生写无>。
- 验证:<结论性摘要:PASS/FAIL/SKIP/NOT_RUN 逐项;逐条证据见下表,来源标注与写入规则见 [按影响选择验证与证据](../standards/verification.md)>。
- 影响与剩余项:<影响面、遗留风险、后续任务>。
| 时间(UTC) | 命令 | 被测 HEAD | exit | 来源 | 摘要/位置 |
|---|---|---|---|---|---|
| <时间> | <命令;由项目 evidence 工具写入,无工具时附命令+对象 SHA+输出 digest 并标 SELF> | <HEAD> | <exit> | GATE/REPLAY/SELF | <摘要/位置> |
## 回收(task-finish)
- 合入核对:<分支已包含于目标分支的核对输出>。
- 未跟踪/ignored 文件处置:<归档/可再生/存疑 逐项;无则写无>。
- 回收动作:<worktree remove、分支删除、prune;放弃路径注明原因>。
+67
View File
@@ -0,0 +1,67 @@
# Project Agent Execution Configuration
# 项目工程 Agent 执行路由配置
适用范围:定义本项目中由 AI / Agent 主导的代码实施、修复、测试与审阅所调用的 Agent CLI 路由。
解析器识别正文中唯一一个 ```agent-execution 代码块。正文外的说明文字可根据项目需要调整。
通用硬规则见 Development-Guidelines 的 [Agent 执行与协作契约](deps/development-guidelines/standards/agent-execution.md)。
本配置为项目本地路由权威,声明具体的候选 profile、尝试次数上限、超时、集成入口与豁免路径;
代码块须通过 `deps/development-guidelines/templates/schemas/agent-execution.schema.json` 校验后才能登记为 active。
`fallback_to_host` 只能为 `never`;旧值 `all-unavailable` 仅供迁移工具读取,不能通过准入。
下例的 CLI 名称、命令与路径均为占位,按项目实际执行器替换。
```agent-execution
schema: agent-execution/v1
execution:
fresh_process_per_unit: true
permission: run-everything
fallback_to_host: never
max_parallel: 3
timeout_seconds: 7200
idle_timeout_seconds: 600
summary_bytes: 16384
raw_output_bytes: 10485760
max_attempts_per_profile: 3
emergency_profile: codex
roles:
implementation: [cursor, antigravity, pi]
repair: [cursor, antigravity, pi]
test: [pi, antigravity, cursor]
review: [pi, antigravity, cursor, codex]
profiles:
cursor:
adapter: cursor
executable: "cursor-agent-stable"
model: auto
enabled: true
antigravity:
adapter: antigravity
executable: agy
model: auto
enabled: true
pi:
adapter: pi
executable: pi
model: auto
enabled: true
codex:
adapter: codex
executable: codex
model: auto
enabled: true
integration:
exempt_paths: [".task/**", "docs/superpowers/specs/**", "docs/superpowers/plans/**"]
transport:
command: "scripts/agent-exec apply"
admission:
command: "scripts/agent-exec admit"
cleanup:
command: "scripts/agent-exec cleanup"
```
+49 -23
View File
@@ -1,28 +1,54 @@
# 项目工作入口
# Agent 工作说明(Logging-System)
本项目采纳的通用规则:[核心规则](deps/development-guidelines/core/baseline.md)。
采纳范围、生效状态及项目差异:[采纳记录](policy/guidelines-adoption.md)。
项目事实、测试和环境入口:[PROJECT.md](PROJECT.md)。
本仓开发遵循 Development-Guidelines(Dev 仓 `deps/development-guidelines`,gitlink 固定版本):
核心规则见其 `core/`,按任务触发阅读 `standards/` 专题;日常交付走 `workflows/delivery.md`。
- 启动:阅读以上短入口;只加载本次任务触发的专题。
- 普通交付:[交付流程](deps/development-guidelines/workflows/delivery.md)。
- 并行开发/正式测试/审核/合入:[共同基线与同步节点](deps/development-guidelines/standards/collaboration.md),必须确认并实际同步最新权威目标。
- Bug/异常:[系统性排障](deps/development-guidelines/workflows/debugging.md)。
- 会话结束/换机器/换客户端/换执行者:[会话、执行者与机器交接](deps/development-guidelines/workflows/handoff.md),状态写入任务主记录,不依赖本地会话历史。
- 测试与验收:[验证标准](deps/development-guidelines/standards/verification.md)。
- 模块/接口:[模块契约](deps/development-guidelines/standards/module-contracts.md)。
- 错误与过程事件:[可观测性](deps/development-guidelines/standards/observability.md)。
- 配置:[配置来源与实例隔离](deps/development-guidelines/standards/configuration.md)。
- 其他专题:按 [任务索引](deps/development-guidelines/README.md) 选择。
## 任务启动门禁
项目补充硬边界:
- 任务启动或恢复后,第一次写操作前在 Dev 仓运行 `make precheck` 并附完整输出(本仓作为子仓随父仓编排);
本仓独立开发时核对工作树 clean、与权威 origin/main 同步,并按任务触发读对应专题。
- 从权威 origin/main 固定共同起点 R0,建 feature|fix|hotfix/<slug> 分支(Dev 仓 `make task-start` 自动化);
任务中途不重复 precheck。
- 验收、请求审核、合入前各同步一次最新目标分支并附证据;合入后回收任务工作区与已合入分支。
- 提交主题行:英文祈使句一行(≤100 列,不以句点结尾);body 写 `Why: / Evidence: / Impact: / Refs:`。
- 本库只依赖标准库。识别错误码使用 `ErrorCode()` / `ErrorFields()` 鸭子接口,不 `import error-code-system`。
- 写前脱敏覆盖 JWT、sk-key、Bearer、api_key、password 形状;采集服务写入时再脱敏一次。
- 异步队列满时丢弃最新一条并计数,不阻塞业务 goroutine。
- 追踪头为 `X-Trace-Id`。`trace_id` 回答哪一次请求,不替代调用方自己的 `run_id`。
## 仓内规则
任务权威:Gitea 仓库 `weichen/Logging-System` 的 Issue 与 Pull Request。
规范性文档目录与过程记录位置:`policy/`;过程记录豁免目录 `docs/records/`。
默认集成基线和提交身份:`main`。权威远端 `ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Logging-System.git`。
共享环境/发布入口及授权:采集服务默认 `:8092`。配置了 token 时要求 `Authorization: Bearer` 或 `X-Log-Token`。令牌值不入库。
- 模块边界、公开契约与隔离档位见 `policy/modules/`(如有)与 PROJECT.md。
- 跨仓 gitlink 变更须经组合验证后在 Dev 仓推进;受保护分支经 PR 合入。
- 验证命令见 PROJECT.md「验证」节;完成声明须附实际命令输出证据。
## Gitea 与 Git 访问事实(2026-09-30 实测)
历史文档与旧链接里的 `git-panel.u1680832.nyat.app:30319` 已失效(TLS 握手失败),
见到一律按过期处理,不要再试。当前权威通道:
- **Web / API(HTTPS)**:`https://gitea.naitangbaobao.cn`(Gitea 1.27.3,
API 前缀 `/api/v1`;偶发 broken pipe / 超时,重试即可)。
- **Git over SSH**:`ssh://git@gitea.naitangbaobao.cn:52222/weichen/<Repo>.git`
(各仓 origin 与 gitlink 均为此格式)。
- **API token**:`~/.secrets/gitea`,两行键值 `URL_PREFIX=…` 与
`ACCESS_TOKEN=<40 位 hex>`;取值 `grep ACCESS_TOKEN ~/.secrets/gitea | cut -d= -f2-`,
用作 `Authorization: token <值>` 请求头。**token 值不入仓、不回显、不写进产出物**
(baseline 硬边界 2:只记录来源、字段与可用状态)。
- **SSH key**:`~/.ssh/home_gitea`(ED25519,公钥指纹
`SHA256:GYXaOXIMeloQ1fKSfdJ/ndgPQzs/Ix7Hk62ekfkfQ20`,Gitea 侧密钥名 GMKtec);
`~/.ssh/config` 已有 `gitea.naitangbaobao.cn(端口 52222)` 主机条目,克隆/推送直接可用。
## Agent 执行与新项目准入(强制)
AI 实施单元只能经 `scripts/agent-exec run` 按 AGENT-EXECUTION.md 执行,并经 `scripts/agent-exec apply` 集成;`scripts/agent-exec` 是共享执行器的权威入口。
1. 缺 Guidelines 固定版本(`deps/development-guidelines` gitlink 未就绪或 HEAD 不符)时,Agent 只能只读分析,不得实施。
2. 缺有效 `AGENT-EXECUTION.md`(`scripts/dm governance check` 未通过)时禁止 AI 实施。
3. 缺共享执行器(`scripts/agent-exec` 或 `deps/development-manager` 不可用)时,状态为 `blocked/unavailable`,不得改由 host 替代。
4. 不允许 host 代写实施单元;实施、修复与测试必须经 `AGENT-EXECUTION.md` 登记的候选执行。
5. 人类直接开发按其自身授权与项目规则进行,不受本条款约束。
6. 分支保护与规范 tag 由用户负责设置与维护,Agent 不得代为设置。
入口:
- 需求分流:`scripts/task triage discover|decide|verify`
- 任务启动:`scripts/task start …`
- PR 检查:`scripts/task pr-check …`
- Agent 执行:`scripts/agent-exec run|apply|admit|validate`
+6 -4
View File
@@ -6,14 +6,14 @@
- 目标/产品边界:结构化日志库与可独立部署的采集服务。把一次请求的日志和错误码对齐到同一个 `trace_id`。不导入错误码模块。
- 源码、资产、文档、机器契约位置:模块路径 `logging-system`。包为 `logsys`、`sink`、`redact`、`config`、`slogadapter`、`server`、`cli`、`conformance`、`examples/trace`。配置示例在 `docs/example.json`。
- 权威远端、集成基线、受保护分支:`ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Logging-System.git`,基线 `main`。
- 权威远端、集成基线、受保护分支:`ssh://git@gitea.naitangbaobao.cn:52222/weichen/Logging-System.git`,基线 `main`。
- 并行共同基线记录位置、合入通知/主动检查方式:Gitea Issue/PR。消费方用自己的 gitlink 固定版本。
- 发布线与批准版本/实际制品查询入口:无独立制品库。`go build -o bin/logctl .` 从当前提交构建。
- 提交/审核/合并/发布身份与权限:仓库所有者 weichen。
- 任务唯一来源:Gitea `weichen/Logging-System` 的 Issue 与 Pull Request。
- 规范性文档目录:`policy/`。
- 过程文档仓/目录:`docs/records/`(项目内豁免)。
- 交接记录位置:随任务主记录;需要落盘的交接放入 `docs/records/`。
- 过程文档仓/目录:`.task/`(任务卡与交付流程证据);`docs/records/`(其他过程记录,项目内豁免)。
- 交接记录位置:随任务主记录;需要落盘的交接放入 `docs/records/`(其他过程记录);任务卡与证据在 `.task/`。
- 凭证查找入口及所需字段:采集 token 来自服务配置或环境,字段名为 token / `X-Log-Token`,值不入库。进程内日志还可由 `LOGSYS_CONFIG`、`LOGSYS_LEVEL`、`LOGSYS_SERVICE`、`LOGSYS_REDACT` 覆盖。
## 依赖组合
@@ -21,6 +21,7 @@
| 逻辑 ID | 路径 | 角色 |
|---|---|---|
| development-guidelines | `deps/development-guidelines` | development-only |
| development-manager | `deps/development-manager` | development-only(治理与 Agent 执行工具,不参与构建) |
本库 Go 依赖只有标准库。`examples/trace` 是独立模块,用相对路径引用本库与同级检出的 Error-Code-System,不把错误码库变成主模块依赖。
@@ -35,7 +36,7 @@ replace logging-system => ./deps/logging-system
克隆:
```bash
git clone --recurse-submodules ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Logging-System.git
git clone --recurse-submodules ssh://git@gitea.naitangbaobao.cn:52222/weichen/Logging-System.git
```
## 验证命令
@@ -46,6 +47,7 @@ git clone --recurse-submodules ssh://git@git-ssh.u1680832.nyat.app:31411/weichen
| 模块/接口 | 仓库根:`go vet ./... && go test -count=1 ./...` | 不含 `examples/trace`(独立模块) |
| 数据/权限/恢复 | 文件滚动与采集 JSONL 由 sink/server 测试覆盖 | 无共享数据库 |
| 跨库追溯示例 | 在 `examples/trace`:`go test ./...` | 需要同级目录 `../../../Error-Code-System` 或该 go.mod 的 replace 目标存在 |
| 工程 Agent 执行与治理 | 仓库根:`scripts/agent-exec validate --repo .` 与 `scripts/dm governance check --repo .`(CI 工作流 `governance` 执行同两条) | 需 `deps/development-manager` 按钉住提交检出;只校验配置与治理文件,不覆盖业务行为 |
## 环境与数据
+1 -1
View File
@@ -84,6 +84,6 @@ replace logging-system => ./deps/logging-system
并列检出、还没放进 `deps/` 时,也可以暂时写 `replace logging-system => ../Logging-System`。本库不导入错误码模块。若消费方同时依赖 Agent-Native,而 Agent-Native 的 `deps/` 里还有一份本库,编译时只认消费方自己的 `replace`;两份 gitlink 必须相同。
远程:`ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Logging-System.git`
远程:`ssh://git@gitea.naitangbaobao.cn:52222/weichen/Logging-System.git`
与错误码系统的追溯闭环见 [docs/integration.md](docs/integration.md)。可运行示例:`go test ./examples/trace`(两个仓库需为同级目录)。
Vendored Submodule
+1
+18 -14
View File
@@ -1,29 +1,31 @@
# 通用规范采纳记录
- 项目/负责人:Logging-System / 仓库所有者 weichen
- 项目/负责人:Logging-System / weichen
- 状态:active
- 规范位置:`deps/development-guidelines`
- 规范性文档目录:`policy/`
- 过程文档位置:`docs/records/`(项目内固定目录豁免。集成说明留在 `docs/integration.md`,因为它描述当前合同而不是某次任务。方案与验证放 `docs/records/`。任务主记录在 Gitea Issue/PR。)
- 版本权威:父仓 gitlink;可读标签:无(内容版本 `0.1.0-draft.6`,提交 `26b562d2e34fbc560711296a309c91c74ffc55b1`)
- 批准/生效依据:本仓接入提交
- 替代范围和迁移说明:无既有根 `AGENTS.md`。
- 规范性文档目录:`policy/`(项目规则与制度放此处)
- 过程文档位置:`.task/`(任务卡与交付流程证据,随 PR 维护);`docs/records/`(其他过程记录,项目内固定目录豁免,方案与验证记录);任务主记录在 Gitea PR
- 版本权威:本仓 gitlink `deps/development-guidelines` @ `2688fd2be6a5`(完整 SHA `2688fd2be6a52c0bf110e7e6366b6f291ab5e4eb`,内容版本 `0.1.0-draft.12`);无可读发布标签;治理工具 gitlink `deps/development-manager` @ `bd3a7de57a3a`(完整 SHA `bd3a7de57a3a9e1a4495b94c5fa5c08d71e7be8c`)
- 批准/生效依据:`feature/governance-adoption PR(Logging-System)`;合入前须在 `.task/feature-governance-adoption.md` 记录正负例、Review 与 CI 结果
- 替代范围和迁移说明:本次把 Guidelines gitlink 从 `26b562d2e34f`(`0.1.0-draft.6`)升级到 `2688fd2be6a5`,并接入共享治理套件(`scripts/dm`、`scripts/agent-exec`、`scripts/task`、`scripts/hooks/pre-commit`、`.gitea/workflows/governance.yml`)。无旧 Agent 执行器需要替代。`.gitea/workflows/ci.yml` 两个 job 原有的 `uses: actions/checkout@v4` 步骤已替换为自包含内联检出,因为 runner 无法访问 github.com;run 步骤未改变。
| 规范/工作流 | 适用条件与范围 | 采纳或不适用理由 | 执行方式/证据 |
|---|---|---|---|
| core/baseline.md | 日常工作 | 日志是失败定位的另一半 | manual |
| workflows/delivery.md、debugging.md、handoff.md | 交付、排障与交接 | 排障会直接使用本库 | manual |
| standards/collaboration.md | 消费方固定版本 | 本仓不跟随消费方分支 | manual |
| standards/verification.md | 并发、脱敏、排空 | conformance 与 `go test` | manual |
| standards/collaboration.md | 合入前同步目标分支;消费方固定版本 | 本仓不跟随消费方分支;PR 前后同步并记录 | manual |
| standards/merge-queue.md | 多个就绪任务的最终同步、CI、Review 与合入调度 | 不适用:单人顺序合入,不存在多个并行就绪候选 | 不适用 |
| standards/verification.md | 并发、脱敏、排空、模块接口 | `go vet` 与 `go test`,见 PROJECT.md「验证命令」;CI `ci.yml` 执行 vet 与 test | manual + CI |
| standards/observability.md | trace、级别、重放 | 本仓实现日志半边 | manual |
| standards/configuration.md | 文件、环境变量、出口 | `config.Load` / `LOGSYS_*` | manual |
| standards/security.md | 脱敏与采集 token | 写前与入库前各脱敏一次 | manual |
| standards/failure-containment.md | 队列满丢弃最新一条 | 不阻塞业务 goroutine | manual |
| standards/module-contracts.md | 不导入错误码库 | 鸭子接口是稳定边界 | manual |
| standards/documentation.md | 三层文档 | `docs/` 与 `docs/records/` 分开 | manual |
| standards/failure-containment.md | 队列满时的丢弃与阻塞策略 | 队列满丢弃最新一条,不阻塞业务 goroutine | manual |
| standards/module-contracts.md | 公开接口与依赖边界 | 不导入错误码库;鸭子接口是稳定边界 | manual |
| standards/documentation.md | 三层文档 | `docs/` 与 `docs/records/` 分开;任务过程记录按 `.task/` 与 PR | manual |
| standards/multi-repo.md | 被 submodule 消费;示例模块用相对 replace | 主模块不嵌套错误码库 | manual |
| standards/data-reliability.md | JSONL 采集文件 | 无事务数据库;文件是日志投影 | manual |
| standards/agent-execution.md | 不执行 Agent | 只记录调用方给出的字段 | 不适用 |
| standards/agent-execution.md | 工程 Agent 执行(实施、修复、测试、审阅) | 配置见 AGENT-EXECUTION.md;入口 `scripts/agent-exec`(validate / admit);CI `governance` 工作流运行 validate 与 governance check;本地 admit 待 host 启用 `core.hooksPath` 后生效 | advisory(CI;分支保护尚未设为必需检查,设为必需检查并有阻断负例后再登记 enforced)+ advisory(本地);证据:`governance check + 正负例(.task/feature-governance-adoption.md)` |
| standards/testability.md、workflows/design-verification.md | 功能增量的设计与可测试性 | 跨包变更按增量写明验收与测试范围 | manual |
| standards/release-operations.md | 无制品流水线 | 消费方固定 gitlink | 不适用 |
| workflows/automation.md | 无独立定时任务 | 异步批导出是库行为,不是运营自动化 | 不适用 |
@@ -32,9 +34,11 @@
| 原规则/章节 | 项目采用方式 | 原因与风险 | 负责人/复查条件 |
|---|---|---|---|
| documentation.md 过程仓默认独立仓库 | `docs/records/` 豁免 | 个人项目。风险同其他三仓 | 采集服务对外长期运行时复查 |
| documentation.md 过程仓默认独立仓库 | `.task/` 仓内任务卡与交付证据目录 | 个人项目,任务卡随 PR 维护。风险同其他三仓 | 采集服务对外长期运行时复查 |
## 本次升级或首次接入验证
- 子模块固定 `26b562d2e34fbc560711296a309c91c74ffc55b1`。
- 子模块固定:`deps/development-guidelines` @ `2688fd2be6a52c0bf110e7e6366b6f291ab5e4eb`;`deps/development-manager` @ `bd3a7de57a3a9e1a4495b94c5fa5c08d71e7be8c`。
- `examples/trace` 仍使用自己的 `go.mod` replace,不改为依赖 `deps/` 下的错误码副本。
- 回退只恢复规范 gitlink 与入口文件。
- 入口与门禁:`AGENTS.md`「Agent 执行与新项目准入(强制)」、`AGENT-EXECUTION.md`(候选 `cursor-agent-stable`)、`.gitea/workflows/governance.yml`;正负例与结果记录在 `.task/feature-governance-adoption.md`。
- 回退:通过普通 PR 恢复 `deps/development-guidelines` 上一 gitlink(`26b562d2e34f`)及其 `.gitmodules` 条目,移除 `deps/development-manager` gitlink 及其 `.gitmodules` 条目,并移除治理入口(`scripts/dm`、`scripts/agent-exec`、`scripts/task`、`scripts/hooks/pre-commit`、`.gitea/workflows/governance.yml`、`.task/templates/task-card.md`、`AGENT-EXECUTION.md`),还原 AGENTS.md / PROJECT.md 中追加的治理章节,并将 `.gitea/workflows/ci.yml` 两个 job 的检出步骤恢复为 `uses: actions/checkout@v4`。
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# 共享 Agent 执行器薄入口:转调 scripts/dm 的 agent-exec 子命令(validate / run / apply / admit / cleanup)。
set -euo pipefail
exec "$(dirname "$0")/dm" agent-exec "$@"
Executable
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
# 共享 dm-server 薄入口:读取 deps/development-manager 的 gitlink 钉住提交,
# 按该提交构建并缓存 dm-server,再 exec 其子命令(agent-exec、task、governance)。执行语义与退出码以该二进制为准。
set -euo pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)
dm="$root/deps/development-manager"
die() { echo "dm: $*" >&2; exit 2; }
# git 钩子会导出仓库本地变量(GIT_DIR、GIT_INDEX_FILE 等),它们会让 `git -C "$dm"` 解析到外层仓库。
# 所有针对 DM 检出的 git 与 go 调用都在清除这些变量后执行;读取外层 gitlink 与最终 exec 仍保留继承环境。
dm_local_env="GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_PREFIX GIT_OBJECT_DIRECTORY GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_COMMON_DIR GIT_GRAFT_FILE GIT_NAMESPACE GIT_CONFIG GIT_CONFIG_PARAMETERS GIT_CONFIG_COUNT GIT_SHALLOW_FILE GIT_IMPLICIT_WORK_TREE $(git rev-parse --local-env-vars 2>/dev/null || true)"
dm_clean_env() { for v in $dm_local_env; do unset "$v"; done; }
dmgit() ( dm_clean_env; git -C "$dm" "$@" )
# 1. 钉住版本只来自索引中的 gitlink(mode 160000),不读取工作区文件。
entry=$(git -C "$root" ls-files -s -- deps/development-manager 2>/dev/null || true)
[ -n "$entry" ] || die "索引中缺少 deps/development-manager 的 gitlink,无法确定钉住的 DM 版本"
read -r mode pin _stage _path <<<"$entry"
[ "$mode" = 160000 ] || die "deps/development-manager 不是 gitlink(mode=$mode)"
[[ "$pin" =~ ^[0-9a-f]{40}$ ]] || die "gitlink 提交格式无效:$pin"
# 2. 检出必须存在且确为 DM 独立仓库(避免 git -C 误解析到外层仓库),HEAD 必须等于钉住提交。
[ -e "$dm/.git" ] || die "deps/development-manager 未检出;请按钉住提交 $pin 检出该 gitlink"
top=$(dmgit rev-parse --show-toplevel 2>/dev/null || true)
[ -n "$top" ] && [ "$top" = "$(cd "$dm" && pwd -P)" ] \
|| die "deps/development-manager 不是独立检出;请按钉住提交 $pin 检出该 gitlink"
head=$(dmgit rev-parse HEAD 2>/dev/null || true)
[ "$head" = "$pin" ] \
|| die "deps/development-manager HEAD(${head:-未知})与钉住提交 $pin 不一致;请按钉住提交检出"
# 3. 检出工作树必须干净(忽略嵌套 submodule 状态)。
dirty=$(dmgit status --porcelain --ignore-submodules=all) \
|| die "无法读取 deps/development-manager 的工作树状态"
[ -z "$dirty" ] || die "deps/development-manager 存在未提交改动,拒绝运行(请先清理该检出)"
# 4. 二进制按钉住提交缓存;缺失时在缓存目录内临时构建,完成后原子改名,避免留下半成品。
cache="${DM_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/development-manager/dm-server}"
bin="$cache/dm-server-$pin"
if [ ! -x "$bin" ]; then
command -v go >/dev/null 2>&1 || die "缺少 go,无法构建 dm-server($pin)"
mkdir -p "$cache"
cache=$(cd "$cache" && pwd -P)
bin="$cache/dm-server-$pin"
work=$(mktemp -d "$cache/build-$pin.XXXXXX")
if ! (dm_clean_env; cd "$dm" && GOWORK=off go build -trimpath -o "$work/dm-server" ./cmd/dm-server); then
rm -rf "$work"
die "构建 dm-server 失败($pin)"
fi
mv -f "$work/dm-server" "$bin"
rm -rf "$work"
fi
exec "$bin" "$@"
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# 本地检查(pre-commit):集成分支直提拒绝 + 分支命名 + 本地完整性核对。权威准入在 PR(baseline.md:26)。
branch=$(git rev-parse --abbrev-ref HEAD)
case "$branch" in
main|master)
echo "pre-commit: 拒绝——集成分支 ${branch} 不得直接提交,走 feature 分支 + PR(collaboration.md)" >&2
exit 1 ;;
esac
echo "$branch" | grep -qE '^(feature|fix|hotfix|release)/[A-Za-z0-9._-]+$' || {
echo "pre-commit: 拒绝——分支名须为 feature|fix|hotfix|release/<slug>,当前:${branch}" >&2
exit 1
}
root=$(git rev-parse --show-toplevel)
# admit 只是本地完整性/篡改证据(SELF):同一 OS 用户可读取本地 HMAC 密钥并绕过本钩子,
# 它不是 GATE,也不是可信身份。缺失或无效的本地记录仍拒绝;交付信任来自精确 HEAD 的 CI 或独立 REPLAY。
"$root/scripts/agent-exec" admit --repo "$root"
Executable
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# 通用任务入口:转调 scripts/dm 的 task 子命令(triage / start / pr-check)。
set -euo pipefail
exec "$(dirname "$0")/dm" task "$@"