WIP: fix/引用持久化 #365
Draft
k88936
wants to merge 39 commits from
fix/ref-persistent into master
pull from: fix/ref-persistent
merge into: GenarrativeAI:master
GenarrativeAI:master
GenarrativeAI:codex/ci-stability-20260917
GenarrativeAI:fix/ci
GenarrativeAI:fix/agc-canvas-json
GenarrativeAI:feat/agc-organize-assetkind
GenarrativeAI:fix/chat-status-lost
GenarrativeAI:feat/more-ref
GenarrativeAI:codex/platform-session-identity-credential-split
GenarrativeAI:feat/ui-editor-v3
GenarrativeAI:fix/agc-vite-target-watch
GenarrativeAI:fix/chat-state
GenarrativeAI:rm/design-v2
GenarrativeAI:feat/Crt_Ws
GenarrativeAI:codex/fix-model-refresh
GenarrativeAI:feat/smart-ref-ui-res
GenarrativeAI:codex/preview-llm-router-config
GenarrativeAI:fix/stroke-width-regression-from-285
GenarrativeAI:agent-organize
GenarrativeAI:feat/expose-image2edit
GenarrativeAI:feat/game-agent-canvas-resource-workbench-v2
GenarrativeAI:feat/agc-new-workflow
GenarrativeAI:fix/agc-release-version-sync
GenarrativeAI:codex/shared-components-followup
GenarrativeAI:codex/agc-runtime-generation-reliability
GenarrativeAI:codex/game-agent-runtime-interaction-design
GenarrativeAI:feat/spine-sequence-export-v2
GenarrativeAI:codex/agc-platform-account-editor-api
GenarrativeAI:codex/game-agent-run
GenarrativeAI:codex/ui-spritesheet-durable-transaction-latest
GenarrativeAI:feat/art-agent-more-tools
GenarrativeAI:codex/editor-canvas-null-source-repair
GenarrativeAI:hotfix/editor-layout-2mib
GenarrativeAI:codex/showcase
No Reviewers
Labels
Clear labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Low
4
The priority is low
Priority
Medium
3
The priority is medium
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
陶泥儿gameAgent
No Assignees
Notifications
Due Date
No due date set.
Blocks
#335 DirectProject对话状态问题
GenarrativeAI/Genarrative
Reference: GenarrativeAI/Genarrative#365
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "fix/ref-persistent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
close #360
after:

1.
apps/ai-game-creator-shell/src/App.tsx:6490的directTurnInput.userItem重复赋值userItem: effectiveUserItem,后面又再次赋同一值。2c623bb57(移除 DirectProject 回合输入的重复赋值)。2.
apps/ai-game-creator-shell/src/App.tsx:6070非 DirectCodex 路径提前创建回合身份handleChatSubmit无条件创建 DirectCodex 回合 ID 和 user item,随后旧 Supervisor/策划路径也会接收到该可选 ID。b3b5d7799(按运行模式创建 DirectProject 回合输入)。3.
direct_project_history.rs:185-190删除 legacy 行投影导致历史读取失败response_item行失败关闭。4.
codex_app_server/mod.rs:15-16顶层sha2import 未使用Sha256/Digest计算输出、认证和配置摘要。5.
ResourceReferenceInput.tsxsameDraft比较 content 造成反复回写EditorState单一 authority;文本、引用和 canonicalcontent[]都从该 state 读出。sameDraftValue/sameCanonicalDraft是旧双状态同步的补偿,会造成重复比较和潜在回写。OnChangePlugin产生。6.
ResourceReferenceInput.tsx:205-210资源引用到 content part 的映射重复chatReferenceToContentPart。提交:f213987f9(复用资源引用的统一内容映射)。7.
resourceReferences.tscontent 缺失时把 text/references 拼成猜测输入EditorState派生的 canonicalcontent[];转换入口不再读取text + references猜测顺序。input_text构造。8.
resourceReferences.ts:130-132嵌套三元表达式if/else三分支。提交:a543b75cf(拆开聊天草稿内容分支判断)。10.
wire.rs:43-44校验与 wire 投影重复读取 manifestf2030a616(复用 DirectProject 用户输入校验读取的 manifest)。11.
model.rs:67-69未使用的DirectCodexUserMessageEnvelopecd2edd696(移除未使用的 DirectProject 输入信封类型)。12.
direct_runtime/user_input.rs附件未进入 DirectProject 模型 promptDirectCodexTurnAttachmentsidecar;canonical user item 不新增附件 part。render_direct_codex_user_prompt;图片、Markdown 和其它文件统一输出原名、项目路径、类型、大小、状态。附件-only 输入允许在 sidecar 渲染前保持空 canonical 文本。13.
direct_runtime/mod.rs:4169两个互斥分支克隆整个 optional JSONdirect_user_item调用.clone()。22e830ff9(避免 DirectProject 回合输入的无必要克隆)。14.
ResourceReferenceInput.tsx:192-194空白 text node 进入 canonical contentinput_text,Rust 校验拒绝 trim 后为空的 part。3c7b02b9f(过滤 DirectProject 编辑器的空白内容 part)。15.
direct_project_history_wire.rs:18-21标准历史 item 被重新投影为错误 wire 形状direct_codex_user_item_to_response_item后,文本 part 当前明确生成为type: "input_text"。response_item_projection_uses_input_text_not_turn_input_text测试已覆盖该口径,不需要迁移或 fallback。16.
codex_app_server/mod.rs:2661-2663canonical AGC part 写入聊天历史后读取丢失textcontent part。17.
App.tsx:6072chatContent 可能携带空白 input_textchatComposerDraftToDirectCodexUserItem转换入口过滤纯空白input_text。提交:35733f0e3(过滤 canonical 草稿中的空白输入 part)。18.
App.tsx:743-745规划 V2 提交后未清理引用草稿chatReferences和chatContent。提交:c266ae7b5(清理策划模式提交后的聊天草稿)。19.
direct_codex_user_item/wire.rs:26-30response item 使用text而非input_textdirect_codex_user_item_to_wire_input内部确实使用type: "text",但它只服务 turn/start prompt;历史 response item 走另一个投影函数,并明确改成type: "input_text"。21.
direct_runtime/user_input.rs:51-62显式校验与空 prompt 分支重复/不可达direct_codex_user_item_to_prompt已包含校验和空 prompt 失败,外层再次校验并检查空字符串。1da106af7(避免重复校验 DirectProject 用户输入)。Review 复核与处理结果
以下结论以当前代码为准;
review.txt只是临时清单,不纳入任何提交。1.
apps/ai-game-creator-shell/src/App.tsx:4375-4377总控纯聊天草稿恢复后被立即清空(high)OnChangePlugin,空文本覆盖刚恢复的草稿。b60750191(修复总控草稿恢复后被清空)。2.
apps/ai-game-creator-shell/src/App.tsx:4618准备建议命令时残留旧引用(medium)replaceText()按设计保留当前编辑器中的引用节点。clear()再replaceText()。已提交30e27abc6(修复建议命令草稿残留引用)。3.
apps/ai-game-creator-shell/src/view/project-development/index.tsx:8127-8130快速编辑润色结果未进入编辑器(medium)initialDraft;润色回调只更新 panel 状态。ResourceReferenceInputHandle,润色时幂等回写编辑器文本。已提交d5c4e0e78、fc0fd846f。4.
apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx:1010-1012润色按钮不会随输入启用(high)OnChangePlugin中变更的 ref。draftTextstate,编辑器变更时同步,按钮改读 state。已提交0b9d16e8f(修复润色按钮无法感知输入)。5.
apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx:644-645空初始草稿吞掉首次编辑(medium)645d806fe(修复空初始草稿吞掉首次编辑)。6.
apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx:867-868清空草稿后润色状态残留(medium)OnChangePlugin同步重置润色结果和确认标记。已提交64a52005f(修复清空草稿后润色状态残留)。7.
apps/ai-game-creator-shell/src/App.tsx:3083-3084初始化阶段空持久化覆盖总控草稿(high)fa99d9ad6(避免总控草稿初始化误删)。8.
apps/ai-game-creator-shell/src/features/project-workspace/resourceReferences.ts:121-123canonicalcontent为空时丢失文本/引用(high)chatComposerDraftToDirectCodexUserItem(draft, id):把输入框的ChatComposerDraft转成 Rust/Direct Codex 接收的DirectCodexUserItem,其中content是唯一 canonical 消息内容。input_text(引用后的分隔空格、段落换行)在转换函数里又过滤了一遍。这个过滤其实已经由 Lexical 投影层做过(Rustvalidate_direct_codex_user_item会拒绝空input_text),属于重复过滤,只会让人误以为“转换函数在替用户改写内容”。App.tsx的userItem ?? chatComposerDraftToDirectCodexUserItem(...):??左边没传userItem时才执行右边的兜底构造,而兜底传的是{ text: prompt, references, content: [] }。首页首轮创建也走这条兜底。此时prompt/references有值、content却是空数组,最终 user message 的文本与引用被静默丢掉。draft.content,不再做二次过滤;ChatComposerDraft删掉text/references,只保留content;删除executeChatAgentReply的userItem兜底分支,首页首轮、普通聊天提交、运行中队列出队、策略确认重试全部显式构造 canonical user item;发送前只在最终 content 上判断是否全空(hasMeaningfulDirectCodexContent),不做预过滤;旧 Planner / legacy Supervisor caller 显式构造纯文本 item 并留迁移 TODO。已提交41366dd71。directCodexUserItemFromContent(content, id);需要文本的地方(草稿持久化、队列 chip、润色判据)用directCodexContentToPromptText(content, assets)从 content 派生,不要再引入并行的文本字段。9.
apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx:641-643快速编辑initialDraft单次应用导致润色后显示旧文本(high,和第 3 条重复)d5c4e0e78、fc0fd846f。View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.