Skip to content

feat: A2A protocol v2 — Discussion mode + cross-platform support#38

Open
AlexAnys wants to merge 1 commit intomainfrom
feat/a2a-v2-protocol
Open

feat: A2A protocol v2 — Discussion mode + cross-platform support#38
AlexAnys wants to merge 1 commit intomainfrom
feat/a2a-v2-protocol

Conversation

@AlexAnys
Copy link
Copy Markdown
Owner

@AlexAnys AlexAnys commented Mar 29, 2026

Summary

A2A 协议从 v1(单平台 Delegation)演化为 v2(跨平台双模式),基于深度研究、OpenClaw 源码验证和架构分析。

核心架构变化:选择性独立化

不需要每个 Agent 都有独立 Slack App。只让少数高价值横向 Agent(如 CoS)拥有独立 App,拉进现有 Agent 的频道直接协作:

独立 App: CoS-Bot ──→ 进入 #cto、#build 等频道
共享 App: Default-Bot ──→ CTO、Builder、CIO(现有模型不变)

映射到 Anthropic Harness Design:

  • CoS = Orchestrator(代表用户推进,不做执行)
  • CTO/Builder = Generator(执行具体工作)

文件变更

文件 受众 变更
shared/A2A_PROTOCOL.md Agent v2 协议:Delegation + Discussion 双模式、选择性独立化架构、per-account channel config、配置指南(含 agent-executable 提示)、POC 验证步骤
docs/CONCEPTS.md Human (中文) 选择性独立化解释、平台对比(含 Discord/Feishu 不支持原因)、源码验证状态
docs/en/CONCEPTS.md Human (英文) 同上英文版

源码验证

通过直接读取 openclaw/openclaw 源码确认:

机制 源码位置 结论
Self-loop 过滤 prepare.ts: message.user === ctx.botUserId Per-account,不同 App 不互相过滤
allowBots prepare.ts: channel > account > global 三级 fallback,可按 account 配置
Per-account channel config resolveMergedAccountConfig 同一频道可给不同 bot 设不同 requireMention
跨 account 去重 inbound-dedupe.ts: key 含 accountId Slack 无跨 account 去重(各自独立处理)

诚实的限制说明

  • Slack Discussion [待 POC 验证]:源码级组件已验证,端到端链路未实测
  • Discord [NO]:OpenClaw 代码层 bug (#11199 + #45300),修复 PR 均已关闭
  • Feishu [NO]:飞书平台限制,im.message.receive_v1 仅投递用户消息
  • Issue #15836 NOT_PLANNEDsessions_send 仍是官方推荐。Discussion 是增强非替代

用户配置路径

PR 包含 agent-executable 配置指南(附录 A):

  1. 人工操作:创建独立 Slack App + 邀请到频道(一次性)
  2. Agent 执行:发送配置提示给 OpenClaw,自动完成 openclaw.json 增量修改

Test plan

  • 验证 A2A_PROTOCOL.md 的 Delegation 部分与 v1 完全兼容
  • 验证 Discussion 部分全部标注 [待 POC 验证]
  • 按附录 B 的 POC 步骤执行测试(4 个测试用例)
  • 验证 CONCEPTS.md 中英版本一致
  • 验证配置指南的 JSON 结构正确

🤖 Generated with Claude Code

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a758e72e8f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +74 to +75
> ⚠️ **SessionKey 注意**:不要手打 sessionKey。优先从 `sessions_list` 复制 `deliveryContext=slack` 的 key。
> 注意 channel ID 大小写一致性——大小写不一致可能导致 session 被拆分,路由到 webchat 而非 Slack
> 注意 channel ID 大小写一致性——大小写不一致可能导致 session 被拆分,路由到 webchat 而非目标平台
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use platform-matched deliveryContext when copying keys

Section 2a is now documented as cross-platform (including Discord), but this note still tells operators to copy only deliveryContext=slack keys; in Discord/Feishu runs that can select the wrong session (or no valid one) and route work away from the intended channel/thread, which breaks the visibility/audit guarantees this protocol is enforcing.

Useful? React with 👍 / 👎.

Comment on lines +62 to +66
A 读取 root message 的 message id(ts),拼出 thread sessionKey:

- 频道 session:`agent:<B>:slack:channel:<channelId>`
- 线程 session:`agent:<B>:slack:channel:<channelId>:thread:<root_ts>`
- Slack 频道 session:`agent:<B>:slack:channel:<channelId>`
- Slack 线程 session:`agent:<B>:slack:channel:<channelId>:thread:<root_ts>`
- Discord 频道 session:`agent:<B>:discord:channel:<channelId>`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add Feishu key derivation to Delegation step

This step is labeled “全平台” but still frames session-key construction as a generic message id (ts) flow and only lists Slack/Discord key patterns; Feishu in section 5 uses topic:<root_id>, so readers following Step 2 for Feishu will derive the wrong identifier and fail to target the correct topic session.

Useful? React with 👍 / 👎.

Evolve the A2A protocol based on deep research, source code
verification, and architectural analysis:

Core architecture change — selective independence:
- Only high-value cross-cutting agents (e.g., CoS) get independent
  Slack Apps. Execution-layer agents (CTO, Builder, CIO) keep sharing
  one App via channel-based routing (existing proven model)
- CoS-Bot joins existing channels (#cto, #build) to collaborate
  directly — like walking into another agent's office
- CoS is the orchestrator (maps to Harness Design's external
  orchestrator), CTO is a participant/generator

Protocol (shared/A2A_PROTOCOL.md — agent-facing):
- Delegation mode: preserved unchanged, all platforms
- Discussion mode: CoS-Bot enters target channel, @mention-driven
  conversation with per-account channel config isolation
- Platform matrix with honest "why not" for Discord/Feishu
- Agent-executable config guide (user sends to their OpenClaw)
- POC verification steps (4 tests)
- Source-code-verified: self-loop per-account, allowBots 3-tier
  fallback, per-account channel config (prepare.ts)

Concepts (docs/CONCEPTS.md + en — human-facing):
- "Selective independence" explained: not every agent needs own App
- CoS as orchestrator, execution layer unchanged
- Discord: OpenClaw code bug (#11199), not platform limitation
- Feishu: platform API limitation (bot messages invisible)

All Discussion content marked [待 POC 验证] / [Pending POC Verification].

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AlexAnys AlexAnys force-pushed the feat/a2a-v2-protocol branch from a758e72 to 2db51c0 Compare March 30, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant