fix(reply): keep webchat-origin main session replies on originating surface#33250
fix(reply): keep webchat-origin main session replies on originating surface#33250bmendonca3 wants to merge 4 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes a routing leak where main-session turns originating from webchat could reuse a previously persisted external delivery route (e.g., WhatsApp), causing replies to fan out to the wrong surface. The fix adds narrow early-return guards in Key points:
Confidence Score: 3/5
Last reviewed commit: c4d04bc |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f9f6c5e07
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a993ea6c56
ℹ️ 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".
|
Superseded by #33786. The synthesis PR includes webchat/main reply-surface routing fixes and aligned session routing invariants. |
|
Thanks again for this work. This PR was triaged and merged using an AI-assisted review/synthesis workflow. This landed indirectly via the synthesized PR #33786, and your contribution is credited in the changelog and as a co-author on the merge commit. Closing this PR as superseded by #33786 (reason: superseded). If anything here looks incorrect or incomplete, reply to reopen and we can reassess. |
|
Correction for accuracy: the synthesized work is credited in the changelog, but the squash merge commit for #33786 does not include explicit |
Summary
Describe the problem and fix in 2–5 bullets:
webchat(TUI/gateway client) can reuse a previously persisted external delivery route (for example WhatsApp), which causes replies to fan out to the wrong surface.resolveLastChannelRawandresolveLastToRawto preferwebchatorigin routing when the session key is the main session (agent:<id>:main), then added a regression test that reproduces the leak and validates webchat pinning.sessions_send) still preserve persisted external fallback behavior; non-main session behavior is unchanged.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Main-session replies triggered from webchat/TUI now stay on webchat instead of reusing a stale external route (for example WhatsApp).
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
agent:main:mainhas persistedlastChannel=whatsapp,lastTo=<phone>.OriginatingChannel=webchatandOriginatingTo=session:webchat-main.Expected
webchatfor that turn (lastChannel=webchat,lastTo=session:webchat-main).Actual
lastChannel=whatsapp) and could deliver to the wrong channel.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
prefers webchat route over persisted external route for main session turns.src/auto-reply/reply/session.test.tsto ensure routing behavior remains coherent.Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
src/auto-reply/reply/session-delivery.ts,src/auto-reply/reply/session.test.ts.Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.