fix(api): GET /v1/pending lists approval requests whose window has passed

オープン
#1,043 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
aws, typescript
領域
api, backend

調査の方向性

Start with the query and row mapping in cdk/src/handlers/get-pending.ts, then check PR #904 for the agreed expiration rule and PR #1013 for how timeout_s of 0 is handled. Filter expired requests while preserving rows with no automatic deadline. Done means GET /v1/pending omits expired requests and retains requests whose timeout is 0.

索引モデルが issue の本文から書いたものです。

説明

bug orchestration
Component

CDK / infrastructure (API handlers)

Describe the bug

GET /v1/pending (bgagent pending) lists approval requests whose window has already passed.

The handler returns every row of the caller whose status is PENDING. It computes expires_at (created_at + timeout_s) for each row, and never compares it with the clock (cdk/src/handlers/get-pending.ts, the query and the mapping that follows it).

Normally the agent ends the wait itself and writes TIMED_OUT, which takes the row out of the list. A stale row is left when the agent can no longer do that: its container is gone, or the task was failed or cancelled while it waited. The row then stays PENDING until DynamoDB's TTL deletes it. The TTL is created_at + timeout_s + 120 s, and DynamoDB deletes expired items lazily, so the row can stay listed long after its window.

Expected behavior

A request whose window has passed is not listed as pending.

Current behavior

The request is listed, with an expires_at in the past. Approving or denying it is refused once the task has left AWAITING_APPROVAL; before that it records a decision that no agent is waiting for.

Reproduction steps
  1. Leave an approval row in status PENDING whose created_at + timeout_s is in the past. On a deployed stack: let a task reach an approval gate, stop its agent (for example by cancelling the task), and wait for the window to pass. On a table without TTL deletion (the emulator tier's tables): write such a row directly.
  2. Call GET /v1/pending as the row's user.
  3. The response contains the request.
Possible solution

Filter out rows whose computed expires_at is in the past in get-pending.ts. The index the handler reads already projects created_at and timeout_s, so this needs no index change.

Two things to check when doing it:

  • Open PR #904 adds a deadline_epoch to the row and makes approve and deny refuse after it. That settles what "expired" means, and the filter should use the same rule.
  • Open PR #1013's writer accepts timeout_s 0 as "no automatic deadline". A filter must keep such rows.
Additional context

Found by the investigation recorded in docs/research/aws-emulator-local-tests.md (pull request for #1041), re-checked on main at 8697c821. It is not fixed by that pull request. No open pull request changes get-pending.ts.

AWS quotas
  • I have reviewed the relevant service quotas (or N/A)
主要言語
TypeScript
スター
173
フォーク
53
平均マージ
2日 9時間
マージ済み PR(30日)
14

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws-samples/sample-autonomous-cloud-coding-agents のほかの issue

aws-samples/sample-autonomous-cloud-coding-agents の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。