mirror of
https://github.com/openai/codex.git
synced 2026-11-12 21:20:34 +00:00
Add bounded original-evidence delivery for Guardian reviewers (#60001)
## 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
This commit is contained in:
@@ -87,6 +87,35 @@ impl LocalBoardReadView {
|
||||
.await
|
||||
.map_err(storage_error)
|
||||
}
|
||||
|
||||
/// Reads one page of whole posts in the requested sequence order. Every post must
|
||||
/// belong to this board and fall within the captured boundary.
|
||||
pub async fn read_post_texts(
|
||||
&self,
|
||||
caller: ThreadId,
|
||||
sequences: &[i64],
|
||||
) -> Result<Vec<String>> {
|
||||
self.board.host.agent_path(caller).await?;
|
||||
if sequences.len() > crate::PageRequest::default().limit.get() as usize {
|
||||
return Err(invalid("requested posts exceed one board page"));
|
||||
}
|
||||
// Drive primary-key lookups from the requested page, not from all posts on the board.
|
||||
let texts = sqlx::query_scalar::<_, String>(
|
||||
"SELECT json_extract(p.payload, '$.text') FROM json_each(?) AS requested
|
||||
CROSS JOIN posts AS p
|
||||
WHERE p.seq=requested.value AND p.board=? AND p.seq<=? ORDER BY requested.key",
|
||||
)
|
||||
.bind(serde_json::to_string(sequences).map_err(storage_error)?)
|
||||
.bind(self.board.identity.to_string())
|
||||
.bind(self.view.post_cutoff)
|
||||
.fetch_all(self.board.pool.as_ref())
|
||||
.await
|
||||
.map_err(storage_error)?;
|
||||
if texts.len() != sequences.len() {
|
||||
return Err(invalid("post not found in this board view"));
|
||||
}
|
||||
Ok(texts)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct ReadView {
|
||||
|
||||
Reference in New Issue
Block a user