chore(coord): 给 coord-agent-auth 补 canonical role 源与 Directory 身份(登记债,非本 PR 范围)
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
## 背景
PR #471 / issue #474 只在 `.harness/agents/registry.yaml`(**checked projection**)里注册了 `coord-agent-auth`。按 ADR-103 与 `.harness/contracts/portable-role-runtime.yaml`,**canonical source 是 `.harness/agents/roles/*.yaml`,registry.yaml 只是投影** —— 所以现状是**方向反了**:投影有、源没有。
由 coord-agent-auth 自己按宪章层级 2 上报(它是该 registry 条目的受益方,仍主动指出自身注册不完整)。
## 为什么没在 PR #471 里顺手补
试过,**被门控挡住,而且挡对了**:
```
FAIL .harness/scripts/portable-role-generator.test.ts
> #441 portable persistent role generator
> defines exactly the six signed stable roles in the dedicated neutral source
AssertionError: expected [ 'coord-agent-auth.yaml', …(6) ] to deeply equal [ 'coord-architecture.yaml', …(5) ]
```
`stable_roles` 是 `.harness/contracts/portable-role-runtime.yaml` 里的**契约**(`owner_issue: 436`,`status: proposed-design`)。加第七个稳定角色是**契约修订**,不是能夹带进一个注册 PR 的东西。
**把那条测试的 6 改成 7 让它变绿 = 拆门**,没有做。已从 #471 撤回 role 文件,改为登记本 issue。
## 两笔债
### 1. canonical role 源缺位
- 需要在 `portable-role-runtime.yaml` 的 `stable_roles` 增补 `coord-agent-auth`(`kind: module-coordinator`、`merge_authority: false`、`dispatch_authority: true`),并同步 `portable-role-generator.test.ts` 的期望集合。
- 这是 **#436 的契约面变更**,归 coord-architecture。
- 建好后 `.harness/agents/roles/coord-agent-auth.yaml` + `pnpm harness gen-subagents` 生成 Claude/Codex 两份,CI 门控保证不漂移。
### 2. Directory 运行时身份缺位
`coord-agent-auth` 目前**没有 `directory_agent_id`**,也**没有 scoped token**(`.harness/state/.cache/coord-credentials.json` 的 7 把里没有它)。后果是实测过的:
- 它跑在 coord-main 的 token 身份上,网关**无法区分它与 coord-main 的动作** ⇒ 铁律 1(verdict 权威)在机械层失去可审计性;
- `module:auth` 租约在网关上显示的持有者是 `coord-main-codex-019fc5b8`,不是它。
同类缺口还有 **`coord-main` 自己**与 **`coord-chat-e2e`**(后者实测 `POST /tasks` 需 coordinator 层 token,它跑在 worker token 上,`GET /tasks?assignee=*` 直接 403,**派不了工,只能由 coord-main 代发**)。
⇒ **三个 coordinator 都缺 Directory 身份。** mint 需要 Cloudflare 访问权,属人类动作(`human-developer-onboarding.md` 第 2 步)。已列入人类待办。
## 缓解措施(在债清偿前一直有效)
**任何 coordinator 出 verdict 时,必须在正文里写明是哪个会话出的**,不靠 token 自证。coord-chat-e2e 已在每条 verdict 带这句声明,coord-agent-auth 同样照做。
## 验收
- `stable_roles` 契约修订经评审落地;`roles/coord-agent-auth.yaml` 存在且 `gen-subagents` 无漂移;`portable-role-generator.test.ts` 期望集合同步更新(**不是把 6 改成 7 了事,而是随契约一起改**)。
- 三个 coordinator 的 Directory 身份与 scoped token 就位后,网关 `claims` 上 `module:auth` 的持有者显示为 `coord-agent-auth` 自己的 ULID,而非借用身份。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with ADR-103 and .harness/contracts/portable-role-runtime.yaml, then inspect .harness/scripts/portable-role-generator.test.ts and the existing files under .harness/agents/roles/. Run the generator test and review the human-developer-onboarding.md identity step. Done means the contract, role source, generated outputs, and expected set agree, while the three coordinator Directory identities and scoped tokens are provisioned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication, build-system, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100