Skip to content

fix: honor quick integrity checks during historical upgrades - #175662

Merged
steipete merged 7 commits into
mainfrom
dbasync/quickpath
Oct 17, 2026
Merged

steipete merged 7 commits into
mainfrom
dbasync/quickpath

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Routine upgrades from historical SQLite schemas silently selected whole-database FULL integrity checks despite the default QUICK policy. On a 6.07 GB stable agent24/state20 fixture, public Doctor executed 12 whole FULL checks and no explicit QUICK check.

User Impact

Ordinary update and Doctor upgrades now use whole-database quick_check, FULL checks of affected tables, and foreign-key validation. --full-integrity-check retains whole-database FULL validation. Explicit backup/database verification, Doctor recovery, rollback-image certification, restore validation, and corruption refusal keep their existing contracts. QUICK receipts cannot satisfy a later FULL request.

This is candidate-side behavior: the installed updater runs first, so this change cannot accelerate work already performed by an older installed updater. No schema, SDK surface, or PostgreSQL behavior changes.

Why This Change Was Made

Historical migration backup eligibility and integrity coverage shared one decision, so a required full-file recovery backup implicitly forced FULL verification. The existing integrity owner now receives a separate cumulative migration-table scope; backup eligibility is unchanged. The requested mode reaches original captures, legacy Doctor/media repairs (including pre-v17 media prerequisites), same-version repairs, ACP inspection, credential relocation, and disposable update rehearsals. Doctor's existing maintenance scope carries that policy through synchronous and asynchronous repair opens and lease cleanup. The integrity worker receives both the mode and table scope. Temporary QUICK repair handles do not publish FULL runtime admission.

The superseded backup-driven FULL selection is removed. History inspection traced this to #174742 (dae099a9414): QUICK eligibility depended on declared migration/backup scope, while undeclared and same-version repairs selected FULL. That was a generic repair policy, not a distinct rollback-certification requirement. This change extends the QUICK default to ordinary historical repairs; explicit recovery and restore certification remain distinct. Accepted edges for the removed implicit checks:

  • Historical/default repair admission: logical index inconsistency in untouched tables may remain undetected until explicit FULL verification. In a pre-v13 source, a corrupt workspace-alias secondary index can leave an attestation-only migrated path NULL; its alias/path and attestation data remain stored, and the existing workspace writer heals the NULL path.
  • Automatic/manual original captures: default capture verification accepts the same untouched-index edge; restore certification remains FULL.
  • Disposable rehearsal images: untouched indexes need not be exhaustively verified; rewritten shared tables remain scoped FULL.
  • Maintenance repair opens and cleanup: inherit the requested coverage; unspecified or out-of-scope callers retain their FULL default.

Structural corruption, affected-table defects, foreign-key violations, and real credential/ownership conflicts still refuse the operation. No foreign-key check was removed.

Evidence

Final candidate: 417c5180c88f61ce01ce80110c30ec59a8b953bc.

The synthetic fixture uses actual stable v2026.10.4 agent24/state20 DDL, 665,600 transcript rows and 1,024 sessions, totaling 6,070,161,408 bytes. Each public Doctor arm runs on a fresh private copy. Completed arms preserve original capture, reach agent31/state27, and preserve relevant row counts plus ordered 100-row hashes. This is bounded preservation proof, not full-corpus byte equality. Times below are observations on a busy host, not controlled speedup claims.

Arm Source Doctor seconds Whole FULL QUICK Scoped FULL FK
Base, default 57314db33e30 319.591 12 0 2 13
Candidate, default cb17486ac75e 294.849 0 16 292 17
Candidate, explicit FULL f4def059a682 310.499 12 0 42 12

The default 6.07 GB result is transparently reused from cb17486: the f4def059 correction changes only FULL/unspecified lease-cleanup policy. Its public Doctor QUICK smoke produces identical check counts (0/16/292/17), and its FULL smoke and 6.07 GB FULL control both produce 12/0/42/12. The final pre-v17 correction cannot run on an agent24 source: both changed call sites require source version <=16. The completed 6.07 GB arms therefore remain applicable, with separate real-v16 regression proof for the final correction. Earlier arms that exposed policy omissions are excluded from this comparison. Explicit FULL measurement source: f4def059a6820da5498ec04d64b540d809224621.

Default native integrity/FK invocations increase 27 → 325, as whole scans become individual affected-table checks. This PR does not claim fewer total SQL statements. Completed live-agent integrity-worker requests remain 1 → 1; that is the traced integrity-worker boundary, not total Doctor requests. The four extra FK checks are repeated live-agent admissions during shared-auth read, shared-auth cleanup, delivery rewrite, and title repair. The trace does not establish unchanged images after identical mutations, so none were removed as duplicates.

Gateway main-thread SQLite in affected owners remains T1 0 → 0; global T1 remains 181 → 181. No warmed-turn SQL/request change is claimed; this is an upgrade-only behavior fix.

Focused regressions fail on base or on the demonstrated omission before correction. They cover historical default versus explicit FULL using real SQLite index corruption, cumulative table scopes, original capture/rehearsal policy, credential and delivery repair, synchronous/asynchronous maintenance inheritance, lease cleanup, and rejection of QUICK-to-FULL receipt promotion. The cleanup regression fails three of four cases before its fix and passes all four afterward. The real pre-v17 regression reproduces both default whole-FULL and explicit-FULL-to-QUICK omissions before correction; both modes and the malformed-transcript rollback case pass afterward.

Final-head CI 39054935606 completed SUCCESS: 138 successful jobs, 22 skipped, zero failures, including all test matrices, PostgreSQL conformance, types, lint, source/export contracts, Madge, and worker/T1/dialect checks. The required CI gate is green. The exact-head published-driver update cell 39054941238 completed SUCCESS: 9 successful jobs, 15 skipped, including its update product exercise. All 16 changed tests appear in the final CI preflight and directly edited-test selection policy; all 97 Node matrix jobs succeeded. Two consolidated-log transport failures prevent a per-file execution-log map, which is not claimed.

The pre-v17 correction exposed two TS2339 diagnostics because its internal parameter type omitted integrityCheck; commit 417c5180c88 fixes that annotation without changing runtime behavior or public database options. The directly affected Doctor typecheck, single-file type-aware lint, formatting, and diff check pass. The pre-v17 policy/rollback regression passes all 3 cases and remains applicable to the type-only correction.

Canonical Knip export scans ran on the exact CI merge 754001c841e2 and its actual main parent 484f36aa09a6: both exit 1 with the same 13 inherited findings (8 production, 5 full-tree, zero scripts), byte-identical logs, and zero new findings. This supersedes the earlier 35-finding result because upstream removed exports and changed scan configuration. The new main findings have been routed to their maintenance owner. No green-Knip claim is made.

Two independent Codex autoreview rounds are complete, with no accepted unresolved finding. The second round's only finding was an index-only version of the old same-version FULL override; the reviewed working-tree successor fixed it. Subsequent measured policy violations were corrected with failing regressions, respecting the two-round cap. The simplification pass reuses existing policy/maintenance owners; no new cache, handshakes, schema or fallback path.

One investigated local tooling failure remains disclosed: the Darwin-only PR worktree provisioner case exceeded its 120 s timeout (164.523 s) on this busy host. Linux skips it, and ordinary macOS PR CI does not select it. No timeout was raised and no full-suite replay is claimed.

The seven SQLite-native STRICT ADD COLUMN checks cost 14.961 s on this baseline and 102.474 s in the prior 43.615 GB measurement. SQLite performs existing-row validation for every STRICT ADD COLUMN, including nullable TEXT/INTEGER/ANY, so no harmless column-definition change avoids them while retaining the canonical schema. No such change is made, and no five-minute large-fixture claim is made.

LOC: 73 files, +1115/-165; production/tooling +504/-88. Most growth is explicit historical table scope and boundary regressions. The full check-by-check evidence below identifies mode, scope, database/image, and elapsed seconds.

Native SQLite observations from one public Doctor run per arm on the same 6.070 GB synthetic stable agent24/state20 corpus. Times are busy-host observations, not a controlled speedup claim.

Arm Request Doctor seconds Whole FULL QUICK Scoped FULL FK
base-private QUICK 319.591 12 0 2 13
candidate-verified-quick QUICK 294.849 0 16 292 17
candidate-final-explicit-full FULL 310.499 12 0 42 12

Summed native check execution below is included in Doctor time; it must not be added again. Totals include every observed phase.

Arm Kind Count Seconds
base-private FULL 12 122.316936
base-private QUICK 0 0.000000
base-private SCOPED-FULL 2 0.000608
base-private FOREIGN-KEY 13 3.894908
base-private ALL 27 126.212452
candidate-verified-quick FULL 0 0.000000
candidate-verified-quick QUICK 16 93.835364
candidate-verified-quick SCOPED-FULL 292 17.698505
candidate-verified-quick FOREIGN-KEY 17 6.465107
candidate-verified-quick ALL 325 117.998976
candidate-final-explicit-full FULL 12 113.386605
candidate-final-explicit-full QUICK 0 0.000000
candidate-final-explicit-full SCOPED-FULL 42 4.056741
candidate-final-explicit-full FOREIGN-KEY 12 3.822464
candidate-final-explicit-full ALL 66 121.265810

Completed live-agent integrity-worker IPC requests: base-private = 1, candidate-verified-quick = 1, candidate-final-explicit-full = 1. This narrowly counts the existing integrity worker reports; it is not total Doctor SQL requests. Snapshot children and synchronous checks are separate.

base-private: every native integrity/FK check

Source: 57314db33e30d3a828c43ef7d6a672952bf8500d. Final schema: agent 31, state 27.

Labels distinguish capture/snapshot paths from live database paths within this arm. Repeated live labels can span migrations or mutations; they do not assert unchanged physical-image identity. Raw evidence retains exact paths and caller stacks.

# Kind Scope Database/image Seconds
1 FULL whole original capture: agent 3.334820
2 FOREIGN-KEY whole original capture: agent 0.697315
3 FULL whole original capture: state 0.011426
4 FOREIGN-KEY whole original capture: state 0.000168
5 FULL whole live state 0.367390
6 FOREIGN-KEY whole live state 0.000141
7 FULL whole read-only image 1 54.437817
8 FOREIGN-KEY whole read-only image 1 0.746213
9 FULL whole historical recovery publication: agent 3.761610
10 FOREIGN-KEY whole historical recovery publication: agent 0.748183
11 FULL whole read-only image 2 0.463951
12 FOREIGN-KEY whole read-only image 2 0.000114
13 FULL whole historical recovery publication: state 0.014536
14 FOREIGN-KEY whole historical recovery publication: state 0.001250
15 FULL whole live state 0.012396
16 FOREIGN-KEY whole live state 0.000184
17 FULL whole live state 0.012740
18 FOREIGN-KEY whole live state 0.000159
19 FULL whole live agent 59.875705
20 FOREIGN-KEY whole live agent 0.856962
21 FULL cache_entries live agent 0.000543
22 FULL trajectory_runtime_events live agent 0.000065
23 FOREIGN-KEY whole live agent 0.844046
24 FULL whole read-only image 3 0.012531
25 FOREIGN-KEY whole read-only image 3 0.000098
26 FULL whole live state 0.012014
27 FOREIGN-KEY whole live state 0.000075

Observed phases: doctor-flow (27).

candidate-verified-quick: every native integrity/FK check

Source: cb17486ac75ed74c12dedb9d8fd8c18f8b19fe58. Final schema: agent 31, state 27.

Labels distinguish capture/snapshot paths from live database paths within this arm. Repeated live labels can span migrations or mutations; they do not assert unchanged physical-image identity. Raw evidence retains exact paths and caller stacks.

# Kind Scope Database/image Seconds
1 QUICK whole original capture: agent 1.526122
2 FOREIGN-KEY whole original capture: agent 0.718100
3 QUICK whole original capture: state 0.009724
4 FOREIGN-KEY whole original capture: state 0.000125
5 QUICK whole live state 0.389895
6 FULL acp_replay_events live state 0.000132
7 FULL acp_sessions live state 0.000305
8 FULL config_machine_state live state 0.000438
9 FULL cron_run_receipts live state 0.000109
10 FULL delivery_queue_entries live state 0.000426
11 FULL execution_decision_facts live state 0.000354
12 FULL meeting_transcript_sessions live state 0.000076
13 FULL meeting_transcript_summaries live state 0.000363
14 FULL operator_approvals live state 0.000714
15 FULL schema_meta live state 0.000668
16 FULL session_state_heads live state 0.000409
17 FULL skill_usage live state 0.000535
18 FULL sqlite_stat1 live state 0.000375
19 FULL sqlite_stat4 live state 0.000105
20 FULL state_leases live state 0.000121
21 FULL task_runs live state 0.000089
22 FOREIGN-KEY whole live state 0.000088
23 QUICK whole read-only image 1 43.144222
24 FULL auth_profile_state read-only image 1 0.000084
25 FULL auth_profile_store read-only image 1 0.000077
26 FULL context_engine_turn_outbox read-only image 1 0.000065
27 FULL memory_entry_origins read-only image 1 0.000674
28 FULL memory_index_chunk_provenance read-only image 1 0.000074
29 FULL memory_index_chunk_recall_metadata read-only image 1 0.000062
30 FULL memory_index_chunks read-only image 1 0.000051
31 FULL memory_index_sources read-only image 1 0.000044
32 FULL memory_index_state read-only image 1 0.000037
33 FULL schema_meta read-only image 1 0.000039
34 FULL session_canonical_validation_pending read-only image 1 0.000272
35 FULL session_conversations read-only image 1 0.000039
36 FULL session_entry_snapshots read-only image 1 0.000225
37 FULL session_key_contract read-only image 1 0.000137
38 FULL session_nodes read-only image 1 0.002193
39 FULL session_pending_inputs read-only image 1 0.000092
40 FULL session_reactions read-only image 1 0.000257
41 FULL session_transcript_active_events read-only image 1 0.667357
42 FULL session_windows read-only image 1 0.001388
43 FULL sqlite_stat1 read-only image 1 0.000049
44 FULL sqlite_stat4 read-only image 1 0.000100
45 FULL trajectory_runtime_events read-only image 1 0.000053
46 FULL transcript_event_identities read-only image 1 1.276557
47 FULL transcript_events read-only image 1 1.468963
48 FOREIGN-KEY whole read-only image 1 0.696431
49 QUICK whole historical recovery publication: agent 1.581819
50 FULL auth_profile_state historical recovery publication: agent 0.000109
51 FULL auth_profile_store historical recovery publication: agent 0.000272
52 FULL context_engine_turn_outbox historical recovery publication: agent 0.000080
53 FULL memory_entry_origins historical recovery publication: agent 0.000673
54 FULL memory_index_chunk_provenance historical recovery publication: agent 0.000048
55 FULL memory_index_chunk_recall_metadata historical recovery publication: agent 0.000061
56 FULL memory_index_chunks historical recovery publication: agent 0.000050
57 FULL memory_index_sources historical recovery publication: agent 0.000300
58 FULL memory_index_state historical recovery publication: agent 0.000178
59 FULL schema_meta historical recovery publication: agent 0.000275
60 FULL session_canonical_validation_pending historical recovery publication: agent 0.000472
61 FULL session_conversations historical recovery publication: agent 0.000217
62 FULL session_entry_snapshots historical recovery publication: agent 0.000189
63 FULL session_key_contract historical recovery publication: agent 0.000073
64 FULL session_nodes historical recovery publication: agent 0.002098
65 FULL session_pending_inputs historical recovery publication: agent 0.000056
66 FULL session_reactions historical recovery publication: agent 0.000229
67 FULL session_transcript_active_events historical recovery publication: agent 0.667721
68 FULL session_windows historical recovery publication: agent 0.001404
69 FULL sqlite_stat1 historical recovery publication: agent 0.001753
70 FULL sqlite_stat4 historical recovery publication: agent 0.000148
71 FULL trajectory_runtime_events historical recovery publication: agent 0.000070
72 FULL transcript_event_identities historical recovery publication: agent 1.277246
73 FULL transcript_events historical recovery publication: agent 1.461394
74 FOREIGN-KEY whole historical recovery publication: agent 0.697917
75 QUICK whole read-only image 2 0.357372
76 FULL acp_replay_events read-only image 2 0.000066
77 FULL acp_sessions read-only image 2 0.000061
78 FULL config_machine_state read-only image 2 0.000284
79 FULL cron_run_receipts read-only image 2 0.000103
80 FULL delivery_queue_entries read-only image 2 0.000093
81 FULL execution_decision_facts read-only image 2 0.000359
82 FULL meeting_transcript_sessions read-only image 2 0.000381
83 FULL meeting_transcript_summaries read-only image 2 0.000061
84 FULL operator_approvals read-only image 2 0.000055
85 FULL schema_meta read-only image 2 0.000047
86 FULL session_state_heads read-only image 2 0.000331
87 FULL skill_usage read-only image 2 0.000045
88 FULL sqlite_stat1 read-only image 2 0.000060
89 FULL sqlite_stat4 read-only image 2 0.000041
90 FULL state_leases read-only image 2 0.000043
91 FULL task_runs read-only image 2 0.000051
92 FOREIGN-KEY whole read-only image 2 0.000084
93 QUICK whole historical recovery publication: state 0.009988
94 FULL acp_replay_events historical recovery publication: state 0.000109
95 FULL acp_sessions historical recovery publication: state 0.000052
96 FULL config_machine_state historical recovery publication: state 0.000063
97 FULL cron_run_receipts historical recovery publication: state 0.000102
98 FULL delivery_queue_entries historical recovery publication: state 0.000079
99 FULL execution_decision_facts historical recovery publication: state 0.000146
100 FULL meeting_transcript_sessions historical recovery publication: state 0.000155
101 FULL meeting_transcript_summaries historical recovery publication: state 0.000059
102 FULL operator_approvals historical recovery publication: state 0.000282
103 FULL schema_meta historical recovery publication: state 0.000281
104 FULL session_state_heads historical recovery publication: state 0.000326
105 FULL skill_usage historical recovery publication: state 0.000113
106 FULL sqlite_stat1 historical recovery publication: state 0.000078
107 FULL sqlite_stat4 historical recovery publication: state 0.000062
108 FULL state_leases historical recovery publication: state 0.000054
109 FULL task_runs historical recovery publication: state 0.000079
110 FOREIGN-KEY whole historical recovery publication: state 0.000082
111 QUICK whole live state 0.010481
112 FULL acp_replay_events live state 0.000067
113 FULL acp_sessions live state 0.000050
114 FULL config_machine_state live state 0.000044
115 FULL cron_run_receipts live state 0.000066
116 FULL delivery_queue_entries live state 0.000077
117 FULL execution_decision_facts live state 0.000083
118 FULL meeting_transcript_sessions live state 0.000055
119 FULL meeting_transcript_summaries live state 0.000049
120 FULL operator_approvals live state 0.000061
121 FULL schema_meta live state 0.000098
122 FULL session_state_heads live state 0.000346
123 FULL skill_usage live state 0.000046
124 FULL sqlite_stat1 live state 0.000047
125 FULL sqlite_stat4 live state 0.000053
126 FULL state_leases live state 0.000208
127 FULL task_runs live state 0.000245
128 FOREIGN-KEY whole live state 0.000107
129 FULL acp_replay_events live state 0.000200
130 FULL acp_sessions live state 0.000052
131 FULL config_machine_state live state 0.000069
132 FULL cron_run_receipts live state 0.000047
133 FULL delivery_queue_entries live state 0.000044
134 FULL execution_decision_facts live state 0.000111
135 FULL meeting_transcript_sessions live state 0.000048
136 FULL meeting_transcript_summaries live state 0.000038
137 FULL operator_approvals live state 0.000039
138 FULL schema_meta live state 0.000057
139 FULL session_state_heads live state 0.000147
140 FULL skill_usage live state 0.000046
141 FULL sqlite_stat1 live state 0.000042
142 FULL sqlite_stat4 live state 0.000052
143 FULL state_leases live state 0.000075
144 FULL task_runs live state 0.000092
145 QUICK whole live state 0.010704
146 FULL acp_replay_events live state 0.000096
147 FULL acp_replay_sessions live state 0.000056
148 FULL apns_registrations live state 0.000084
149 FULL audit_events live state 0.000088
150 FULL audit_identity_keys live state 0.000049
151 FULL claw_installs live state 0.000074
152 FULL claw_package_refs live state 0.000053
153 FULL config_machine_state live state 0.000058
154 FULL cron_jobs live state 0.000067
155 FULL current_conversation_bindings live state 0.000079
156 FULL delivery_queue_entries live state 0.000146
157 FULL device_bootstrap_tokens live state 0.000046
158 FULL device_pairing_paired live state 0.000048
159 FULL device_pairing_pending live state 0.000048
160 FULL diagnostic_events live state 0.000052
161 FULL gateway_boot_lifecycle live state 0.000053
162 FULL gateway_restart_handoff live state 0.000078
163 FULL gateway_restart_intent live state 0.000351
164 FULL gateway_restart_sentinel live state 0.000063
165 FULL managed_outgoing_image_records live state 0.000050
166 FULL migration_runs live state 0.000050
167 FULL official_external_plugin_catalog_snapshots live state 0.000074
168 FULL operator_approvals live state 0.000097
169 FULL sandbox_registry_entries live state 0.000060
170 FULL schema_meta live state 0.000060
171 FULL secret_store_entries live state 0.000049
172 FULL session_watch_cursors live state 0.000055
173 FULL sqlite_sequence live state 0.000063
174 FULL sqlite_stat1 live state 0.000058
175 FULL sqlite_stat4 live state 0.000065
176 FULL subagent_runs live state 0.000060
177 FULL task_runs live state 0.000071
178 FULL user_profile_identities live state 0.000139
179 FULL worker_environments live state 0.000083
180 FULL worker_session_placements live state 0.000063
181 FULL worker_session_tool_operations live state 0.000048
182 FULL worker_turn_tool_authorities live state 0.000069
183 FULL worker_workspace_pending_results live state 0.000048
184 FULL worktrees live state 0.000063
185 FOREIGN-KEY whole live state 0.000147
186 QUICK whole live agent 40.268715
187 FULL auth_profile_state live agent 0.000169
188 FULL auth_profile_store live agent 0.000275
189 FULL context_engine_turn_outbox live agent 0.000339
190 FULL memory_entry_origins live agent 0.001056
191 FULL memory_index_chunk_provenance live agent 0.001044
192 FULL memory_index_chunk_recall_metadata live agent 0.000833
193 FULL memory_index_chunks live agent 0.000082
194 FULL memory_index_sources live agent 0.000574
195 FULL memory_index_state live agent 0.000237
196 FULL schema_meta live agent 0.000460
197 FULL session_canonical_validation_pending live agent 0.000897
198 FULL session_conversations live agent 0.000592
199 FULL session_entry_snapshots live agent 0.000085
200 FULL session_key_contract live agent 0.000564
201 FULL session_nodes live agent 0.002285
202 FULL session_pending_inputs live agent 0.000262
203 FULL session_reactions live agent 0.000770
204 FULL session_transcript_active_events live agent 0.686684
205 FULL session_windows live agent 0.001471
206 FULL sqlite_stat1 live agent 0.000285
207 FULL sqlite_stat4 live agent 0.000226
208 FULL trajectory_runtime_events live agent 0.000192
209 FULL transcript_event_identities live agent 1.346829
210 FULL transcript_events live agent 2.123342
211 FOREIGN-KEY whole live agent 0.797557
212 FULL cache_entries live agent 0.000152
213 FULL trajectory_runtime_events live agent 0.000072
214 FULL auth_profile_state live agent 0.000103
215 FULL auth_profile_store live agent 0.000076
216 FULL context_engine_turn_outbox live agent 0.000045
217 FULL memory_entry_origins live agent 0.000845
218 FULL memory_index_chunk_provenance live agent 0.000057
219 FULL memory_index_chunk_recall_metadata live agent 0.000047
220 FULL memory_index_chunks live agent 0.000078
221 FULL memory_index_sources live agent 0.000064
222 FULL memory_index_state live agent 0.000078
223 FULL schema_meta live agent 0.000056
224 FULL session_canonical_validation_pending live agent 0.000284
225 FULL session_conversations live agent 0.000157
226 FULL session_entry_snapshots live agent 0.000066
227 FULL session_key_contract live agent 0.000048
228 FULL session_nodes live agent 0.001840
229 FULL session_pending_inputs live agent 0.000054
230 FULL session_reactions live agent 0.000064
231 FULL session_transcript_active_events live agent 0.721656
232 FULL session_windows live agent 0.002456
233 FULL sqlite_stat1 live agent 0.000049
234 FULL sqlite_stat4 live agent 0.000114
235 FULL trajectory_runtime_events live agent 0.000081
236 FULL transcript_event_identities live agent 1.021175
237 FULL transcript_events live agent 2.174759
238 FOREIGN-KEY whole live agent 0.787376
239 QUICK whole live agent 1.621310
240 FULL auth_profile_state live agent 0.000104
241 FULL auth_profile_store live agent 0.000055
242 FULL memory_index_chunk_provenance live agent 0.000104
243 FULL memory_index_chunk_recall_metadata live agent 0.000083
244 FULL memory_index_chunks live agent 0.000067
245 FULL memory_index_sources live agent 0.000093
246 FULL memory_index_state live agent 0.000098
247 FULL schema_meta live agent 0.000094
248 FULL session_canonical_validation_pending live agent 0.000308
249 FULL session_conversations live agent 0.000061
250 FULL session_entry_snapshots live agent 0.000052
251 FULL session_key_contract live agent 0.000082
252 FULL session_nodes live agent 0.001894
253 FULL session_pending_inputs live agent 0.000154
254 FULL session_transcript_active_events live agent 0.683093
255 FULL session_windows live agent 0.002528
256 FULL sqlite_stat1 live agent 0.000104
257 FULL sqlite_stat4 live agent 0.000150
258 FOREIGN-KEY whole live agent 0.693672
259 QUICK whole live agent 1.622453
260 FULL auth_profile_state live agent 0.000074
261 FULL auth_profile_store live agent 0.000054
262 FULL memory_index_chunk_provenance live agent 0.000048
263 FULL memory_index_chunk_recall_metadata live agent 0.000185
264 FULL memory_index_chunks live agent 0.000085
265 FULL memory_index_sources live agent 0.000063
266 FULL memory_index_state live agent 0.000065
267 FULL schema_meta live agent 0.000057
268 FULL session_canonical_validation_pending live agent 0.000325
269 FULL session_conversations live agent 0.000056
270 FULL session_entry_snapshots live agent 0.000137
271 FULL session_key_contract live agent 0.000089
272 FULL session_nodes live agent 0.001900
273 FULL session_pending_inputs live agent 0.000060
274 FULL session_transcript_active_events live agent 0.680645
275 FULL session_windows live agent 0.002498
276 FULL sqlite_stat1 live agent 0.000081
277 FULL sqlite_stat4 live agent 0.000127
278 FOREIGN-KEY whole live agent 0.686278
279 QUICK whole live agent 1.641741
280 FULL auth_profile_state live agent 0.000074
281 FULL auth_profile_store live agent 0.000053
282 FULL memory_index_chunk_provenance live agent 0.000085
283 FULL memory_index_chunk_recall_metadata live agent 0.000090
284 FULL memory_index_chunks live agent 0.000066
285 FULL memory_index_sources live agent 0.000109
286 FULL memory_index_state live agent 0.000080
287 FULL schema_meta live agent 0.000100
288 FULL session_canonical_validation_pending live agent 0.000326
289 FULL session_conversations live agent 0.000095
290 FULL session_entry_snapshots live agent 0.000066
291 FULL session_key_contract live agent 0.000058
292 FULL session_nodes live agent 0.001896
293 FULL session_pending_inputs live agent 0.000068
294 FULL session_transcript_active_events live agent 0.685548
295 FULL session_windows live agent 0.002559
296 FULL sqlite_stat1 live agent 0.000092
297 FULL sqlite_stat4 live agent 0.000162
298 FOREIGN-KEY whole live agent 0.695715
299 QUICK whole read-only image 3 0.011515
300 FOREIGN-KEY whole read-only image 3 0.000114
301 QUICK whole live agent 1.618501
302 FULL auth_profile_state live agent 0.000089
303 FULL auth_profile_store live agent 0.000084
304 FULL memory_index_chunk_provenance live agent 0.000062
305 FULL memory_index_chunk_recall_metadata live agent 0.000062
306 FULL memory_index_chunks live agent 0.000056
307 FULL memory_index_sources live agent 0.000074
308 FULL memory_index_state live agent 0.000060
309 FULL schema_meta live agent 0.000086
310 FULL session_canonical_validation_pending live agent 0.000304
311 FULL session_conversations live agent 0.000050
312 FULL session_entry_snapshots live agent 0.000053
313 FULL session_key_contract live agent 0.000090
314 FULL session_nodes live agent 0.001917
315 FULL session_pending_inputs live agent 0.000068
316 FULL session_transcript_active_events live agent 0.682156
317 FULL session_windows live agent 0.002553
318 FULL sqlite_stat1 live agent 0.000063
319 FULL sqlite_stat4 live agent 0.000113
320 FOREIGN-KEY whole live agent 0.691207
321 QUICK whole live state 0.010802
322 FULL agent_database_leases live state 0.000170
323 FULL schema_meta live state 0.000068
324 FULL state_leases live state 0.000085
325 FOREIGN-KEY whole live state 0.000107

Observed phases: doctor-flow (325).

candidate-final-explicit-full: every native integrity/FK check

Source: f4def059a6820da5498ec04d64b540d809224621. Final schema: agent 31, state 27.

Labels distinguish capture/snapshot paths from live database paths within this arm. Repeated live labels can span migrations or mutations; they do not assert unchanged physical-image identity. Raw evidence retains exact paths and caller stacks.

# Kind Scope Database/image Seconds
1 FULL whole original capture: agent 3.891282
2 FOREIGN-KEY whole original capture: agent 0.750627
3 FULL whole original capture: state 0.010966
4 FOREIGN-KEY whole original capture: state 0.000286
5 FULL whole live state 0.367705
6 FULL whole read-only image 1 55.252472
7 FOREIGN-KEY whole read-only image 1 0.739670
8 FULL whole historical recovery publication: agent 3.688968
9 FOREIGN-KEY whole historical recovery publication: agent 0.718051
10 FULL whole read-only image 2 0.368152
11 FOREIGN-KEY whole read-only image 2 0.000135
12 FULL whole historical recovery publication: state 0.012076
13 FOREIGN-KEY whole historical recovery publication: state 0.000193
14 FULL whole live state 0.012388
15 FOREIGN-KEY whole live state 0.000102
16 FULL acp_replay_events live state 0.000200
17 FULL acp_sessions live state 0.000640
18 FULL config_machine_state live state 0.000270
19 FULL cron_run_receipts live state 0.000414
20 FULL delivery_queue_entries live state 0.000068
21 FULL execution_decision_facts live state 0.000056
22 FULL meeting_transcript_sessions live state 0.000084
23 FULL meeting_transcript_summaries live state 0.000452
24 FULL operator_approvals live state 0.000088
25 FULL schema_meta live state 0.000073
26 FULL session_state_heads live state 0.000184
27 FULL skill_usage live state 0.000078
28 FULL sqlite_stat1 live state 0.000050
29 FULL sqlite_stat4 live state 0.000080
30 FULL state_leases live state 0.000100
31 FULL task_runs live state 0.000053
32 FULL whole live state 0.012755
33 FOREIGN-KEY whole live state 0.000090
34 FULL whole live agent 49.746394
35 FOREIGN-KEY whole live agent 0.801148
36 FULL cache_entries live agent 0.000152
37 FULL trajectory_runtime_events live agent 0.000047
38 FULL auth_profile_state live agent 0.000189
39 FULL auth_profile_store live agent 0.000047
40 FULL context_engine_turn_outbox live agent 0.000083
41 FULL memory_entry_origins live agent 0.000978
42 FULL memory_index_chunk_provenance live agent 0.000071
43 FULL memory_index_chunk_recall_metadata live agent 0.000058
44 FULL memory_index_chunks live agent 0.000084
45 FULL memory_index_sources live agent 0.000059
46 FULL memory_index_state live agent 0.000085
47 FULL schema_meta live agent 0.000056
48 FULL session_canonical_validation_pending live agent 0.000319
49 FULL session_conversations live agent 0.000180
50 FULL session_entry_snapshots live agent 0.000235
51 FULL session_key_contract live agent 0.000063
52 FULL session_nodes live agent 0.001878
53 FULL session_pending_inputs live agent 0.000053
54 FULL session_reactions live agent 0.000060
55 FULL session_transcript_active_events live agent 0.688286
56 FULL session_windows live agent 0.002647
57 FULL sqlite_stat1 live agent 0.000090
58 FULL sqlite_stat4 live agent 0.000113
59 FULL trajectory_runtime_events live agent 0.000050
60 FULL transcript_event_identities live agent 1.055380
61 FULL transcript_events live agent 2.302588
62 FOREIGN-KEY whole live agent 0.811983
63 FULL whole read-only image 3 0.011842
64 FOREIGN-KEY whole read-only image 3 0.000102
65 FULL whole live state 0.011605
66 FOREIGN-KEY whole live state 0.000077

Observed phases: doctor-flow (66).

Each arm retained its original capture, reached current agent/state schema versions, and preserved transcript/identity/origin counts and ordered 100-row sample hashes plus state-head/event counts and samples. This is bounded preservation proof, not whole-corpus byte equality.

Candidate-side behavior: these runs invoke the public Doctor command with repair/noninteractive and optional fullIntegrityCheck. An installed updater executes first in ordinary updates; candidate Doctor changes do not accelerate that already-installed updater. Optional UI sources/assets are absent in the same minimal runtime shape for every arm.

The 6.070 GB QUICK result was measured at cb17486 and is reused transparently for the FULL-control head f4def05. The f4def05 change makes lease cleanup follow the maintenance scope mode; its selected QUICK path is unchanged. The f4def05 public Doctor smoke tests passed in both modes with preserved data, and default QUICK exactly matched the prior 16 QUICK / 292 scoped FULL / 17 FK / zero whole FULL counts. Explicit FULL at f4def05 is measured again on the medium fixture. Later pre-v17 fixes cannot execute on this agent24 source; the final 417c518 type annotation changes no runtime behavior.

Setup failures, intermediate candidates that failed integrity-mode policy, and an interrupted run are excluded from this final comparison.

This 6.070 GB synthetic fixture does not establish the five-minute target for the earlier 43.6 GB corpus.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T17:32:04.241520Z 2257026 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes commands Command implementations size: L labels Oct 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a24b4bf1b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

});
writeCurrentStateSchemaMetadata(db, now);
assertOpenClawStateDatabaseForMaintenance(db, { pathname });
assertMigratedStateTableIntegrity(db, pathname, previousVersion, true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit post-migration checks to tables actually affected

For a canonical recent upgrade such as shared-state v26→v27, passing true unions every historical repair table into the post-migration checks, so assertSqliteTableIntegrity performs full scans of unrelated tables such as audit_events and subagent_runs even though the v27 migration only changes the replay, skill-usage, and lease indexes. Large installations therefore still incur potentially expensive unrelated full-index scans during the default QUICK upgrade path; track which historical repairs actually ran or omit the historical union for this runtime migration path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The canonical v26-to-v27 path returns earlier through migrateBoundedStateSchema and calls assertMigratedStateTableIntegrity with its default historicalRepair = false. It does not reach the cited call with true. That wider scope is reached only when the bounded path is unavailable and the historical convergence helpers run. No change is needed for the canonical recent-upgrade example.

Comment thread docs/install/updating.md Outdated
Comment on lines +59 to +61
honor the requested check. Same-version Doctor repairs, automatic rollback
images, restore validation, and legacy transformed recovery archives retain full
integrity checks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correct the stated same-version Doctor integrity policy

This says same-version Doctor repairs retain full checks, but the new resolver returns QUICK plus the historical-repair table scope when foundVersion === supportedVersion, and the updated current-schema test explicitly allows an untouched corrupt index to remain unless FULL is requested. An operator relying on this paragraph may run doctor --fix believing the whole database was verified; document that ordinary same-version repair is QUICK by default and requires --full-integrity-check for whole-database coverage.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Separates migration integrity coverage from backup eligibility and carries the requested QUICK or FULL policy through Doctor and update preparation.

Example: Run openclaw doctor --fix on an agent database at schema version 24.

  • Before: Historical backup requirements force whole-database FULL verification despite the default QUICK policy.
  • After: Admission uses whole-database QUICK, affected-table FULL checks, and foreign-key validation while retaining the required recovery backup.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The design has clear value, but documentation and CI contract defects remain, and required final-head upgrade evidence is pending.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Historical upgrades still perform expensive whole-database index verification despite selecting the default QUICK policy.
Reason: The feature-history owner authored the direction and explicitly accepts the narrower integrity coverage while retaining recovery safeguards.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: this maintainer-authored PR addresses unnecessary full scans, but the same-version documentation and a diff-caused test failure need correction.

Priority: P2
Reviewed head: a24b4bf1b9c083dbd08cbee414414107aada0a9f

Before merge

  • Document QUICK defaults for same-version Doctor repairs (P2) - This paragraph still says same-version Doctor repairs retain full integrity checks. The new resolver instead returns QUICK plus historical repair tables when foundVersion equals supportedVersion, and the updated current-schema test permits an untouched corrupt index under the default. An operator following this guide can therefore mistake successful doctor --fix output for whole-database verification. State the QUICK default and the need for --full-integrity-check here, consistent with the other updated references. This confirms the concern in fix: honor quick integrity checks during historical upgrades #175662 (comment).
  • Request FULL coverage in the existing corruption-recovery regression (P2) - Changing same-version admission to QUICK leaves the unrecorded-corruption variant of this existing test incompatible with the intended policy: unsafe_index_records_value is outside the repair scope, so default repair returns no changes instead of the asserted backup and rebuild. Exact-head CI check 117441024704 reports this failure at this assertion. Make the unrecorded-corruption recovery case request explicit FULL coverage, retaining the recorded-corruption case as a default-mode recovery check and preserving the separate QUICK-default regression.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Document QUICK defaults for same-version Doctor repairs — docs/install/updating.md:59-61
  • [P2] Request FULL coverage in the existing corruption-recovery regression — src/state/openclaw-state-db.test.ts:2336-2343

Tests

  • Missing end-to-end proof: Complete the final-head default/FULL public Doctor and published v2026.10.4 updater scenarios with retained settings, row preservation, integrity traces, and successful subsequent admission.
Agent review details

How this fits together

Doctor and updater maintenance receive integrity options, preserve recovery images, validate SQLite databases, and pass admitted state to schema migration owners.

flowchart TD
  A[Doctor or update CLI] --> B[Maintenance owner]
  B --> C[Recovery capture]
  B --> D[Integrity policy]
  D --> E[SQLite validation workers]
  E --> F[Schema migration owners]
  F --> G[Runtime admission]
Loading

Technical review

Best possible solution:

Retain separate backup and integrity policies, correct the same-version contract and regression expectation, and complete the historical upgrade evidence.

Do we have a high-confidence way to reproduce the issue?

Current-main source deterministically selects FULL for historical migrations without scoped-backup declarations, and the PR reports a matching public Doctor baseline; no target code was executed during this review.

Is this the best way to solve the issue?

Separating integrity coverage from recovery format addresses the coupling directly, reuses existing maintenance owners, and preserves the explicit FULL and recorded-corruption recovery paths.

Full review comments:

  • [P2] Document QUICK defaults for same-version Doctor repairs — docs/install/updating.md:59-61
    This paragraph still says same-version Doctor repairs retain full integrity checks. The new resolver instead returns QUICK plus historical repair tables when foundVersion equals supportedVersion, and the updated current-schema test permits an untouched corrupt index under the default. An operator following this guide can therefore mistake successful doctor --fix output for whole-database verification. State the QUICK default and the need for --full-integrity-check here, consistent with the other updated references. This confirms the concern in fix: honor quick integrity checks during historical upgrades #175662 (comment).
    Confidence: 1
  • [P2] Request FULL coverage in the existing corruption-recovery regression — src/state/openclaw-state-db.test.ts:2336-2343
    Changing same-version admission to QUICK leaves the unrecorded-corruption variant of this existing test incompatible with the intended policy: unsafe_index_records_value is outside the repair scope, so default repair returns no changes instead of the asserted backup and rebuild. Exact-head CI check 117441024704 reports this failure at this assertion. Make the unrecorded-corruption recovery case request explicit FULL coverage, retaining the recorded-corruption case as a default-mode recovery check and preserving the separate QUICK-default regression.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ff908fed3f95.

Provenance checked

  • Historical and same-version integrity selection changes intended behavior with a stated reason (dae099a: The original efficient-integrity change retained FULL verification where historical mutation scopes were undeclared and during same-version repair.)
  • Full-verification receipt handling keeps the original intent (2e20625: Quick checks must not satisfy runtime FULL admission, while owner-controlled migrations can retain genuine full-verification evidence.)
  • Original-state capture verification changes intended behavior with a stated reason (2411716: Manual original-state captures use exclusive maintenance custody and grant no automatic restore authority; automatic rollback images retain stronger certification.)
  • Private update rehearsal keeps the original intent (d1a69c0: Validate candidates against isolated state before stopping the serving Gateway.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • node scripts/run-vitest.mjs src/state/openclaw-state-db.test.ts src/state/openclaw-state-db-head-layout-migration.test.ts src/commands/doctor-schema-migrations.test.ts --maxWorkers=1
  • pnpm docs:check-links
  • git diff --check

What I checked:

PR surface

Source +306, Tests +151, Docs +9, Other +1. Total +467 across 47 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 33 373 67 +306
Tests 9 212 61 +151
Docs 4 20 11 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 47 606 139 +467

Labels

Label changes:

  • add P2: This improves historical database upgrade costs; the identified repairs are limited documentation and test-contract corrections.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This improves historical database upgrade costs; the identified repairs are limited documentation and test-contract corrections.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Supply the pending final-head historical Doctor and published-updater results with data preservation and integrity coverage visible; redact private endpoints and credentials.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 17, 2026, 12:24 PM ET / 16:24 UTC.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 417c5180c88f61ce01ce80110c30ec59a8b953bc
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/infra/state-migrations.shared-auth-store.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab97e707eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +137 to +141
13: [
"cron_jobs",
"subagent_runs",
"workspace_setup_state",
"workspace_attestations",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include workspace aliases in the v13 integrity scope

For upgrades from before v13, migrateJsonCanonicalWideRowsV13 reads workspace_path_aliases by workspace_key to populate workspace_setup_state.workspace_path, but this scope omits that source table. Because the default quick_check does not detect table/index inconsistencies, corruption in idx_workspace_path_aliases_workspace can make the migration miss an existing alias, persist a null workspace path, and then discard the corresponding attestation source. Add workspace_path_aliases to the v13 affected-table checks before running this migration.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indexed lookup is real, but the migration preserves the alias/path in workspace_path_aliases and transfers the attestation timestamps into workspace_setup_state; hashes remain in workspace_generated_bootstrap_hashes. It drops the old attestation table after that transfer, not the alias source. A missing alias lookup therefore produces the existing NULL-path orphan representation rather than losing the underlying path or attestation.

readWorkspaceStateSnapshotFromDatabase accepts that matching-key orphan, and replaceWorkspaceAttestationInDatabase heals its NULL path. Runtime alias resolution reads by alias_key and retains its path/key collision checks. This is a recoverable instance of the documented QUICK tradeoff for logical index inconsistencies in untouched tables. I have named the specific edge in the PR; it remains a follow-up rather than widening the migration scope in this change. Explicit FULL still detects the index inconsistency.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4def059a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

agentId: params.agentId,
path: params.pathname,
env: params.env,
integrityCheck: params.integrityCheck,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate FULL into pre-v17 media schema upgrades

When Doctor runs with --full-integrity-check against an agent database at v16 or older, this property is never consumed by migrateOpenClawAgentDatabaseToMediaPrerequisiteSchemaSteps: that helper accepts only OpenClawAgentDatabaseOptions and calls both agentDatabaseIntegrityBeforeMutationSteps and ensureOpenClawAgentSchema without the requested mode. Consequently, the pre-media schema migration still performs QUICK/scoped admission, allowing unrelated index corruption to survive an explicitly requested whole-database check; thread integrityCheck into that helper.

AGENTS.md reference: AGENTS.md:L69-L69

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2257026733b655e8580669b9159ef366e4896fa1.

Fixed by forwarding the selected mode through the pre-v17 media prerequisite gate and schema ensure, and through the subsequent canonical-index precheck. The index owner retains scoped FULL validation for every table it actually rebuilds. The known-corruption and preserving recovery branches remain unchanged.

The real v16 migration regression fails before this correction in both modes: default emits a whole PRAGMA integrity_check, while explicit FULL sends a QUICK worker request. After the correction both modes pass, preserving event identity/content/media and reaching the current schema; the existing malformed-v16-transcript rollback case also passes. This closes an additional ordinary-upgrade policy omission without changing the completed agent24/state20 measurement path.

@steipete
steipete merged commit f58d46d into main Oct 17, 2026
260 of 261 checks passed
@steipete
steipete deleted the dbasync/quickpath branch October 17, 2026 18:25
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…w#175662)

Honor the requested QUICK integrity policy in ordinary historical update and Doctor migrations, independently of recovery-backup format. Carry the existing mode through captures, schema/media repairs, repair opens, asynchronous admission and lease cleanup. Keep scoped FULL checks on affected/rebuilt tables, foreign-key checks, explicit FULL/recovery verification, and the rule that QUICK cannot supply FULL admission.

On a 6.07 GB stable agent24/state20 fixture, default public Doctor changes from 12 whole FULL / 0 QUICK / 2 scoped FULL / 13 FK to 0 whole FULL / 16 QUICK / 292 scoped FULL / 17 FK. Explicit FULL retains 12 whole FULL checks. Observed durations on the busy host are not controlled speedup claims. Separate failing-then-passing pre-v17 regressions cover default QUICK, explicit FULL and malformed transcript preservation. Candidate-side behavior only: the installed updater runs first.

Untouched logical index inconsistencies remain the accepted QUICK tradeoff. Rollback/restore certification and known-corruption recovery retain FULL. No schema, SDK surface or PostgreSQL behavior changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant