Skip to content

fix(rpc): prevent race condition on agent reload#297

Merged
DayTF merged 1 commit into
mainfrom
fix/prevent-race-condition-agent-reload
May 6, 2026
Merged

fix(rpc): prevent race condition on agent reload#297
DayTF merged 1 commit into
mainfrom
fix/prevent-race-condition-agent-reload

Conversation

@DayTF
Copy link
Copy Markdown
Contributor

@DayTF DayTF commented May 6, 2026

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

Note

Fix race condition in AgentFactory#reload! with re-entrancy guard

  • Adds a @reloading flag to AgentFactory that prevents concurrent reloads: if reload! is called while a reload is in progress, it logs an info message and returns immediately.
  • The flag is reset in an ensure block so subsequent reloads are always allowed, even after an error.
  • On error, the datasource replacement and schema send are skipped, matching existing error-handling behavior.
  • New specs in agent_factory_spec.rb cover concurrent reload suppression, post-completion re-entry, and flag reset after failure.

Macroscope summarized 910e5ec.

Copy link
Copy Markdown
Member

@arnaud-moncel arnaud-moncel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@DayTF DayTF merged commit c02c26e into main May 6, 2026
40 checks passed
@DayTF DayTF deleted the fix/prevent-race-condition-agent-reload branch May 6, 2026 08:00
forest-bot added a commit that referenced this pull request May 6, 2026
## [1.28.2](v1.28.1...v1.28.2) (2026-05-06)

### Bug Fixes

* **rpc:** prevent race condition on agent reload ([#297](#297)) ([c02c26e](c02c26e))
@forest-bot
Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.28.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants