fix: preserve Signal group session IDs#82853
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Current main source shows whole session keys and peer IDs being lowercased in routing, inbound recording, gateway store-key canonicalization, and store lookup paths that can carry Real behavior proof Next step before merge Security Review detailsBest possible solution: Land the focused normalization fix after normal maintainer review and required checks, then close the linked Signal regression as fixed by the merged PR. Do we have a high-confidence way to reproduce the issue? Yes. Current main source shows whole session keys and peer IDs being lowercased in routing, inbound recording, gateway store-key canonicalization, and store lookup paths that can carry Is this the best way to solve the issue? Yes. For this P1 regression, preserving provider-owned Signal group IDs while retaining lowercase structural tokens and legacy lowercase lookup is the narrowest maintainable fix in the touched paths; a future generic opaque-peer contract can replace the Signal-specific branch if maintainers want to remove the core special case later. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 9b5f5b86510b. |
e46d81f to
8e6d002
Compare
8e6d002 to
e6a114a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6a114a6ea
ℹ️ 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".
| const candidateMatches = | ||
| normalizeStoreSessionKey(candidateKey) === normalizedKey || | ||
| (foldedLegacyKey !== normalizedKey && | ||
| normalizeLowercaseStringOrEmpty(candidateKey) === foldedLegacyKey); |
There was a problem hiding this comment.
Avoid conflating distinct Signal group IDs by lowercase fold
The new candidateMatches fallback treats any store key whose lowercase form equals foldedLegacyKey as a legacy alias, so resolving agent:...:signal:group:<ID> can select a different session whose group ID differs only by case if that entry has a newer updatedAt. In that case, reads/writes (including transcript/session metadata updates) can attach to the wrong conversation. This fallback should only match the true legacy-lowercased form of the requested key, not arbitrary case-colliding canonical keys.
Useful? React with 👍 / 👎.
Summary
Verification
Real behavior proof
Behavior addressed: Signal group auto-reply sessions no longer lowercase mixed-case group IDs, and legacy lowercase session-store entries remain readable/migratable.
Real environment tested: Local OpenClaw source checkout with focused route/session/store/gateway/transcript suites and direct TypeScript probe of the runtime key-normalization helpers.
Exact steps or command run after this patch: node scripts/run-vitest.mjs src/routing/session-key.test.ts src/routing/resolve-route.test.ts src/config/sessions/explicit-session-key-normalization.test.ts src/channels/session.test.ts src/config/sessions/group.test.ts --reporter=verbose; node scripts/run-vitest.mjs src/config/sessions/store.session-key-normalization.test.ts src/config/sessions/delivery-info.test.ts src/gateway/session-utils.test.ts --reporter=verbose; node scripts/run-vitest.mjs src/config/sessions/transcript.test.ts --reporter=verbose; codex-review --mode local; git diff --check; pnpm exec tsx direct key-preservation probe.
Evidence after fix: Copied terminal output after fix from the direct probe:
{ "peer": "agent:main:signal:group:VWATodkf2hc8zdOS76q9Tb0+5Bi522E03qLdaQ/9ypg=", "route": "agent:main:signal:group:VWATodkf2hc8zdOS76q9Tb0+5Bi522E03qLdaQ/9ypg=", "history": "signal:default:group:VWATodkf2hc8zdOS76q9Tb0+5Bi522E03qLdaQ/9ypg=", "store": "agent:ops:signal:group:VWATodkf2hc8zdOS76q9Tb0+5Bi522E03qLdaQ/9ypg=", "spawnedBy": "agent:ops:signal:group:VWATodkf2hc8zdOS76q9Tb0+5Bi522E03qLdaQ/9ypg=" }Observed result after fix: Signal group session keys and persisted group metadata retain the original mixed-case group ID, while legacy lowercase entries are still found by delivery and transcript lookup paths.
What was not tested: A live Signal gateway round-trip with signal-cli credentials was not run.
Fixes #82827.