Repository navigation
Quick Review: read-only sidebar code review with automatic verdict relay - #29
Conversation
…idebar tab A new standalone plugin that starts a specified-model, read-only review session from the conversation header, shows it live in a right-sidebar tab, and relays the first-turn verdict back to the source session as an agent-message relay. Defaults to reviewing only the files this session changed (workspace/changes summaries), falling back to all uncommitted workspace changes when no summary survives. Key safety choices: the model route is validated before the session is created, agent.model.select is used instead of sessionController.selectModel so the global default model is never overwritten, the read-only preset is verified up front and pinned before any prompt (a host without the preset or a failed setup refuses rather than spawning a writable reviewer), and the review record is registered before awaiting the prompt so a fast turn/end can never slip past the tracker. Review sessions are tracked explicitly and the header action is hidden inside them; settled records are evicted to bound memory. Registered as testing in the lifecycle manifest: QA acceptance passed (mock provider, isolated dsh web) and the first npm release goes through the manual first_release workflow. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The repo-wide ui-scope check requires every plugin's authored CSS to be rooted at a declared class; qrv-root is now declared for @klarkxy/dsh-quick-review. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
| const latest = this.latestBySource.get(sourceSessionId) | ||
| if (latest !== undefined && this.reviews.get(latest)?.state === 'running') { | ||
| throw new QuickReviewError('busy', 'a review is already running for this session') | ||
| } |
There was a problem hiding this comment.
🔴 并发启动会为同一会话创建多个评审
两个客户端同时启动同一会话的评审时,都会通过 busy 检查。运行记录在多次异步操作后才登记,两个请求因此都会创建会话、调用模型并回传结果。
Learn more
启动检查与运行记录登记之间没有互斥。两个请求都能在第一次异步等待前看到没有运行中的评审,然后各自执行会话创建和模型调用。运行记录登记发生得太晚,无法阻止第二个请求。用实际服务源码配合内存宿主桩并发调用两次 start,两个调用均成功,并观察到两次创建和两次 prompt。
Example: 用户在两个浏览器标签页中打开同一源会话,同时点击开始评审;预期第二个请求返回 busy,实际会启动两个独立评审。
Recommended fix: 按 sourceSessionId 维护启动中的占位或互斥锁,在第一次 await 前占用,并在 finally 中释放;检查同时覆盖启动中和已运行的评审。增加并发启动测试,断言只有一次 create 和 prompt。
Was this helpful? React with 👍 or 👎 to provide feedback.
| async dispose(): Promise<void> { | ||
| this.disposed = true | ||
| this.reviews.clear() | ||
| this.latestBySource.clear() | ||
| } |
There was a problem hiding this comment.
🔴 停用插件后仍会启动评审
启动请求等待模型校验时停用插件,不会取消该请求。请求恢复后仍创建会话并调用模型,但回传监听已卸载,评审结果无法自动送回。
Learn more
服务只在 start 入口检查是否停用,后续异步等待结束后仅检查调用方的 signal。模型校验后的启动流程没有再次检查 disposed,而 dispose 不会中止该 signal。插件卸载还会移除结果跟踪监听。用实际服务源码挂起 resolveCallConfig、调用 dispose 后再恢复校验,仍能观察到一次 create 和 prompt。
Example: 用户点击开始评审后,在模型校验尚未结束时停用插件;校验完成后插件仍发送评审任务,但已没有监听器负责自动回传。
Recommended fix: 为服务建立生命周期取消信号,与请求信号合并,并在异步边界后及创建、提示和回传前检查。跟踪未结束操作,使 dispose 能取消并等待它们;自动回传任务也应遵守同一生命周期。增加挂起启动后卸载的回归测试。
Was this helpful? React with 👍 or 👎 to provide feedback.
| live = false | ||
| if (timer !== undefined) clearTimeout(timer) | ||
| } | ||
| }, [call, sessionId, blank, subagent]) |
There was a problem hiding this comment.
🟡 评审结束后无法再次从头部启动评审
首次状态查询没有运行中的评审时,轮询立即停止。开始评审只更新本地状态,不会重启查询,完成后按钮仍显示“评审中”,只能打开旧评审。
Learn more
头部状态 effect 只在组件挂载或列出的依赖变化时执行;它只有查到 running 才安排下一次查询。启动成功处理把本地 review 设为 running,但这些状态不在 effect 依赖中。实际注入的 call引用稳定,评审开始与结束也不会改变会话 ID、blank 或 subagent,因此正常流程不会重新查询。侧边栏自己的状态查询不会更新头部状态。
Example: 打开没有评审的会话,等待初次状态查询结束,再启动评审;侧边栏显示结果已发回后,头部仍显示评审中,点击只能重新打开旧标签页。
Recommended fix: 在启动成功后显式启动头部状态跟踪,或让跟踪 effect 依赖当前评审标识与是否运行;确保查到终态后停止轮询。补充初次无评审、启动、完成后恢复开始按钮的组件测试。
Was this helpful? React with 👍 or 👎 to provide feedback.
| if (expectedRevision !== this.settings.revision) { | ||
| throw new QuickReviewError('stale', 'settings changed; refresh and retry') | ||
| } | ||
| const next: QuickReviewSettings = { | ||
| revision: this.settings.revision + 1, | ||
| model: normalizeModelRoute(patch.model), | ||
| } | ||
| await this.deps.settings?.save(next) | ||
| this.settings = next |
There was a problem hiding this comment.
🟡 并发保存会静默覆盖评审模型偏好
两个设置请求携带相同版本时,都可能通过检查并开始保存。版本在异步保存后才更新,两个请求因此都返回成功,后写入的模型偏好覆盖先前选择。
Learn more
设置采用 expectedRevision 检测客户端冲突,但检查和 revision 更新之间存在异步保存。两个请求在保存结束前都能读取相同的旧版本,所以都会接受,并产生相同的新版本。用实际服务源码挂起保存后并发更新,观察到两次 save 都被调用,两个请求最终都返回 revision 1。现有 设置测试只覆盖串行请求,无法发现此问题。
Example: 两个浏览器标签页都读取 revision 0,分别保存模型 A 和 B;预期一个成功、另一个收到 stale,实际两者都成功,只有一个模型偏好被保留。
Recommended fix: 将版本检查、持久化和内存状态发布放入同一串行队列,或者使用存储层的原子比较更新。可参照 Git 提交设置队列,并加入挂起持久化时的并发版本冲突测试。
Was this helpful? React with 👍 or 👎 to provide feedback.
--dsw-alias-border-subtle is outside the OFFICIAL_THEME_TOKEN_NAMES allowlist and its literal transparent fallback violated the no-literal-fallback rule; the divider now uses --dsw-alias-border-l2, same as the official ui divider styles. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
| .qrv-root.qrv-panel { position: fixed; width: min(340px, calc(100vw - 32px)); max-height: min(480px, calc(100vh - 32px)); overflow: auto; } | ||
| .qrv-root .dsh-ui-textarea { width: 100%; resize: vertical; min-height: 44px; } | ||
| .qrv-root.qrv-tab { display: flex; flex-direction: column; height: 100%; min-height: 0; } | ||
| .qrv-root .qrv-tab-status { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-bottom: 0.5px solid var(--dsw-alias-border-l2); flex: none; } |
Regenerated index.json: dsh-model-picker is now published as 0.3.5 on npm, so the stale market index fails site:market:check. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
改动 / Change
新增独立插件
@klarkxy/dsh-quick-review:read-only权限预设;宿主无此预设或初始化失败时拒绝启动,绝不放行可写评审。模型用agent.model.select写入评审会话,绝不改动全局默认模型。workspace/changes汇总出的改动文件(优先path,回退display);宿主无记录时如实回退为「工作区全部未提交改动」并在弹窗与提示词中声明。quickreview资源提供器 +sidebar.right.pane.tab,右侧标签页实时显示评审会话完整对话,顶部状态条支持「再次发回主会话」。turn/end完成后把最终文本作为agent-messagerelay 发回源会话,精确一次。中止 / 空文本 / 会话释放 / 发回失败都记为失败状态,不发空消息。busy;设置更新走乐观版本检查;已结束记录按 50 条上限回收。scripts/plugin-release-states.json登记为testing,首次 npm 发布走手动first_release工作流。Standalone plugin: a conversation-header action spawns a specified-model, read-only review session shown live in a right-sidebar tab; its first-turn verdict is relayed back to the source session exactly once.
测试 / Tests
pnpm --filter @klarkxy/dsh-quick-review test:17/17(scope 合并与回退、启动顺序、busy、模型回退链、首轮中继恰好一次、中止/空响应不重发、resend、setup-failed、记录回收、RPC 校验、客户端 start 载荷带模型)pnpm --filter @klarkxy/dsh-quick-review typecheckpnpm --filter @klarkxy/dsh-quick-review build(lib/client.js无外部 plugin-kit/model-route 引用)pnpm release:check77/77、node --test scripts/plugin-settings.test.mjs、git diff --check界面验收 / UI acceptance
bfd0d77(同一份工作区代码构建后直接录制,GIF 分支docs/demo-assets@824d69e)。.agents/skills/dsh-web-acceptance/隔离dsh web(临时HOME/DSH_HOME/DSH_AGENTS_HOME,本地 127.0.0.1 mock OpenAI 供应商qa-mock-1,不使用真实账号或付费接口);qa-report.json无页面错误、控制台错误和 HTTP 错误。Generated with Devin