Closed
[user feedback][344] [Agent feedback] git-repo pulls list 输出 JSON 含原始控制字符,机器解析失败 #684
马岩松Add on  21 days agoClosed at  21 days ago
马岩松
马岩松Collaborators
21 days ago Create

用户反馈

  • 后台 id:344(Agent feedback,2026-11-02 12:14,page:-)
  • 原文:grape git-repo pulls list --json-out 的返回 JSON 中字符串字段内含未转义的原始换行/控制字符(如 PR body),json.loads 直接报 Invalid control character;需正则清洗后仍可能解析失败。建议 CLI 服务端输出前对字符串值做合法 JSON 转义。另:git-repo milestones --state 过滤只接受 open/closed/all,但返回字段 state 值为 active,命名口径不一致;且 milestones 仅有 list 子命令,无法创建/关联里程碑,Issue 排期只能靠评论说明。

后台数据线索

  • events 表(seq 39679):已按 Spec 拆分 PR-A(P1 输出侧转义)/PR-B(milestones 口径)/PR-C(milestones create 能力)交办 coding 开发。
  • 相关既有反馈:#90/#253(issue 554,pulls files --json-out 响应结构未在文档说明,根因不同——本条为服务端未转义);milestones create 缺口已由反馈 #312(issue 668)跟踪。

真实问题

  1. grape CLI json 输出未对字符串值做控制字符转义,机器解析失败;2) milestones --state 参数与返回字段命名口径不一致(open/closed/all vs active)。

可解决性

高——输出侧转义与口径修复已在 grape-skills 拆 PR 实现;milestones create 归 #668 跟踪。

执行方案

  1. 跟进 PR-A/PR-B 合并与 QA 审查;
  2. 服务端侧评估 json 序列化统一转义(所有 --json-out 端点);
  3. milestones state 字段口径统一或文档注明映射。
likedislike
grape_bot
grape_botCollaborators
21 days ago Comments:

[VOD Agent] 已结构化收敛需求:

目标

grape CLI --json-out 机器可读输出可靠可解析(字符串值合法 JSON 转义),并统一 git-repo milestones --state 过滤值与返回字段的命名口径,保障 Agent 流水线对 GitCode 数据的自动化消费。

现状(本轮复测)

  1. git-repo pulls list --json-out:用户反馈字符串字段(如 PR body)含未转义原始换行/控制字符,下游 json.loads 报 Invalid control character,正则清洗后仍可能解析失败。本轮复测(grape 0.3.3,全量 815 个 PR 分页拉取)各页面均可直接 json.loads(多行 body 以 \n 合法转义出现),未再触发该报错;但触发条件为服务端返回的 JSON 字符串值本身含原始控制字符,目前输出侧无统一转义/兜底保证,风险窗口仍在(CLI lenient 兜底 PR-A 尚未合入)。
  2. git-repo milestones --state:已复现口径错位——--state active 返回 400(Value must be 'open', 'closed', or 'all'),而无过滤 / --state open 返回的条目 state 字段值为 active,过滤合法值与返回字段命名不对齐。
  3. git-repo milestones 仅有 list 子命令,无 create/关联能力:该缺口已由本仓 Issue #668(反馈 #312)跟踪;服务端 POST/PATCH milestones 路由已由本仓 PR #795 合入、#808 在途。

期望行为

  1. CLI 输出侧(grape-cli 仓,PR-A = grape-cli#8):--json-out 对字符串值做合法 JSON 转义 / lenient 兜底重解析,输出可被 json.loads 无预处理直接解析。
  2. 服务端侧(本仓,执行方案第 2 条):评估所有 --json-out 端点 JSON 序列化的统一控制字符转义,从源头消除原始控制字符输出。
  3. milestones 口径:CLI 层 active→open 归一化 + help 映射(PR-B = grape-cli#9),或服务端/文档统一注明映射关系。

验收标准

优先级

P1(机器解析失败直接中断 Agent 流水线的四维分析与下游交办)

关联与分工(避免重复实现)

  • 同一反馈(后台 id 344)已在 grape-dev/grape-skills#429 立项推进:PR-A = grape-cli#8(P1 输出侧转义,open)、PR-B = grape-cli#9(milestones 归一化 + help 映射,open)、PR-C = grape-skills#213(降级话术,open)。本仓 Issue #684 聚焦服务端侧统一转义评估与口径收口,与上述 PR 平行推进、不重复实现。
  • 区别于 #554(pulls files patch 字段响应结构未文档化,根因不同,本条为序列化转义缺陷)。

归仓判断:已执行,结论=留仓(本仓承担服务端侧 JSON 序列化统一转义与口径收口),依据=职责地图命中(grape 仓为 API 服务端实现方;CLI 客户端侧修复已在 grape-dev/grape-cli 仓平行推进)。


来源:Issue #684(用户反馈后台 id 344,Agent feedback)
auto-submitted by VOD Agent

likedislike
grape_bot
grape_botCollaborators
21 days ago Comments:

[issue agent] 深度可开发性分析完成,评级:ready。以下为服务端侧 Spec(本仓分工:统一 JSON 转义与口径收口;CLI 客户端侧修复已在 grape-cli#8/#9 平行推进,不重复实现)。

目标

grape 服务端所有 --json-out 端点输出的 JSON 字符串值不含原始控制字符,机器可 json.loads 直接解析;milestones --state 过滤值与返回 state 字段命名口径统一。

现状

  1. git-repo pulls list --json-out:服务端透传 GitCode API 返回的字符串值(如 PR body)可能含未转义原始换行/控制字符,下游 json.loads 报 Invalid control character。本轮复测(grape 0.3.3,815 个 PR 分页)未再触发,但服务端无统一转义保证,风险窗口仍在。
  2. git-repo milestones --state:--state active 返回 400(仅接受 open/closed/all),而返回条目 state 字段值为 active,过滤合法值与返回字段不对齐。
  3. 目标分支 weekly-09 上无相关实现(最近 20 commit 均为 #468/#472/#482/feedback 等),需求未实现。

期望(服务端实现要点)

  1. 在服务端 JSON 序列化统一出口处(所有 --json-out 端点共用路径)对字符串值做合法 JSON 控制字符转义(ensure_ascii/escape control chars),从源头消除原始控制字符;避免逐端点散修。
  2. milestones --state 口径二选一收口:服务端将 state 值归一化为 open/closed(与过滤值一致),或在契约/help 文档明确 active→open 映射说明。

验收标准

优先级

P1(机器解析失败直接中断 Agent 流水线四维分析与下游交办)

关联与分工

  • grape-cli#8(PR-A 输出侧转义)、grape-cli#9(PR-B active→open 归一化)、grape-skills#213(PR-C 文档降级):CLI 客户端侧,平行推进,本 Spec 不重复实现。
  • milestones create 能力缺口归 #668(服务端路由 PR #795 已合入、#808 在途)。
  • 区别于 #554(patch 字段响应结构未文档化,根因不同)。

开发基准

目标分支:weekly-09(服务端注入 GRAPE_WORK_BRANCH)。

⚠️ 交办说明:当前仓库流水线场景未配置 coding Agent 节点(仅 vod/issue),本次未发起 A2A 交办;待配置/确认该环节后再进入开发,或由维护者基于本 Spec 手动交办。

likedislike
grape_botgrape_botCollaborators
21 days ago Modify description of issue
grape_botgrape_botCollaborators
21 days ago Assign grape_bot as responsible person, remove original responsible person: XOcto
grape_botgrape_botCollaborators
21 days ago Added label: bugP1spec-ready
grape_bot
grape_botCollaborators
21 days ago Comments:

[VOD Agent] 跨流水线移交复核完成(马岩松的专属开发流水线/vod):

  • 复核结论:Issue #684 需求已收敛且 Spec 已就绪——issue Agent 已于评论 197570999 发布服务端侧 Spec(评级 ready:统一 JSON 转义出口修复 + milestones state 口径收口,目标分支 weekly-09,四要素齐全)。
  • 场景核验:当前流水线(scene=3f40dd97)包含 issue 节点,可交办。
  • 后续动作:已按移交上下文流转至 issue Agent,请其确认 Spec 并继续打标签/分配/排期环节。
likedislike
grape_bot
grape_botCollaborators
21 days ago Comments:

[issue agent] Spec 确认通过,继续交办开发。

  • Spec 确认:评论 197570999 的服务端侧 Spec(统一 JSON 转义出口修复 + milestones state 口径收口,评级 ready)四要素齐全,与移交复核结论一致,可直接进入开发。
  • 标签/分配:bug / P1 / spec-ready 已就位,assignee=grape_bot。
  • 开发基准:本流水线(跨流水线移交后)注入的工作基线分支为 weekly-08-mys,本轮开发以此为准(原流水线 Spec 基准 weekly-09 的差异已在移交时说明,统一转义出口为服务端共用路径,两分支均未实现、无冲突)。
  • 实现核对:目标分支最近 20 个 commit 均为 #468/#472/#482/feedback 等,无 JSON 转义统一出口及 milestones 口径收口相关实现,需求未实现。
  • 交办:当前场景已含 coding 节点,已 A2A 交办 coding 基于 Spec 在 weekly-08-mys 启动开发;CLI 客户端侧(grape-cli#8/#9、grape-skills#213)平行推进,不重复实现。
likedislike
grape_botgrape_botCollaborators
21 days ago Associated pull request
grape_bot
grape_botCollaborators
21 days ago Comments:

[Coding Agent] ✅ 已按评论 197570999 的 Spec 完成服务端侧实现,请审查 PR #830(base: weekly-08-mys)。

改动摘要:

  1. 统一 JSON 序列化出口:新增 src/api/json_safe.py(SafeJSONResponse)并注册为 default_response_class——所有 --json-out 端点单点共用,字符串值原始控制字符(U+0000–U+001F、U+007F)统一转义,孤立代理项由历史 500 修复为降级转义,输出恒可 json.loads 直解;
  2. milestones --state 口径收口:返回 state 归一化为 open/closed(active/opened→open),与过滤合法值对齐,端点描述与 API 文档注明映射。

测试:pytest 50 passed(唯一失败项为基线既有失败,与本改动无关,已 stash 对照验证)。CLI 客户端侧(grape-cli#8/#9、grape-skills#213)与 #668 未在本 PR 重复实现。

likedislike
grape_bot
grape_botCollaborators
21 days ago Comments:

[QA Agent] 任务已完成。

likedislike
马岩松马岩松Collaborators
21 days ago Close issue
grape_botgrape_botCollaborators
20 days ago Associated pull request