@@ -20,6 +20,14 @@ impl ServerRuntime {
2020 } ;
2121 let session_id = params. session_id ;
2222 let replace_existing = params. replace_existing ;
23+ let title_input = params. objective . trim ( ) . to_string ( ) ;
24+ if !self . sessions . lock ( ) . await . contains_key ( & session_id) {
25+ return self . error_response (
26+ request_id,
27+ ProtocolErrorCode :: SessionNotFound ,
28+ "session does not exist" ,
29+ ) ;
30+ }
2331
2432 let mut stores = self . goal_stores . lock ( ) . await ;
2533 let store = stores. entry ( session_id) . or_insert_with ( GoalStore :: new) ;
@@ -43,6 +51,8 @@ impl ServerRuntime {
4351 tracing:: warn!( session_id = %session_id, error = %error, "failed to persist goal create record" ) ;
4452 }
4553 self . sync_core_session_goal ( session_id, session_goal) . await ;
54+ self . maybe_start_title_generation_from_user_input ( session_id, & title_input)
55+ . await ;
4656 if replace_existing {
4757 self . interrupt_active_goal_continuation_turn ( session_id, "goal replaced" )
4858 . await ;
@@ -77,10 +87,23 @@ impl ServerRuntime {
7787 } ;
7888 let session_id = params. session_id ;
7989 let requested_status = params. status ;
90+ let title_input = params
91+ . objective
92+ . as_deref ( )
93+ . map ( str:: trim)
94+ . filter ( |objective| !objective. is_empty ( ) )
95+ . map ( str:: to_string) ;
8096 let only_pause_budget_limited = requested_status
8197 == Some ( devo_protocol:: ThreadGoalStatus :: Paused )
8298 && params. objective . is_none ( )
8399 && params. token_budget . is_none ( ) ;
100+ if !self . sessions . lock ( ) . await . contains_key ( & session_id) {
101+ return self . error_response (
102+ request_id,
103+ ProtocolErrorCode :: SessionNotFound ,
104+ "session does not exist" ,
105+ ) ;
106+ }
84107
85108 let mut stores = self . goal_stores . lock ( ) . await ;
86109 let store = stores. entry ( session_id) . or_insert_with ( GoalStore :: new) ;
@@ -146,6 +169,10 @@ impl ServerRuntime {
146169 )
147170 . await ;
148171 }
172+ if let Some ( title_input) = title_input {
173+ self . maybe_start_title_generation_from_user_input ( session_id, & title_input)
174+ . await ;
175+ }
149176 if should_continue {
150177 self . maybe_start_goal_continuation_turn ( session_id) . await ;
151178 }
0 commit comments