fix: abort listener leak in agent-loop.ts sleep and code-mode/service.ts delay
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- tooling
Research direction
Read sleep() in packages/core/src/agent/agent-loop.ts and delay() in packages/core/src/tools/code-mode/service.ts, then run pnpm check and pnpm test:coverage. Remove the timer-success cleanup calls described in the issue while preserving the abort-handler cleanup. Done means all 1475 tests pass and repeated shared-signal sleep calls keep the abort listener count stable.
Written by the indexing model from the issue text.
Description
Bug
sleep() in agent-loop.ts and delay() in code-mode/service.ts call signal.removeEventListener('abort', ...) in the timer success callback. This prematurely removes the abort listener from shared AbortController signals, so other operations waiting on the same signal miss abort notifications.
Fix
Remove the removeEventListener call from the timer success path. The { once: true } option already handles cleanup when the listener fires (either on abort or on success). The abort handler still explicitly removes the listener as a defensive measure.
Scope
packages/core/src/agent/agent-loop.ts— remove spuriousremoveEventListenerinsleep()packages/core/src/tools/code-mode/service.ts— same pattern indelay()
No public API changes.
Verification
pnpm check # all pass
pnpm test:coverage # 1475 tests pass, coverage 83.66% stmt / 84.97% branch
Manual: abort listener count stays stable across 100+ repeated sleep() calls with a shared AbortController.
- Dominant language
- TypeScript
- Stars
- 54
- Forks
- 20
- Avg merge
- 2h 58m
- Merged PRs (30d)
- 1
Contributor 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 stepfun-ai/Step-Code
-
status/needs-triage type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
stepfun-ai/Step-Code#85 · 1 comment ·
-
status/needs-triage type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stepfun-ai/Step-Code#84 ·
-
status/needs-triage type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stepfun-ai/Step-Code#83 ·
-
status/needs-triage type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stepfun-ai/Step-Code#81 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
stepfun-ai/Step-Code#118 ·
All issues in stepfun-ai/Step-Code
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·