Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Inbox cancel returns 204 even when nothing was withdrawn

未关闭 适合新手
#56,735 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
api, backend

调研方向

检查 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.update already 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
  1. Start a reply that takes a few seconds.
  2. While it runs, queue a follow-up message. It appears in GET /api/session/:sessionID/inbox.
  3. Wait until the reply ends and the follow-up appears in GET /api/session/:sessionID/message.
  4. Send DELETE /api/session/:sessionID/inbox/:inboxID for that follow-up. The answer is 204, the same as for a real withdrawal.
主要语言
TypeScript
星标
215k
派生
28.9k
平均合并
8 小时 11 分钟
30 天内合并 PR
365

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。