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
7 changes: 6 additions & 1 deletion frontend/src/adk/wecomAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import defaultSdk, {
// The package creates a singleton listener on import; attempts own their instances.
defaultSdk.destroy();

type WecomBotInfo = {
botid?: unknown;
secret?: unknown;
};

export class WecomAuthorizationError extends Error {
constructor(public readonly code: string) {
super("WeCom authorization failed");
Expand Down Expand Up @@ -45,7 +50,7 @@ export function authorizeWecom(
debug: false,
})
.then(
(bot) => {
(bot: WecomBotInfo | null | undefined) => {
if (settled) return;
if (
typeof bot?.botid !== "string" ||
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Align package dependency metadata for Google ADK and OpenTelemetry

[中文版](2026-10-12-google-adk-opentelemetry-baseline.zh.md)

- Change ID: `runtime-dependency-compatibility`
- Created/revised: 2026-10-13
- Status: implemented
- Related component spec: [Runtime dependency compatibility](../../../specs/runtime-dependency-compatibility/README.md)
- Scope: main package dependency metadata, the main development lock, metadata regression tests, and minimal ADK 2.7 build-graph/Studio compatibility coverage. Studio, sandbox, generated project, managed sidecar, and Docker dependency declarations are intentionally out of scope.

## Background and evidence

Two upstream Google ADK commits fix session event timestamp determinism and UTC storage/filtering:

- `4ca975eb9acd30a64b2c8615a93d31dada63052c`: `fix(sessions): make event reads deterministic and timezone-correct`
- `1b8ed3d9c0b125852df1902dd32b65bcab63ce1d`: `fix(sessions): store and filter event timestamps in UTC`

Those fixes are available in Google ADK `2.7.0` and later. The local VeADK lock previously selected Google ADK `2.2.0`.

The confirmed resolver blockers were:

- AgentKit SDK's old OpenTelemetry upper bounds. They were fixed by publishing `agentkit-sdk-python==0.8.9`.
- VeADK's direct `opentelemetry-exporter-otlp==1.37.0` exact pin.

Fresh resolver evidence on 2026-10-13 showed that an unconstrained `google-adk>=2.7.0` selects `google-adk==2.11.0`. The targeted compatibility suite failed on that line because ADK 2.11 removed or changed internals VeADK still patches, including `google.adk.flows.llm_flows.functions.__call_tool_async`, and piagent tool execution then saw a missing `run_config` on the test invocation context. This PR therefore supports the current 2.7 compatibility window as `google-adk>=2.7.0,<2.8.0`.

## Goals

- Raise VeADK's Google ADK requirement to `google-adk>=2.7.0,<2.8.0` so the UTC session timestamp fixes are available while avoiding known ADK 2.8+ compatibility risk.
- Keep VeADK's AgentKit requirement flexible at `agentkit-sdk-python>=0.8.5` so new installs can resolve to `0.8.9` without forcing an exact pin.
- Keep VeADK's direct OpenTelemetry exporter flexible at `opentelemetry-exporter-otlp>=1.37.0`.
- Update the main development `uv.lock` to the current compatible resolution.
- Preserve ADK 2.7 build-graph and Studio lazy GenAI behavior covered by regression tests.

## Non-goals

- Do not change Studio, sandbox, generated project, managed sidecar, or Docker dependency declarations in this change.
- Do not pin VeADK to `agentkit-sdk-python==0.8.9`.
- Do not support ADK `2.8.0` or later in this PR; that requires a separate compatibility pass for changed ADK internals.
- Do not publish packages, Docker images, sandbox images, or Studio assets.

## Requirements

- `FR-1`: Package metadata must use `google-adk>=2.7.0,<2.8.0` for the base dependency and `google-adk[eval]>=2.7.0,<2.8.0` for the eval extra.
- `FR-2`: Package metadata must keep `agentkit-sdk-python>=0.8.5`.
- `FR-3`: Package metadata must use `opentelemetry-exporter-otlp>=1.37.0`, not an exact pin.
- `FR-4`: The main `uv.lock` metadata must reflect the updated package metadata and resolve Google ADK to a compatible 2.7.x release.
- `FR-5`: Regression tests must cover package metadata and lock metadata.
- `FR-6`: ADK build-graph serialization must continue to expose VeADK nested `sub_agents` under ADK 2.7.x.
- `FR-7`: Studio startup tests must continue to verify lazy GenAI model loading under ADK 2.7.x telemetry APIs.

## Design and contract impact

Update the published package dependency metadata and the main development lock:

- `google-adk>=2.7.0,<2.8.0`
- `agentkit-sdk-python>=0.8.5`
- `opentelemetry-exporter-otlp>=1.37.0`

`google-adk[eval]` uses the same `>=2.7.0,<2.8.0` window. The `harness-sidecar` optional dependency keeps the same AgentKit lower bound.

The `google-adk<2.8.0` upper bound is deliberate. It prevents fresh installs from selecting currently unverified ADK 2.8+ releases after the targeted suite reproduced ADK 2.11 incompatibility.

ADK 2.7's graph serializer skips Pydantic fields marked `exclude=True`; VeADK's `Agent.sub_agents` uses that flag. The build-graph compatibility patch therefore adds `sub_agents` from the live VeADK agent only when ADK's serialized result omits them.

ADK 2.7 no longer exposes `_experimental_semconv.transformers` in the Studio test path. The test now falls back to `google.genai.models.t` while preserving the assertion that Studio defers the real GenAI models module until first use.

No persistent state, security boundary, or public Python API changes are introduced.

## Implementation tasks

| Task | Requirements | Affected files |
| --- | --- | --- |
| `T-1` | `FR-1`, `FR-2`, `FR-3` | `pyproject.toml` |
| `T-2` | `FR-4` | `uv.lock` |
| `T-3` | `FR-5` | `tests/test_runtime_dependency_compatibility.py` |
| `T-4` | `FR-6` | `veadk/utils/patches.py`, `tests/cli/test_frontend_trace.py` |
| `T-5` | `FR-7` | `tests/cli/test_studio_startup_imports.py` |
| `T-6` | all | PRD/spec reconciliation and verification record |

## Verification and acceptance

| Requirement | Acceptance criterion | Result/evidence |
| --- | --- | --- |
| `FR-1` | Package metadata uses `google-adk>=2.7.0,<2.8.0` and `google-adk[eval]>=2.7.0,<2.8.0` | pass |
| `FR-2` | `agentkit-sdk-python>=0.8.5` remains in package metadata | pass |
| `FR-3` | `opentelemetry-exporter-otlp>=1.37.0` remains flexible | pass |
| `FR-4` | `uv.lock` metadata reflects the updated package metadata and resolves ADK 2.7.x | pass: lock resolves `google-adk==2.7.1` |
| `FR-5` | targeted dependency metadata tests pass | pass |
| `FR-6` | nested VeADK agents appear in ADK build-graph JSON | pass |
| `FR-7` | Studio lazy GenAI startup tests pass under ADK 2.7.x | pass |

## Risks and open questions

- Users with existing lock files or constraints can still remain on older dependency selections until they update those files.
- ADK `2.8.0` and later are intentionally excluded until VeADK adapts to upstream internal API changes.
- Studio, sandbox, generated project, managed sidecar, and Docker paths still have their existing dependency declarations and should be handled separately if product owners decide to update those surfaces.

## Review and approval

- User approved upgrading ADK directly in this PR on 2026-10-13 and asked to add an upper bound if higher ADK versions are incompatible.
- Direct design review (`review-spec` unavailable): scope, dependency bounds, lock behavior, ADK 2.7 compatibility, ADK 2.11 failure evidence, and bilingual equivalence reviewed.

## Delivery record

### Verification (2026-10-13, working diff)

| Check | Result |
| --- | --- |
| PyPI version check for `google-adk` | pass: latest stable observed as `2.11.0`; unrestricted `>=2.7.0` would select a newer line |
| `uv lock --upgrade-package google-adk` with unrestricted `>=2.7.0` | fail for compatibility scope: resolved `google-adk==2.11.0`; targeted suite failed on ADK internal changes |
| `uv lock --upgrade-package google-adk` with `>=2.7.0,<2.8.0` | pass: resolved `google-adk==2.7.1` |
| `uv run --extra dev pytest -q tests/test_runtime_dependency_compatibility.py tests/extensions/harness/test_sidecar_wheel.py::test_wheel_metadata_keeps_sidecar_optional_and_sdk_constraints_aligned tests/cli/test_frontend_sandbox.py::test_snapshot_metadata_survives_older_sdk_and_scopes_cards tests/runtime/piagent/test_piagent_runtime.py::test_piagent_runtime_emits_canonical_bridge_tool_events tests/runtime/piagent/test_piagent_runtime.py::test_piagent_runtime_exposes_before_model_added_tools tests/test_adk_sync_tool_thread_pool_patch.py::test_run_code_uses_agent_thread_pool_when_configured tests/tools/builtin_tools/create_agent/test_create_agent_toolset.py::test_runner_transfers_from_create_agents_to_dynamic_sub_agent tests/cli/test_frontend_trace.py::test_build_graph_serializes_nested_veadk_agent_models tests/cli/test_studio_startup_imports.py::test_studio_fast_api_defers_genai_models_until_first_request tests/cli/test_studio_startup_imports.py::test_studio_deferred_genai_models_support_openapi_first_use` | pass: 11 passed |
| `uv run --extra dev pytest -q -n 4 tests/runtime/piagent/test_piagent_runtime.py` | pass: 55 passed; verifies PiAgent fake invocation contexts now provide the ADK 2.7 `run_config` expected by tool execution |
| `uv run --extra dev pre-commit run --all-files` | pass |
| `git diff --check` | pass |
| `uv run --extra dev pytest -n 2 -m "not codex_smoke and not piagent_smoke"` | fail: 6913 passed, 55 skipped, 4 xfailed, 16 failed. The failed run included stale assertions fixed by this change and Codex runtime tests missing the optional `openai_codex` package under `--extra dev`. The Codex failure subset passed with `--extra codex`. |
| `uv run --extra dev --extra codex pytest -q` for the 10 failed Codex runtime tests | pass: 10 passed |

This change is complete for the main package dependency and ADK 2.7 compatibility scope. Studio, sandbox, generated project, managed sidecar, and Docker dependency declarations are deferred.
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# 对齐 Google ADK 与 OpenTelemetry 的包依赖元数据

[English](2026-10-12-google-adk-opentelemetry-baseline.md)

- 变更 ID:`runtime-dependency-compatibility`
- 创建/修订日期:2026-10-13
- 状态:implemented
- 相关组件规格:[Runtime dependency compatibility](../../../specs/runtime-dependency-compatibility/README.zh.md)
- 范围:主包依赖元数据、主开发 lock、元数据回归测试,以及最小 ADK 2.7 build-graph/Studio 兼容覆盖。Studio、sandbox、生成项目、托管 sidecar 和 Docker 依赖声明有意不在本次范围内。

## 背景与证据

两个上游 Google ADK commit 修复了 session event 时间戳确定性以及 UTC 存储/过滤问题:

- `4ca975eb9acd30a64b2c8615a93d31dada63052c`:`fix(sessions): make event reads deterministic and timezone-correct`
- `1b8ed3d9c0b125852df1902dd32b65bcab63ce1d`:`fix(sessions): store and filter event timestamps in UTC`

这些修复从 Google ADK `2.7.0` 开始可用。VeADK 本地 lock 此前解析到 Google ADK `2.2.0`。

已确认的 resolver 阻塞点是:

- AgentKit SDK 旧的 OpenTelemetry 上限;该问题已通过发布 `agentkit-sdk-python==0.8.9` 修复。
- VeADK 直接声明的 `opentelemetry-exporter-otlp==1.37.0` 精确 pin。

2026-10-13 的全新 resolver 证据显示,不加上限的 `google-adk>=2.7.0` 会选择 `google-adk==2.11.0`。目标兼容测试在该版本线上失败,因为 ADK 2.11 移除或改变了 VeADK 仍在 patch 的内部入口,包括 `google.adk.flows.llm_flows.functions.__call_tool_async`;piagent 工具执行还会在测试 invocation context 上遇到缺失 `run_config` 的问题。因此本 PR 将当前支持窗口定义为 `google-adk>=2.7.0,<2.8.0`。

## 目标

- 将 VeADK 的 Google ADK 需求提升到 `google-adk>=2.7.0,<2.8.0`,确保包含 UTC session 时间戳修复,同时避开已知 ADK 2.8+ 兼容风险。
- 保持 VeADK 的 AgentKit 需求为灵活的 `agentkit-sdk-python>=0.8.5`,使全新安装可以解析到 `0.8.9`,但不做精确 pin。
- 保持 VeADK 直接的 OpenTelemetry exporter 依赖为灵活的 `opentelemetry-exporter-otlp>=1.37.0`。
- 将主开发 `uv.lock` 更新到当前兼容解析。
- 保持回归测试覆盖的 ADK 2.7 build-graph 与 Studio lazy GenAI 行为。

## 非目标

- 不在本次变更中修改 Studio、sandbox、生成项目、托管 sidecar 或 Docker 依赖声明。
- 不把 VeADK pin 到 `agentkit-sdk-python==0.8.9`。
- 不在本 PR 支持 ADK `2.8.0` 或更高版本;这需要单独适配已变化的 ADK 内部 API。
- 不发布包、Docker 镜像、sandbox 镜像或 Studio 资产。

## 需求

- `FR-1`:基础依赖必须使用 `google-adk>=2.7.0,<2.8.0`,eval extra 必须使用 `google-adk[eval]>=2.7.0,<2.8.0`。
- `FR-2`:包元数据必须保持 `agentkit-sdk-python>=0.8.5`。
- `FR-3`:包元数据必须使用 `opentelemetry-exporter-otlp>=1.37.0`,而不是精确 pin。
- `FR-4`:主 `uv.lock` 元数据必须反映更新后的包元数据,并将 Google ADK 解析到兼容的 2.7.x 版本。
- `FR-5`:回归测试必须覆盖包元数据和 lock 元数据。
- `FR-6`:ADK build-graph 序列化在 ADK 2.7.x 下必须继续暴露 VeADK 嵌套 `sub_agents`。
- `FR-7`:Studio 启动测试必须继续验证 ADK 2.7.x telemetry API 下的 lazy GenAI model 加载。

## 设计与契约影响

更新发布包依赖元数据和主开发 lock:

- `google-adk>=2.7.0,<2.8.0`
- `agentkit-sdk-python>=0.8.5`
- `opentelemetry-exporter-otlp>=1.37.0`

`google-adk[eval]` 使用同样的 `>=2.7.0,<2.8.0` 窗口。`harness-sidecar` optional dependency 保持相同的 AgentKit 下限。

`google-adk<2.8.0` 上限是有意设置的。目标测试已复现 ADK 2.11 不兼容,因此该上限避免全新安装选择当前未验证的 ADK 2.8+ 版本。

ADK 2.7 的 graph serializer 会跳过 Pydantic 中标记 `exclude=True` 的字段;VeADK 的 `Agent.sub_agents` 使用了该标记。因此 build-graph 兼容 patch 只在 ADK 原生序列化结果缺失 `sub_agents` 时,从运行中的 VeADK agent 补回子 Agent。

ADK 2.7 在 Studio 测试路径中不再暴露 `_experimental_semconv.transformers`。测试现在 fallback 到 `google.genai.models.t`,同时保留“Studio 在首次真正使用前延迟加载真实 GenAI models 模块”的断言。

本次变更不引入持久化状态、安全边界或公开 Python API 变化。

## 实施任务

| 任务 | 需求 | 影响文件 |
| --- | --- | --- |
| `T-1` | `FR-1`, `FR-2`, `FR-3` | `pyproject.toml` |
| `T-2` | `FR-4` | `uv.lock` |
| `T-3` | `FR-5` | `tests/test_runtime_dependency_compatibility.py` |
| `T-4` | `FR-6` | `veadk/utils/patches.py`, `tests/cli/test_frontend_trace.py` |
| `T-5` | `FR-7` | `tests/cli/test_studio_startup_imports.py` |
| `T-6` | all | PRD/spec 对齐和验证记录 |

## 验证与验收

| 需求 | 验收标准 | 结果/证据 |
| --- | --- | --- |
| `FR-1` | 包元数据使用 `google-adk>=2.7.0,<2.8.0` 和 `google-adk[eval]>=2.7.0,<2.8.0` | pass |
| `FR-2` | 包元数据保留 `agentkit-sdk-python>=0.8.5` | pass |
| `FR-3` | `opentelemetry-exporter-otlp>=1.37.0` 保持灵活 | pass |
| `FR-4` | `uv.lock` 元数据反映更新后的包元数据并解析 ADK 2.7.x | pass:lock 解析为 `google-adk==2.7.1` |
| `FR-5` | 目标依赖元数据测试通过 | pass |
| `FR-6` | 嵌套 VeADK agents 出现在 ADK build-graph JSON 中 | pass |
| `FR-7` | Studio lazy GenAI 启动测试在 ADK 2.7.x 下通过 | pass |

## 风险与开放问题

- 已有 lock 文件或 constraints 的用户仍可能停留在旧依赖选择,直到他们更新这些文件。
- ADK `2.8.0` 及更高版本被有意排除,直到 VeADK 适配上游内部 API 变化。
- Studio、sandbox、生成项目、托管 sidecar 和 Docker 路径仍保留现有依赖声明;如果产品负责人决定更新这些表面,应另行处理。

## 评审与批准

- 用户在 2026-10-13 明确批准在此 PR 中直接升级 ADK,并要求如果更高 ADK 版本存在不兼容就设置上限。
- 直接设计评审(`review-spec` 不可用):已评审范围、依赖边界、lock 行为、ADK 2.7 兼容性、ADK 2.11 失败证据和中英文等价性。

## 交付记录

### 验证(2026-10-13,working diff)

| 检查 | 结果 |
| --- | --- |
| `google-adk` PyPI 版本检查 | pass:观察到最新稳定版为 `2.11.0`;不设上限的 `>=2.7.0` 会选择更新版本线 |
| 在无限制 `>=2.7.0` 下运行 `uv lock --upgrade-package google-adk` | fail(针对兼容范围):解析为 `google-adk==2.11.0`;目标测试因 ADK 内部变化失败 |
| 在 `>=2.7.0,<2.8.0` 下运行 `uv lock --upgrade-package google-adk` | pass:解析为 `google-adk==2.7.1` |
| `uv run --extra dev pytest -q tests/test_runtime_dependency_compatibility.py tests/extensions/harness/test_sidecar_wheel.py::test_wheel_metadata_keeps_sidecar_optional_and_sdk_constraints_aligned tests/cli/test_frontend_sandbox.py::test_snapshot_metadata_survives_older_sdk_and_scopes_cards tests/runtime/piagent/test_piagent_runtime.py::test_piagent_runtime_emits_canonical_bridge_tool_events tests/runtime/piagent/test_piagent_runtime.py::test_piagent_runtime_exposes_before_model_added_tools tests/test_adk_sync_tool_thread_pool_patch.py::test_run_code_uses_agent_thread_pool_when_configured tests/tools/builtin_tools/create_agent/test_create_agent_toolset.py::test_runner_transfers_from_create_agents_to_dynamic_sub_agent tests/cli/test_frontend_trace.py::test_build_graph_serializes_nested_veadk_agent_models tests/cli/test_studio_startup_imports.py::test_studio_fast_api_defers_genai_models_until_first_request tests/cli/test_studio_startup_imports.py::test_studio_deferred_genai_models_support_openapi_first_use` | pass:11 passed |
| `uv run --extra dev pytest -q -n 4 tests/runtime/piagent/test_piagent_runtime.py` | pass:55 passed;验证 PiAgent fake invocation context 已提供 ADK 2.7 工具执行期望的 `run_config` |
| `uv run --extra dev pre-commit run --all-files` | pass |
| `git diff --check` | pass |
| `uv run --extra dev pytest -n 2 -m "not codex_smoke and not piagent_smoke"` | fail:6913 passed,55 skipped,4 xfailed,16 failed。该失败运行包含已在本变更中修复的旧断言,以及在 `--extra dev` 下缺少 optional `openai_codex` 包的 Codex runtime 测试。Codex 失败子集在 `--extra codex` 下通过。 |
| 对 10 个失败的 Codex runtime 测试运行 `uv run --extra dev --extra codex pytest -q` | pass:10 passed |

本次变更已完成主包依赖和 ADK 2.7 兼容范围。Studio、sandbox、生成项目、托管 sidecar 和 Docker 依赖声明延后处理。
Loading
Loading