Skip to content

fix: 新建原生任务的首条长粘贴不再报「内容已丢失」 - #164

Merged
chenweigao merged 1 commit into
mainfrom
fix/newtask-paste-store
Oct 15, 2026
Merged

chenweigao merged 1 commit into
mainfrom
fix/newtask-paste-store

Conversation

@chenweigao

Copy link
Copy Markdown
Owner

问题

新建任务 + 长粘贴(折成 @paste("id") 令牌)首次发送必报「粘贴内容已丢失」;删掉重粘就好了。

机制:新建任务的编辑器把长粘贴存进 Kimi 的粘贴库(pastes-kimi-<host>,NewTaskView.swift:187 写死了 kimi.pastes),而选中原生 Agent(Codex/Claude 等)时发送路径用 native 库(pastes-native-<host>)展开令牌——写读不同库,解析不到。首次发送失败后会话已创建、界面切到会话编辑器(用的是 native 库),所以重粘就好。Kimi 路径写读同库,不受影响。

修复

编辑器按所选 provider 取对应连接的粘贴库(provider == .kimi ? kimi.pastes : native.pastes)。

验证

Release 构建通过。发送链路无注入接缝,未加单测;复现路径:新建任务 → 选 Codex/Claude → 粘贴长文本 → 发送。

新建任务的编辑器一直把长粘贴存进 Kimi 的粘贴库(pastes-kimi-<host>),
而原生 Agent(Codex/Claude 等)的发送路径用 native 库展开
(pastes-native-<host>),令牌解析不到,首次发送必报丢失。会话已建、
界面切到会话编辑器后重粘,写读才同库,所以"删了重粘就好"。

编辑器按所选 provider 取对应连接自己的粘贴库,写读同库。
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T08:56:05.727561Z 73f79d5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73f79d5285

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

referenceBrowser.open(path)
showReference = true
}, pastes: kimi.pastes, minimumEditorHeight: 96, referencesBelowEditor: true, files: projectFiles)
}, pastes: provider == .kimi ? kimi.pastes : native.pastes, minimumEditorHeight: 96, referencesBelowEditor: true, files: projectFiles)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve folded pastes when switching providers

If a user selects a native agent, pastes long text, and then switches to Kimi before sending, the existing @paste token remains in prompt while this expression changes the backing store from native.pastes to kimi.pastes. KimiConnection.sendPrompt expands only its own store, so it rejects the first message as missing content even though the paste still exists in the native store. Rehome existing folded content when the provider changes, or retain the originating store for each token.

Useful? React with 👍 / 👎.

@chenweigao
chenweigao merged commit 520c3df into main Oct 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant