enhance: add optional bounded client polling fallback#328
Merged
liujuanjuan1984 merged 1 commit intomainfrom Mar 26, 2026
Merged
enhance: add optional bounded client polling fallback#328liujuanjuan1984 merged 1 commit intomainfrom
liujuanjuan1984 merged 1 commit intomainfrom
Conversation
Collaborator
Author
|
本轮基于 PR diff 的自审结论:未发现阻塞性问题。 审查要点:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
A2AClient.send()增加可选且有界的 polling fallback,用于兼容 peer 返回 non-terminal task 且需要后续tasks/get轮询的场景send_message()的 stream-first 事件流 contract 不变,只在send()上做可选收敛send()与文档表述,明确其返回的是 latest response event;当 fallback 启用时,可能进一步收敛为轮询得到的最终 task snapshotClient facade
src/opencode_a2a/client/client.py中为send()增加 bounded polling fallbacksend()收到(Task, None)且 task state 属于submitted、working、unknown时触发自动轮询input_required、auth_required等 caller-intervention state,则停止自动轮询并返回当前 snapshottasks/get错误映射与send_message()事件流行为不变Polling policy / config
src/opencode_a2a/client/polling.py,收敛 polling fallback 的状态判定、退避和配置校验逻辑src/opencode_a2a/client/config.py中增加以下配置项:A2A_CLIENT_POLLING_FALLBACK_ENABLEDA2A_CLIENT_POLLING_FALLBACK_INITIAL_INTERVAL_SECONDSA2A_CLIENT_POLLING_FALLBACK_MAX_INTERVAL_SECONDSA2A_CLIENT_POLLING_FALLBACK_BACKOFF_MULTIPLIERA2A_CLIENT_POLLING_FALLBACK_TIMEOUT_SECONDSTests
tests/client/test_client_facade.py中补充 terminal 收敛、caller-intervention state、timeout、tasks/get错误路径回归测试tests/client/test_client_config.py中补充新配置解析与非法参数校验tests/client/test_polling.py覆盖 polling policy helperDocs
docs/guide.md中补充send()的最新语义说明与 polling fallback 配置说明验证
./scripts/doctor.sh关联
#311、#321:这两个 issue 已关闭,且本 PR 未修改 server-side heartbeat 或 durable task contract