docs: add comment explaining non-atomic SaveWithModels behavior

Christian Rocha created

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>

Change summary

internal/session/session.go | 5 +++++
1 file changed, 5 insertions(+)

Detailed changes

internal/session/session.go 🔗

@@ -322,6 +322,11 @@ func (s *service) UpdateSessionModels(ctx context.Context, id string, models map
 	return err
 }
 
+// SaveWithModels saves the session and then persists the models column as a
+// second operation. This is intentionally non-atomic: if the models update
+// fails, the session fields are still saved (which is equivalent to the
+// pre-feature behavior where models were never persisted). The next agent turn
+// will retry the models write, so transient failures are self-healing.
 func (s *service) SaveWithModels(ctx context.Context, session Session, models map[config.SelectedModelType]config.SelectedModel) (Session, error) {
 	saved, err := s.Save(ctx, session)
 	if err != nil {