Skip to content

Conversation

@nshkrdotcom
Copy link
Contributor

@nshkrdotcom nshkrdotcom commented Jan 3, 2026

Summary

  • Respect agent server mode when scheduling queue processing; add explicit sync processing for step/debug.
  • Stabilize cross-process test helpers with received-signal waits and auto defaults.
  • Fix flaky routing-error assertion by referencing Jido.Error in server runtime test.

Testing

  • mix test
  • mix test --include flaky
  • mix dialyzer

Refactor signal queue processing to properly handle step and debug modes:

- Add synchronous handle_call(:process_queue, ...) for explicit queue
  processing in step/debug modes
- Modify handle_info(:process_queue, ...) to only auto-process in auto
  mode, preventing unintended processing in step/debug modes
- Extract maybe_trigger_queue_processing/1 helper that conditionally
  triggers async processing based on current mode

Update test infrastructure for reliable cross-process synchronization:

- Add wait_for_received_signals/3 helper to properly wait for signal
  delivery in async scenarios
- Modify spawn_producer_agent and spawn_consumer_agent to default to
  auto mode for consistent behavior
- Add maybe_process_queue/1 helper to explicitly trigger processing
  when testing in step mode
- Replace Process.sleep with proper wait_for assertions in
  send_signal_sync
- Improve error handling in agent cleanup to catch exit signals
@nshkrdotcom
Copy link
Contributor Author

There's still some test flakiness. Will submit another commit today.

@mikehostetler
Copy link
Contributor

thank you @nshkrdotcom

Please take a look at the v2 branch as well, lots of goodies in there - would love to get your thoughts as we're discussing this in Discord too

@nshkrdotcom
Copy link
Contributor Author

Perfect. I'll push what I have here, and focus on the latest work.

Centralize agent cleanup logic in Support.cleanup_agent/1 and make it
safer by unlinking before stopping to prevent linked-exit propagation
from killing the cleanup process.

Changes:
- Add Process.unlink/1 call before GenServer.stop in cleanup_agent
- Add guard clause (when is_pid) for type safety
- Delegate stop_test_agent in AgentCase to shared cleanup function
- Use Support.unique_id for invalid refs in interaction tests to avoid
  async test collisions between concurrent test runs
- Split atom reference test separately since fixed atoms are safe
@nshkrdotcom
Copy link
Contributor Author

These changes ended up being inapplicable to the v2 cleanup. Not sure if you're doing maintenance work on this older version.

@mikehostetler
Copy link
Contributor

Yeah, we will be maintaining 1.0

The 2.0 branch is very alpha at the moment - but getting there

@mikehostetler mikehostetler changed the base branch from main to v1.x January 16, 2026 02:20
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.

2 participants