Skip to content

fix: keep a Run waiting when one of several open approvals is cancelled - #2053

Merged
4pmtong merged 3 commits into
mainfrom
fix/cancelled-approval-keeps-waiting
Oct 15, 2026
Merged

4pmtong merged 3 commits into
mainfrom
fix/cancelled-approval-keeps-waiting

Conversation

@4pmtong

@4pmtong 4pmtong commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request

Related Issue

Description

Problem. When a task was waiting on two approvals at once (for example parallel workers asking at the same time) and one of them was cancelled because its tool could no longer run, the app treated the whole task as interrupted, although it was still waiting for the other approval:

  • In the chat view, a task watched live could be shown as interrupted even though the remaining approval could still be answered and the task would continue.
  • In the experimental timeline view, the timer stopped holding during the remaining wait. In one case it read 2s, 2s, 12s, 15s instead of 2s, 2s, 2s, 5s.

Cause. When an approval is answered, the backend reports how many requests are still open, and the app keeps the task waiting while that number is above zero. When an approval is cancelled this way, the backend keeps the task waiting if other requests are open, but it did not report the number, so the app always read the cancellation as the end of the wait.

Fix.

  • The backend now includes the number of requests still open with such a cancellation, the same as with an answer.
  • The app keeps the task waiting after a cancellation that leaves other requests open, so the task is not shown as interrupted and the timer keeps holding until the last request is answered. A cancellation that leaves nothing open, or one recorded before this change, ends the wait as before.
  • In the chat view, the card of a cancelled approval now closes and the other open approval is shown, whether the cancelled one was on screen or still waiting in line. Before, the chat view never heard about a request the backend closed by itself.
  • When the user stops a task while an approval is open, the backend closes that approval as part of stopping. The app used to read that as an interruption a moment before the stop arrived, so the task ended as interrupted instead of cancelled. Such a closing now leaves the task's status to the stop itself.

Testing Evidence (REQUIRED)

  • Backend: with two pending approvals, cancelling one reports one open request and the task stays waiting; with a single approval it reports none and the task is interrupted as before.

  • Chat view, with a live task: work 2s, two approvals, one cancelled after 10s, the other approved 10s later, work 3s. The task stays running and the timer reads 2s through the wait and 5s at the end.

  • Experimental timeline view, same sequence with a 30s and a 10s wait: 2s, 2s, 2s, 5s.

  • Run status: the task stays waiting after the cancellation and runs again after the remaining approval, with the whole 48s counted as waiting; a cancellation with nothing left open, or without the count, still interrupts it.

  • Chat view cards: with two approval cards, cancelling the one on screen shows the other, and cancelling the one still waiting in line removes it from the line; the task keeps running.

  • Stopping a task while an approval is open ends it as cancelled, not interrupted.

  • Without the change, the new backend and app tests fail. The related timer, timeline and run journal tests, type checking, ESLint, Prettier and ruff pass.

  • I have included human-verified testing evidence in this PR.

  • This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).

  • No frontend/UI changes in this PR.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

@4pmtong
4pmtong marked this pull request as ready for review October 15, 2026 04:13
@4pmtong
4pmtong merged commit bbfd2ac into main Oct 15, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant