-
Notifications
You must be signed in to change notification settings - Fork 1
Add recovery mechanics #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
f079714
Add Legion.Store conversation persistence with a built-in Postgres ad…
dimamik be6b873
Review feedback and minor flow improvements
dimamik 328ef14
WiP
dimamik 07e837d
Move handling AgentServer PID from Store to Registry
tom-ehh a6d2026
Resolve Credo style warnings
tom-ehh d361d1e
Modify Store contract - merge saves and loads
tom-ehh 31dabdf
Finalize Store behavior: Snapshot -> Conversation; add Conversation s…
tom-ehh be36ac8
Adjust Postgres adapter to follow new Store contract
tom-ehh d109205
Wire new store contract into AgentServer
tom-ehh 9103db6
Update store contract\nStore no longer uses specific column groups th…
tom-ehh 9aa4605
Wire new store contract into AgentServer
tom-ehh 4f3353f
Fix race condition in resume/2
tom-ehh f71080b
Add ability to store intra-turn updates
tom-ehh ed2f72a
Add parent_agent_id and started_at time to AgentRegistry
tom-ehh afcff80
Apply review suggestions and update docs
tom-ehh cee0be8
Move migrations closer to Oban style
tom-ehh 1a2a24a
Add 'Migrating Without Ecto' section
tom-ehh 4b08fab
Revise resume/2 wiring
tom-ehh 84b4865
Add recovery mechanics
tom-ehh 30f2203
Resolve merge conflicts
tom-ehh 5fb7d14
Update docs for newly added recovery flow and consistency
tom-ehh e57cc8d
Address revive concerns from diff branch
tom-ehh 8930fbe
Address review comments
tom-ehh 582b857
Move from Registry to :global, refactor resume/2 and recover/2
tom-ehh 4e218e2
Fix docs and test descriptions
tom-ehh 2eec501
Restore running?/1, rename perform_run -> do_run
tom-ehh 84fd157
Rebase to main
tom-ehh 851de48
Change base :executor_state to :nonexistent from nil
tom-ehh 6db0510
Update CHANGELOG.md
tom-ehh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| defmodule Legion.AgentIndex do | ||
| @moduledoc """ | ||
| Cluster-wide process index used by Legion's agent servers. | ||
|
|
||
| Implements the `:via` registration callbacks over `:global`. Starting an | ||
| agent atomically claims its agent ID across connected nodes. The name is | ||
| released automatically when the process stops. | ||
| """ | ||
|
|
||
| @doc false | ||
| def name(agent_id) do | ||
| {:via, __MODULE__, agent_id} | ||
| end | ||
|
|
||
| @doc false | ||
| def register_name(agent_id, pid) do | ||
| :global.register_name(key(agent_id), pid) | ||
| end | ||
|
|
||
| @doc false | ||
| def unregister_name(agent_id) do | ||
| :global.unregister_name(key(agent_id)) | ||
| end | ||
|
|
||
| @doc false | ||
| def whereis_name(agent_id) do | ||
| :global.whereis_name(key(agent_id)) | ||
| end | ||
|
|
||
| @doc false | ||
| def send(agent_id, message) do | ||
| :global.send(key(agent_id), message) | ||
| end | ||
|
|
||
| @doc false | ||
| def lookup(agent_id) do | ||
| case whereis_name(agent_id) do | ||
| :undefined -> :error | ||
| pid -> {:ok, pid} | ||
| end | ||
| end | ||
|
|
||
| defp key(agent_id), do: {:legion_agent, agent_id} | ||
| end | ||
|
tom-ehh marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.