Conversation
tt-a1i
requested changes
Sep 20, 2026
|
|
||
| function readControllerId() { | ||
| try { | ||
| const existing = window.sessionStorage.getItem(controllerStorageKey); |
Collaborator
There was a problem hiding this comment.
[P1] 不要用可被复制标签页继承的 sessionStorage 作为 controller 身份。浏览器复制标签页或通过带 opener 的窗口打开页面时,sessionStorage 可能从原标签页克隆,两个页面会拿到同一个 controllerId;复制页因此也能读取并回答原页等待中的 ask_user,违反“仅发起标签页可回答”的隔离合同。请增加活动标签页碰撞检测并在重复时轮换身份(例如 BroadcastChannel 协调),同时补一个由原页面打开/复制出的标签页回归测试;现有 context.newPage() 不会覆盖 storage 克隆场景。
6iKUN6
force-pushed
the
codex/web-ask-user
branch
from
September 20, 2026 10:11
3f94767 to
fe1fef8
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.
Problem
Refs #562,关联 #343、#348。
部分 OpenPI 工具和扩展命令已经可以在 Web 中执行,但浏览器缺少对应交互:
ask_user等待答案时没有提交入口,plan_ready的完整计划藏在工具结果里,human_handoff没有反馈卡片,部分命令执行后也没有可见结果。命令菜单统一标为“不支持”,与手动提交后仍可能执行的行为不一致。验收中还复现了计划生成期间消息反复消失,以及停止等待中的问答时,实际已取消却显示失败的问题。
Value
用户可以在 Web 中完成提问、复核答案、阅读计划和反馈人工操作,也能明确看到当前模式、命令结果和停止状态。继续使用 Pi 原有的工具、Session、命令分派与取消流程,不增加另一套代理或权限系统。
Approach
ask_user卡片,支持选项、自定义答案和复核提交。待回答的问题绑定到发起标签页、Session 和轮次;支持刷新恢复、过期、取消和重复提交回执。关闭卡片不提交草稿,也不扩大工具原有的 Plan/Setup 使用范围。sessionStorage身份则重新生成。普通刷新可恢复原身份;不支持 Web Locks 时使用新身份,安全降级但不保证刷新恢复。此机制隔离问答控制权,不隔离同一 Session 的历史消息,也不是新的登录体系。plan_ready成功返回的 Markdown 计划,支持收起、复制和刷新恢复。卡片不代表批准实施;本次不实现 bug(web): Plan Ready 后实施命令被静默处理,工具门仍关闭 #470 的实施交接,也不把未完成的流式参数显示成已就绪计划。human_handoff增加操作说明和复核提交。“已完成”只是用户报告,模型仍需验证完成信号。本次不包含主题选择器、主题直接写入接口或首屏主题处理,相关改动保留在独立本地分支继续打磨。
实现与边界说明:Web structured questions、Web interaction UI。
Validation
已基于上游
main的45f12a4(已合并 #561)完成冲突处理和重新验证。以下是整合后的结果,使用 Node 24.16.0:bun run check:通过,包含配置/文档合同、生产构建、格式、lint 和类型检查。bun run test:Node 1,712 passed / 2 failed / 1 skipped。两个失败是已有的 TUI Plan Markdown 渲染断言;用未修改的上游45f12a4和同一套依赖单独运行该文件,也得到 22 passed / 2 failed。不宣称全量测试通过。.spec.ts(--maxWorkers=2):22 files / 318 passed。默认高并发曾导致已有设置页和侧栏测试超时,限制并发后通过,没有放宽断言或超时时间。playwright test --config tests/web/playwright.config.ts:50 passed。playwright test --config tests/web/playwright.provider.config.ts:12 passed。使用隔离 Pi 目录、本地合成 Provider 和真实 Host/Pi/浏览器,不读取用户凭据。window.open继承存储,验证新标签页换身份、无法取得待答卡片、提交取消得到 403,原页刷新仍可回答。该用例在修复前已复现失败。新增设置窗口内完成问答和 Stop 取消的整合测试。aborted状态,以及随后能否继续对话。git diff --check:通过。未覆盖 Safari 真机、手机软键盘和长期断网恢复。真实断线后的快照恢复仍可能暂时丢失未完成消息,本次修复的是正常有界数据突发造成的主动断线。
Impact
本次仅引用 #562,不关闭其中尚未推进的提案。没有提交私人会话、录屏或现场调查草稿。