Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 1:37 AM ET / 05:37 UTC. ClawSweeper reviewWhat this changesThe PR changes legacy pairing allowlist migration to recover case-preserved account filename suffixes while retaining ambiguous, nonliteral-default, and punctuation-confusable files for operator recovery. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep this PR open as a landable fix candidate: current main still performs the lossy filename comparison, while the final head repairs it without allowing punctuation-derived authorization reassignment. The exact-head Doctor transcript and focused boundary coverage address the prior review moves; no actionable patch defect was found. Priority: P1 Review scores
Verification
How this fits togetherDoctor discovers legacy channel pairing allowlist files, attributes each to a configured account, then imports it into shared SQLite state and removes the source. This attribution boundary affects gateway startup and must never move an allowlist between accounts. flowchart LR
A[Legacy allowlist files] --> B[Doctor migration scan]
C[Configured channel accounts] --> D[Case-only ownership check]
B --> D
D --> E{Unique owner with no collision?}
E -->|yes| F[Shared SQLite allowlist]
E -->|no| G[Warning and retain source]
F --> H[Gateway startup]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +40, Tests +120. Total +160 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the bounded case-only recovery after exact-head required checks pass, keeping ambiguous, punctuation-derived, and nonliteral-default filenames retained rather than guessing authorization ownership. Do we have a high-confidence way to reproduce the issue? Yes. Current main's raw-suffix versus normalized-key comparison at Is this the best way to solve the issue? Yes. Resolving only case-equivalent raw account IDs at the Doctor migration owner boundary is safer than reusing lossy safe-key equality, which would conflate punctuation-distinct authorization owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dc93ea6d699a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (19 earlier review cycles; latest 8 shown)
|
f115d31 to
f8cfcb9
Compare
f8cfcb9 to
ee67b5a
Compare
ee67b5a to
0180931
Compare
d7c6200 to
736998d
Compare
246ca40 to
3be786c
Compare
|
@clawsweeper re-review Please review exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
3be786c to
d38029e
Compare
|
@clawsweeper re-review Please review exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Exact-head land-readiness proof for Source-blind Doctor validation used isolated synthetic state roots on a verified case-sensitive APFS volume. Paths below are redacted to $ openclaw doctor --fix --non-interactive --yes
# Two non-exact case-equivalent files
files: telegram-AMBIGUOUSACCT-allowFrom.json, telegram-AmbiguousAcct-allowFrom.json
output: Legacy channel allowFrom channel/account is ambiguous; left in place at <state>/credentials/telegram-AMBIGUOUSACCT-allowFrom.json
output: Legacy channel allowFrom channel/account is ambiguous; left in place at <state>/credentials/telegram-AmbiguousAcct-allowFrom.json
SQLite allow entries: []
# Exact lowercase plus case variant
files: telegram-ExactAcct-allowFrom.json, telegram-exactacct-allowFrom.json
output: Legacy channel allowFrom channel/account is ambiguous; left in place at <state>/credentials/telegram-ExactAcct-allowFrom.json
output: Legacy channel allowFrom channel/account is ambiguous; left in place at <state>/credentials/telegram-exactacct-allowFrom.json
SQLite allow entries: []
# Singleton case-only recovery
files after Doctor: []
output: Migrated 1 telegram/hy_rin_bot allowFrom entry → shared SQLite state
SQLite allow entries: [{"account_id":"hy_rin_bot","entry":"user-e"}]
# Filename punctuation must not alias configured raw account
filename ops..bot, configured ops_bot: file retained; unresolved; SQLite []
filename ops_bot, configured ops.bot: file retained; unresolved; SQLite []
# Exact raw owner beside punctuation-normalized sibling
filename Ops_Bot, configured ops/bot + ops_bot: file removed
output: Migrated 1 telegram/ops_bot allowFrom entry → shared SQLite state
SQLite allow entries: [{"account_id":"ops_bot","entry":"user-h"}]Focused proof: $ node scripts/run-vitest.mjs src/infra/state-migrations.channel-pairing.test.ts --reporter=verbose
Test Files 1 passed (1)
Tests 10 passed (10)
$ node scripts/run-vitest.mjs src/commands/doctor-state-migrations.test.ts --reporter=verbose
Test Files 1 passed (1)
Tests 92 passed (92)
$ OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs -- src/infra/state-migrations.channel-pairing.ts src/infra/state-migrations.channel-pairing.test.ts src/commands/doctor-state-migrations.test.ts
passed: format, typecheck core, typecheck core tests, lint changed files, pairing guards, import cycles, database-first guard, and related changed lanes
$ git diff --check origin/main...HEAD
# passedFinal Codex branch autoreview with |
… parsing parseAllowFromFilename extracted the account segment from filenames without normalizing it via safeAccountKey, so non-canonical spellings (e.g. HY_RIN_Bot vs hy_rin_bot) could never match configured accounts. This left the file unresolved, producing a startup migration warning that blocks gateway readiness on every restart. Normalize accountKey via safeAccountKey before comparing so that raw and canonical spellings resolve to the same account. Wrap in try/catch so pathological filename segments skip safely instead of throwing. Guard non-canonical DEFAULT segments: when safeAccountKey maps a non-literal-default segment (e.g. "DEFAULT") to the canonical key "default", skip the filter so the file remains unresolved instead of being attributed to the implicit bundled default account and deleted. Keep the implicit bundled-default fallback on the literal canonical suffix (accountKey === DEFAULT_ACCOUNT_ID). Ambiguity detection remains unchanged. Related to openclaw#110187
Co-authored-by: WangYan <[email protected]>
Co-authored-by: WangYan <[email protected]>
Co-authored-by: WangYan <[email protected]>
Co-authored-by: WangYan <[email protected]>
d38029e to
584cd74
Compare
|
Exact-head land-readiness proof for Source-blind Doctor validation used isolated synthetic state roots on a verified case-sensitive APFS volume. Paths below are redacted to $ openclaw doctor --fix --non-interactive --yes
# Two non-exact case-equivalent files
files: telegram-AMBIGUOUSACCT-allowFrom.json, telegram-AmbiguousAcct-allowFrom.json
output: Legacy channel allowFrom channel/account is ambiguous; left in place at <state>/credentials/telegram-AMBIGUOUSACCT-allowFrom.json
output: Legacy channel allowFrom channel/account is ambiguous; left in place at <state>/credentials/telegram-AmbiguousAcct-allowFrom.json
SQLite allow entries: []
# Exact lowercase plus case variant
files: telegram-ExactAcct-allowFrom.json, telegram-exactacct-allowFrom.json
output: Legacy channel allowFrom channel/account is ambiguous; left in place at <state>/credentials/telegram-ExactAcct-allowFrom.json
output: Legacy channel allowFrom channel/account is ambiguous; left in place at <state>/credentials/telegram-exactacct-allowFrom.json
SQLite allow entries: []
# Singleton case-only recovery
files after Doctor: []
output: Migrated 1 telegram/hy_rin_bot allowFrom entry → shared SQLite state
SQLite allow entries: [{"account_id":"hy_rin_bot","entry":"user-e"}]
# Filename punctuation must not alias configured raw account
filename ops..bot, configured ops_bot: file retained; unresolved; SQLite []
filename ops_bot, configured ops.bot: file retained; unresolved; SQLite []
# Exact raw owner beside punctuation-normalized sibling
filename Ops_Bot, configured ops/bot + ops_bot: file removed
output: Migrated 1 telegram/ops_bot allowFrom entry → shared SQLite state
SQLite allow entries: [{"account_id":"ops_bot","entry":"user-h"}]
# Nonliteral default remains unresolved
filename DEFAULT, configured/default candidate: file retained
output: Legacy channel allowFrom channel/account is unresolved; left in place at <state>/credentials/telegram-DEFAULT-allowFrom.json
SQLite allow entries: []Focused proof: $ node scripts/run-vitest.mjs src/infra/state-migrations.channel-pairing.test.ts --reporter=verbose
Test Files 1 passed (1)
Tests 11 passed (11)
$ node scripts/run-vitest.mjs src/commands/doctor-state-migrations.test.ts --reporter=verbose
Test Files 1 passed (1)
Tests 92 passed (92)
$ node scripts/run-vitest.mjs src/commands/doctor-config-preflight.state-migration.test.ts --reporter=verbose
Test Files 1 passed (1)
Tests 29 passed (29)
$ OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs -- src/infra/state-migrations.channel-pairing.ts src/infra/state-migrations.channel-pairing.test.ts src/commands/doctor-state-migrations.test.ts
passed: format, typecheck core, typecheck core tests, lint changed files, pairing guards, import cycles, database-first guard, and related changed lanes
$ git diff --check origin/main...HEAD
# passedFinal Codex branch autoreview with Maintainer decision on the remaining prior review move: do not restore punctuation-based safe-key fallback. A unique fallback can still move authorization between punctuation-distinct raw account IDs ( |
|
@clawsweeper re-review Please review exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…ing (openclaw#110415) * [AI] fix(pairing): normalize account key in legacy allowFrom filename parsing parseAllowFromFilename extracted the account segment from filenames without normalizing it via safeAccountKey, so non-canonical spellings (e.g. HY_RIN_Bot vs hy_rin_bot) could never match configured accounts. This left the file unresolved, producing a startup migration warning that blocks gateway readiness on every restart. Normalize accountKey via safeAccountKey before comparing so that raw and canonical spellings resolve to the same account. Wrap in try/catch so pathological filename segments skip safely instead of throwing. Guard non-canonical DEFAULT segments: when safeAccountKey maps a non-literal-default segment (e.g. "DEFAULT") to the canonical key "default", skip the filter so the file remains unresolved instead of being attributed to the implicit bundled default account and deleted. Keep the implicit bundled-default fallback on the literal canonical suffix (accountKey === DEFAULT_ACCOUNT_ID). Ambiguity detection remains unchanged. Related to openclaw#110187 * fix(pairing): constrain legacy filename recovery Co-authored-by: WangYan <[email protected]> * fix(pairing): preserve case-colliding legacy files Co-authored-by: WangYan <[email protected]> * fix(pairing): match legacy files to raw account ids Co-authored-by: WangYan <[email protected]> * fix(pairing): keep default suffix literal Co-authored-by: WangYan <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
Closes #110187
What Problem This Solves
Fixes an upgrade failure where a legacy account-scoped pairing allowlist file with a case-preserved account suffix, such as
telegram-HY_RIN_Bot-allowFrom.json, could not be matched to the configured Telegram account. The migration left the file in place, emitted a warning, and gateway startup refused to report ready on every retry.Why This Change Was Made
The legacy pairing migration compared the filename suffix verbatim with a normalized account key. The repair accepts case-only differences, but determines ownership from case-insensitive equality between the raw filename account suffix and the raw configured account ID.
safeAccountKeystill validates configured candidates, but its lossy output is never used for equality. This matters in both directions:ops..botmust not becomeops_bot, and a canonical-lookingops_botfilename must not be attributed to configured accountops.bot. When bothops/botandops_botare configured, the rawops_botowner remains distinguishable and receives only its own file.The migration also treats the complete set of case-equivalent source filenames as one attribution decision. If two real files differ only by account-suffix case—even when one is the exact lowercase spelling—every member remains ambiguous and untouched. This prevents multiple source allowlists from being merged and deleted on case-sensitive filesystems.
Provenance caveat: the shipped
v2026.7.1writer already usedsafeAccountKeyand therefore emitted lowercase canonical filenames. The reported uppercase file is real observed upgrade state, but its producer has not been identified in repository history. This PR recovers bounded case-only state without broadening punctuation or multi-source attribution.User Impact
A single case-preserved filename whose raw suffix identifies exactly one configured account can upgrade normally: Doctor/startup imports the allowlist into shared SQLite state and removes the source.
Multiple case-equivalent files remain ambiguous and untouched. Punctuation-normalized lookalikes, unknown accounts, non-canonical implicit-default spellings, and other unresolved ownership remain on disk for operator recovery rather than risking cross-account authorization.
Evidence
Exact head:
584cd74e8b8bb037587fe55fd0e67259d27c0a28The branch is rebased onto current
origin/main.Focused proof:
Source-blind CLI validation ran
openclaw doctor --fix --non-interactive --yeswith isolated state roots on a verified case-sensitive APFS volume:AmbiguousAcct+AMBIGUOUSACCTexactacct+ExactAcctHY_RIN_Bothy_rin_bot:user-eimportedops..bot, configuredops_botops_bot, configuredops.botOps_Bot, configuredops/botandops_botops_bot:user-hDEFAULT, configured/default candidateThe unique canonical safe-key fallback suggested during review is intentionally not retained: it would let punctuation normalization create authorization ownership between distinct raw account IDs such as
ops_botandops.bot. The migration accepts only case differences; ambiguous or punctuation-derived ownership remains an operator decision.The regression suite covers both punctuation-normalization directions, exact raw ownership beside a punctuation lookalike, case-folded source collision sets, singleton case recovery, and source retention/deletion.
Final branch-level Codex autoreview at maximum priority P1 reported no accepted/actionable findings.
PR surface against current base:
+43 / -3— records collision-set, raw-owner, and literal-default safety before import/removal.+129 / -9+172 / -12across 3 filesAI Assistance