MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / persist_incomplete_refusal

Method persist_incomplete_refusal

atomic-agent/src/turn/orchestrator/mod.rs:730–759  ·  view source on GitHub ↗

Durably persist one incomplete refusal on the session (first writer wins) and index it in the repository session ledger (review R3: the JSON refusal is the crash-safe minimum; the index is best-effort). Returns the authoritative persisted refusal.

(
        &self,
        session: &mut AgentSession,
        incomplete: &IncompleteSession,
    )

Source from the content-addressed store, hash-verified

728 /// JSON refusal is the crash-safe minimum; the index is best-effort).
729 /// Returns the authoritative persisted refusal.
730 pub(crate) fn persist_incomplete_refusal(
731 &self,
732 session: &mut AgentSession,
733 incomplete: &IncompleteSession,
734 ) -> IncompleteSession {
735 let persisted = session.mark_incomplete(incomplete.clone()).clone();
736 match atomic_repository::Repository::open_existing(&self.repo_root).and_then(|repo| {
737 repo.mark_session_incomplete(
738 &session.session_id,
739 Some(session.view_name.clone()),
740 session.parent_view.clone(),
741 &persisted,
742 )
743 }) {
744 Ok(indexed) => {
745 if session.incomplete() != Some(&indexed) {
746 session.status = SessionStatus::Incomplete(indexed);
747 }
748 }
749 Err(error) => {
750 log::warn!(
751 "Could not index incomplete agent session {}: {}; \
752 JSON refusal remains durable",
753 session.session_id,
754 error
755 );
756 }
757 }
758 session.incomplete().cloned().unwrap_or(persisted)
759 }
760
761 // ── Main dispatch ──────────────────────────────────────────────
762

Callers 3

handle_session_endMethod · 0.80
handle_turn_endMethod · 0.80

Calls 4

mark_incompleteMethod · 0.80
cloneMethod · 0.45
incompleteMethod · 0.45

Tested by

no test coverage detected