Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Inbox cancel returns 204 even when nothing was withdrawn

Đang mở Phù hợp với người mới
#56,735 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
api, backend

Hướng nghiên cứu

Kiểm tra packages/server/src/handlers/session.ts, đặc biệt là session.inbox.cancel và trình xử lý cùng cấp session.inbox.update, sau đó tìm các bài kiểm thử tương ứng của trình xử lý hộp thư đến phiên. Tái hiện việc hủy sau khi một mục đã được chuyển giao và xác minh rằng việc rút lại thực sự vẫn có thể phân biệt với xung đột. Công việc hoàn tất khi hành vi của phản hồi khớp với hợp đồng API đã chọn và các bài kiểm thử liên quan bao phủ cả hai trường hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
TypeScript
Star
215k
Fork
28.9k
Merge trung bình
11 giờ 19 phút
Pull request đã merge (30 ngày)
320

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode

Tất cả issue của anomalyco/opencode

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.