Skip to content

Add agent graph store interface#19229

Merged
rasmusrygaard merged 4 commits intomainfrom
dev/rasmus/add-agent-graph-store-protocol
Apr 29, 2026
Merged

Add agent graph store interface#19229
rasmusrygaard merged 4 commits intomainfrom
dev/rasmus/add-agent-graph-store-protocol

Conversation

@rasmusrygaard
Copy link
Copy Markdown
Contributor

@rasmusrygaard rasmusrygaard commented Apr 23, 2026

Summary

Persisted subagent parent/child topology currently leaks through StateRuntime's SQLite-specific thread-spawn helpers. This PR introduces a narrow AgentGraphStore boundary so follow-up work can route graph operations through a local or remote store without coupling orchestration code directly to the state DB graph API.

Changes

  • Adds the new codex-agent-graph-store crate.
  • Defines a flat AgentGraphStore trait for the v1 graph surface: upsert edge, set edge status, list direct children, and list descendants.
  • Adds public graph types for ThreadSpawnEdgeStatus, AgentGraphStoreError, and AgentGraphStoreResult.
  • Implements LocalAgentGraphStore on top of an existing codex_state::StateRuntime, preserving today's SQLite-backed thread_spawn_edges behavior.
  • Registers the crate in Cargo/Bazel metadata.

This PR only adds the local contract and implementation; call-site migration and the remote gRPC store are left to the follow-up PRs in the stack.

Testing

  • cargo test -p codex-agent-graph-store

The new unit tests cover local parity with the existing StateRuntime graph methods, Open/Closed filtering, status updates, and stable breadth-first descendant ordering.

@rasmusrygaard rasmusrygaard marked this pull request as ready for review April 24, 2026 17:16
.upsert_thread_spawn_edge(parent_thread_id, child_thread_id, to_state_status(status))
.await
.map_err(internal_error)
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Implementation should match what's already in the repo. Will point those callers at this code eventually

Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Ok after my comments

Comment thread codex-rs/agent-graph-store/src/local.rs Outdated
Comment thread codex-rs/agent-graph-store/src/store.rs
Comment thread codex-rs/agent-graph-store/src/types.rs
@rasmusrygaard rasmusrygaard force-pushed the dev/rasmus/add-agent-graph-store-protocol branch from d5ec021 to ce284b5 Compare April 29, 2026 21:34
@rasmusrygaard rasmusrygaard enabled auto-merge (squash) April 29, 2026 22:23
@rasmusrygaard rasmusrygaard merged commit 7821915 into main Apr 29, 2026
28 checks passed
@rasmusrygaard rasmusrygaard deleted the dev/rasmus/add-agent-graph-store-protocol branch April 29, 2026 22:48
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants