docs: clarify chat output mode contract#381
Merged
liujuanjuan1984 merged 1 commit intomainfrom Apr 2, 2026
Merged
Conversation
Collaborator
Author
|
聚焦本 PR 代码变动的自审结论:未发现阻塞性问题。 审查结论:
风险判断:
Issue 关系审查:
验证:
结果: |
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.
背景
本 PR 聚焦
#379,把现有的 chatacceptedOutputModesfail-fast 校验提升为更明确的公开契约表达。当前主逻辑已经会在入口和 executor 层拒绝不接受
text/plain的 chat 请求,但文档与 Agent Card skill 描述此前还没有把这层边界直接说透,客户端容易把default_output_modes = [text/plain, application/json]误解成“只接受application/json也总能工作”。Guide 契约说明
docs/guide.md的 Core Behavior 段落补充 chat output modes consumer guidance。configuration.acceptedOutputModes必须与 chat 声明能力兼容。text/plain。application/json是增量结构化输出支持,不承诺普通 assistant prose 都能无损表示为 JSON。Agent Card 技能说明
src/opencode_a2a/server/agent_card.py的opencode.chatskill description 中补充同样的边界说明。Tests
tests/server/test_app_behaviors.py补充更聚焦的入口契约测试:acceptedOutputModes=["application/json"]时在入口拒绝,并稳定断言错误data字段。acceptedOutputModes=["image/png"]时在入口拒绝,并稳定断言错误data字段。tests/server/test_agent_card.py增加 chat skill 文案断言,防止 Agent Card 说明回退。验证
uv run pytest --no-cov tests/server/test_app_behaviors.py tests/server/test_agent_card.py -q./scripts/doctor.shIssue 关联
Closes #379