Repository navigation
[bugfix] contracts: one version rule and complete, bilingual contract errors (#645) - #647
Conversation
…he fix (ThinkFlowLab#645) - generation.submit: required_versions() includes the origin node; help examples, capabilities and validate_command share it. Missing versions are version_required, listed together with ready expectedVersions and --expected-version options; revision_conflict names the current revision. Parsing of recorded commands keeps its previous subset. - --help-field / command_schema: help_field_invalid names the nearest valid path, fields at that level and a runnable example. - canvas.update with position only: use_canvas_move with a canvas.move example. - rate_limit advice covers rate limiting and backoff only. - New messages in zh-CN and en-US. Refs ThinkFlowLab#632
ThinkFlowLab#645) - generation submit: --expected-spec-revision supplies the generation_spec expectedVersions entry unless one is given; the origin node version is never read on the caller's behalf. - HTTP parse rejections with a contract code (version_required, use_canvas_move) return that code and the localized detail. - --help-field suggestions search under the deepest valid prefix first. Refs ThinkFlowLab#632
…tes (ThinkFlowLab#645) Detail labels for help_field_invalid and revision_conflict were English inside Chinese output. Each code now has a full template per language; fields hold only identities, paths and commands. Refs ThinkFlowLab#632
CLI transcript: Base
|
CLI transcript: This PR
|
david6666666
left a comment
There was a problem hiding this comment.
REQUEST CHANGES b194776 Fixes #645; Refs #632
双语截图确认了版本冲突的现值/预期值,以及 429 不再提示额度;前后 CLI 记录也支持缺版本一次报全。还要修一个恢复提示:带位置和标题等其他改动时,当前仍建议只执行 canvas.move,照做会漏掉同一次请求中的其他更新,详见行内。#646 的其他错误出口不算这次已修。
Ran: 核对了前后截图、作者 CLI 记录和 同一提交的 Release checks。前端、浏览器、CodeQL、DSH 通过;Release Python 在已有的 OpenCode image-model 集成路径超时,未确认是本 PR 引入。Not run: 未独立跑 CLI、应用和真实供应商。
本次证据暂定 82/100(非批准分):范围 3/3,正确性 2/3,验证 2/3,主张证据 3/3,简洁性 2/3。先补混合更新的报错和回归测试,再核对 Release checks。
Dot,代表 @david6666666
|
|
||
| @model_validator(mode='after') | ||
| def validate_placement(self): | ||
| if self.position is not None and not self.preserveCanvasPosition and 'parentId' not in self.model_fields_set: |
There was a problem hiding this comment.
这里没判断是否真的「只改位置」。如果调用同时带 position 和 title(或尺寸/锁定),返回的 canvas.move 只会移动,照提示重试会漏掉另外的更新。能否把这个提示限定在纯移动?混合更新则说明应拆成两步,并补一条 position + title 的回归测试。
There was a problem hiding this comment.
已修改(3e196f1b)。只带 position 的更新仍返回 use_canvas_move;同时带标题、尺寸、锁定等其他字段时,改为返回新错误码 split_canvas_update,按顺序给出 canvas move 和其余字段的 canvas update 两条命令(JSON 与 CLI),第 2 步使用第 1 步回执中的新版本。默认先移动;如果同时解锁,则先解锁再移动,因为锁定节点上的 canvas.move 会被拒绝。
回归测试 test_mixed_update_is_split_and_both_steps_apply 覆盖未锁定节点的「移动+改名+锁定」和已锁定节点的「解锁+移动+改名」,两步都在真实项目上执行并核对最终位置、标题和锁定状态。真实 CLI 端到端记录见下方评论。
CLI transcript:
|
david6666666
left a comment
There was a problem hiding this comment.
Non-voting COMMENT · technical verdict: REQUEST CHANGES · 3e196f1 Fixes #645; Refs #632
混合更新不再漏掉标题或锁定状态。作者提供的同 SHA CLI 回执也覆盖了「先移动再锁定」和「先解锁再移动」两条路径。不过结构化建议还会改写与 revision 占位符同名的用户字段,已在线内指出。请把占位符限定在 revision 字段。
Ran: 核对当前 diff、作者的 CLI 回执与双语截图证据,以及 Release checks。OpenCode gateway 集成失败,其余已观察到的 frontend、browser、CodeQL、DSH 检查通过。Not run: 未独立执行应用、CLI 或 provider。
当前证据暂定 82/100,非批准分。 范围 3/3、正确性 2/3、验证 2/3、主张证据 3/3、简洁度 2/3。
Dot,代表 @david6666666 作非表决复审。
| revision = 'REVISION' if unlock else 'NEXT_REVISION' | ||
| update = json.dumps({'type': 'canvas.update', 'payload': payload, 'expectedVersions': [ | ||
| {'objectType': 'canvas_item', 'id': str(self.itemId), 'revision': revision}]}, | ||
| separators=(',', ':'), ensure_ascii=False).replace(f'"{revision}"', revision) |
There was a problem hiding this comment.
这次把两步恢复都补上了,但这里对整个 JSON 做 .replace(),会一起改掉标题等用户字段里恰好与 revision 占位符同名的值。结果是 Agent 照抄 JSON 建议时,连要保留的字段也被改了。建议只在 expectedVersions[].revision 生成占位符,再加一例确认标题按原值保留。
There was a problem hiding this comment.
已修改(d04431ab、4cebb837)。提示改为按结构序列化:占位符 REVISION / NEXT_REVISION 只写在 expectedVersions[].revision 和 --expected-version 里,不再对整段文本做 .replace(),所以标题等用户字段即使正好等于占位符也原样保留。回归测试 test_mixed_update_is_split_and_both_steps_apply 新增标题为 NEXT_REVISION 和 REVISION 的两个用例,只替换版本位置后两步都在真实项目上执行;这两个用例在 3e196f1 上失败。
另外,中文提示现在直接用错误自带的字段格式化,不再从英文文本反向解析,所以标题含 ; CLI: 时 CLI 和 HTTP 的中文输出也保持原样(test_localized_split_hint_keeps_user_fields_exactly)。真实 CLI 记录见下方评论。
… parsing the English text (ThinkFlowLab#645)
CLI transcript:
|
david6666666
left a comment
There was a problem hiding this comment.
WITHHOLD 4cebb83 Fixes #645; Refs #632
Dot,代表 @david6666666。
上轮标题被改写的问题已修。现在占位符只写进 expectedVersions[].revision,序列化保留用户原值;双语错误直接传结构化字段,不再从英文句子反切。作者在这个 SHA 的 CLI 回执也确认同名标题保留下来。此前双语/UI 证明与本次改动分开核对。
Ran: 核对差异、作者回执和 同 SHA Release。前端、三条 browser、CodeQL、DSH 绿;Bundled OpenCode gateway 红。不把更新后的 main 的成功转给当前 PR head,也不因为 BEHIND 单独要求 rebase。Not run: 未独立执行 CLI 或应用。
当前证据暂定 90/100,非批准分:范围 3/3、正确性 3/3、验证 2/3、主张证据 3/3、简洁度 2/3。
david6666666
left a comment
There was a problem hiding this comment.
PASS df3c53f Fixes #645; Refs #632
Dot,代表 @david6666666。
已核对:随 main 带入的查询和 OpenCode worker 隔离改动不属于这条 PR 的产品差分;版本规则、双语提示、标题与占位符冲突的回归文件与上一轮逐字节一致。split_canvas_update 仍从第一步回执取版本,用户标题保持原样。
Ran: 核对三点差异、前一版 CLI 回执/双语截图,以及 同 SHA Release、CodeQL 和 DSH,均通过。Not run: 未独立执行 CLI 或实际模型。
97/100(非表决):范围 3/3、正确性 3/3、验证 3/3、主张证据 3/3、简洁度 2/3。没有当前正式审查邀请,这条不是 GitHub Approve。
Coordinator: verify review assignment and merge gates before integration.
|
@FayeSpica Hello, could you please perform a final check on this PR and decide whether to proceed with merging it? Thank you very much. |


Summary
Contract errors now tell the caller everything to fix in one response. Version protection is unchanged.
generation.submitnow requires the origin node version too. Help examples,capabilities[].expectedVersionsand server validation read the samerequired_versions().version_required(new code) lists every missing version at once with ready--expected-versionoptions.revision_conflictis used only when a supplied version changed, and states the current and supplied revisions.--help-fieldtypos (help_field_invalid) return the nearest valid path, the fields at that level and a runnable example.canvas update --positionalone returnsuse_canvas_movewith thecanvas movecommand to run. When the same update also changes other fields (title, size, lock…), it returnssplit_canvas_updatewith thecanvas moveandcanvas updatecommands in the order to send them; step 2 uses the revision from the step 1 receipt. Moving first is the default; an update that also unlocks the node unlocks first, becausecanvas.moverejects a locked node.Recorded commands still parse on project load: parse-time checks keep their old subset, and the new origin check runs in
validate_command(lesson added).Linked issue
Fixes #645. Refs #632 (A2). Follow-up for four other places that still report a missing version as
revision_conflict: #646.Fixes #NorRefs #Nis included, or no issue appliesLabels
Proposed:
type:bug,area:agent,area:canvas,area:i18n(the author cannot set labels here).Test plan
pytest testsatdf3c53f4: 3409 passed, 131 skipped, 0 failed.tests/test_a2_repros.py(the 6 repros from [bugfix] cli: 版本要求分两次报出、缺前置条件被报成版本冲突,以及几处误导性错误信息 (week1-1130-1206) #645): 6 failed on base, 6 passed here.tests/test_command_version_contract.pychecks help,capabilitiesand validation agree for all 43 commands, and runs both suggested steps against a real project forposition + title + lockon an unlocked node andposition + title + unlockon a locked node (final position, title and lock state all applied), including titles equal to the revision placeholders, which the hint keeps unchanged because placeholders appear only inexpectedVersions[].revision. The zh-CN hint is formatted from the error's own fields rather than parsed back out of the English text, so a title containing; CLI:is kept exactly in both CLI and HTTP output (tested).npm run check:i18n0 problems;node --test tests/generationFailureText.test.tspasses; contracts regenerated.b194776e,3e196f1b,4cebb837) were red only inchecks / pythonattests/test_agent_visual_gate.py::test_real_opencode_native_visual_input[image-model](OpenCode integration timeout), which this PR does not touch; main's [test] agent: isolate bundled OpenCode workers #648, now merged in, isolates those OpenCode workers. The PR diff against the new base is line-for-line the same as the reviewed4cebb837diff.128230015ce8f58db7232317f51237bdf196b18e(main after [perf] projects: check head snapshot before scanning commit records #643, [test] agent: isolate bundled OpenCode workers #648; merged in), headdf3c53f49e09d4691de469831cc67e3737162ba3.test_a2_submit_reports_all_missing_versions_at_oncecontradicted another repro, so it now supplies every version stage 1 reported.Evidence that it works
CLI before/after transcripts are in the comments below, including a real CLI run of the
split_canvas_updatehint at4cebb837: both suggested commands applied in order for move + rename + lock, for unlock + move + rename, and for a title ofNEXT_REVISION(kept as is), with the node state before and after.Version history → Apply to canvas after the node changed elsewhere (base showed English inside the Chinese UI):
5bebfc02)Generation history for a 429 from a local stand-in endpoint (no real provider call):
5bebfc02)After, zoomed on the failure reason:

Provider verification
No provider calls; the 429 change is copy only.
Bilingual UI