Repository navigation
[Bounty: $100] Await in-flight task promises in AgentRuntime.stop() instead of busy-polling #259
Description
Activity
Implemented promise tracking in executeTask() and replaced busy-polling with Promise.race in stop(), fulfilling all acceptance criteria. Submitted PR: #363 (Payout Wallet: GwGvT7jeUa9GPYYfSbnT2HRzTyZk6xeqs9EG7443tGi)
- added 5 commits that reference this issue
on Sep 6, 2026 Correction: EVM wallet is
0x01d830d1e147e36eaaf3697b71923c3959c8a85e(previous comment had a typo)/claim #259
/bounty claim 0xad4215910eb90f2d5c948cdb074a6c1487c4136fHi @David-patrick-chuks-02, claiming the bounty for Issue #259 with PR #280 (merged in commit
38ad7d788ea65d703f90bf517d97b8ff1ab61b12).Note for maintainers regarding claim priority:
- PR fix(runtime): await in-flight task promises in AgentRuntime.stop() #280 was authored and opened by me on September 3, 2026 (12:49 UTC), establishing first chronological priority by 3 full days.
- PR Await in-flight task promises in AgentRuntime.stop() instead of busy-polling #385 was only submitted on September 6. The automated claim above from @hummern is an automated bot attempting to snipe the bounty via duplicate PR.
USDC Payout Address (BSC BEP-20 / EVM):
0xad4215910eb90f2d5c948cdb074a6c1487c4136f@David-patrick-chuks-02
⚠️ Bounty Security / Bot Spoofing Advisory for MaintainersHi David, wanted to bring to your direct attention two automated bot patterns actively attempting to intercept bounty payouts across the repositories before settlements are processed:
-
Sniper Bot (
@hummern/@kveita) onagentlily-runtime:- At
09:17 UTCtoday,@hummernran an automated script firing duplicate/claimcomments across Issues [Bounty: $50] Fix RangeError from fc.date().toISOString() in InMemoryMemoryStore property tests #253, [Bounty: $95] Consume a task's tool-call budget only after its tool is resolved in ActionExecutor.execute #256, [Bounty: $100] Warn when AgentRuntime.stop() times out with tasks still in flight #258, and [Bounty: $100] Await in-flight task promises in AgentRuntime.stop() instead of busy-polling #259 in seconds. - On Issue [Bounty: $100] Await in-flight task promises in AgentRuntime.stop() instead of busy-polling #259 ($100 bounty),
@hummernis attempting to claim the bounty using duplicate PR Await in-flight task promises in AgentRuntime.stop() instead of busy-polling #385 (submitted Sept 6). - In reality, PR fix(runtime): await in-flight task promises in AgentRuntime.stop() #280 was authored and opened by me on September 3 (3 days earlier) and merged into
mainwith commit38ad7d788ea65d703f90bf517d97b8ff1ab61b12.
- At
-
Wallet Spoof Bot (
@Zhiyilang074811) onlily-sdk:- Spammed 69+ threads across the org attempting to spoof authors' PRs.
- Example: On PR #533 (which I authored),
@Zhiyilang074811commented claiming ownership of my PR and providing an external Solana wallet (3rb3NNa...).
All my merged contributions across
agentlily-runtime,lily-sdk, andlily-frontendare formally recorded and claimed under my official EVM wallet:
0xad4215910eb90f2d5c948cdb074a6c1487c4136f(USDC on BSC BEP-20)Thank you for your review, time, and diligence!
-
Context
AgentRuntimeinsrc/runtime/agent-runtime.tsstores only task IDs ininFlightTasks, anddrainInFlightTasks()busy-waits by sleepingMath.min(5, remaining)milliseconds in a loop until the deadline. This polling wastes CPU during every graceful stop and makes the wait granularity dependent on an arbitrary 5 ms tick rather than actual task completion.Proposed Change
Track the promises of in-flight
executeTask()calls (or a shared deferred) alongside the ID set, and havestop()await them with a timeout (e.g.Promise.raceagainst the configureddrainTimeoutMs) so shutdown completes as soon as work finishes without polling.Acceptance Criteria
stop({ drainTimeoutMs })returns promptly when in-flight tools finish early instead of waiting up to the full timeout in 5 ms slices.drainTimeoutMsstill leavestop()unblocked, and the runtime reports the stranded state.getInFlightTaskCount()semantics and the drain test intests/runtime/stress-hardening.test.tsremain green.agent-runtime.ts.Suggested Label
DX
ETA: 24 hours