MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / pending_codex_compaction_summary_requests

Method pending_codex_compaction_summary_requests

src/global_db.rs:2878–2915  ·  view source on GitHub ↗

Returns Codex compaction summary nodes that still need an auxiliary Codex app-server summary.

(
        &self,
        session_id: Option<&str>,
        limit: usize,
    )

Source from the content-addressed store, hash-verified

2876 /// Returns Codex compaction summary nodes that still need an auxiliary
2877 /// Codex app-server summary.
2878 pub async fn pending_codex_compaction_summary_requests(
2879 &self,
2880 session_id: Option<&str>,
2881 limit: usize,
2882 ) -> Result<Vec<PendingCodexCompactionSummary>, crate::sessions::lcm::LcmError> {
2883 let limit = limit.clamp(1, 100) as i64;
2884 let mut sql = String::from(
2885 "SELECT node_id, session_id
2886 FROM lcm_summary_nodes
2887 WHERE provider = 'codex'
2888 AND json_extract(metadata_json, '$.source') = 'codex_context_compacted'
2889 AND COALESCE(
2890 json_extract(metadata_json, '$.tracedecay_summary_source'),
2891 ''
2892 ) <> 'codex_app_server'",
2893 );
2894 let mut query_params = vec![Value::Integer(limit)];
2895 if let Some(session_id) = session_id {
2896 sql.push_str(" AND session_id = ?2 ORDER BY depth DESC, created_at DESC LIMIT ?1");
2897 query_params.push(Value::Text(session_id.to_string()));
2898 } else {
2899 sql.push_str(" ORDER BY created_at DESC, depth DESC LIMIT ?1");
2900 }
2901
2902 let mut rows = self.conn.query(&sql, query_params).await?;
2903 let mut pending = Vec::new();
2904 while let Some(row) = rows.next().await? {
2905 let node_id: String = row.get(0)?;
2906 let row_session_id: String = row.get(1)?;
2907 if let Some(request) = self
2908 .codex_compaction_summary_request_for_node(&node_id, &row_session_id)
2909 .await?
2910 {
2911 pending.push(PendingCodexCompactionSummary { node_id, request });
2912 }
2913 }
2914 Ok(pending)
2915 }
2916
2917 async fn codex_compaction_summary_request_for_node(
2918 &self,

Calls 2

pushMethod · 0.80

Tested by

no test coverage detected