Skip to content

fix: persist Connection.aiRules through StoredConnection and CloudKit sync#1098

Merged
datlechin merged 1 commit into
mainfrom
fix/ai-rules-persistence
May 7, 2026
Merged

fix: persist Connection.aiRules through StoredConnection and CloudKit sync#1098
datlechin merged 1 commit into
mainfrom
fix/ai-rules-persistence

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

PR #1081 (per-connection AI rules) added aiRules: String? to DatabaseConnection.Codable, but missed two downstream layers:

  1. StoredConnection (private struct in ConnectionStorage.swift) is the on-disk JSON format — separate from DatabaseConnection.Codable. Without aiRules here, the field is silently dropped on every saveConnections / loadConnections round-trip. User-visible bug: set rules in the AI Rules pane, save, relaunch the app — rules are gone.

  2. SyncRecordMapper (Core/Sync/SyncRecordMapper.swift) maps DatabaseConnection to CKRecord for iCloud sync. Without aiRules here, the field never propagates between devices.

This PR adds aiRules to both layers, mirroring the established pattern (e.g. aiPolicy, aiAlwaysAllowedTools from PR E).

Test plan

  • Edit a connection, set custom AI Rules text, click Save.
  • Quit and relaunch the app. Open the connection's AI Rules pane — text persists.
  • On a second iCloud-synced device: connection's AI Rules text matches.
  • Verify the rules are still injected into the chat system prompt for that connection (existing PR G behavior — no regression).

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin datlechin merged commit 1dd6f41 into main May 7, 2026
1 check passed
@datlechin datlechin deleted the fix/ai-rules-persistence branch May 7, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant