Skip to content

fix(session): count freshly spawned actors as busy in concurrency check#13

Merged
glittercowboy merged 1 commit intomainfrom
fix/session-concurrency-race
Apr 12, 2026
Merged

fix(session): count freshly spawned actors as busy in concurrency check#13
glittercowboy merged 1 commit intomainfrom
fix/session-concurrency-race

Conversation

@glittercowboy
Copy link
Copy Markdown
Contributor

Summary

  • Fixes a race where rapid task delivery bypasses the max concurrent tasks limit
  • Freshly spawned actors (task queued via SendTask but not yet picked up by executeTask) were counted as idle since HasInFlightTask() returned false
  • Adds HasBeenIdle() method to distinguish "never ran a task" from "completed a task and is idle"
  • Concurrency check now counts actors that are executing OR have never completed a task as busy

Test plan

  • go test ./internal/session/... passes

🤖 Generated with Claude Code

Actors that have been spawned but haven't picked up their task yet
(taskID="" and idleSince==nil) were counted as idle, allowing rapid
task delivery to bypass the max concurrent tasks limit during the
race window between SendTask and executeTask.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@glittercowboy glittercowboy merged commit c1c6144 into main Apr 12, 2026
1 check passed
@glittercowboy glittercowboy deleted the fix/session-concurrency-race branch April 12, 2026 23:13
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