Skip to content

Conversation

@nshkrdotcom
Copy link
Contributor

@nshkrdotcom nshkrdotcom commented Jan 21, 2026

Summary

  • Normalize await timeout errors and make InstanceManager attach/detach/lookup resilient to race exits
  • Replace timing sleeps with eventual assertions and accept valid orphan reasons
  • Make log-capture tests independent of global LOG_LEVEL (dedicated stop-log test + per-test Logger level)

Why

Tests were failing under non-debug log levels and on timing-sensitive races (attach/stop/drain). This isolates logging config from test expectations and removes racey timing assumptions.

Testing

  • mix test

- Enhanced `InstanceManager.lookup/2` to verify process is alive before returning pid, preventing stale pid returns from registry.
- Added try/catch blocks in `AgentServer.attach/2` and `detach/2` to gracefully handle process exit scenarios with proper error tuples.
- Updated `Await` module to properly propagate timeout errors in `collect_all` and `any` functions.
- Removed flaky tag from instance manager stop test after fixing underlying race condition.
- Extracted log capture test to separate file for better test isolation.
- Replaced `Process.sleep` with `refute_eventually` for more reliable process termination assertions.
- Updated hierarchy test to accept both `:normal` and `:noproc` as valid orphan reasons.
- Added Logger level configuration in observe tests to ensure consistent debug output.
@mikehostetler mikehostetler merged commit 8d14a6e into agentjido:main Jan 21, 2026
6 checks passed
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