Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
lint:
name: Lint
uses: agentjido/github-actions/.github/workflows/elixir-lint.yml@v3
with:
otp_version: "28"
elixir_version: "1.20.0-rc.4"
secrets: inherit

test:
Expand All @@ -23,3 +26,11 @@ jobs:
otp_versions: '["27", "28"]'
elixir_versions: '["1.18", "1.19"]'
test_command: mix test

test_elixir_120:
name: Test Elixir 1.20
uses: agentjido/github-actions/.github/workflows/elixir-test.yml@v3
with:
otp_versions: '["28"]'
elixir_versions: '["1.20.0-rc.4"]'
test_command: mix test
4 changes: 4 additions & 0 deletions lib/jido/agent_server/signal/child_exit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ defmodule Jido.AgentServer.Signal.ChildExit do

use Jido.Signal,
type: "jido.agent.child.exit",
extension_policy: [
{Jido.Signal.Ext.Trace, :optional},
{Jido.Signal.Ext.Dispatch, :optional}
],
schema: [
tag: [type: :any, required: true, doc: "Tag assigned to the child when spawned"],
pid: [type: :any, required: true, doc: "PID of the child process that exited"],
Expand Down
4 changes: 4 additions & 0 deletions lib/jido/agent_server/signal/child_started.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ defmodule Jido.AgentServer.Signal.ChildStarted do
use Jido.Signal,
type: "jido.agent.child.started",
default_source: "/agent",
extension_policy: [
{Jido.Signal.Ext.Trace, :optional},
{Jido.Signal.Ext.Dispatch, :optional}
],
schema: [
parent_id: [type: :string, required: true, doc: "ID of the parent agent"],
child_id: [type: :string, required: true, doc: "ID of the child agent"],
Expand Down
4 changes: 4 additions & 0 deletions lib/jido/agent_server/signal/cron_tick.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ defmodule Jido.AgentServer.Signal.CronTick do

use Jido.Signal,
type: "jido.cron_tick",
extension_policy: [
{Jido.Signal.Ext.Trace, :optional},
{Jido.Signal.Ext.Dispatch, :optional}
],
schema: [
job_id: [type: :any, required: true, doc: "The logical cron job id"],
message: [type: :any, required: true, doc: "The cron tick message payload"]
Expand Down
4 changes: 4 additions & 0 deletions lib/jido/agent_server/signal/orphaned.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ defmodule Jido.AgentServer.Signal.Orphaned do

use Jido.Signal,
type: "jido.agent.orphaned",
extension_policy: [
{Jido.Signal.Ext.Trace, :optional},
{Jido.Signal.Ext.Dispatch, :optional}
],
schema: [
parent_id: [type: :string, required: true, doc: "ID of the parent agent that died"],
parent_pid: [type: :any, required: true, doc: "PID of the parent process that died"],
Expand Down
4 changes: 4 additions & 0 deletions lib/jido/agent_server/signal/scheduled.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ defmodule Jido.AgentServer.Signal.Scheduled do

use Jido.Signal,
type: "jido.scheduled",
extension_policy: [
{Jido.Signal.Ext.Trace, :optional},
{Jido.Signal.Ext.Dispatch, :optional}
],
schema: [
message: [type: :any, required: true, doc: "The scheduled message payload"]
]
Expand Down
2 changes: 0 additions & 2 deletions lib/jido/discovery.ex
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ defmodule Jido.Discovery do
All processes can read concurrently without contention.
"""

require Logger

@catalog_key :jido_discovery_catalog

@type component_type :: :actions | :sensors | :agents | :plugins | :demos
Expand Down
2 changes: 0 additions & 2 deletions lib/jido/observe/log.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ defmodule Jido.Observe.Log do
Log.log(:info, "Agent completed", agent_id: agent.id)
"""

require Logger

@type level :: Logger.level()

@doc """
Expand Down
5 changes: 1 addition & 4 deletions lib/jido/scheduler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,7 @@ defmodule Jido.Scheduler do
end

def run_every(fun, cron_expr, opts) when is_function(fun, 0) and is_list(opts) do
case validate_cron_expression_type(cron_expr) do
:ok -> {:error, {:invalid_scheduler_options, :invalid_type}}
{:error, reason} -> {:error, reason}
end
validate_cron_expression_type(cron_expr)
end

def run_every(fun, _cron_expr, _opts) when is_function(fun, 0),
Expand Down
2 changes: 1 addition & 1 deletion lib/jido/storage/file.ex
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ defmodule Jido.Storage.File do
defp decode_entries(_malformed, _acc), do: {:error, :invalid_entries_log}

defp decode_frame(rest, size) when byte_size(rest) >= size do
<<term_binary::binary-size(size), remaining::binary>> = rest
<<term_binary::binary-size(^size), remaining::binary>> = rest
{:ok, term_binary, remaining}
end

Expand Down
2 changes: 1 addition & 1 deletion test/jido/agent/agent_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule JidoTest.AgentTest do
assert TestAgents.Minimal.name() == "minimal_agent"
assert TestAgents.Minimal.description() == nil
schema = TestAgents.Minimal.schema()
assert is_struct(schema) or schema == []
assert is_struct(schema)
end
end

Expand Down
10 changes: 7 additions & 3 deletions test/jido/agent_server/directive_exec_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,13 @@ defmodule JidoTest.AgentServer.DirectiveExecTest do
assert child_info.module == agent_struct.__struct__
assert is_pid(child_info.pid)

# Stop the child - catch potential exit as process may be in init
catch_exit do
GenServer.stop(child_info.pid, :normal, 100)
# Stop the child without relying on catch_exit's generated AST handling.
if Process.alive?(child_info.pid) do
try do
GenServer.stop(child_info.pid, :normal, 100)
catch
:exit, _ -> :ok
end
end
end

Expand Down
Loading