fix(turn-tail): leave a turn that declared deliveries to the delivery card - #634
Open
longisland-icetea wants to merge 1 commit into
Open
fix(turn-tail): leave a turn that declared deliveries to the delivery card#634longisland-icetea wants to merge 1 commit into
longisland-icetea wants to merge 1 commit into
Conversation
… card
`conversation.chat.turnTail` is a chain slot and its election is
first-match-wins with a `break`, so returning the produced paths also
suppresses the official delivery card for that turn. A turn that writes a
file and then presents it — the common workflow — therefore lost its card
entirely: the sidebar claimed the chain, and ui-deliverables was never
consulted.
The official card renders the produced-files row and the delivered cards
together (`selectDeliverables` returns `{ produced, presented }`), so decline
the takeover whenever the turn declared files before its closing reply. This
is the same fallback the disabled-editor case already relies on.
longisland-icetea
force-pushed
the
fix/turn-tail-presented-claim
branch
from
September 11, 2026 17:36
c02fee6 to
4f44685
Compare
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.
问题
同一轮里既改代码又交付图片时,交付卡片整个消失。 例如脚本出图后
present它、顺手还改了脚本或文档——这是最常见的收尾方式——那个present出来的图片不会出现在这一轮的交付列表里。根因在两份数据不一致:
conversation.chat.turnTail是 chain 槽,选举是先命中先赢 +break(ui-rendererspec.kind === 'chain'分支)。本插件只要这一轮有写文件就抢占这个位置,官方交付卡片的注册者根本轮不到被咨询;produced(用户级即「本次产出」行,由write/edit类工具的改动路径累积),而脚本产出的图片这类文件是present声明的,只进presented、不进produced。于是抢占之后这一轮只剩产出行,
presented无处渲染。官方卡片本来把两者一起渲染(selectDeliverables返回{ produced, presented }),所以这些交付不是没数据,是被本插件挡掉了。修法
这一轮在收尾回复前声明过交付时,本插件主动退让:
selectProducedFiles返回null,把位置还给官方卡片。判据与官方presentedForClosing一致(存在presented.seq < 收尾 seq的声明)——晚于收尾回复的声明本来也渲染不出卡片,不影响抢占。这与已有的两个退让分支(editor tab 被设置禁用、侧栏被外部禁用)是同一条路径:官方卡片就是宿主预期行为,不是能力损失。
不改成「本插件自己把
presented也画出来」:那要自己接管交付卡片的打开通道(presentedFileUrl认证打开、原生「用默认应用打开」菜单、桌面可用性判定),面比让位大得多,且与宿主实现长期重复。验证
tests/produced-files.spec.ts新增用例,覆盖四种情形(有先前声明 → null;空声明 / 晚于收尾的声明 / 无presented字段 → 仍抢占)。已实测反事实:把该用例跑在本 PR 之前的
selectProducedFiles(base blob23a2f1ea)上失败——返回['a.ts'],即抢占发生、presented被挡掉;打上补丁后通过。pnpm typecheck通过。代价
这类轮次的「本次产出」标签回到宿主行为:点开走宿主文件预览,不再是本插件的侧栏编辑器;「在文件夹中显示」也不再提供。其余轮次(仅改文件、仅交付)行为一字不变。
另外记录一条未处理项:
priority: -1在 chain 语义下不生效(选举不看 priority),本 PR 未改动。