mirror of
https://github.com/openai/codex.git
synced 2026-11-07 20:30:33 +00:00
## What changed Add `DeliveryPlan::deliver` to supply selected originals as `guardian_original_evidence` context in source order. Read whole posts one board page at a time and batch them within the model's tool-output budget, rejecting originals that cannot fit intact. Record delivered ordinals only after the admission callback succeeds, and advance channel positions when the plan completes. Preserve successful admissions across partial plans so retries and overlapping channel selections do not duplicate evidence. Add `LocalBoardReadView::read_post_texts` to retrieve posts in the requested order while enforcing the captured board boundary. ## Testing Add retrieval tests covering ordered delivery into a retained conversation without starting inference, deduplication, failed admission, oversized-original retries, older evidence from newly selected channels, captured-view boundaries, and paged reads. GitOrigin-RevId: b2f03e039c6677e0b94dceaa7ed75a966edf81eb
61 lines
2.1 KiB
Rust
61 lines
2.1 KiB
Rust
//! Guardian's durable evidence storage, owned by the main thread.
|
|
//! Reviewer tools search a fixed board view and deliver the originals routed by the housekeeper.
|
|
//! The host owns review scheduling and the lifetime of each view.
|
|
//! Hosts invoke permanent-deletion cleanup only when Guardian V3 is enabled.
|
|
|
|
use codex_message_board::LocalBoard;
|
|
use codex_message_board::LocalBoardOptions;
|
|
use codex_protocol::SessionId;
|
|
use codex_state::SqliteConfig;
|
|
|
|
mod delivery;
|
|
mod evidence;
|
|
mod housekeeper;
|
|
mod retrieval_tools;
|
|
mod sampling;
|
|
mod selection;
|
|
mod subscription_tools;
|
|
pub use delivery::DeliveryPlan;
|
|
pub use delivery::DeliveryState;
|
|
pub use evidence::EvidenceCursor;
|
|
pub use evidence::EvidenceId;
|
|
pub use evidence::EvidenceSnapshot;
|
|
pub use evidence::OriginalEvidence;
|
|
pub use housekeeper::HOUSEKEEPER_INSTRUCTIONS;
|
|
pub use housekeeper::HOUSEKEEPER_TIMEOUT;
|
|
pub use housekeeper::Housekeeper;
|
|
pub use retrieval_tools::RetrievalBinding;
|
|
pub use retrieval_tools::install_retrieval_tools;
|
|
pub use sampling::HousekeeperResult;
|
|
pub use sampling::OperationResult;
|
|
pub use selection::CHANNEL_SELECTION_INSTRUCTIONS;
|
|
pub use selection::ReviewerSubscriptions;
|
|
|
|
/// Storage selected by the Guardian consumer for setup, opening and cleanup.
|
|
pub fn local_board_options() -> LocalBoardOptions {
|
|
LocalBoardOptions {
|
|
storage_namespace: "guardian".into(),
|
|
}
|
|
}
|
|
|
|
/// Selects the board for the owning main thread, never the temporary reviewer or housekeeper.
|
|
/// Hosts use a read-write connection; reviewers use a read-only connection, which still
|
|
/// permits their own explicit subscriptions. Cleanup uses the same namespace and root identity.
|
|
pub fn local_board(sqlite: SqliteConfig, root: SessionId) -> LocalBoard {
|
|
LocalBoard::new(sqlite, root).with_options(local_board_options())
|
|
}
|
|
|
|
/// Permanently deletes evidence boards owned by these main threads.
|
|
/// Hosts invoke this only when Guardian V3 is enabled.
|
|
pub async fn delete_local_boards(
|
|
sqlite: &SqliteConfig,
|
|
roots: &[SessionId],
|
|
) -> codex_protocol::error::Result<()> {
|
|
codex_message_board::LocalAgentMessageBoard::delete_boards(
|
|
sqlite,
|
|
&local_board_options(),
|
|
roots,
|
|
)
|
|
.await
|
|
}
|