Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: TaskEventStream methods don't receive ServerCallContext

未关闭
#1,374 0 条评论 0 个 reaction 已指派 2 人 在 GitHub 查看

维护者通常 2 天内回复

@rohityan 已经在做这个了。

开始于 2026年10月23日。

评估

这个 Issue 还没有评估数据。

描述

What happened?

Version: a2a-sdk 1.2.1

Problem

TaskEventStream (a2a/server/cluster/event_stream.py L17–32) is keyed only by task_id:

async def publish(self, task_id: str, event: VersionedEvent) -> None: ...
def subscribe(self, task_id: str, *, after: TaskVersion) -> AsyncGenerator[VersionedEvent, None]: ...
async def destroy(self, task_id: str) -> None: ...

TaskStore, VersionedTaskStore and PushNotificationConfigStore.{set,get,delete}_info all take context: ServerCallContext. TaskEventStream and PushNotificationConfigStore.get_info_for_dispatch don't.

Context-derived identity is already central to the SDK — OwnerResolver = Callable[[ServerCallContext], str], and DatabaseTaskStore scopes every query by owner = self.owner_resolver(context). TaskEventStream can't participate.

Impact

DefaultRequestHandlerV2 holds one event_stream from construction (L143) and calls publish (L304) / subscribe (L571) with no caller information, so an implementation is permanently bound to its startup resources. That rules out selecting a backing resource per caller, refreshing credentials at a request boundary, propagating auth downstream, or request-scoped tracing — all of which TaskStore supports today.

Related: DatabaseTaskEventStream filters only on task_id/seq, never on the owner column it writes. Authorization is enforced upstream (_versioned_store.get(task_id, context) precedes subscribe), so the default composition is safe — but the stream can't check independently.

Proposed change

Add context: ServerCallContext to the three methods, optional for source compatibility:

async def publish(self, task_id: str, event: VersionedEvent, context: ServerCallContext | None = None) -> None: ...
def subscribe(self, task_id: str, *, after: TaskVersion, context: ServerCallContext | None = None) -> ...: ...
async def destroy(self, task_id: str, context: ServerCallContext | None = None) -> None: ...

The handler already holds the context at both call sites.

get_info_for_dispatch has the same gap — dispatch runs after the request completes, so it needs a stored context, not a live one.

Relevant log output

Code of Conduct
  • I agree to follow this project's Code of Conduct
主要语言
Python
星标
2.2k
派生
518
平均合并
3 天 7 小时
30 天内合并 PR
38

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

a2aproject/a2a-python 的其他 Issue

查看 a2aproject/a2a-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。