🤖 fix: waitForAgentReport keeps its waiter when onExecutionStarted throws synchronously
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start with TaskService.waitForAgentReport and the timer-arming path through startReportWaitTimeout. Then find the existing tests for this wait and add the case where onExecutionStarted throws synchronously. Done means the wait settles and its waiter and foreground-await count are cleaned up.
Written by the indexing model from the issue text.
Description
If the onExecutionStarted callback passed to TaskService.waitForAgentReport throws synchronously, the wait rejects but its waiter and the requester's foreground-await count stay registered.
Cause
The callback runs from the timer arming (startReportWaitTimeout after the stack-16 split; inline before it). A synchronous throw leaves that step before the timer is set, so the waiter's cleanup never runs. The async rejection of the callback is already caught (.catch), but a synchronous throw is not.
Effect
The same as the leak fixed in #7764: the requester stays counted as foreground-awaiting, so countActiveAgentTasks skips it and the queue can start more tasks than maxParallelAgentTasks allows. A dead waiter also stays registered.
Likelihood
Low. The only production caller that passes the callback is WorkflowRunner, and its callback does not throw in practice.
Fix
Wrap the call so a synchronous throw is treated like a rejection (cleanup, then settle), and add a test that passes a throwing callback.
Found by the stack-16 advisor (TaskService plan 8). The code existed before the split; the split moved it unchanged.
Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $546.28
- Dominant language
- TypeScript
- Stars
- 2.1k
- Forks
- 139
- Avg merge
- 3h 34m
- Merged PRs (30d)
- 951
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coder/xum
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
kunchenguid/gh-axi#247 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lidge-jun/opencodex#8101 · 2 comments ·
Maintainers usually reply within 1 day
-
effort:S P3 refactor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nightscout/nocturne#3243 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
JuliusBrussee/caveman#1449 ·
Maintainers usually reply within 1 day