Inbox cancel returns 204 even when nothing was withdrawn
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
检查 packages/server/src/handlers/session.ts,尤其是 session.inbox.cancel 和同级的 session.inbox.update,然后找到相应的会话收件箱处理器测试。复现项目投递后的取消操作,并验证实际撤回仍可与冲突区分。当响应行为符合所选的 API 契约,并且相关测试覆盖这两种情况时,工作即告完成。
由索引模型根据 Issue 内容生成。
描述
Description
What happens. In v2.0.32, DELETE /api/session/:sessionID/inbox/:inboxID answers 204 No Content in two different situations:
- the pending item was withdrawn, so it will never reach the model;
- the item was no longer pending, for example because it had already been delivered to the session.
The handler catches the conflict and returns the same empty success (packages/server/src/handlers/session.ts, lines 551–559 at v2.0.32):
.handle(
"session.inbox.cancel",
Effect.fn(function* (ctx) {
yield* session.cancelInbox({ sessionID: ctx.params.sessionID, inboxID: ctx.params.inboxID }).pipe(
Effect.catchTag("Session.NotFoundError", missingSession),
Effect.catchTag("Session.InboxConflictError", () => Effect.void),
)
return HttpApiSchema.NoContent.make()
}),
)
The sibling session.inbox.update handler (line 564) sends the same InboxConflictError through pendingMutation, which answers 409 Conflict. Only cancel hides it.
Why it matters. A client that offers "undo my queued message" wants to put the withdrawn text back in the input box. Between the client's inbox read and the cancel, the running turn can end and the item can be delivered. The cancel still returns 204. If the client then restores the text, the person may send the same request again, although the first copy already ran. The client cannot tell the two cases apart:
- the item is absent from a fresh inbox read in both cases;
- the transcript proves delivery only when the message is in the page the client reads.
Request. Let the cancel response say what happened. For example:
- answer 409 Conflict for an item that is no longer pending, as
session.inbox.updatealready does, and keep 204 for a real withdrawal; or - if changing the status would break existing callers, return a small body such as
{ "withdrawn": true }or{ "withdrawn": false }.
Either form lets a client restore the text only after a real withdrawal, and otherwise point the person to the delivered message.
Plugins
None
OpenCode version
2.0.32
Steps to reproduce
- Start a reply that takes a few seconds.
- While it runs, queue a follow-up message. It appears in
GET /api/session/:sessionID/inbox. - Wait until the reply ends and the follow-up appears in
GET /api/session/:sessionID/message. - Send
DELETE /api/session/:sessionID/inbox/:inboxIDfor that follow-up. The answer is 204, the same as for a real withdrawal.
- 主要语言
- TypeScript
- 星标
- 215k
- 派生
- 28.9k
- 平均合并
- 8 小时 11 分钟
- 30 天内合并 PR
- 365
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
reproduced
难度 2/5 1-3 小时 新手友好度 67/100
anomalyco/opencode#57711 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
anomalyco/opencode#57698 · 3 条评论 ·
维护者通常 1 天内回复
-
pending close triaging
难度 2/5 1-3 小时 新手友好度 66/100
anomalyco/opencode#57664 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
anomalyco/opencode#57579 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
anomalyco/opencode#57536 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
ranxianglei/billion-context#4172 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
awslabs/threat-composer#362 ·
维护者通常 1 天内回复
-
Area/Cloud Needs Triage Type/Bug
难度 1/5 1-3 小时 新手友好度 86/100
wso2/product-integrator#2847 ·
维护者通常 1 天内回复