ag_session/service.rs
1//! Programmatic session orchestration facade and host backend port.
2
3use std::sync::Arc;
4
5use async_trait::async_trait;
6
7use crate::error::SessionError;
8use crate::model::{ReviewRequest, Session, SessionId};
9use crate::{
10 AcceptTaskChainPlanRequest, AcceptTaskPlanRequest, ContinueTaskChainRequest, CreateTaskRequest,
11 ReplyToTaskChainRequest, StartPlanThenImplementRequest, SubmitTaskRequest, Task, TaskChain,
12 TaskChainReplyOutcome,
13};
14
15/// Creation strategy for a new session.
16#[derive(Clone, Debug, Default, Eq, PartialEq)]
17pub enum CreateSessionMode {
18 /// Creates a regular root session with an eagerly materialized worktree.
19 #[default]
20 Regular,
21 /// Creates a root draft whose worktree is materialized on first send.
22 Draft,
23 /// Creates a regular root session that runs on the in-process
24 /// [`crate::AgentKind::Harness`] with its default model.
25 Harness,
26 /// Creates a draft stacked on an existing parent session.
27 Stacked {
28 /// Review-ready parent session whose branch becomes the stack base.
29 parent_session_id: SessionId,
30 },
31}
32
33/// Explicit input for creating one session.
34#[derive(Clone, Debug, Eq, PartialEq)]
35pub struct CreateSessionRequest {
36 /// Existing session whose launch settings should be copied.
37 ///
38 /// When absent, the host resolves the owning project's current defaults.
39 pub inherit_from_session_id: Option<SessionId>,
40 /// Determines whether the session is regular, deferred, or stacked.
41 pub mode: CreateSessionMode,
42 /// Project that owns the new session.
43 pub project_id: i64,
44}
45
46/// One structured response to a persisted clarification question.
47#[derive(Clone, Debug, Eq, PartialEq)]
48pub struct QuestionAnswer {
49 /// User response paired with `question`.
50 pub answer: String,
51 /// Exact persisted question text being answered.
52 pub question: String,
53}
54
55/// Structured input for resuming one session from clarification questions.
56#[derive(Clone, Debug, Eq, PartialEq)]
57pub struct AnswerQuestionsRequest {
58 /// Ordered question and answer pairs for the current question set.
59 pub answers: Vec<QuestionAnswer>,
60}
61
62/// Idempotent turn submitted to one session.
63#[derive(Clone, Debug, Eq, PartialEq)]
64pub struct DurableMessageRequest {
65 /// Agent-facing prompt.
66 pub message: String,
67 /// Stable operation identifier reused when delivery is retried.
68 pub operation_id: String,
69 /// Whether the machine-authored prompt is shown in the human transcript.
70 pub visibility: DurableMessageVisibility,
71}
72
73/// Transcript treatment for one durable prompt.
74#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
75pub enum DurableMessageVisibility {
76 /// Deliver generated context without displaying it as user chat.
77 #[default]
78 Hidden,
79 /// Display the submitted instruction in session history.
80 Visible,
81}
82
83/// Host implementation boundary for session persistence and workflows.
84///
85/// The trait is object-safe so agent loops and background workflows can hold a
86/// programmatic session capability without depending on a concrete frontend.
87#[async_trait]
88pub trait SessionBackend: Send + Sync {
89 /// Reads durable progress without launching or retrying work.
90 async fn get_execution_graph(
91 &self,
92 graph_id: &str,
93 ) -> Result<Option<crate::ExecutionGraphProgress>, SessionError> {
94 let _ = graph_id;
95
96 Err(SessionError::Operation(
97 "Host does not support execution graphs".into(),
98 ))
99 }
100
101 /// Closes graph admission durably, then signals its owned workers.
102 async fn cancel_execution_graph(
103 &self,
104 request: crate::GraphControlRequest,
105 ) -> Result<(), SessionError> {
106 let _ = request;
107
108 Err(SessionError::Operation(
109 "Host does not support execution graphs".into(),
110 ))
111 }
112
113 /// Explicitly restarts dispatch without replaying admitted executions.
114 async fn resume_execution_graph(
115 &self,
116 request: crate::ResumeExecutionGraphRequest,
117 ) -> Result<(), SessionError> {
118 let _ = request;
119
120 Err(SessionError::Operation(
121 "Host does not support execution graphs".into(),
122 ))
123 }
124
125 /// Authorizes one new attempt against an exact failed/question execution.
126 async fn continue_execution_graph_node(
127 &self,
128 request: crate::ContinueGraphNodeRequest,
129 ) -> Result<(), SessionError> {
130 let _ = request;
131
132 Err(SessionError::Operation(
133 "Host does not support execution graphs".into(),
134 ))
135 }
136
137 /// Saves and starts a static graph. Existing admitted nodes are never
138 /// replayed. Named budgets are shared within this graph's live driver.
139 async fn start_execution_graph(
140 &self,
141 request: StartExecutionGraphRequest,
142 ) -> Result<(), SessionError> {
143 let _ = request;
144
145 Err(SessionError::Operation(
146 "Host does not support execution graphs".into(),
147 ))
148 }
149
150 /// Records explicit acceptance of an exact graph output and wakes ready
151 /// dependents. Model output must never call this trusted host boundary.
152 async fn accept_execution_graph_result(
153 &self,
154 reference: crate::GraphResultRef,
155 ) -> Result<(), SessionError> {
156 let _ = reference;
157
158 Err(SessionError::Operation(
159 "Host does not support execution graphs".into(),
160 ))
161 }
162 /// Admits a role-bound attempt with its own isolated conversation.
163 async fn submit_agent_task(
164 &self,
165 session_id: &SessionId,
166 request: crate::SubmitAgentTaskRequest,
167 ) -> Result<(), SessionError> {
168 let _ = (session_id, request);
169
170 Err(SessionError::Operation(
171 "Host does not support role-aware tasks".to_string(),
172 ))
173 }
174
175 /// Reads isolated task responses without exposing host storage types.
176 async fn get_agent_task_history(
177 &self,
178 task_id: &str,
179 ) -> Result<Option<crate::TaskAgentHistory>, SessionError> {
180 let _ = task_id;
181
182 Err(SessionError::Operation(
183 "Host does not support role-aware tasks".to_string(),
184 ))
185 }
186
187 /// Explicitly accepts a standalone Planner response by producing version.
188 async fn accept_agent_plan(
189 &self,
190 _session_id: &SessionId,
191 _request: AcceptTaskPlanRequest,
192 ) -> Result<(), SessionError> {
193 Err(SessionError::Operation(
194 "Host does not support plan acceptance".into(),
195 ))
196 }
197
198 /// Saves and starts the static Planner → Implementer execution graph.
199 async fn start_plan_then_implement(
200 &self,
201 _session_id: &SessionId,
202 _request: StartPlanThenImplementRequest,
203 ) -> Result<(), SessionError> {
204 Err(SessionError::Operation(
205 "Host does not support task chains".to_string(),
206 ))
207 }
208
209 /// Reads a workflow snapshot without recovering or replaying work.
210 async fn get_task_chain(&self, _chain_id: &str) -> Result<Option<TaskChain>, SessionError> {
211 Err(SessionError::Operation(
212 "Host does not support task chains".to_string(),
213 ))
214 }
215
216 /// Lists a session's workflows in creation order.
217 async fn list_task_chains(
218 &self,
219 _session_id: &SessionId,
220 ) -> Result<Vec<TaskChain>, SessionError> {
221 Err(SessionError::Operation(
222 "Host does not support task chains".to_string(),
223 ))
224 }
225
226 /// Explicitly accepts an exact Planner version, releasing implementation.
227 async fn accept_task_chain_plan(
228 &self,
229 _chain_id: &str,
230 _request: AcceptTaskChainPlanRequest,
231 ) -> Result<(), SessionError> {
232 Err(SessionError::Operation(
233 "Host does not support task chains".to_string(),
234 ))
235 }
236
237 /// Explicitly continues the current stage with a new execution UUID.
238 async fn continue_task_chain(
239 &self,
240 _chain_id: &str,
241 _request: ContinueTaskChainRequest,
242 ) -> Result<(), SessionError> {
243 Err(SessionError::Operation(
244 "Host does not support task chains".to_string(),
245 ))
246 }
247
248 /// Cancels only the current stage's execution; the graph stays open.
249 async fn cancel_task_chain(&self, _chain_id: &str) -> Result<(), SessionError> {
250 Err(SessionError::Operation(
251 "Host does not support task chains".to_string(),
252 ))
253 }
254
255 /// Routes a natural-language reply to the session's latest workflow.
256 async fn reply_to_task_chain(
257 &self,
258 _session_id: &SessionId,
259 _request: ReplyToTaskChainRequest,
260 ) -> Result<TaskChainReplyOutcome, SessionError> {
261 Err(SessionError::Operation(
262 "Host does not support task chains".to_string(),
263 ))
264 }
265
266 /// Persists an outcome without execution. Older hosts may omit support.
267 async fn create_task(
268 &self,
269 _session_id: &SessionId,
270 _request: CreateTaskRequest,
271 ) -> Result<(), SessionError> {
272 Err(SessionError::Operation(
273 "Host does not support tasks".to_string(),
274 ))
275 }
276
277 /// Lists a session's tasks, including unattempted and completed outcomes.
278 async fn list_tasks(&self, _session_id: &SessionId) -> Result<Vec<Task>, SessionError> {
279 Err(SessionError::Operation(
280 "Host does not support tasks".to_string(),
281 ))
282 }
283
284 /// Admits an explicit task attempt. Older hosts may omit task support.
285 async fn submit_task(
286 &self,
287 _session_id: &SessionId,
288 _request: SubmitTaskRequest,
289 ) -> Result<(), SessionError> {
290 Err(SessionError::Operation(
291 "Host does not support tasks".to_string(),
292 ))
293 }
294
295 /// Loads the desired outcome and retained attempt history.
296 async fn get_task(&self, _task_id: &str) -> Result<Option<Task>, SessionError> {
297 Err(SessionError::Operation(
298 "Host does not support tasks".to_string(),
299 ))
300 }
301
302 /// Explicitly accepts the task outcome after all attempts have settled.
303 async fn complete_task(&self, _task_id: &str) -> Result<(), SessionError> {
304 Err(SessionError::Operation(
305 "Host does not support tasks".to_string(),
306 ))
307 }
308
309 /// Creates one session and returns its stable identifier.
310 async fn create_session(
311 &self,
312 request: CreateSessionRequest,
313 ) -> Result<SessionId, SessionError>;
314
315 /// Loads one complete session aggregate, including settings and messages.
316 async fn get_session(&self, session_id: &SessionId) -> Result<Option<Session>, SessionError>;
317
318 /// Sends one text message, starting, resuming, or queueing as appropriate.
319 async fn send_message(
320 &self,
321 session_id: &SessionId,
322 message: String,
323 ) -> Result<(), SessionError>;
324
325 /// Submits a durable turn without entering the lossy live-chat
326 /// queue used while an ordinary user turn is active.
327 async fn submit_durable_message(
328 &self,
329 session_id: &SessionId,
330 request: DurableMessageRequest,
331 ) -> Result<(), SessionError>;
332
333 /// Answers the complete current clarification-question set.
334 async fn answer_questions(
335 &self,
336 session_id: &SessionId,
337 request: AnswerQuestionsRequest,
338 ) -> Result<(), SessionError>;
339
340 /// Cancels one session through the host lifecycle workflow.
341 async fn cancel_session(&self, session_id: &SessionId) -> Result<(), SessionError>;
342
343 /// Requests merge processing for one review-ready session.
344 async fn merge_session(&self, session_id: &SessionId) -> Result<(), SessionError>;
345
346 /// Queues publication of one session branch and creates or refreshes its
347 /// review request.
348 async fn create_review_request(
349 &self,
350 session_id: &SessionId,
351 ) -> Result<ReviewRequest, SessionError>;
352}
353
354/// Stable programmatic facade for session lifecycle operations.
355#[derive(Clone)]
356pub struct SessionService {
357 backend: Arc<dyn SessionBackend>,
358}
359
360/// Explicit static-graph launch, separate from ordinary chat and `/plan`.
361#[derive(Clone, Debug, Eq, PartialEq)]
362pub struct StartExecutionGraphRequest {
363 /// Validated immutable snapshot to save before admitting nodes.
364 pub graph: crate::ExecutionGraph,
365 /// Provider calls shared by nodes naming the same budget, including
366 /// repairs. These limits cannot be replenished by redelivering an
367 /// active launch.
368 pub provider_call_limits: std::collections::BTreeMap<String, usize>,
369}
370
371impl SessionService {
372 /// Reads graph/node progress and immutable execution history.
373 ///
374 /// # Errors
375 /// Returns failed persistence or query delivery errors.
376 pub async fn get_execution_graph(
377 &self,
378 graph_id: &str,
379 ) -> Result<Option<crate::ExecutionGraphProgress>, SessionError> {
380 self.backend.get_execution_graph(graph_id).await
381 }
382
383 /// Permanently cancels this graph without canceling unrelated session work.
384 ///
385 /// # Errors
386 /// Rejects missing/stale graphs and failed durable cancellation.
387 pub async fn cancel_execution_graph(
388 &self,
389 request: crate::GraphControlRequest,
390 ) -> Result<(), SessionError> {
391 self.backend.cancel_execution_graph(request).await
392 }
393
394 /// Resumes dispatch explicitly; failed nodes still require a new action.
395 ///
396 /// # Errors
397 /// Rejects canceled/stale graphs, invalid limits, or ineligible sessions.
398 pub async fn resume_execution_graph(
399 &self,
400 request: crate::ResumeExecutionGraphRequest,
401 ) -> Result<(), SessionError> {
402 self.backend.resume_execution_graph(request).await
403 }
404
405 /// Retries a failed node or answers its exact settled clarification set.
406 ///
407 /// # Errors
408 /// Rejects stale sources, partial answers, conflicting action identities,
409 /// canceled graphs, and failed persistence or delivery.
410 pub async fn continue_execution_graph_node(
411 &self,
412 request: crate::ContinueGraphNodeRequest,
413 ) -> Result<(), SessionError> {
414 self.backend.continue_execution_graph_node(request).await
415 }
416
417 /// Starts an explicit static graph without waiting for model execution.
418 ///
419 /// # Errors
420 /// Rejects unsupported profiles, stale/conflicting identities, missing
421 /// budgets, ineligible sessions, and failed persistence or delivery.
422 pub async fn start_execution_graph(
423 &self,
424 request: StartExecutionGraphRequest,
425 ) -> Result<(), SessionError> {
426 self.backend.start_execution_graph(request).await
427 }
428
429 /// Accepts one exact validated output and releases its acceptance gate.
430 ///
431 /// # Errors
432 /// Rejects stale or unvalidated references and failed persistence.
433 pub async fn accept_execution_graph_result(
434 &self,
435 reference: crate::GraphResultRef,
436 ) -> Result<(), SessionError> {
437 self.backend.accept_execution_graph_result(reference).await
438 }
439
440 /// Accepts a standalone Planner version from durable task history.
441 ///
442 /// # Errors
443 /// Returns an error for stale/ineligible versions or failed persistence.
444 pub async fn accept_agent_plan(
445 &self,
446 session_id: &SessionId,
447 request: AcceptTaskPlanRequest,
448 ) -> Result<(), SessionError> {
449 self.backend.accept_agent_plan(session_id, request).await
450 }
451
452 /// Saves the Planner → accepted plan → Implementer execution graph with a
453 /// captured provider/model selection and starts its driver. Matching
454 /// launch redelivery is a receipt.
455 ///
456 /// # Errors
457 /// Returns an error for identity conflicts, ineligible sessions, or failed
458 /// admission.
459 pub async fn start_plan_then_implement(
460 &self,
461 session_id: &SessionId,
462 request: StartPlanThenImplementRequest,
463 ) -> Result<(), SessionError> {
464 self.backend
465 .start_plan_then_implement(session_id, request)
466 .await
467 }
468
469 /// Reads a durable workflow snapshot without dispatching work.
470 ///
471 /// # Errors
472 /// Returns an error when the host cannot read or decode the workflow.
473 pub async fn get_task_chain(&self, chain_id: &str) -> Result<Option<TaskChain>, SessionError> {
474 self.backend.get_task_chain(chain_id).await
475 }
476
477 /// Lists workflows owned by one session.
478 ///
479 /// # Errors
480 /// Returns an error when the host cannot read workflow snapshots.
481 pub async fn list_task_chains(
482 &self,
483 session_id: &SessionId,
484 ) -> Result<Vec<TaskChain>, SessionError> {
485 self.backend.list_task_chains(session_id).await
486 }
487
488 /// Accepts the exact latest validated plan. The graph executor then
489 /// admits the isolated Implementer with that version pinned as input.
490 ///
491 /// # Errors
492 /// Returns an error for stale/ineligible plans, conflicts, or failed
493 /// admission.
494 pub async fn accept_task_chain_plan(
495 &self,
496 chain_id: &str,
497 request: AcceptTaskChainPlanRequest,
498 ) -> Result<(), SessionError> {
499 self.backend.accept_task_chain_plan(chain_id, request).await
500 }
501
502 /// Explicitly revises, clarifies, or retries the current stage through a
503 /// graph continuation. `attempt_id` must be a new UUID.
504 ///
505 /// # Errors
506 /// Returns an error for unfinished or stale attempts, accepted plans,
507 /// conflicts, or failed admission.
508 pub async fn continue_task_chain(
509 &self,
510 chain_id: &str,
511 request: ContinueTaskChainRequest,
512 ) -> Result<(), SessionError> {
513 self.backend.continue_task_chain(chain_id, request).await
514 }
515
516 /// Requests cancellation of this workflow's current execution. The graph
517 /// stays open, so a later continuation may retry the canceled stage.
518 ///
519 /// # Errors
520 /// Returns an error when the workflow is missing or cancellation cannot
521 /// persist.
522 pub async fn cancel_task_chain(&self, chain_id: &str) -> Result<(), SessionError> {
523 self.backend.cancel_task_chain(chain_id).await
524 }
525
526 /// Records a user reply once and lets the host decide what it means.
527 ///
528 /// While a plan awaits acceptance, the host decides through a model run
529 /// whether the reply clearly approves the plan. Only clear approval with
530 /// no requested changes starts the Implementer; anything else, including
531 /// a failed or uncertain decision, revises the plan. In every other
532 /// settled phase the reply continues the current role. Redelivering the
533 /// same `reply_id` returns the original outcome.
534 ///
535 /// # Errors
536 /// Returns [`SessionError::TaskChainNotFound`] when the session owns no
537 /// workflow, [`SessionError::TaskChainBusy`] while an agent is working
538 /// or an earlier reply is being decided, and other errors for invalid
539 /// input, conflicts, or failed admission.
540 pub async fn reply_to_task_chain(
541 &self,
542 session_id: &SessionId,
543 request: ReplyToTaskChainRequest,
544 ) -> Result<TaskChainReplyOutcome, SessionError> {
545 self.backend.reply_to_task_chain(session_id, request).await
546 }
547
548 /// Creates an owned session capability backed by a shared host handle.
549 pub fn new(backend: Arc<dyn SessionBackend>) -> Self {
550 Self { backend }
551 }
552
553 /// Admits an isolated role-bound attempt, acknowledging durable admission.
554 /// Identical redeliveries do not execute again. Task completion is
555 /// explicit.
556 ///
557 /// # Errors
558 /// Returns an error for invalid input, unaccepted implementation plans,
559 /// conflicting identity, or a session unable to accept work.
560 pub async fn submit_agent_task(
561 &self,
562 session_id: &SessionId,
563 request: crate::SubmitAgentTaskRequest,
564 ) -> Result<(), SessionError> {
565 self.backend.submit_agent_task(session_id, request).await
566 }
567
568 /// Reads the task's own responses. Attempt status remains authoritative.
569 ///
570 /// # Errors
571 /// Returns an error when the host cannot load the isolated conversation.
572 pub async fn get_agent_task_history(
573 &self,
574 task_id: &str,
575 ) -> Result<Option<crate::TaskAgentHistory>, SessionError> {
576 self.backend.get_agent_task_history(task_id).await
577 }
578
579 /// Persists a task with zero attempts in an existing session, regardless
580 /// of its execution status. Does not start work or change session state.
581 /// Identical creation requests preserve the task and its history.
582 ///
583 /// # Errors
584 /// Returns an error for empty inputs, conflicting identity, a missing
585 /// session, or a host that cannot persist tasks.
586 pub async fn create_task(
587 &self,
588 session_id: &SessionId,
589 request: CreateTaskRequest,
590 ) -> Result<(), SessionError> {
591 self.backend.create_task(session_id, request).await
592 }
593
594 /// Lists all tasks owned by a session in creation order, including their
595 /// attempt histories in one snapshot. Equal timestamps retain insertion
596 /// order. Returns an empty list for a missing session or one without tasks.
597 ///
598 /// # Errors
599 /// Returns an error when the host cannot read tasks.
600 pub async fn list_tasks(&self, session_id: &SessionId) -> Result<Vec<Task>, SessionError> {
601 self.backend.list_tasks(session_id).await
602 }
603
604 /// Admits one task attempt through the existing serialized session worker.
605 /// Creates the task atomically if it does not already exist.
606 /// Acceptance does not wait for execution or imply task completion.
607 /// Identical deliveries are acknowledged without running again.
608 ///
609 /// # Errors
610 /// Returns an error for conflicting identity, an unavailable host, a
611 /// completed task, or a session that cannot accept a new durable turn.
612 pub async fn submit_task(
613 &self,
614 session_id: &SessionId,
615 request: SubmitTaskRequest,
616 ) -> Result<(), SessionError> {
617 self.backend.submit_task(session_id, request).await
618 }
619
620 /// Loads a task and all its attempts from durable storage.
621 ///
622 /// # Errors
623 /// Returns an error when the host cannot read tasks.
624 pub async fn get_task(&self, task_id: &str) -> Result<Option<Task>, SessionError> {
625 self.backend.get_task(task_id).await
626 }
627
628 /// Explicitly accepts the outcome. Successful model execution alone never
629 /// completes a task. Repeated completion retains its original timestamp.
630 ///
631 /// # Errors
632 /// Returns an error if the task is missing, an attempt is unfinished, or
633 /// the host cannot persist completion.
634 pub async fn complete_task(&self, task_id: &str) -> Result<(), SessionError> {
635 self.backend.complete_task(task_id).await
636 }
637
638 /// Creates one session and returns its stable identifier.
639 ///
640 /// # Errors
641 /// Returns an error when the host cannot create the requested session.
642 pub async fn create_session(
643 &self,
644 request: CreateSessionRequest,
645 ) -> Result<SessionId, SessionError> {
646 self.backend.create_session(request).await
647 }
648
649 /// Loads one complete session aggregate by identifier.
650 ///
651 /// # Errors
652 /// Returns an error when persisted data cannot be loaded or decoded.
653 pub async fn get_session(
654 &self,
655 session_id: &SessionId,
656 ) -> Result<Option<Session>, SessionError> {
657 self.backend.get_session(session_id).await
658 }
659
660 /// Sends a text message to one session.
661 ///
662 /// # Errors
663 /// Returns an error when the session cannot accept or enqueue the message.
664 pub async fn send_message(
665 &self,
666 session_id: &SessionId,
667 message: impl Into<String> + Send,
668 ) -> Result<(), SessionError> {
669 self.backend.send_message(session_id, message.into()).await
670 }
671
672 /// Submits one durable turn directly to the serialized worker.
673 ///
674 /// # Errors
675 /// Returns an error when the session is busy or cannot accept the turn.
676 pub async fn submit_durable_message(
677 &self,
678 session_id: &SessionId,
679 request: DurableMessageRequest,
680 ) -> Result<(), SessionError> {
681 self.backend
682 .submit_durable_message(session_id, request)
683 .await
684 }
685
686 /// Answers the complete current clarification-question set.
687 ///
688 /// # Errors
689 /// Returns an error when the answers are stale, incomplete, or cannot be
690 /// enqueued as a follow-up turn.
691 pub async fn answer_questions(
692 &self,
693 session_id: &SessionId,
694 request: AnswerQuestionsRequest,
695 ) -> Result<(), SessionError> {
696 self.backend.answer_questions(session_id, request).await
697 }
698
699 /// Cancels one session through its host lifecycle workflow.
700 ///
701 /// # Errors
702 /// Returns an error when the session does not exist or cannot be canceled
703 /// in its current state.
704 pub async fn cancel_session(&self, session_id: &SessionId) -> Result<(), SessionError> {
705 self.backend.cancel_session(session_id).await
706 }
707
708 /// Requests merge processing for one session.
709 ///
710 /// # Errors
711 /// Returns an error when the session is not mergeable or queueing fails.
712 pub async fn merge_session(&self, session_id: &SessionId) -> Result<(), SessionError> {
713 self.backend.merge_session(session_id).await
714 }
715
716 /// Queues publication of one session and creates or refreshes its review
717 /// request.
718 ///
719 /// # Errors
720 /// Returns an error when queueing, branch publication, forge access, or
721 /// persistence fails.
722 pub async fn create_review_request(
723 &self,
724 session_id: &SessionId,
725 ) -> Result<ReviewRequest, SessionError> {
726 self.backend.create_review_request(session_id).await
727 }
728}
729
730#[cfg(test)]
731#[path = "service_test.rs"]
732mod tests;