@@ -226,6 +226,7 @@ func (s *InMemorySessionStore) UpdateSession(_ context.Context, session *Session
226226 Evals : session .Evals ,
227227 CreatedAt : session .CreatedAt ,
228228 ToolsApproved : session .ToolsApproved ,
229+ SafetyPolicy : session .SafetyPolicy ,
229230 HideToolResults : session .HideToolResults ,
230231 WorkingDir : session .WorkingDir ,
231232 SendUserMessage : session .SendUserMessage ,
@@ -376,7 +377,7 @@ type SQLiteSessionStore struct {
376377// sessionSelectColumns is the canonical SELECT list for the sessions table.
377378// The column order matches what scanSession expects; all read paths use this
378379// constant so that adding a column requires updating exactly one place.
379- const sessionSelectColumns = `id, tools_approved, input_tokens, output_tokens, title, cost, send_user_message, max_iterations, working_dir, created_at, starred, permissions, agent_model_overrides, custom_models_used, thinking, parent_id, instruction_context`
380+ const sessionSelectColumns = `id, tools_approved, safety_policy, input_tokens, output_tokens, title, cost, send_user_message, max_iterations, working_dir, created_at, starred, permissions, agent_model_overrides, custom_models_used, thinking, parent_id, instruction_context`
380381
381382// sessionPersistedFields holds the encoded form of a Session's JSON-bearing
382383// columns plus the SQL representation of parent_id (nil for the empty
@@ -643,11 +644,11 @@ func (s *SQLiteSessionStore) AddSession(ctx context.Context, session *Session) e
643644
644645 _ , err = tx .ExecContext (ctx ,
645646 `INSERT INTO sessions (
646- id, tools_approved, input_tokens, output_tokens, title, cost, send_user_message,
647+ id, tools_approved, safety_policy, input_tokens, output_tokens, title, cost, send_user_message,
647648 max_iterations, working_dir, created_at, permissions, agent_model_overrides,
648649 custom_models_used, thinking, parent_id, instruction_context
649- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` ,
650- session .ID , session .ToolsApproved , session .InputTokens , session .OutputTokens , session .Title ,
650+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )` ,
651+ session .ID , session .ToolsApproved , string ( session . SafetyPolicy ), session .InputTokens , session .OutputTokens , session .Title ,
651652 session .Cost , session .SendUserMessage , session .MaxIterations , session .WorkingDir ,
652653 session .CreatedAt .Format (time .RFC3339 ), fields .PermissionsJSON , fields .AgentModelOverridesJSON ,
653654 fields .CustomModelsUsedJSON , false , fields .ParentID , fields .InstructionContextJSON )
@@ -675,6 +676,7 @@ func scanSession(scanner interface {
675676) (* Session , error ) {
676677 var (
677678 sess Session
679+ safetyPolicy sql.NullString
678680 workingDir sql.NullString
679681 permissionsJSON sql.NullString
680682 parentID sql.NullString
@@ -686,7 +688,7 @@ func scanSession(scanner interface {
686688 )
687689
688690 err := scanner .Scan (
689- & sess .ID , & sess .ToolsApproved , & sess .InputTokens , & sess .OutputTokens ,
691+ & sess .ID , & sess .ToolsApproved , & safetyPolicy , & sess .InputTokens , & sess .OutputTokens ,
690692 & sess .Title , & sess .Cost , & sess .SendUserMessage , & sess .MaxIterations ,
691693 & workingDir , & createdAtStr , & sess .Starred , & permissionsJSON ,
692694 & agentModelOverridesJSON , & customModelsUsedJSON , & thinking , & parentID , & instructionContextJSON ,
@@ -696,6 +698,7 @@ func scanSession(scanner interface {
696698 }
697699
698700 sess .CreatedAt = parseCreatedAt (createdAtStr )
701+ sess .SafetyPolicy = SafetyPolicy (safetyPolicy .String )
699702 sess .WorkingDir = workingDir .String
700703 sess .ParentID = parentID .String
701704
@@ -965,6 +968,7 @@ func (s *SQLiteSessionStore) UpdateSession(ctx context.Context, session *Session
965968 Title : session .Title ,
966969 CreatedAt : session .CreatedAt ,
967970 ToolsApproved : session .ToolsApproved ,
971+ SafetyPolicy : session .SafetyPolicy ,
968972 HideToolResults : session .HideToolResults ,
969973 WorkingDir : session .WorkingDir ,
970974 SendUserMessage : session .SendUserMessage ,
@@ -996,14 +1000,15 @@ func (s *SQLiteSessionStore) UpdateSession(ctx context.Context, session *Session
9961000 // Use INSERT OR REPLACE for upsert behavior - creates if not exists, updates if exists
9971001 _ , err = tx .ExecContext (ctx ,
9981002 `INSERT INTO sessions (
999- id, tools_approved, input_tokens, output_tokens, title, cost, send_user_message,
1003+ id, tools_approved, safety_policy, input_tokens, output_tokens, title, cost, send_user_message,
10001004 max_iterations, working_dir, created_at, starred, permissions, agent_model_overrides,
10011005 custom_models_used, thinking, parent_id, instruction_context
10021006 )
1003- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
1007+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
10041008 ON CONFLICT(id) DO UPDATE SET
10051009 title = excluded.title,
10061010 tools_approved = excluded.tools_approved,
1011+ safety_policy = excluded.safety_policy,
10071012 input_tokens = excluded.input_tokens,
10081013 output_tokens = excluded.output_tokens,
10091014 cost = excluded.cost,
@@ -1017,7 +1022,7 @@ func (s *SQLiteSessionStore) UpdateSession(ctx context.Context, session *Session
10171022 thinking = excluded.thinking,
10181023 parent_id = excluded.parent_id,
10191024 instruction_context = excluded.instruction_context` ,
1020- snapshot .ID , snapshot .ToolsApproved , snapshot .InputTokens , snapshot .OutputTokens ,
1025+ snapshot .ID , snapshot .ToolsApproved , string ( snapshot . SafetyPolicy ), snapshot .InputTokens , snapshot .OutputTokens ,
10211026 snapshot .Title , snapshot .Cost , snapshot .SendUserMessage , snapshot .MaxIterations , snapshot .WorkingDir ,
10221027 snapshot .CreatedAt .Format (time .RFC3339 ), snapshot .Starred , fields .PermissionsJSON , fields .AgentModelOverridesJSON ,
10231028 fields .CustomModelsUsedJSON , false , fields .ParentID , fields .InstructionContextJSON )
@@ -1165,12 +1170,12 @@ func (s *SQLiteSessionStore) addSessionTx(ctx context.Context, tx *sql.Tx, sessi
11651170
11661171 _ , err = tx .ExecContext (ctx ,
11671172 `INSERT INTO sessions (
1168- id, tools_approved, input_tokens, output_tokens, title, cost, send_user_message,
1173+ id, tools_approved, safety_policy, input_tokens, output_tokens, title, cost, send_user_message,
11691174 max_iterations, working_dir, created_at, starred, permissions, agent_model_overrides,
11701175 custom_models_used, thinking, parent_id, instruction_context
11711176 )
1172- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` ,
1173- session .ID , session .ToolsApproved , session .InputTokens , session .OutputTokens ,
1177+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )` ,
1178+ session .ID , session .ToolsApproved , string ( session . SafetyPolicy ), session .InputTokens , session .OutputTokens ,
11741179 session .Title , session .Cost , session .SendUserMessage , session .MaxIterations ,
11751180 session .WorkingDir , session .CreatedAt .Format (time .RFC3339 ), session .Starred ,
11761181 fields .PermissionsJSON , fields .AgentModelOverridesJSON , fields .CustomModelsUsedJSON , false ,
0 commit comments